summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXDraw.c
diff options
context:
space:
mode:
authorculler <culler>2024-06-18 12:17:43 (GMT)
committerculler <culler>2024-06-18 12:17:43 (GMT)
commit5175b17dce9102ec83c6f8a3db45ac1a0725a01c (patch)
treee261109d420b33d5cbb13bc7251c6edae5440848 /macosx/tkMacOSXDraw.c
parent4ef53d757fa6987eeb638dfc02192c2afd1899c1 (diff)
downloadtk-5175b17dce9102ec83c6f8a3db45ac1a0725a01c.zip
tk-5175b17dce9102ec83c6f8a3db45ac1a0725a01c.tar.gz
tk-5175b17dce9102ec83c6f8a3db45ac1a0725a01c.tar.bz2
Remove inner loop in setFrameSize, tame the chaos with UpdateClipRgn, deal with the artifacts later.
Diffstat (limited to 'macosx/tkMacOSXDraw.c')
-rw-r--r--macosx/tkMacOSXDraw.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c
index 0e0a35e..66140fe 100644
--- a/macosx/tkMacOSXDraw.c
+++ b/macosx/tkMacOSXDraw.c
@@ -1538,10 +1538,13 @@ TkMacOSXGetClipRgn(
}
if (macDraw->drawRgn) {
+ // The drawRgn is the visRgn intersected with a rectangle which
+ // may be smaller than the widget bounds.
clipRgn = HIShapeCreateCopy(macDraw->drawRgn);
} else if (macDraw->visRgn) {
clipRgn = HIShapeCreateCopy(macDraw->visRgn);
}
+ // A NULL clipRgn does not allow any drawing at all.
return clipRgn;
}
@@ -1551,7 +1554,9 @@ TkMacOSXGetClipRgn(
* Tk_ClipDrawableToRect --
*
* Clip all drawing into the drawable d to the given rectangle. If width
- * or height are negative, reset to no clipping.
+ * or height are negative, reset to no clipping.bThis is called by the
+ * Text widget to display each DLine, and by the Canvas widget when it
+ * is updating a sub rectangle in the canvas.
*
* Results:
* None.
@@ -1580,7 +1585,10 @@ Tk_ClipDrawableToRect(
width, height);
HIShapeRef drawRgn = HIShapeCreateWithRect(&clipRect);
- if (macDraw->winPtr && macDraw->flags & TK_CLIP_INVALID) {
+ // When drawing a Text widget we can reuse the
+ // clipping region for different DLines, so we don't want to
+ // update unless necessary.
+ if (macDraw->winPtr && (macDraw->flags & TK_CLIP_INVALID)) {
TkMacOSXUpdateClipRgn(macDraw->winPtr);
}
if (macDraw->visRgn) {