summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2023-07-16 12:58:32 (GMT)
committerfvogel <fvogelnew1@free.fr>2023-07-16 12:58:32 (GMT)
commit17cd772470e5867a435c8475e35b6cbba1a63737 (patch)
treec7db89a7f4c7b77e72b567ac7c42c00293030e12
parent444e600b9353a21efde61a3ea5444ae541a85308 (diff)
downloadtk-17cd772470e5867a435c8475e35b6cbba1a63737.zip
tk-17cd772470e5867a435c8475e35b6cbba1a63737.tar.gz
tk-17cd772470e5867a435c8475e35b6cbba1a63737.tar.bz2
Bug [f9eddb541a] (TkSetRegion(), XSetClipRectangles): Patch 1 from Christopher Chavez - Introduce a convenience function TkpCopyRegion(dst, src).
-rw-r--r--generic/tkInt.h2
-rw-r--r--macosx/tkMacOSXRegion.c24
-rw-r--r--unix/tkUnix.c26
-rw-r--r--win/tkWinRegion.c24
4 files changed, 76 insertions, 0 deletions
diff --git a/generic/tkInt.h b/generic/tkInt.h
index 7568585..e31bc1b 100644
--- a/generic/tkInt.h
+++ b/generic/tkInt.h
@@ -1337,6 +1337,8 @@ MODULE_SCOPE Status TkParseColor (Display * display,
MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion);
#endif
+MODULE_SCOPE void TkpCopyRegion(TkRegion dst, TkRegion src);
+
#if !defined(__cplusplus) && !defined(c_plusplus)
# define c_class class
#endif
diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c
index fbb41cb..e03cb2e 100644
--- a/macosx/tkMacOSXRegion.c
+++ b/macosx/tkMacOSXRegion.c
@@ -478,6 +478,30 @@ XOffsetRegion(
/*
*----------------------------------------------------------------------
*
+ * TkpCopyRegion --
+ *
+ * Makes the destination region a copy of the source region.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpCopyRegion(
+ TkRegion dst,
+ TkRegion src)
+{
+ ChkErr(HIShapeSetWithShape, (HIMutableShapeRef)dst, (HIShapeRef)src);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkMacOSXHIShapeCreateEmpty, TkMacOSXHIShapeCreateMutableWithRect,
* TkMacOSXHIShapeSetWithShape,
* TkMacOSHIShapeDifferenceWithRect, TkMacOSHIShapeUnionWithRect,
diff --git a/unix/tkUnix.c b/unix/tkUnix.c
index ed024d1..8ec4254 100644
--- a/unix/tkUnix.c
+++ b/unix/tkUnix.c
@@ -116,6 +116,32 @@ Tk_UpdatePointer(
/*
*----------------------------------------------------------------------
*
+ * TkpCopyRegion --
+ *
+ * Makes the destination region a copy of the source region.
+ * Currently unused on X11.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpCopyRegion(
+ TkRegion dst,
+ TkRegion src)
+{
+ /* XUnionRegion() in Xlib is optimized to detect copying */
+ XUnionRegion(src, src, dst);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkpBuildRegionFromAlphaData --
*
* Set up a rectangle of the given region based on the supplied alpha
diff --git a/win/tkWinRegion.c b/win/tkWinRegion.c
index a2f6fd7..9e9d80a 100644
--- a/win/tkWinRegion.c
+++ b/win/tkWinRegion.c
@@ -285,6 +285,30 @@ TkSubtractRegion(
}
/*
+ *----------------------------------------------------------------------
+ *
+ * TkpCopyRegion --
+ *
+ * Makes the destination region a copy of the source region.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TkpCopyRegion(
+ TkRegion dst,
+ TkRegion src)
+{
+ CombineRgn((HRGN)dst, (HRGN)src, NULL, RGN_COPY);
+}
+
+/*
* Local Variables:
* mode: c
* c-basic-offset: 4