mirror of
https://github.com/yawut/SDL.git
synced 2026-08-25 02:05:07 -05:00
Fixed bug 1810 - xxx_RenderReadPixels - incorrect behaviour in certain conditions
PoopiSan GLES2_RenderReadPixels, GLES_RenderReadPixels, GL_RenderReadPixels and possibly other backends is incorrectly implemented. If the current target viewport is different than window size the function is reading garbage and according to the function documentation should work with any rendering target "Read pixels from the current rendering target.". this seems to be caused by this line: ... SDL_GetWindowSize(window, &w, &h);
This commit is contained in:
@@ -1233,7 +1233,6 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
||||
Uint32 pixel_format, void * pixels, int pitch)
|
||||
{
|
||||
GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
|
||||
SDL_Window *window = renderer->window;
|
||||
Uint32 temp_format = SDL_PIXELFORMAT_ARGB8888;
|
||||
void *temp_pixels;
|
||||
int temp_pitch;
|
||||
@@ -1253,7 +1252,7 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
||||
|
||||
convert_format(data, temp_format, &internalFormat, &format, &type);
|
||||
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
SDL_GetRendererOutputSize(renderer, &w, &h);
|
||||
|
||||
data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
data->glPixelStorei(GL_PACK_ROW_LENGTH,
|
||||
|
||||
@@ -1006,7 +1006,6 @@ GLES_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
||||
Uint32 pixel_format, void * pixels, int pitch)
|
||||
{
|
||||
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
|
||||
SDL_Window *window = renderer->window;
|
||||
Uint32 temp_format = SDL_PIXELFORMAT_ABGR8888;
|
||||
void *temp_pixels;
|
||||
int temp_pitch;
|
||||
@@ -1022,7 +1021,7 @@ GLES_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
SDL_GetRendererOutputSize(renderer, &w, &h);
|
||||
|
||||
data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
|
||||
|
||||
@@ -1508,7 +1508,6 @@ GLES2_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
||||
Uint32 pixel_format, void * pixels, int pitch)
|
||||
{
|
||||
GLES2_DriverContext *rdata = (GLES2_DriverContext *)renderer->driverdata;
|
||||
SDL_Window *window = renderer->window;
|
||||
Uint32 temp_format = SDL_PIXELFORMAT_ABGR8888;
|
||||
void *temp_pixels;
|
||||
int temp_pitch;
|
||||
@@ -1524,7 +1523,7 @@ GLES2_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
SDL_GetRendererOutputSize(renderer, &w, &h);
|
||||
|
||||
rdata->glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user