app: remove GimpPickable::get_tiles()
and change some legacy places to get their tiles from the buffer returned by GimpPickable::get_buffer().
This commit is contained in:
@ -291,6 +291,7 @@ static gboolean
|
|||||||
debug_benchmark_projection (GimpImage *image)
|
debug_benchmark_projection (GimpImage *image)
|
||||||
{
|
{
|
||||||
GimpProjection *projection = gimp_image_get_projection (image);
|
GimpProjection *projection = gimp_image_get_projection (image);
|
||||||
|
GeglBuffer *buffer;
|
||||||
TileManager *tiles;
|
TileManager *tiles;
|
||||||
gint x, y;
|
gint x, y;
|
||||||
|
|
||||||
@ -300,7 +301,8 @@ debug_benchmark_projection (GimpImage *image)
|
|||||||
gimp_image_get_height (image));
|
gimp_image_get_height (image));
|
||||||
gimp_projection_flush_now (projection);
|
gimp_projection_flush_now (projection);
|
||||||
|
|
||||||
tiles = gimp_pickable_get_tiles (GIMP_PICKABLE (projection));
|
buffer = gimp_pickable_get_buffer (GIMP_PICKABLE (projection));
|
||||||
|
tiles = gimp_gegl_buffer_get_tiles (buffer);
|
||||||
|
|
||||||
GIMP_TIMER_START ();
|
GIMP_TIMER_START ();
|
||||||
|
|
||||||
|
@ -264,7 +264,6 @@ gimp_drawable_pickable_iface_init (GimpPickableInterface *iface)
|
|||||||
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_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_pixel_at = gimp_drawable_get_pixel_at;
|
iface->get_pixel_at = gimp_drawable_get_pixel_at;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,6 @@ static const Babl * gimp_image_map_get_format (GimpPickable *pick
|
|||||||
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 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 gboolean gimp_image_map_get_pixel_at (GimpPickable *pickable,
|
static gboolean gimp_image_map_get_pixel_at (GimpPickable *pickable,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
@ -143,7 +142,6 @@ gimp_image_map_pickable_iface_init (GimpPickableInterface *iface)
|
|||||||
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_buffer = gimp_image_map_get_buffer;
|
iface->get_buffer = gimp_image_map_get_buffer;
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,17 +264,6 @@ gimp_image_map_get_buffer (GimpPickable *pickable)
|
|||||||
return gimp_pickable_get_buffer (GIMP_PICKABLE (image_map->drawable));
|
return gimp_pickable_get_buffer (GIMP_PICKABLE (image_map->drawable));
|
||||||
}
|
}
|
||||||
|
|
||||||
static TileManager *
|
|
||||||
gimp_image_map_get_tiles (GimpPickable *pickable)
|
|
||||||
{
|
|
||||||
GimpImageMap *image_map = GIMP_IMAGE_MAP (pickable);
|
|
||||||
|
|
||||||
if (image_map->undo_buffer)
|
|
||||||
return gimp_gegl_buffer_get_tiles (image_map->undo_buffer);
|
|
||||||
|
|
||||||
return gimp_pickable_get_tiles (GIMP_PICKABLE (image_map->drawable));
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gimp_image_map_get_pixel_at (GimpPickable *pickable,
|
gimp_image_map_get_pixel_at (GimpPickable *pickable,
|
||||||
gint x,
|
gint x,
|
||||||
@ -365,7 +352,7 @@ gimp_image_map_apply (GimpImageMap *image_map,
|
|||||||
&rect.width, &rect.height))
|
&rect.width, &rect.height))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* If undo tiles don't exist, or change size, (re)allocate */
|
/* If undo buffer don't exist, or change size, (re)allocate */
|
||||||
gimp_image_map_update_undo_buffer (image_map, &rect);
|
gimp_image_map_update_undo_buffer (image_map, &rect);
|
||||||
|
|
||||||
input_buffer = image_map->undo_buffer;
|
input_buffer = image_map->undo_buffer;
|
||||||
@ -589,18 +576,16 @@ gimp_image_map_update_undo_buffer (GimpImageMap *image_map,
|
|||||||
undo_width != rect->width ||
|
undo_width != rect->width ||
|
||||||
undo_height != rect->height)
|
undo_height != rect->height)
|
||||||
{
|
{
|
||||||
/* If either the extents changed or the tiles don't exist,
|
/* If either the extents changed or the buffer don't exist,
|
||||||
* allocate new
|
* allocate new
|
||||||
*/
|
*/
|
||||||
if (! image_map->undo_buffer ||
|
if (! image_map->undo_buffer ||
|
||||||
undo_width != rect->width ||
|
undo_width != rect->width ||
|
||||||
undo_height != rect->height)
|
undo_height != rect->height)
|
||||||
{
|
{
|
||||||
/* Destroy old tiles */
|
|
||||||
if (image_map->undo_buffer)
|
if (image_map->undo_buffer)
|
||||||
g_object_unref (image_map->undo_buffer);
|
g_object_unref (image_map->undo_buffer);
|
||||||
|
|
||||||
/* Allocate new tiles */
|
|
||||||
image_map->undo_buffer =
|
image_map->undo_buffer =
|
||||||
gimp_gegl_buffer_new (GEGL_RECTANGLE (0, 0,
|
gimp_gegl_buffer_new (GEGL_RECTANGLE (0, 0,
|
||||||
rect->width, rect->height),
|
rect->width, rect->height),
|
||||||
|
@ -137,21 +137,6 @@ gimp_pickable_get_buffer (GimpPickable *pickable)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
TileManager *
|
|
||||||
gimp_pickable_get_tiles (GimpPickable *pickable)
|
|
||||||
{
|
|
||||||
GimpPickableInterface *pickable_iface;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_PICKABLE (pickable), NULL);
|
|
||||||
|
|
||||||
pickable_iface = GIMP_PICKABLE_GET_INTERFACE (pickable);
|
|
||||||
|
|
||||||
if (pickable_iface->get_tiles)
|
|
||||||
return pickable_iface->get_tiles (pickable);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gimp_pickable_get_pixel_at (GimpPickable *pickable,
|
gimp_pickable_get_pixel_at (GimpPickable *pickable,
|
||||||
gint x,
|
gint x,
|
||||||
|
@ -40,7 +40,6 @@ struct _GimpPickableInterface
|
|||||||
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);
|
||||||
GeglBuffer * (* get_buffer) (GimpPickable *pickable);
|
GeglBuffer * (* get_buffer) (GimpPickable *pickable);
|
||||||
TileManager * (* get_tiles) (GimpPickable *pickable);
|
|
||||||
gboolean (* get_pixel_at) (GimpPickable *pickable,
|
gboolean (* get_pixel_at) (GimpPickable *pickable,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
@ -59,7 +58,6 @@ 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);
|
||||||
GeglBuffer * gimp_pickable_get_buffer (GimpPickable *pickable);
|
GeglBuffer * gimp_pickable_get_buffer (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,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
|
@ -153,6 +153,7 @@ gimp_projection_construct_legacy (GimpProjection *proj,
|
|||||||
for (list = reverse_list; list; list = g_list_next (list))
|
for (list = reverse_list; list; list = g_list_next (list))
|
||||||
{
|
{
|
||||||
GimpItem *item = list->data;
|
GimpItem *item = list->data;
|
||||||
|
GeglBuffer *proj_buffer;
|
||||||
PixelRegion projPR;
|
PixelRegion projPR;
|
||||||
gint x1, y1;
|
gint x1, y1;
|
||||||
gint x2, y2;
|
gint x2, y2;
|
||||||
@ -173,8 +174,10 @@ gimp_projection_construct_legacy (GimpProjection *proj,
|
|||||||
x2 = CLAMP (off_x + gimp_item_get_width (item), x, x + w);
|
x2 = CLAMP (off_x + gimp_item_get_width (item), x, x + w);
|
||||||
y2 = CLAMP (off_y + gimp_item_get_height (item), y, y + h);
|
y2 = CLAMP (off_y + gimp_item_get_height (item), y, y + h);
|
||||||
|
|
||||||
|
proj_buffer = gimp_pickable_get_buffer (GIMP_PICKABLE (proj));
|
||||||
|
|
||||||
pixel_region_init (&projPR,
|
pixel_region_init (&projPR,
|
||||||
gimp_pickable_get_tiles (GIMP_PICKABLE (proj)),
|
gimp_gegl_buffer_get_tiles (proj_buffer),
|
||||||
x1, y1, x2 - x1, y2 - y1,
|
x1, y1, x2 - x1, y2 - y1,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
@ -261,7 +264,8 @@ gimp_projection_initialize (GimpProjection *proj,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TileManager *tiles = gimp_pickable_get_tiles (GIMP_PICKABLE (proj));
|
GeglBuffer *buffer = gimp_pickable_get_buffer (GIMP_PICKABLE (proj));
|
||||||
|
TileManager *tiles = gimp_gegl_buffer_get_tiles (buffer);
|
||||||
const Babl *format = gimp_pickable_get_format (GIMP_PICKABLE (proj));
|
const Babl *format = gimp_pickable_get_format (GIMP_PICKABLE (proj));
|
||||||
|
|
||||||
buffer = gimp_tile_manager_create_buffer (tiles, format);
|
buffer = gimp_tile_manager_create_buffer (tiles, format);
|
||||||
|
@ -63,7 +63,6 @@ static void gimp_projection_pickable_flush (GimpPickable *picka
|
|||||||
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 GeglBuffer * gimp_projection_get_buffer (GimpPickable *pickable);
|
static GeglBuffer * gimp_projection_get_buffer (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,
|
||||||
gint x,
|
gint x,
|
||||||
gint y,
|
gint y,
|
||||||
@ -166,7 +165,6 @@ gimp_projection_pickable_iface_init (GimpPickableInterface *iface)
|
|||||||
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_buffer = gimp_projection_get_buffer;
|
iface->get_buffer = gimp_projection_get_buffer;
|
||||||
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;
|
||||||
iface->get_opacity_at = gimp_projection_get_opacity_at;
|
iface->get_opacity_at = gimp_projection_get_opacity_at;
|
||||||
}
|
}
|
||||||
@ -307,7 +305,7 @@ gimp_projection_get_buffer (GimpPickable *pickable)
|
|||||||
|
|
||||||
if (! proj->buffer)
|
if (! proj->buffer)
|
||||||
{
|
{
|
||||||
TileManager *tiles = gimp_projection_get_tiles (pickable);
|
TileManager *tiles = gimp_projection_get_tiles_at_level (proj, 0, NULL);
|
||||||
const Babl *format = gimp_projection_get_format (pickable);
|
const Babl *format = gimp_projection_get_format (pickable);
|
||||||
|
|
||||||
proj->buffer = gimp_tile_manager_create_buffer (tiles, format);
|
proj->buffer = gimp_tile_manager_create_buffer (tiles, format);
|
||||||
@ -327,14 +325,6 @@ gimp_projection_get_buffer (GimpPickable *pickable)
|
|||||||
return proj->buffer;
|
return proj->buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static TileManager *
|
|
||||||
gimp_projection_get_tiles (GimpPickable *pickable)
|
|
||||||
{
|
|
||||||
return gimp_projection_get_tiles_at_level (GIMP_PROJECTION (pickable),
|
|
||||||
0, NULL);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gimp_projection_get_pixel_at (GimpPickable *pickable,
|
gimp_projection_get_pixel_at (GimpPickable *pickable,
|
||||||
gint x,
|
gint x,
|
||||||
|
@ -62,6 +62,8 @@
|
|||||||
|
|
||||||
#include "paint-funcs/paint-funcs.h"
|
#include "paint-funcs/paint-funcs.h"
|
||||||
|
|
||||||
|
#include "gegl/gimp-gegl-utils.h"
|
||||||
|
|
||||||
#include "core/gimpchannel.h"
|
#include "core/gimpchannel.h"
|
||||||
#include "core/gimpchannel-select.h"
|
#include "core/gimpchannel-select.h"
|
||||||
#include "core/gimpimage.h"
|
#include "core/gimpimage.h"
|
||||||
@ -1651,6 +1653,7 @@ gradmap_tile_validate (TileManager *tm,
|
|||||||
|
|
||||||
GimpPickable *pickable;
|
GimpPickable *pickable;
|
||||||
const Babl *pickable_format;
|
const Babl *pickable_format;
|
||||||
|
GeglBuffer *src_buffer;
|
||||||
Tile *srctile;
|
Tile *srctile;
|
||||||
PixelRegion srcPR;
|
PixelRegion srcPR;
|
||||||
PixelRegion destPR;
|
PixelRegion destPR;
|
||||||
@ -1686,7 +1689,8 @@ gradmap_tile_validate (TileManager *tm,
|
|||||||
gimp_pickable_flush (pickable);
|
gimp_pickable_flush (pickable);
|
||||||
|
|
||||||
/* get corresponding tile in the image */
|
/* get corresponding tile in the image */
|
||||||
srctile = tile_manager_get_tile (gimp_pickable_get_tiles (pickable),
|
src_buffer = gimp_pickable_get_buffer (pickable);
|
||||||
|
srctile = tile_manager_get_tile (gimp_gegl_buffer_get_tiles (src_buffer),
|
||||||
x, y, TRUE, FALSE);
|
x, y, TRUE, FALSE);
|
||||||
if (! srctile)
|
if (! srctile)
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user