gimp r27545 - in trunk/app: base core



Author: neo
Date: Tue Nov  4 09:07:38 2008
New Revision: 27545
URL: http://svn.gnome.org/viewvc/gimp?rev=27545&view=rev

Log:
2008-11-04  Sven Neumann  <sven sven>

	* app/base/tile-pyramid.[ch] (tile_pyramid_new):
	* app/core/gimpprojection.c 
(gimp_projection_get_tiles_at_level):
	reverted last change as the code in tile-pyramid does care about
	the pixel format and it should continue to reject types that it
	cannot handle.



Modified:
   trunk/app/base/tile-pyramid.c
   trunk/app/base/tile-pyramid.h
   trunk/app/core/gimpprojection.c

Modified: trunk/app/base/tile-pyramid.c
==============================================================================
--- trunk/app/base/tile-pyramid.c	(original)
+++ trunk/app/base/tile-pyramid.c	Tue Nov  4 09:07:38 2008
@@ -32,11 +32,12 @@
 
 struct _TilePyramid
 {
-  guint        width;
-  guint        height;
-  gint         bytes;
-  TileManager *tiles[PYRAMID_MAX_LEVELS];
-  gint         top_level;
+  GimpImageType  type;
+  guint          width;
+  guint          height;
+  gint           bytes;
+  TileManager   *tiles[PYRAMID_MAX_LEVELS];
+  gint           top_level;
 };
 
 
@@ -60,9 +61,9 @@
 
 /**
  * tile_pyramid_new:
+ * @type:   type of pixel data stored in the pyramid
  * @width:  bottom level width
  * @height: bottom level height
- * @bytes:  the bpp of the pixel data stored in the pyramid
  *
  * Creates a new #TilePyramid, managing a set of tile-managers where
  * each level is a sized-down version of the level below.
@@ -78,9 +79,9 @@
  * Return value: a newly allocate #TilePyramid
  **/
 TilePyramid *
-tile_pyramid_new (gint width,
-                  gint height,
-                  gint bytes)
+tile_pyramid_new (GimpImageType  type,
+                  gint           width,
+                  gint           height)
 {
   TilePyramid *pyramid;
 
@@ -89,11 +90,35 @@
 
   pyramid = g_slice_new0 (TilePyramid);
 
+  pyramid->type   = type;
   pyramid->width  = width;
   pyramid->height = height;
-  pyramid->bytes  = bytes;
 
-  pyramid->tiles[0] = tile_manager_new (width, height, bytes);
+  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);
 
   return pyramid;
 }

Modified: trunk/app/base/tile-pyramid.h
==============================================================================
--- trunk/app/base/tile-pyramid.h	(original)
+++ trunk/app/base/tile-pyramid.h	Tue Nov  4 09:07:38 2008
@@ -29,9 +29,9 @@
  *  is "nlevels - 1". That level will be smaller than TILE_WIDTH x
  *  TILE_HEIGHT
  */
-TilePyramid * tile_pyramid_new               (gint               width,
-                                              gint               height,
-                                              gint               bytes);
+TilePyramid * tile_pyramid_new               (GimpImageType      type,
+                                              gint               width,
+                                              gint               height);
 void          tile_pyramid_destroy           (TilePyramid       *pyramid);
 
 gint          tile_pyramid_get_level         (gint               width,

Modified: trunk/app/core/gimpprojection.c
==============================================================================
--- trunk/app/core/gimpprojection.c	(original)
+++ trunk/app/core/gimpprojection.c	Tue Nov  4 09:07:38 2008
@@ -372,9 +372,9 @@
 
   if (! proj->pyramid)
     {
-      proj->pyramid = tile_pyramid_new (gimp_image_get_width  (proj->image),
-                                        gimp_image_get_height (proj->image),
-                                        gimp_projection_get_bytes (proj));
+      proj->pyramid = tile_pyramid_new (gimp_projection_get_image_type (proj),
+                                        gimp_image_get_width  (proj->image),
+                                        gimp_image_get_height (proj->image));
 
       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]