From 0aadda70d5cac2498e1b5bf09ee623130091da50 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Mon, 23 Sep 2013 22:20:06 +0200 Subject: gl: cope with positive stride in put_image() 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); -- cgit v1.2.3