diff options
author | culler <culler> | 2021-07-31 21:41:51 (GMT) |
---|---|---|
committer | culler <culler> | 2021-07-31 21:41:51 (GMT) |
commit | 8713a1a4977a211504657d65a3d134b7c85bf0d3 (patch) | |
tree | 28da0106e94bafb1d7066844801fef1d2a2dafd7 /macosx/tkMacOSXDraw.c | |
parent | b7889a1f0d9c38ea7f81360228d66061a98a5c3f (diff) | |
download | tk-8713a1a4977a211504657d65a3d134b7c85bf0d3.zip tk-8713a1a4977a211504657d65a3d134b7c85bf0d3.tar.gz tk-8713a1a4977a211504657d65a3d134b7c85bf0d3.tar.bz2 |
Use the correct coordinates to compute the damage region. This makes the tests pass again.
Diffstat (limited to 'macosx/tkMacOSXDraw.c')
-rw-r--r-- | macosx/tkMacOSXDraw.c | 24 |
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); |