cogl: Use pixel_format_to_gl_with_target on bitmap uploading paths

We already do have a texture with an internal format in these paths,
so we should check the required format according to it.

This fixes CoglAtlasTexture (and CoglPangoRenderer indirectly), as
it forces a RGBA format on its texture, but pixel_format_to_gl()
anyway assumed swizzling is performed on the texture, while it is
not the case.

https://bugzilla.gnome.org/show_bug.cgi?id=779234
This commit is contained in:
Carlos Garnacho 2017-03-03 17:13:10 +01:00
parent aa5738c777
commit 35388fb33c

View File

@ -772,11 +772,12 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d,
upload_format = cogl_bitmap_get_format (upload_bmp);
ctx->driver_vtable->pixel_format_to_gl (ctx,
upload_format,
NULL, /* internal format */
&gl_format,
&gl_type);
ctx->driver_vtable->pixel_format_to_gl_with_target (ctx,
upload_format,
_cogl_texture_get_format (tex),
NULL, /* internal gl format */
&gl_format,
&gl_type);
/* If this touches the first pixel then we'll update our copy */
if (dst_x == 0 && dst_y == 0 &&