[gimp/metadata-browser] app: replace the tile pyramid's GimpImageType by bytes, it needs nothing else



commit d02047892c5dd39cf7f50fa8bf875e606fa1931e
Author: Michael Natterer <mitch gimp org>
Date:   Thu Mar 29 20:36:21 2012 +0200

    app: replace the tile pyramid's GimpImageType by bytes, it needs nothing else

 app/base/tile-pyramid.c   |   37 ++++++-------------------------------
 app/base/tile-pyramid.h   |    2 +-
 app/core/gimpprojection.c |   10 +++++-----
 3 files changed, 12 insertions(+), 37 deletions(-)
---
diff --git a/app/base/tile-pyramid.c b/app/base/tile-pyramid.c
index 16a72eb..98f9e51 100644
--- a/app/base/tile-pyramid.c
+++ b/app/base/tile-pyramid.c
@@ -31,7 +31,6 @@
 
 struct _TilePyramid
 {
-  GimpImageType  type;
   guint          width;
   guint          height;
   gint           bytes;
@@ -60,7 +59,7 @@ static void  tile_pyramid_write_upper_quarter (Tile        *dest,
 
 /**
  * tile_pyramid_new:
- * @type:   type of pixel data stored in the pyramid
+ * @bytes:  foo
  * @width:  bottom level width
  * @height: bottom level height
  *
@@ -78,9 +77,9 @@ static void  tile_pyramid_write_upper_quarter (Tile        *dest,
  * Return value: a newly allocate #TilePyramid
  **/
 TilePyramid *
-tile_pyramid_new (GimpImageType  type,
-                  gint           width,
-                  gint           height)
+tile_pyramid_new (gint bytes,
+                  gint width,
+                  gint height)
 {
   TilePyramid *pyramid;
 
@@ -89,35 +88,11 @@ tile_pyramid_new (GimpImageType  type,
 
   pyramid = g_slice_new0 (TilePyramid);
 
-  pyramid->type   = type;
+  pyramid->bytes  = bytes;
   pyramid->width  = width;
   pyramid->height = height;
 
-  switch (type)
-    {
-    case GIMP_GRAY_IMAGE:
-      pyramid->bytes = 1;
-      break;
-
-    case GIMP_GRAYA_IMAGE:
-      pyramid->bytes = 2;
-      break;
-
-    case GIMP_RGB_IMAGE:
-      pyramid->bytes = 3;
-      break;
-
-    case GIMP_RGBA_IMAGE:
-      pyramid->bytes = 4;
-      break;
-
-    case GIMP_INDEXED_IMAGE:
-    case GIMP_INDEXEDA_IMAGE:
-      g_assert_not_reached ();
-      break;
-    }
-
-  pyramid->tiles[0] = tile_manager_new (width, height, pyramid->bytes);
+  pyramid->tiles[0] = tile_manager_new (width, height, bytes);
 
   return pyramid;
 }
diff --git a/app/base/tile-pyramid.h b/app/base/tile-pyramid.h
index 6143bda..aa84f81 100644
--- a/app/base/tile-pyramid.h
+++ b/app/base/tile-pyramid.h
@@ -28,7 +28,7 @@
  *  is "nlevels - 1". That level will be smaller than TILE_WIDTH x
  *  TILE_HEIGHT
  */
-TilePyramid * tile_pyramid_new               (GimpImageType      type,
+TilePyramid * tile_pyramid_new               (gint               bytes,
                                               gint               width,
                                               gint               height);
 void          tile_pyramid_destroy           (TilePyramid       *pyramid);
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index 3320ac9..c06bea2 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -477,14 +477,14 @@ gimp_projection_get_tiles_at_level (GimpProjection *proj,
 
   if (! proj->pyramid)
     {
-      GimpImageType type;
-      gint          width;
-      gint          height;
+      gint bytes;
+      gint width;
+      gint height;
 
-      type = gimp_projection_get_image_type (GIMP_PICKABLE (proj));
+      bytes = gimp_projection_get_bytes (GIMP_PICKABLE (proj));
       gimp_projectable_get_size (proj->projectable, &width, &height);
 
-      proj->pyramid = tile_pyramid_new (type, width, height);
+      proj->pyramid = tile_pyramid_new (bytes, width, height);
 
       tile_pyramid_set_validate_proc (proj->pyramid,
                                       (TileValidateProc) gimp_projection_validate_tile,



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