Commit 87dc343b authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

remove public functions get_tiles(), get_image(), get_image_type() and

2008-11-04  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpprojection.[ch]: remove public functions
	get_tiles(), get_image(), get_image_type() and get_bytes().

	* app/actions/debug-commands.c
	* app/actions/layers-commands.c
	* app/core/gimpprojection-construct.c
	* app/display/gimpdisplayshell-render.c
	* app/paint/gimppaintcore.c
	* tools/pdbgen/pdb/layer.pdb: use the GimpPickable API insatead.

	* app/pdb/layer-cmds.c: regenerated.


svn path=/trunk/; revision=27547
parent 5d4f7f6e
2008-11-04 Michael Natterer <mitch@gimp.org>
* app/core/gimpprojection.[ch]: remove public functions
get_tiles(), get_image(), get_image_type() and get_bytes().
* app/actions/debug-commands.c
* app/actions/layers-commands.c
* app/core/gimpprojection-construct.c
* app/display/gimpdisplayshell-render.c
* app/paint/gimppaintcore.c
* tools/pdbgen/pdb/layer.pdb: use the GimpPickable API insatead.
* app/pdb/layer-cmds.c: regenerated.
2008-11-04 Sven Neumann <sven@sven> 2008-11-04 Sven Neumann <sven@sven>
* app/base/tile-pyramid.[ch] (tile_pyramid_new): * app/base/tile-pyramid.[ch] (tile_pyramid_new):
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "core/gimp.h" #include "core/gimp.h"
#include "core/gimpcontext.h" #include "core/gimpcontext.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimppickable.h"
#include "core/gimpprojection.h" #include "core/gimpprojection.h"
#include "widgets/gimpmenufactory.h" #include "widgets/gimpmenufactory.h"
...@@ -85,7 +86,7 @@ debug_benchmark_projection_cmd_callback (GtkAction *action, ...@@ -85,7 +86,7 @@ debug_benchmark_projection_cmd_callback (GtkAction *action,
return_if_no_image (image, data); return_if_no_image (image, data);
projection = gimp_image_get_projection (image); projection = gimp_image_get_projection (image);
tiles = gimp_projection_get_tiles (projection); tiles = gimp_pickable_get_tiles (GIMP_PICKABLE (projection));
timer = g_timer_new (); timer = g_timer_new ();
if (projection && tiles && timer) if (projection && tiles && timer)
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h" #include "core/gimplayer-floating-sel.h"
#include "core/gimplayermask.h" #include "core/gimplayermask.h"
#include "core/gimpprojection.h" #include "core/gimppickable.h"
#include "core/gimptoolinfo.h" #include "core/gimptoolinfo.h"
#include "core/gimpundostack.h" #include "core/gimpundostack.h"
#include "core/gimpprogress.h" #include "core/gimpprogress.h"
...@@ -340,14 +340,14 @@ void ...@@ -340,14 +340,14 @@ void
layers_new_from_visible_cmd_callback (GtkAction *action, layers_new_from_visible_cmd_callback (GtkAction *action,
gpointer data) gpointer data)
{ {
GimpImage *image; GimpImage *image;
GimpLayer *layer; GimpLayer *layer;
GimpProjection *projection; GimpPickable *pickable;
return_if_no_image (image, data); return_if_no_image (image, data);
projection = gimp_image_get_projection (image); pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
layer = gimp_layer_new_from_tiles (gimp_projection_get_tiles (projection), layer = gimp_layer_new_from_tiles (gimp_pickable_get_tiles (pickable),
image, image,
gimp_image_base_type_with_alpha (image), gimp_image_base_type_with_alpha (image),
_("Visible"), _("Visible"),
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "gimplayer.h" #include "gimplayer.h"
#include "gimplayer-floating-sel.h" #include "gimplayer-floating-sel.h"
#include "gimplayermask.h" #include "gimplayermask.h"
#include "gimppickable.h"
#include "gimpprojection.h" #include "gimpprojection.h"
#include "gimpprojection-construct.h" #include "gimpprojection-construct.h"
...@@ -125,9 +126,11 @@ gimp_projection_construct (GimpProjection *proj, ...@@ -125,9 +126,11 @@ gimp_projection_construct (GimpProjection *proj,
g_printerr ("cow-projection!"); g_printerr ("cow-projection!");
pixel_region_init (&srcPR, gimp_drawable_get_tiles (layer), pixel_region_init (&srcPR,
gimp_drawable_get_tiles (layer),
x, y, w,h, FALSE); x, y, w,h, FALSE);
pixel_region_init (&destPR, gimp_projection_get_tiles (proj), pixel_region_init (&destPR,
gimp_pickable_get_tiles (GIMP_PICKABLE (proj)),
x, y, w,h, TRUE); x, y, w,h, TRUE);
copy_region (&srcPR, &destPR); copy_region (&srcPR, &destPR);
...@@ -247,7 +250,8 @@ gimp_projection_construct_layers (GimpProjection *proj, ...@@ -247,7 +250,8 @@ gimp_projection_construct_layers (GimpProjection *proj,
y2 = CLAMP (off_y + gimp_item_get_height (GIMP_ITEM (layer)), y, y + h); y2 = CLAMP (off_y + gimp_item_get_height (GIMP_ITEM (layer)), y, y + h);
/* configure the pixel regions */ /* configure the pixel regions */
pixel_region_init (&src1PR, gimp_projection_get_tiles (proj), pixel_region_init (&src1PR,
gimp_pickable_get_tiles (GIMP_PICKABLE (proj)),
x1, y1, (x2 - x1), (y2 - y1), x1, y1, (x2 - x1), (y2 - y1),
TRUE); TRUE);
...@@ -346,7 +350,7 @@ gimp_projection_construct_channels (GimpProjection *proj, ...@@ -346,7 +350,7 @@ gimp_projection_construct_channels (GimpProjection *proj,
/* configure the pixel regions */ /* configure the pixel regions */
pixel_region_init (&src1PR, pixel_region_init (&src1PR,
gimp_projection_get_tiles (proj), gimp_pickable_get_tiles (GIMP_PICKABLE (proj)),
x, y, w, h, x, y, w, h,
TRUE); TRUE);
pixel_region_init (&src2PR, pixel_region_init (&src2PR,
...@@ -415,7 +419,8 @@ gimp_projection_initialize (GimpProjection *proj, ...@@ -415,7 +419,8 @@ gimp_projection_initialize (GimpProjection *proj,
PixelRegion region; PixelRegion region;
pixel_region_init (&region, pixel_region_init (&region,
gimp_projection_get_tiles (proj), x, y, w, h, TRUE); gimp_pickable_get_tiles (GIMP_PICKABLE (proj)),
x, y, w, h, TRUE);
clear_region (&region); clear_region (&region);
} }
} }
......
...@@ -55,59 +55,63 @@ GeglNode * gegl_node_add_child (GeglNode *self, ...@@ -55,59 +55,63 @@ GeglNode * gegl_node_add_child (GeglNode *self,
/* local function prototypes */ /* local function prototypes */
static void gimp_projection_pickable_iface_init (GimpPickableInterface *iface); static void gimp_projection_pickable_iface_init (GimpPickableInterface *iface);
static void gimp_projection_finalize (GObject *object); static void gimp_projection_finalize (GObject *object);
static gint64 gimp_projection_get_memsize (GimpObject *object, static gint64 gimp_projection_get_memsize (GimpObject *object,
gint64 *gui_size); gint64 *gui_size);
static void gimp_projection_pickable_flush (GimpPickable *pickable); static void gimp_projection_pickable_flush (GimpPickable *pickable);
static gboolean gimp_projection_get_pixel_at (GimpPickable *pickable, static GimpImage * gimp_projection_get_image (GimpPickable *pickable);
gint x, static GimpImageType gimp_projection_get_image_type (GimpPickable *pickable);
gint y, static gint gimp_projection_get_bytes (GimpPickable *pickable);
guchar *pixel); static TileManager * gimp_projection_get_tiles (GimpPickable *pickable);
static gint gimp_projection_get_opacity_at (GimpPickable *pickable, static gboolean gimp_projection_get_pixel_at (GimpPickable *pickable,
gint x, gint x,
gint y); gint y,
guchar *pixel);
static void gimp_projection_add_update_area (GimpProjection *proj, static gint gimp_projection_get_opacity_at (GimpPickable *pickable,
gint x, gint x,
gint y, gint y);
gint w,
gint h); static void gimp_projection_add_update_area (GimpProjection *proj,
static void gimp_projection_flush_whenever (GimpProjection *proj, gint x,
gboolean now); gint y,
static void gimp_projection_idle_render_init (GimpProjection *proj); gint w,
static gboolean gimp_projection_idle_render_callback (gpointer data); gint h);
static gboolean gimp_projection_idle_render_next_area (GimpProjection *proj); static void gimp_projection_flush_whenever (GimpProjection *proj,
static void gimp_projection_paint_area (GimpProjection *proj, gboolean now);
gboolean now, static void gimp_projection_idle_render_init (GimpProjection *proj);
gint x, static gboolean gimp_projection_idle_render_callback (gpointer data);
gint y, static gboolean gimp_projection_idle_render_next_area (GimpProjection *proj);
gint w, static void gimp_projection_paint_area (GimpProjection *proj,
gint h); gboolean now,
static void gimp_projection_invalidate (GimpProjection *proj, gint x,
guint x, gint y,
guint y, gint w,
guint w, gint h);
guint h); static void gimp_projection_invalidate (GimpProjection *proj,
static void gimp_projection_validate_tile (TileManager *tm, guint x,
Tile *tile, guint y,
GimpProjection *proj); guint w,
static void gimp_projection_image_update (GimpImage *image, guint h);
gint x, static void gimp_projection_validate_tile (TileManager *tm,
gint y, Tile *tile,
gint w, GimpProjection *proj);
gint h, static void gimp_projection_image_update (GimpImage *image,
GimpProjection *proj); gint x,
static void gimp_projection_image_size_changed (GimpImage *image, gint y,
GimpProjection *proj); gint w,
static void gimp_projection_image_mode_changed (GimpImage *image, gint h,
GimpProjection *proj); GimpProjection *proj);
static void gimp_projection_image_flush (GimpImage *image, static void gimp_projection_image_size_changed (GimpImage *image,
gboolean invalidate_preview, GimpProjection *proj);
GimpProjection *proj); static void gimp_projection_image_mode_changed (GimpImage *image,
GimpProjection *proj);
static void gimp_projection_image_flush (GimpImage *image,
gboolean invalidate_preview,
GimpProjection *proj);
G_DEFINE_TYPE_WITH_CODE (GimpProjection, gimp_projection, GIMP_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GimpProjection, gimp_projection, GIMP_TYPE_OBJECT,
...@@ -161,10 +165,10 @@ static void ...@@ -161,10 +165,10 @@ static void
gimp_projection_pickable_iface_init (GimpPickableInterface *iface) gimp_projection_pickable_iface_init (GimpPickableInterface *iface)
{ {
iface->flush = gimp_projection_pickable_flush; iface->flush = gimp_projection_pickable_flush;
iface->get_image = (GimpImage * (*) (GimpPickable *pickable)) gimp_projection_get_image; iface->get_image = gimp_projection_get_image;
iface->get_image_type = (GimpImageType (*) (GimpPickable *pickable)) gimp_projection_get_image_type; iface->get_image_type = gimp_projection_get_image_type;
iface->get_bytes = (gint (*) (GimpPickable *pickable)) gimp_projection_get_bytes; iface->get_bytes = gimp_projection_get_bytes;
iface->get_tiles = (TileManager * (*) (GimpPickable *pickable)) 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;
iface->get_opacity_at = gimp_projection_get_opacity_at; iface->get_opacity_at = gimp_projection_get_opacity_at;
} }
...@@ -270,6 +274,46 @@ gimp_projection_pickable_flush (GimpPickable *pickable) ...@@ -270,6 +274,46 @@ gimp_projection_pickable_flush (GimpPickable *pickable)
} }
} }
static GimpImage *
gimp_projection_get_image (GimpPickable *pickable)
{
GimpProjection *proj = GIMP_PROJECTION (pickable);
return proj->image;
}
static GimpImageType
gimp_projection_get_image_type (GimpPickable *pickable)
{
switch (gimp_image_base_type (gimp_projection_get_image (pickable)))
{
case GIMP_RGB:
case GIMP_INDEXED:
return GIMP_RGBA_IMAGE;
case GIMP_GRAY:
return GIMP_GRAYA_IMAGE;
}
g_assert_not_reached ();
return 0;
}
static gint
gimp_projection_get_bytes (GimpPickable *pickable)
{
return GIMP_IMAGE_TYPE_BYTES (gimp_projection_get_image_type (pickable));
}
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,
...@@ -284,7 +328,7 @@ gimp_projection_get_pixel_at (GimpPickable *pickable, ...@@ -284,7 +328,7 @@ gimp_projection_get_pixel_at (GimpPickable *pickable,
y >= gimp_image_get_height (proj->image)) y >= gimp_image_get_height (proj->image))
return FALSE; return FALSE;
read_pixel_data_1 (gimp_projection_get_tiles (proj), x, y, pixel); read_pixel_data_1 (gimp_projection_get_tiles (pickable), x, y, pixel);
return TRUE; return TRUE;
} }
...@@ -324,13 +368,6 @@ gimp_projection_new (GimpImage *image) ...@@ -324,13 +368,6 @@ gimp_projection_new (GimpImage *image)
return proj; return proj;
} }
TileManager *
gimp_projection_get_tiles (GimpProjection *proj)
{
return gimp_projection_get_tiles_at_level (proj, 0, NULL);
}
GeglNode * GeglNode *
gimp_projection_get_sink_node (GimpProjection *proj) gimp_projection_get_sink_node (GimpProjection *proj)
{ {
...@@ -353,7 +390,7 @@ gimp_projection_get_sink_node (GimpProjection *proj) ...@@ -353,7 +390,7 @@ gimp_projection_get_sink_node (GimpProjection *proj)
proj->sink_node = proj->sink_node =
gegl_node_new_child (proj->graph, gegl_node_new_child (proj->graph,
"operation", "gimp:tilemanager-sink", "operation", "gimp:tilemanager-sink",
"tile-manager", gimp_projection_get_tiles (proj), "tile-manager", gimp_projection_get_tiles (GIMP_PICKABLE (proj)),
"linear", TRUE, "linear", TRUE,
NULL); NULL);
...@@ -372,7 +409,7 @@ gimp_projection_get_tiles_at_level (GimpProjection *proj, ...@@ -372,7 +409,7 @@ gimp_projection_get_tiles_at_level (GimpProjection *proj,
if (! proj->pyramid) if (! proj->pyramid)
{ {
proj->pyramid = tile_pyramid_new (gimp_projection_get_image_type (proj), proj->pyramid = tile_pyramid_new (gimp_projection_get_image_type (GIMP_PICKABLE (proj)),
gimp_image_get_width (proj->image), gimp_image_get_width (proj->image),
gimp_image_get_height (proj->image)); gimp_image_get_height (proj->image));
...@@ -413,42 +450,6 @@ gimp_projection_get_level (GimpProjection *proj, ...@@ -413,42 +450,6 @@ gimp_projection_get_level (GimpProjection *proj,
MAX (scale_x, scale_y)); MAX (scale_x, scale_y));
} }
GimpImage *
gimp_projection_get_image (const GimpProjection *proj)
{
g_return_val_if_fail (GIMP_IS_PROJECTION (proj), NULL);
return proj->image;
}
GimpImageType
gimp_projection_get_image_type (const GimpProjection *proj)
{
g_return_val_if_fail (GIMP_IS_PROJECTION (proj), -1);
switch (gimp_image_base_type (proj->image))
{
case GIMP_RGB:
case GIMP_INDEXED:
return GIMP_RGBA_IMAGE;
case GIMP_GRAY:
return GIMP_GRAYA_IMAGE;
}
g_assert_not_reached ();
return 0;
}
gint
gimp_projection_get_bytes (const GimpProjection *proj)
{
g_return_val_if_fail (GIMP_IS_PROJECTION (proj), 0);
return GIMP_IMAGE_TYPE_BYTES (gimp_projection_get_image_type (proj));
}
void void
gimp_projection_flush (GimpProjection *proj) gimp_projection_flush (GimpProjection *proj)
{ {
......
...@@ -85,7 +85,6 @@ GType gimp_projection_get_type (void) G_GNUC_CONST; ...@@ -85,7 +85,6 @@ GType gimp_projection_get_type (void) G_GNUC_CONST;
GimpProjection * gimp_projection_new (GimpImage *image); GimpProjection * gimp_projection_new (GimpImage *image);
TileManager * gimp_projection_get_tiles (GimpProjection *proj);
GeglNode * gimp_projection_get_sink_node (GimpProjection *proj); GeglNode * gimp_projection_get_sink_node (GimpProjection *proj);
TileManager * gimp_projection_get_tiles_at_level TileManager * gimp_projection_get_tiles_at_level
...@@ -96,10 +95,6 @@ gint gimp_projection_get_level (GimpProjection *proj, ...@@ -96,10 +95,6 @@ gint gimp_projection_get_level (GimpProjection *proj,
gdouble scale_x, gdouble scale_x,
gdouble scale_y); gdouble scale_y);
GimpImage * gimp_projection_get_image (const GimpProjection *proj);
GimpImageType gimp_projection_get_image_type (const GimpProjection *proj);
gint gimp_projection_get_bytes (const GimpProjection *proj);
void gimp_projection_flush (GimpProjection *proj); void gimp_projection_flush (GimpProjection *proj);
void gimp_projection_flush_now (GimpProjection *proj); void gimp_projection_flush_now (GimpProjection *proj);
void gimp_projection_finish_draw (GimpProjection *proj); void gimp_projection_finish_draw (GimpProjection *proj);
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "core/gimpdrawable.h" #include "core/gimpdrawable.h"
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpimage-colormap.h" #include "core/gimpimage-colormap.h"
#include "core/gimppickable.h"
#include "core/gimpprojection.h" #include "core/gimpprojection.h"
#include "gimpcanvas.h" #include "gimpcanvas.h"
...@@ -278,7 +279,7 @@ gimp_display_shell_render (const GimpDisplayShell *shell, ...@@ -278,7 +279,7 @@ gimp_display_shell_render (const GimpDisplayShell *shell,
} }
/* Currently, only RGBA and GRAYA projection types are used. */ /* Currently, only RGBA and GRAYA projection types are used. */
type = gimp_projection_get_image_type (projection); type = gimp_pickable_get_image_type (GIMP_PICKABLE (projection));
switch (type) switch (type)
{ {
......
...@@ -369,9 +369,9 @@ gimp_paint_core_start (GimpPaintCore *core, ...@@ -369,9 +369,9 @@ gimp_paint_core_start (GimpPaintCore *core,
if (core->use_saved_proj) if (core->use_saved_proj)
{ {
GimpImage *image = gimp_item_get_image (item); GimpImage *image = gimp_item_get_image (item);
GimpProjection *projection = gimp_image_get_projection (image); GimpPickable *pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
TileManager *tiles = gimp_projection_get_tiles (projection); TileManager *tiles = gimp_pickable_get_tiles (pickable);
core->saved_proj_tiles = tile_manager_new (tile_manager_width (tiles), core->saved_proj_tiles = tile_manager_new (tile_manager_width (tiles),
tile_manager_height (tiles), tile_manager_height (tiles),
......
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
#include "core/gimplayer.h" #include "core/gimplayer.h"
#include "core/gimplayermask.h" #include "core/gimplayermask.h"
#include "core/gimpparamspecs.h" #include "core/gimpparamspecs.h"
#include "core/gimppickable.h"
#include "core/gimpprogress.h" #include "core/gimpprogress.h"
#include "core/gimpprojection.h"
#include "gimppdb.h" #include "gimppdb.h"
#include "gimppdb-utils.h" #include "gimppdb-utils.h"
...@@ -112,9 +112,9 @@ layer_new_from_visible_invoker (GimpProcedure *procedure, ...@@ -112,9 +112,9 @@ layer_new_from_visible_invoker (GimpProcedure *procedure,
if (success) if (success)
{ {
GimpProjection *projection = gimp_image_get_projection (image); GimpPickable *pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
layer = gimp_layer_new_from_tiles (gimp_projection_get_tiles (projection), layer = gimp_layer_new_from_tiles (gimp_pickable_get_tiles (pickable),
dest_image, dest_image,
gimp_image_base_type_with_alpha (dest_image), gimp_image_base_type_with_alpha (dest_image),
name, name,
......
...@@ -95,9 +95,9 @@ HELP ...@@ -95,9 +95,9 @@ HELP
%invoke = ( %invoke = (
code => <<'CODE' code => <<'CODE'
{ {
GimpProjection *projection = gimp_image_get_projection (image); GimpPickable *pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
layer = gimp_layer_new_from_tiles (gimp_projection_get_tiles (projection), layer = gimp_layer_new_from_tiles (gimp_pickable_get_tiles (pickable),
dest_image, dest_image,
gimp_image_base_type_with_alpha (dest_image), gimp_image_base_type_with_alpha (dest_image),
name, name,
...@@ -1062,8 +1062,8 @@ CODE ...@@ -1062,8 +1062,8 @@ CODE
"core/gimp.h" "core/gimp.h"
"core/gimpimage-undo.h" "core/gimpimage-undo.h"
"core/gimpitem-linked.h" "core/gimpitem-linked.h"
"core/gimppickable.h"
"core/gimpprogress.h" "core/gimpprogress.h"
"core/gimpprojection.h"
"gimppdb-utils.h" "gimppdb-utils.h"
"gimp-intl.h"); "gimp-intl.h");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment