cogl: Use pixel_format_to_gl_with_target in find_best_gl_get_data_format

Fixes cogl_texture_get_data() resorting to the wrong conversions when
extracting the texture data. This notably resulted in RGB/RGBA buffers
copied as-is into BGRA buffers, for instance for the fullscreen animation,
or single-window screenshots of such buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=779234
This commit is contained in:
Carlos Garnacho 2017-05-18 14:57:43 +02:00
parent fe5138dfc4
commit 374bb630f0
4 changed files with 10 additions and 5 deletions

View File

@ -198,6 +198,7 @@ struct _CoglTextureDriver
CoglPixelFormat
(* find_best_gl_get_data_format) (CoglContext *context,
CoglPixelFormat format,
CoglPixelFormat target_format,
GLenum *closest_gl_format,
GLenum *closest_gl_type);
};

View File

@ -1059,6 +1059,7 @@ cogl_texture_get_data (CoglTexture *texture,
closest_format =
ctx->texture_driver->find_best_gl_get_data_format (ctx,
texture_format,
format,
&closest_gl_format,
&closest_gl_type);

View File

@ -533,11 +533,13 @@ static CoglPixelFormat
_cogl_texture_driver_find_best_gl_get_data_format
(CoglContext *context,
CoglPixelFormat format,
CoglPixelFormat target_format,
GLenum *closest_gl_format,
GLenum *closest_gl_type)
{
return context->driver_vtable->pixel_format_to_gl (context,
return context->driver_vtable->pixel_format_to_gl_with_target (context,
format,
target_format,
NULL, /* don't need */
closest_gl_format,
closest_gl_type);

View File

@ -615,6 +615,7 @@ static CoglPixelFormat
_cogl_texture_driver_find_best_gl_get_data_format
(CoglContext *context,
CoglPixelFormat format,
CoglPixelFormat target_format,
GLenum *closest_gl_format,
GLenum *closest_gl_type)
{