From b8fe310b6d3b13d00d8380c28f24c1ecf59c8616 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Mon, 2 Nov 2009 01:12:10 +0000 Subject: [PATCH] [cogl_read_pixels] fixes for calculating the y offset when rendering offscreen Since offscreen rendering is forced to be upside down we don't need to do any conversion of the users coordinates to go from Cogl window coordinates to OpenGL window coordinates. --- cogl/cogl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cogl/cogl.c b/cogl/cogl.c index d9effc441..c34205290 100644 --- a/cogl/cogl.c +++ b/cogl/cogl.c @@ -809,8 +809,13 @@ cogl_read_pixels (int x, draw_buffer_height = _cogl_draw_buffer_get_height (draw_buffer); /* The y co-ordinate should be given in OpenGL's coordinate system - so 0 is the bottom row */ - y = draw_buffer_height - y - height; + * so 0 is the bottom row + * + * NB: all offscreen rendering is done upside down so no conversion + * is necissary in this case. + */ + if (!cogl_is_offscreen (draw_buffer)) + y = draw_buffer_height - y - height; /* Setup the pixel store parameters that may have been changed by Cogl */