[mutter] cogl: Use pixel_format_to_gl_with_target in find_best_gl_get_data_format



commit 374bb630f044d430206bd5e6f3bd2f670fcf51fb
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu May 18 14:57:43 2017 +0200

    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

 cogl/cogl/cogl-texture-driver.h                    |    1 +
 cogl/cogl/cogl-texture.c                           |    1 +
 cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c    |   12 +++++++-----
 .../cogl/driver/gl/gles/cogl-texture-driver-gles.c |    1 +
 4 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/cogl/cogl/cogl-texture-driver.h b/cogl/cogl/cogl-texture-driver.h
index 3ab86ed..e548605 100644
--- a/cogl/cogl/cogl-texture-driver.h
+++ b/cogl/cogl/cogl-texture-driver.h
@@ -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);
 };
diff --git a/cogl/cogl/cogl-texture.c b/cogl/cogl/cogl-texture.c
index 877d1d7..729fb0c 100644
--- a/cogl/cogl/cogl-texture.c
+++ b/cogl/cogl/cogl-texture.c
@@ -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);
diff --git a/cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c
index d5ee4b4..036b04c 100644
--- a/cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c
+++ b/cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c
@@ -533,14 +533,16 @@ 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,
-                                                     format,
-                                                     NULL, /* don't need */
-                                                     closest_gl_format,
-                                                     closest_gl_type);
+  return context->driver_vtable->pixel_format_to_gl_with_target (context,
+                                                                 format,
+                                                                 target_format,
+                                                                 NULL, /* don't need */
+                                                                 closest_gl_format,
+                                                                 closest_gl_type);
 }
 
 const CoglTextureDriver
diff --git a/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c 
b/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c
index 34ba57f..1f62ade 100644
--- a/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c
+++ b/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c
@@ -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)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]