summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry (Yu) Song <hsong@sisa.samsung.com>2012-03-29 01:08:51 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-03-29 15:06:11 +0100
commita965b0f95fdeb567f7ccb51f7c8c47735a61e2d9 (patch)
tree4cbe40e57328cf0887dd73ae3d8dd18aa965a226
parentaf6e084dd78fcbb8ecce46c57f655f5e24343b8c (diff)
gl: fix y-axis origin when map_to_image() for non texture GL surface
We need to fix y-axis origin when map a GL surface to image surface for non-texture GL surface. Test cases: extended-blend-alpha-mask, extended-blend-mask. Although the image outputs is not right, but the image on the first grid (upper-left corner) is correct comparing to image output.
-rw-r--r--src/cairo-gl-surface.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index 8bbf9390..32ecf63c 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -985,6 +985,7 @@ _cairo_gl_surface_map_to_image (void *abstract_surface,
unsigned int cpp;
cairo_bool_t invert;
cairo_status_t status;
+ int y;
/* Want to use a switch statement here but the compiler gets whiny. */
if (surface->base.content == CAIRO_CONTENT_COLOR_ALPHA) {
@@ -1065,7 +1066,12 @@ _cairo_gl_surface_map_to_image (void *abstract_surface,
glPixelStorei (GL_PACK_ROW_LENGTH, image->stride / cpp);
if (invert)
glPixelStorei (GL_PACK_INVERT_MESA, 1);
- glReadPixels (extents->x, extents->y,
+
+ y = extents->y;
+ if (! _cairo_gl_surface_is_texture (surface))
+ y = surface->height - extents->y - extents->height;
+
+ glReadPixels (extents->x, y,
extents->width, extents->height,
format, type, image->data);
if (invert)