[Spice-devel] [PATCH 3/4] gl: cope with positive stride in put_image()

Marc-André Lureau marcandre.lureau at gmail.com
Tue Sep 24 04:47:39 PDT 2013


Keeping the warning, because I don't think this should happen anyway.
---
 common/gl_canvas.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/common/gl_canvas.c b/common/gl_canvas.c
index 176c3ef..fe152ef 100644
--- a/common/gl_canvas.c
+++ b/common/gl_canvas.c
@@ -758,7 +758,7 @@ static void gl_canvas_put_image(SpiceCanvas *spice_canvas, const SpiceRect *dest
     GLCImage image;
     uint32_t i;
 
-    spice_return_if_fail(src_stride <= 0);
+    spice_warn_if_fail(src_stride <= 0);
 
     glc_clip_reset(canvas->glc);
 
@@ -788,9 +788,13 @@ static void gl_canvas_put_image(SpiceCanvas *spice_canvas, const SpiceRect *dest
     image.format = GLC_IMAGE_RGB32;
     image.width = src_width;
     image.height = src_height;
-    src_stride = -src_stride;
+    if (src_stride < 0) {
+        src_stride = -src_stride;
+        image.pixels = (uint8_t *)src_data - (src_height - 1) * src_stride;
+    } else {
+        image.pixels = (uint8_t *)src_data;
+    }
     image.stride = src_stride;
-    image.pixels = (uint8_t *)src_data - (src_height - 1) * src_stride;
     image.pallet = NULL;
     glc_draw_image(canvas->glc, &gldest, &src, &image, 0, 1);
 
-- 
1.8.3.1



More information about the Spice-devel mailing list