diff options
-rw-r--r-- | generic/Icon.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/generic/Icon.c b/generic/Icon.c index 54b1748..bd8c7e1 100644 --- a/generic/Icon.c +++ b/generic/Icon.c @@ -347,11 +347,11 @@ ComputeCoordinates(Item item, else { ZnTransformPoint(wi->current_transfo, &icon->pos, &icon->pos_dev); } - icon->pos_dev.x = REAL_TO_INT(icon->pos_dev.x); - icon->pos_dev.y = REAL_TO_INT(icon->pos_dev.y); Anchor2Origin(&icon->pos_dev, width, height, icon->anchor, &icon->pos_dev); + icon->pos_dev.x = REAL_TO_INT(icon->pos_dev.x); + icon->pos_dev.y = REAL_TO_INT(icon->pos_dev.y); /* * Compute the bounding box. @@ -422,7 +422,9 @@ Draw(Item item) ImageBits *im_bits; Pixmap pmap, mask_pmap; int w, h; - ZnBBox box, inter; + ZnBBox box, inter, *clip_box; + Region clip_region; + ZnBool simple; if (icon->image != ZnUnspecifiedImage) { /* @@ -445,8 +447,8 @@ Draw(Item item) box = inter; im_bits = GetImageBits(wi->win, icon->image_name, icon->image); pmap = GetImagePixmap(wi->win, icon->image_name, icon->image, &mask_pmap); - if ((im_bits->mask == ZnUnspecifiedPattern) || - !wi->current_clip || (wi->current_clip->simple)) { + ITEM_P.CurrentClip(wi, &clip_region, NULL, &simple); + if ((im_bits->mask == ZnUnspecifiedPattern) || simple) { if (im_bits->mask != ZnUnspecifiedPattern) { XSetClipMask(wi->dpy, wi->gc, mask_pmap); values.clip_x_origin = (int) icon->pos_dev.x; @@ -459,12 +461,7 @@ Draw(Item item) box.orig.x, box.orig.y); values.clip_x_origin = values.clip_y_origin = 0; XChangeGC(wi->dpy, wi->gc, GCClipXOrigin|GCClipYOrigin, &values); - if (wi->current_clip) { - XSetRegion(wi->dpy, wi->gc, wi->current_clip->region); - } - else { - XSetRegion(wi->dpy, wi->gc, wi->damaged_region); - } + XSetRegion(wi->dpy, wi->gc, clip_region); } else { GC gc; @@ -475,7 +472,7 @@ Draw(Item item) im_bits->width, im_bits->height, 1); gc = XCreateGC(wi->dpy, mask_pmap, 0, NULL); XFillRectangle(wi->dpy, mask_pmap, gc, 0, 0, im_bits->width, im_bits->height); - XSetRegion(wi->dpy, gc, wi->current_clip->region); + XSetRegion(wi->dpy, gc, clip_region); values.foreground = 1; values.background = 0; values.clip_x_origin = (int) -icon->pos_dev.x; @@ -498,7 +495,7 @@ Draw(Item item) box.orig.x, box.orig.y); values.clip_x_origin = values.clip_y_origin = 0; XChangeGC(wi->dpy, wi->gc, GCClipXOrigin|GCClipYOrigin, &values); - XSetRegion(wi->dpy, wi->gc, wi->current_clip->region); + XSetRegion(wi->dpy, wi->gc, clip_region); XFreePixmap(wi->dpy, mask_pmap); } } @@ -507,8 +504,9 @@ Draw(Item item) box.orig = icon->pos_dev; box.corner.x = icon->pos_dev.x + w; box.corner.y = icon->pos_dev.y + h; - if (wi->current_clip && (wi->current_clip->simple)) { - IntersectBBox(&box, &wi->current_clip->clip_box, &inter); + ITEM_P.CurrentClip(wi, NULL, &clip_box, &simple); + if (simple) { + IntersectBBox(&box, clip_box, &inter); box = inter; } values.fill_style = FillStippled; |