summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2013-09-23 22:20:06 +0200
committerMarc-André Lureau <marcandre.lureau@gmail.com>2013-09-30 02:18:37 +0200
commit0aadda70d5cac2498e1b5bf09ee623130091da50 (patch)
tree1d31d9a2126723ca52679b7f843c9db6cb793473
parentb6faccb3812c89ea0a4b1a19147ecdfe423aa4d9 (diff)
gl: cope with positive stride in put_image()
Keeping the warning, because I don't think this should happen anyway.
-rw-r--r--common/gl_canvas.c10
1 files 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);