[gimp/goat-invasion: 147/401] app: port drawable'e and projection's get_pixel_at() to gegl_buffer_sample()



commit 1e6c191c404daf945b3423759808f5b551ec3b0e
Author: Michael Natterer <mitch gimp org>
Date:   Mon Mar 19 10:46:47 2012 +0100

    app: port drawable'e and projection's get_pixel_at() to gegl_buffer_sample()

 app/core/gimpdrawable.c   |    6 ++++--
 app/core/gimpprojection.c |   14 ++++++++------
 2 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/app/core/gimpdrawable.c b/app/core/gimpdrawable.c
index 13b82dc..cffe5c4 100644
--- a/app/core/gimpdrawable.c
+++ b/app/core/gimpdrawable.c
@@ -742,8 +742,10 @@ gimp_drawable_get_pixel_at (GimpPickable *pickable,
       y < 0 || y >= gimp_item_get_height (GIMP_ITEM (drawable)))
     return FALSE;
 
-  tile_manager_read_pixel_data_1 (gimp_drawable_get_tiles (drawable), x, y,
-                                  pixel);
+  gegl_buffer_sample (gimp_drawable_get_read_buffer (drawable),
+                      x, y, NULL, pixel,
+                      gimp_drawable_get_format (drawable),
+                      GEGL_SAMPLER_NEAREST);
 
   return TRUE;
 }
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index 0db5b20..1f4bb35 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -376,15 +376,17 @@ gimp_projection_get_pixel_at (GimpPickable *pickable,
                               gint          y,
                               guchar       *pixel)
 {
-  TileManager *tiles = gimp_projection_get_tiles (pickable);
+  GeglBuffer *buffer = gimp_projection_get_buffer (pickable);
 
-  if (x <  0                           ||
-      y <  0                           ||
-      x >= tile_manager_width  (tiles) ||
-      y >= tile_manager_height (tiles))
+  if (x <  0                               ||
+      y <  0                               ||
+      x >= gegl_buffer_get_width  (buffer) ||
+      y >= gegl_buffer_get_height (buffer))
     return FALSE;
 
-  tile_manager_read_pixel_data_1 (tiles, x, y, pixel);
+  gegl_buffer_sample (buffer, x, y, NULL, pixel,
+                      gimp_projection_get_format (pickable),
+                      GEGL_SAMPLER_NEAREST);
 
   return TRUE;
 }



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