summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--macosx/tkMacOSXDraw.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 2830fa1..3d8f26e 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -1144,7 +1144,7 @@ TkScrollWindow(
TKContentView *view = (TKContentView *)TkMacOSXGetNSViewForDrawable(macDraw);
HIShapeRef srcRgn, dstRgn;
HIMutableShapeRef dmgRgn = HIShapeCreateMutable();
- NSRect bounds, scrollSrc, scrollDst;
+ NSRect bounds, viewSrcRect, srcRect, dstRect;
int result = 0;
if (view) {
@@ -1154,29 +1154,31 @@ TkScrollWindow(
*/
bounds = [view bounds];
- scrollSrc = NSMakeRect(macDraw->xOff + x,
+ viewSrcRect = NSMakeRect(macDraw->xOff + x,
bounds.size.height - height - (macDraw->yOff + y),
width, height);
- scrollDst = NSOffsetRect(scrollSrc, dx, -dy);
/*
- * Compute the damage.
+ * Scroll the rectangle.
*/
- srcRgn = HIShapeCreateWithRect(&scrollSrc);
- dstRgn = HIShapeCreateWithRect(&scrollDst);
- ChkErr(HIShapeDifference, srcRgn, dstRgn, dmgRgn);
- result = HIShapeIsEmpty(dmgRgn) ? 0 : 1;
+ [view scrollRect:viewSrcRect by:NSMakeSize(dx, -dy)];
/*
- * Scroll the rectangle.
+ * Compute the damage region, using Tk coordinates (origin at top left).
*/
- [view scrollRect:scrollSrc by:NSMakeSize(dx, -dy)];
+ srcRect = CGRectMake(x, y, width, height);
+ dstRect = CGRectOffset(srcRect, dx, dy);
+ srcRgn = HIShapeCreateWithRect(&srcRect);
+ dstRgn = HIShapeCreateWithRect(&dstRect);
+ ChkErr(HIShapeDifference, srcRgn, dstRgn, dmgRgn);
+ result = HIShapeIsEmpty(dmgRgn) ? 0 : 1;
+
}
/*
- * Convert dmgRgn to Tk coordinates and store the result.
+ * Convert the HIShape dmgRgn into a TkRegion and store it.
*/
TkMacOSXSetWithNativeRegion(damageRgn, dmgRgn);