Fixed flaky redraw in Mac OS X Areas.

This commit is contained in:
Pietro Gagliardi 2014-03-30 14:29:02 -04:00
parent 6a40011f85
commit 8c18adcfdb
1 changed files with 3 additions and 1 deletions

View File

@ -55,7 +55,9 @@ var (
func areaView_drawRect(self C.id, rect C.struct_xrect) { func areaView_drawRect(self C.id, rect C.struct_xrect) {
s := getSysData(self) s := getSysData(self)
// TODO clear clip rect // TODO clear clip rect
cliprect := image.Rect(int(rect.x), int(rect.y), int(rect.width), int(rect.height)) // rectangles in Cocoa are origin/size, not point0/point1; if we don't watch for this, weird things will happen when scrolling
// TODO change names EVERYWHERE ELSE to match
cliprect := image.Rect(int(rect.x), int(rect.y), int(rect.x + rect.width), int(rect.y + rect.height))
max := C.objc_msgSend_stret_rect_noargs(self, _frame) max := C.objc_msgSend_stret_rect_noargs(self, _frame)
cliprect = image.Rect(0, 0, int(max.width), int(max.height)).Intersect(cliprect) cliprect = image.Rect(0, 0, int(max.width), int(max.height)).Intersect(cliprect)
if cliprect.Empty() { // no intersection; nothing to paint if cliprect.Empty() { // no intersection; nothing to paint