[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.
This commit is contained in:
Robert Bragg 2009-11-02 01:12:10 +00:00
parent 426197f51d
commit b47404c91d

View File

@ -809,8 +809,13 @@ cogl_read_pixels (int x,
draw_buffer_height = _cogl_draw_buffer_get_height (draw_buffer); draw_buffer_height = _cogl_draw_buffer_get_height (draw_buffer);
/* The y co-ordinate should be given in OpenGL's coordinate system /* The y co-ordinate should be given in OpenGL's coordinate system
so 0 is the bottom row */ * so 0 is the bottom row
y = draw_buffer_height - y - height; *
* 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 /* Setup the pixel store parameters that may have been changed by
Cogl */ Cogl */