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

This commit is contained in:
Michael Natterer 2012-03-19 10:46:47 +01:00
parent 6f6c42a9c3
commit 62a23f8a89
2 changed files with 12 additions and 8 deletions

View file

@ -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;
}

View file

@ -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;
}