From 986c911e21b41464aa17006fd048dc38d5824325 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 7 Nov 2018 15:49:40 +0100
Subject: [PATCH 070/142] ply-pixel-buffer: Fix fill_with_buffer fastpath when
 device_scale != 1

After calling ply_pixel_buffer_crop_area_to_clip_area cropped_area.x/y
are in device coordinates. So when calculating the x/y offset in the
source-buffer due to device-clip areas possible making cropped_area.x/y
larger then just the xoffset/yoffset (in the canvas) we must multiply
the original xoffset/yoffset by device_scale before subtracting.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 src/libply-splash-core/ply-pixel-buffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libply-splash-core/ply-pixel-buffer.c b/src/libply-splash-core/ply-pixel-buffer.c
index de3b107..04aa0d6 100644
--- a/src/libply-splash-core/ply-pixel-buffer.c
+++ b/src/libply-splash-core/ply-pixel-buffer.c
@@ -868,8 +868,8 @@ ply_pixel_buffer_fill_with_buffer_at_opacity_with_clip (ply_pixel_buffer_t *canv
                 if (cropped_area.width == 0 || cropped_area.height == 0)
                         return;
 
-                x = cropped_area.x - x_offset;
-                y = cropped_area.y - y_offset;
+                x = cropped_area.x - x_offset * canvas->device_scale;
+                y = cropped_area.y - y_offset * canvas->device_scale;
 
                 ply_pixel_buffer_copy_area (canvas, source, x, y, &cropped_area);
 
-- 
2.7.4

