[gimp/goat-invasion] app: explicitly use a u8 format for image previews



commit b14d111b89c3696f4e0fb5fe8793d2063be86339
Author: Michael Natterer <mitch gimp org>
Date:   Sat Apr 28 15:18:55 2012 +0200

    app: explicitly use a u8 format for image previews
    
    instead of relying on the temporary fact that the projection is always
    8 bit.

 app/core/gimpimage-preview.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/app/core/gimpimage-preview.c b/app/core/gimpimage-preview.c
index a48309c..d4bf816 100644
--- a/app/core/gimpimage-preview.c
+++ b/app/core/gimpimage-preview.c
@@ -23,6 +23,8 @@
 
 #include "base/tile-manager-preview.h"
 
+#include "gegl/gimp-babl.h"
+
 #include "gimpimage.h"
 #include "gimpimage-preview.h"
 #include "gimpimage-private.h"
@@ -129,6 +131,7 @@ gimp_image_get_new_preview (GimpViewable *viewable,
 {
   GimpImage      *image      = GIMP_IMAGE (viewable);
   GimpProjection *projection = gimp_image_get_projection (image);
+  const Babl     *format;
   GimpTempBuf    *buf;
   TileManager    *tiles;
   gdouble         scale_x;
@@ -142,14 +145,16 @@ gimp_image_get_new_preview (GimpViewable *viewable,
   level = gimp_projection_get_level (projection, scale_x, scale_y);
   tiles = gimp_projection_get_tiles_at_level (projection, level, &is_premult);
 
-  buf = tile_manager_get_preview (tiles,
-                                  gimp_projectable_get_format (GIMP_PROJECTABLE (image)),
-                                  width, height);
+  format = gimp_projectable_get_format (GIMP_PROJECTABLE (image));
+
+  format = gimp_babl_format (gimp_babl_format_get_base_type (format),
+                             GIMP_PRECISION_U8,
+                             babl_format_has_alpha (format));
+
+  buf = tile_manager_get_preview (tiles, format, width, height);
 
   if (is_premult)
     {
-      const Babl *format = gimp_temp_buf_get_format (buf);
-
       if (format == babl_format ("Y'A u8"))
         {
           gimp_temp_buf_set_format (buf, babl_format ("Y'aA u8"));



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