diff options
Diffstat (limited to 'cogl/cogl-texture.c')
-rw-r--r-- | cogl/cogl-texture.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/cogl/cogl-texture.c b/cogl/cogl-texture.c index cd65dda3..7b2fb3c0 100644 --- a/cogl/cogl-texture.c +++ b/cogl/cogl-texture.c @@ -105,7 +105,7 @@ _cogl_texture_init (CoglTexture *texture, CoglContext *context, int width, int height, - CoglPixelFormat internal_format, + CoglPixelFormat src_format, CoglTextureLoader *loader, const CoglTextureVtable *vtable) { @@ -119,7 +119,13 @@ _cogl_texture_init (CoglTexture *texture, texture->loader = loader; - _cogl_texture_set_internal_format (texture, internal_format); + _cogl_texture_set_internal_format (texture, src_format); + + /* Although we want to initialize texture::components according + * to the source format, we always want the internal layout to + * be premultiplied by default if applicable... */ + if (COGL_PIXEL_FORMAT_CAN_HAVE_PREMULT (src_format)) + texture->premultiplied = TRUE; } static void @@ -1405,3 +1411,11 @@ cogl_texture_get_premultiplied (CoglTexture *texture) { return texture->premultiplied; } + +void +_cogl_texture_copy_internal_format (CoglTexture *src, + CoglTexture *dest) +{ + cogl_texture_set_components (dest, src->components); + cogl_texture_set_premultiplied (dest, src->premultiplied); +} |