summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Woelders <kim@woelders.dk>2017-12-23 19:33:14 +0100
committerKim Woelders <kim@woelders.dk>2017-12-23 19:35:15 +0100
commit8232c9213b04e64e71a2d7e5cc449438f874d43e (patch)
tree683b3d96ffc0dcd5d093fcabfc32c539661443ed
parent257a72fabe7505c681813b33629ff17e0df41344 (diff)
downloadimlib2-8232c9213b04e64e71a2d7e5cc449438f874d43e.tar.gz
imlib_create_scaled_image_from_drawable(): Drop shape handling if unshaped
-rw-r--r--src/lib/api.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/lib/api.c b/src/lib/api.c
index 82c2c33..2231bbc 100644
--- a/src/lib/api.c
+++ b/src/lib/api.c
@@ -2187,25 +2187,36 @@ imlib_create_scaled_image_from_drawable(Pixmap mask, int source_x,
XRectangle *rect;
int rect_num, rect_ord;
- tmpmask = 1;
- mask =
- XCreatePixmap(ctx->display, ctx->drawable, source_width,
- source_height, 1);
- mgc = XCreateGC(ctx->display, mask,
- GCForeground | GCGraphicsExposures, &gcv);
- rect =
- XShapeGetRectangles(ctx->display, ctx->drawable, ShapeBounding,
- &rect_num, &rect_ord);
- XFillRectangle(ctx->display, mask, mgc, 0, 0, source_width,
- source_height);
- if (rect)
+ rect = XShapeGetRectangles(ctx->display, ctx->drawable, ShapeBounding,
+ &rect_num, &rect_ord);
+
+ if (rect && (rect_num == 1 &&
+ rect[0].x == 0 && rect[0].y == 0 &&
+ rect[0].width == source_width &&
+ rect[0].height == source_height))
{
- XSetForeground(ctx->display, mgc, 1);
- for (x = 0; x < rect_num; x++)
- XFillRectangle(ctx->display, mask, mgc, rect[x].x,
- rect[x].y, rect[x].width, rect[x].height);
+ domask = 0;
XFree(rect);
}
+ else
+ {
+ tmpmask = 1;
+ mask =
+ XCreatePixmap(ctx->display, ctx->drawable, source_width,
+ source_height, 1);
+ mgc = XCreateGC(ctx->display, mask,
+ GCForeground | GCGraphicsExposures, &gcv);
+ XFillRectangle(ctx->display, mask, mgc, 0, 0, source_width,
+ source_height);
+ if (rect)
+ {
+ XSetForeground(ctx->display, mgc, 1);
+ for (x = 0; x < rect_num; x++)
+ XFillRectangle(ctx->display, mask, mgc, rect[x].x,
+ rect[x].y, rect[x].width, rect[x].height);
+ XFree(rect);
+ }
+ }
}
if ((destination_width == source_width) &&