From 35388fb33cb39a311b4ccc504ac15a6c5d226dab Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 3 Mar 2017 17:13:10 +0100 Subject: [PATCH] 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 --- cogl/cogl/driver/gl/cogl-texture-2d-gl.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cogl/cogl/driver/gl/cogl-texture-2d-gl.c b/cogl/cogl/driver/gl/cogl-texture-2d-gl.c index 375edcb14..d1eff4507 100644 --- a/cogl/cogl/driver/gl/cogl-texture-2d-gl.c +++ b/cogl/cogl/driver/gl/cogl-texture-2d-gl.c @@ -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 &&