diff options
author | fvogel <fvogelnew1@free.fr> | 2023-07-16 13:19:29 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2023-07-16 13:19:29 (GMT) |
commit | dd8254af9cebde60bfd0d6d0aebaef9b0585d049 (patch) | |
tree | b4e88229ac0af722a28f13d6459d214fbc8eee20 /xlib | |
parent | c0213377420fc585acd517b8a519901101aba1db (diff) | |
download | tk-dd8254af9cebde60bfd0d6d0aebaef9b0585d049.zip tk-dd8254af9cebde60bfd0d6d0aebaef9b0585d049.tar.gz tk-dd8254af9cebde60bfd0d6d0aebaef9b0585d049.tar.bz2 |
Bug [f9eddb541a] (TkSetRegion(), XSetClipRectangles): Patch 4 from Christopher Chavez - TkSetRegion() copies the provided region to a dedicated region for the TkpClipMask.
Diffstat (limited to 'xlib')
-rw-r--r-- | xlib/xgc.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -49,6 +49,8 @@ static TkpClipMask *AllocClipMask(GC gc) { if (clip_mask == NULL) { clip_mask = (TkpClipMask *)ckalloc(sizeof(TkpClipMask)); gc->clip_mask = (Pixmap) clip_mask; + } else if (clip_mask->type == TKP_CLIP_REGION) { + TkDestroyRegion(clip_mask->value.region); } clip_mask->type = TKP_CLIP_PIXMAP; clip_mask->value.pixmap = None; @@ -76,6 +78,9 @@ static void FreeClipMask(GC gc) { if (clip_mask == NULL) { return; } + if (clip_mask->type == TKP_CLIP_REGION) { + TkDestroyRegion(clip_mask->value.region); + } ckfree(clip_mask); gc->clip_mask = None; } @@ -431,8 +436,8 @@ XSetClipOrigin( * * Sets the clipping region/pixmap for a GC. * - * Note that unlike the Xlib equivalent, it is not safe to delete the - * region after setting it into the GC (except on Mac OS X). The only + * Like the Xlib equivalent, it is safe to delete the + * region after setting it into the GC. The only * uses of TkSetRegion are currently in DisplayFrame and in * ImgPhotoDisplay, which use the GC immediately. * @@ -460,6 +465,8 @@ TkSetRegion( clip_mask->type = TKP_CLIP_REGION; clip_mask->value.region = r; + clip_mask->value.region = TkCreateRegion(); + TkpCopyRegion(clip_mask->value.region, r); } return Success; } |