Skip to content

Commit

Permalink
GC: Fix XSetClipMask and enable clipping.
Browse files Browse the repository at this point in the history
  • Loading branch information
waddlesplash committed May 10, 2023
1 parent 78d3a6b commit f0c05a2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions xlib/GC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,16 @@ XSetClipRectangles(Display *display, GC gc, int clip_x_origin, int clip_y_origin
extern "C" Status
XSetClipMask(Display* display, GC gc, Pixmap pixmap)
{
if (pixmap == None) {
ClipMask* mask = gc_clip_mask(gc, false);
if (!mask)
return Success;

mask->region.MakeEmpty();
gc->dirty |= GCClipMask;
return Success;
}

XPixmap* pxm = Drawables::get_pixmap(pixmap);
if (!pxm)
return BadPixmap;
Expand Down Expand Up @@ -571,15 +581,13 @@ _x_check_gc(XDrawable* drawable, GC gc)
}

if (gc->dirty & (GCClipMask | GCClipXOrigin | GCClipYOrigin)) {
#if 0
view->ConstrainClippingRegion(NULL);
ClipMask* mask = gc_clip_mask(gc, false);
if (mask && mask->region.CountRects() > 0) {
BRegion region = mask->region;
region.OffsetBy(gc->values.clip_x_origin, gc->values.clip_y_origin);
view->ConstrainClippingRegion(&region);
}
#endif
}

gc->dirty = 0;
Expand Down

0 comments on commit f0c05a2

Please sign in to comment.