app: remove GimpPickable::get_bytes()

This commit is contained in:
Michael Natterer
2012-03-29 20:51:51 +02:00
parent 5e754a9641
commit 2a853cd1ee
7 changed files with 16 additions and 45 deletions

View File

@ -261,7 +261,6 @@ gimp_drawable_pickable_iface_init (GimpPickableInterface *iface)
iface->get_image = (GimpImage * (*) (GimpPickable *pickable)) gimp_item_get_image; iface->get_image = (GimpImage * (*) (GimpPickable *pickable)) gimp_item_get_image;
iface->get_format = (const Babl * (*) (GimpPickable *pickable)) gimp_drawable_get_format; iface->get_format = (const Babl * (*) (GimpPickable *pickable)) gimp_drawable_get_format;
iface->get_format_with_alpha = (const Babl * (*) (GimpPickable *pickable)) gimp_drawable_get_format_with_alpha; iface->get_format_with_alpha = (const Babl * (*) (GimpPickable *pickable)) gimp_drawable_get_format_with_alpha;
iface->get_bytes = (gint (*) (GimpPickable *pickable)) gimp_drawable_bytes;
iface->get_buffer = (GeglBuffer * (*) (GimpPickable *pickable)) gimp_drawable_get_buffer; iface->get_buffer = (GeglBuffer * (*) (GimpPickable *pickable)) gimp_drawable_get_buffer;
iface->get_tiles = (TileManager * (*) (GimpPickable *pickable)) gimp_drawable_get_tiles; iface->get_tiles = (TileManager * (*) (GimpPickable *pickable)) gimp_drawable_get_tiles;
iface->get_pixel_at = gimp_drawable_get_pixel_at; iface->get_pixel_at = gimp_drawable_get_pixel_at;

View File

@ -91,7 +91,6 @@ static GimpImage * gimp_image_map_get_image (GimpPickable *pick
static const Babl * gimp_image_map_get_format (GimpPickable *pickable); static const Babl * gimp_image_map_get_format (GimpPickable *pickable);
static const Babl * gimp_image_map_get_format_with_alpha static const Babl * gimp_image_map_get_format_with_alpha
(GimpPickable *pickable); (GimpPickable *pickable);
static gint gimp_image_map_get_bytes (GimpPickable *pickable);
static GeglBuffer * gimp_image_map_get_buffer (GimpPickable *pickable); static GeglBuffer * gimp_image_map_get_buffer (GimpPickable *pickable);
static TileManager * gimp_image_map_get_tiles (GimpPickable *pickable); static TileManager * gimp_image_map_get_tiles (GimpPickable *pickable);
static gboolean gimp_image_map_get_pixel_at (GimpPickable *pickable, static gboolean gimp_image_map_get_pixel_at (GimpPickable *pickable,
@ -142,7 +141,6 @@ gimp_image_map_pickable_iface_init (GimpPickableInterface *iface)
iface->get_image = gimp_image_map_get_image; iface->get_image = gimp_image_map_get_image;
iface->get_format = gimp_image_map_get_format; iface->get_format = gimp_image_map_get_format;
iface->get_format_with_alpha = gimp_image_map_get_format_with_alpha; iface->get_format_with_alpha = gimp_image_map_get_format_with_alpha;
iface->get_bytes = gimp_image_map_get_bytes;
iface->get_buffer = gimp_image_map_get_buffer; iface->get_buffer = gimp_image_map_get_buffer;
iface->get_tiles = gimp_image_map_get_tiles; iface->get_tiles = gimp_image_map_get_tiles;
iface->get_pixel_at = gimp_image_map_get_pixel_at; iface->get_pixel_at = gimp_image_map_get_pixel_at;
@ -256,14 +254,6 @@ gimp_image_map_get_format_with_alpha (GimpPickable *pickable)
return gimp_pickable_get_format_with_alpha (GIMP_PICKABLE (image_map->drawable)); return gimp_pickable_get_format_with_alpha (GIMP_PICKABLE (image_map->drawable));
} }
static gint
gimp_image_map_get_bytes (GimpPickable *pickable)
{
GimpImageMap *image_map = GIMP_IMAGE_MAP (pickable);
return gimp_pickable_get_bytes (GIMP_PICKABLE (image_map->drawable));
}
static GeglBuffer * static GeglBuffer *
gimp_image_map_get_buffer (GimpPickable *pickable) gimp_image_map_get_buffer (GimpPickable *pickable)
{ {

View File

@ -121,21 +121,6 @@ gimp_pickable_get_format_with_alpha (GimpPickable *pickable)
return NULL; return NULL;
} }
gint
gimp_pickable_get_bytes (GimpPickable *pickable)
{
GimpPickableInterface *pickable_iface;
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), 0);
pickable_iface = GIMP_PICKABLE_GET_INTERFACE (pickable);
if (pickable_iface->get_bytes)
return pickable_iface->get_bytes (pickable);
return 0;
}
GeglBuffer * GeglBuffer *
gimp_pickable_get_buffer (GimpPickable *pickable) gimp_pickable_get_buffer (GimpPickable *pickable)
{ {

View File

@ -39,7 +39,6 @@ struct _GimpPickableInterface
GimpImage * (* get_image) (GimpPickable *pickable); GimpImage * (* get_image) (GimpPickable *pickable);
const Babl * (* get_format) (GimpPickable *pickable); const Babl * (* get_format) (GimpPickable *pickable);
const Babl * (* get_format_with_alpha) (GimpPickable *pickable); const Babl * (* get_format_with_alpha) (GimpPickable *pickable);
gint (* get_bytes) (GimpPickable *pickable);
GeglBuffer * (* get_buffer) (GimpPickable *pickable); GeglBuffer * (* get_buffer) (GimpPickable *pickable);
TileManager * (* get_tiles) (GimpPickable *pickable); TileManager * (* get_tiles) (GimpPickable *pickable);
gboolean (* get_pixel_at) (GimpPickable *pickable, gboolean (* get_pixel_at) (GimpPickable *pickable,
@ -58,7 +57,6 @@ void gimp_pickable_flush (GimpPickable *pickable);
GimpImage * gimp_pickable_get_image (GimpPickable *pickable); GimpImage * gimp_pickable_get_image (GimpPickable *pickable);
const Babl * gimp_pickable_get_format (GimpPickable *pickable); const Babl * gimp_pickable_get_format (GimpPickable *pickable);
const Babl * gimp_pickable_get_format_with_alpha (GimpPickable *pickable); const Babl * gimp_pickable_get_format_with_alpha (GimpPickable *pickable);
gint gimp_pickable_get_bytes (GimpPickable *pickable);
GeglBuffer * gimp_pickable_get_buffer (GimpPickable *pickable); GeglBuffer * gimp_pickable_get_buffer (GimpPickable *pickable);
TileManager * gimp_pickable_get_tiles (GimpPickable *pickable); TileManager * gimp_pickable_get_tiles (GimpPickable *pickable);
gboolean gimp_pickable_get_pixel_at (GimpPickable *pickable, gboolean gimp_pickable_get_pixel_at (GimpPickable *pickable,

View File

@ -62,7 +62,6 @@ static gint64 gimp_projection_get_memsize (GimpObject *objec
static void gimp_projection_pickable_flush (GimpPickable *pickable); static void gimp_projection_pickable_flush (GimpPickable *pickable);
static GimpImage * gimp_projection_get_image (GimpPickable *pickable); static GimpImage * gimp_projection_get_image (GimpPickable *pickable);
static const Babl * gimp_projection_get_format (GimpPickable *pickable); static const Babl * gimp_projection_get_format (GimpPickable *pickable);
static gint gimp_projection_get_bytes (GimpPickable *pickable);
static GeglBuffer * gimp_projection_get_buffer (GimpPickable *pickable); static GeglBuffer * gimp_projection_get_buffer (GimpPickable *pickable);
static TileManager * gimp_projection_get_tiles (GimpPickable *pickable); static TileManager * gimp_projection_get_tiles (GimpPickable *pickable);
static gboolean gimp_projection_get_pixel_at (GimpPickable *pickable, static gboolean gimp_projection_get_pixel_at (GimpPickable *pickable,
@ -165,7 +164,6 @@ gimp_projection_pickable_iface_init (GimpPickableInterface *iface)
iface->get_image = gimp_projection_get_image; iface->get_image = gimp_projection_get_image;
iface->get_format = gimp_projection_get_format; iface->get_format = gimp_projection_get_format;
iface->get_format_with_alpha = gimp_projection_get_format; /* sic */ iface->get_format_with_alpha = gimp_projection_get_format; /* sic */
iface->get_bytes = gimp_projection_get_bytes;
iface->get_buffer = gimp_projection_get_buffer; iface->get_buffer = gimp_projection_get_buffer;
iface->get_tiles = gimp_projection_get_tiles; iface->get_tiles = gimp_projection_get_tiles;
iface->get_pixel_at = gimp_projection_get_pixel_at; iface->get_pixel_at = gimp_projection_get_pixel_at;
@ -316,14 +314,6 @@ gimp_projection_get_format (GimpPickable *pickable)
return NULL; return NULL;
} }
static gint
gimp_projection_get_bytes (GimpPickable *pickable)
{
const Babl *format = gimp_projection_get_format (pickable);
return babl_format_get_bytes_per_pixel (format);
}
static GeglBuffer * static GeglBuffer *
gimp_projection_get_buffer (GimpPickable *pickable) gimp_projection_get_buffer (GimpPickable *pickable)
{ {
@ -454,11 +444,14 @@ gimp_projection_get_tiles_at_level (GimpProjection *proj,
if (! proj->pyramid) if (! proj->pyramid)
{ {
gint bytes; const Babl *format;
gint width; gint bytes;
gint height; gint width;
gint height;
bytes = gimp_projection_get_bytes (GIMP_PICKABLE (proj)); format = gimp_projection_get_format (GIMP_PICKABLE (proj));
bytes = babl_format_get_bytes_per_pixel (format);
gimp_projectable_get_size (proj->projectable, &width, &height); gimp_projectable_get_size (proj->projectable, &width, &height);
proj->pyramid = tile_pyramid_new (bytes, width, height); proj->pyramid = tile_pyramid_new (bytes, width, height);

View File

@ -769,6 +769,7 @@ gimp_paint_core_get_orig_proj (GimpPaintCore *core,
gboolean release_tile; gboolean release_tile;
gint h; gint h;
gint pixelwidth; gint pixelwidth;
const Babl *pickable_format;
gint pickable_width; gint pickable_width;
gint pickable_height; gint pickable_height;
const guchar *s; const guchar *s;
@ -779,8 +780,10 @@ gimp_paint_core_get_orig_proj (GimpPaintCore *core,
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), NULL); g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), NULL);
g_return_val_if_fail (core->saved_proj_tiles != NULL, NULL); g_return_val_if_fail (core->saved_proj_tiles != NULL, NULL);
pickable_format = gimp_pickable_get_format (pickable);
core->orig_proj_buf = temp_buf_resize (core->orig_proj_buf, core->orig_proj_buf = temp_buf_resize (core->orig_proj_buf,
gimp_pickable_get_bytes (pickable), babl_format_get_bytes_per_pixel (pickable_format),
x, y, width, height); x, y, width, height);
src_tiles = gimp_pickable_get_tiles (pickable); src_tiles = gimp_pickable_get_tiles (pickable);

View File

@ -1647,6 +1647,7 @@ gradmap_tile_validate (TileManager *tm,
static gboolean first_gradient = TRUE; static gboolean first_gradient = TRUE;
GimpPickable *pickable; GimpPickable *pickable;
const Babl *pickable_format;
Tile *srctile; Tile *srctile;
PixelRegion srcPR; PixelRegion srcPR;
PixelRegion destPR; PixelRegion destPR;
@ -1690,10 +1691,12 @@ gradmap_tile_validate (TileManager *tm,
sw = tile_ewidth (srctile); sw = tile_ewidth (srctile);
sh = tile_eheight (srctile); sh = tile_eheight (srctile);
pickable_format = gimp_pickable_get_format (pickable);
pixel_region_init_data (&srcPR, pixel_region_init_data (&srcPR,
tile_data_pointer (srctile, 0, 0), tile_data_pointer (srctile, 0, 0),
gimp_pickable_get_bytes (pickable), babl_format_get_bytes_per_pixel (pickable_format),
gimp_pickable_get_bytes (pickable) * babl_format_get_bytes_per_pixel (pickable_format) *
MIN (dw, sw), MIN (dw, sw),
0, 0, MIN (dw, sw), MIN (dh, sh)); 0, 0, MIN (dw, sw), MIN (dh, sh));