mirror of https://github.com/encounter/SDL.git
Fixed bug 3349 - GLES2_RenderReadPixels doesn't use target texture format
Simon Hug The OpenGL ES 2 renderer does not check the target texture format when using SDL_RenderReadPixels and just always uses ABGR8888. This can result in swapped or wrong colors. The attached patch adds a check and selects the target texture format, if a texture is set as the target.
This commit is contained in:
parent
51d6371ec1
commit
061cc5e75f
|
@ -1414,7 +1414,7 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
||||||
Uint32 pixel_format, void * pixels, int pitch)
|
Uint32 pixel_format, void * pixels, int pitch)
|
||||||
{
|
{
|
||||||
GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
|
GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
|
||||||
Uint32 temp_format = SDL_PIXELFORMAT_ARGB8888;
|
Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ABGR8888;
|
||||||
void *temp_pixels;
|
void *temp_pixels;
|
||||||
int temp_pitch;
|
int temp_pitch;
|
||||||
GLint internalFormat;
|
GLint internalFormat;
|
||||||
|
|
|
@ -1069,7 +1069,7 @@ GLES_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
||||||
Uint32 pixel_format, void * pixels, int pitch)
|
Uint32 pixel_format, void * pixels, int pitch)
|
||||||
{
|
{
|
||||||
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
|
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
|
||||||
Uint32 temp_format = SDL_PIXELFORMAT_ABGR8888;
|
Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ABGR8888;
|
||||||
void *temp_pixels;
|
void *temp_pixels;
|
||||||
int temp_pitch;
|
int temp_pitch;
|
||||||
Uint8 *src, *dst, *tmp;
|
Uint8 *src, *dst, *tmp;
|
||||||
|
|
|
@ -1817,7 +1817,7 @@ GLES2_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
||||||
Uint32 pixel_format, void * pixels, int pitch)
|
Uint32 pixel_format, void * pixels, int pitch)
|
||||||
{
|
{
|
||||||
GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
|
GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
|
||||||
Uint32 temp_format = SDL_PIXELFORMAT_ABGR8888;
|
Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ABGR8888;
|
||||||
void *temp_pixels;
|
void *temp_pixels;
|
||||||
int temp_pitch;
|
int temp_pitch;
|
||||||
Uint8 *src, *dst, *tmp;
|
Uint8 *src, *dst, *tmp;
|
||||||
|
|
Loading…
Reference in New Issue