imlib_create_scaled_image_from_drawable(): Simplify call path

On 1:1 scaling call  __imlib_GrabDrawableToRGBA() directly instead of
going through __imlib_GrabDrawableScaledToRGBA().

This fixes 1:1 grabbing of pixmaps.
Non-1:1 pixmaps grabs are still not ok (window grabs are).
This commit is contained in:
Kim Woelders 2023-02-17 14:25:53 +01:00
parent 61097080e5
commit 5ea6a407cf
1 changed files with 17 additions and 6 deletions

View File

@ -361,12 +361,23 @@ imlib_create_scaled_image_from_drawable(Pixmap mask, int src_x, int src_y,
domask = mask != 0 || get_mask_from_shape;
err = __imlib_GrabDrawableScaledToRGBA(im->data, 0, 0, dst_width, dst_height,
ctx->display, ctx->drawable, mask,
ctx->visual, ctx->colormap,
ctx->depth,
src_x, src_y, src_width, src_height,
&domask, need_to_grab_x);
if (src_width == dst_width && src_height == dst_height)
err = __imlib_GrabDrawableToRGBA(im->data,
0, 0, dst_width, dst_height,
ctx->display, ctx->drawable, mask,
ctx->visual, ctx->colormap,
ctx->depth,
src_x, src_y, src_width, src_height,
&domask, need_to_grab_x);
else
err = __imlib_GrabDrawableScaledToRGBA(im->data,
0, 0, dst_width, dst_height,
ctx->display, ctx->drawable, mask,
ctx->visual, ctx->colormap,
ctx->depth,
src_x, src_y,
src_width, src_height,
&domask, need_to_grab_x);
if (err)
{
__imlib_FreeImage(im);