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

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>
* app/base/tile-pyramid.[ch] (tile_pyramid_new):
......
......@@ -33,6 +33,7 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
#include "core/gimppickable.h"
#include "core/gimpprojection.h"
#include "widgets/gimpmenufactory.h"
......@@ -85,7 +86,7 @@ debug_benchmark_projection_cmd_callback (GtkAction *action,
return_if_no_image (image, data);
projection = gimp_image_get_projection (image);
tiles = gimp_projection_get_tiles (projection);
tiles = gimp_pickable_get_tiles (GIMP_PICKABLE (projection));
timer = g_timer_new ();
if (projection && tiles && timer)
......
......@@ -42,7 +42,7 @@
#include "core/gimplayer.h"
#include "core/gimplayer-floating-sel.h"
#include "core/gimplayermask.h"
#include "core/gimpprojection.h"
#include "core/gimppickable.h"
#include "core/gimptoolinfo.h"
#include "core/gimpundostack.h"
#include "core/gimpprogress.h"
......@@ -340,14 +340,14 @@ void
layers_new_from_visible_cmd_callback (GtkAction *action,
gpointer data)
{
GimpImage *image;
GimpLayer *layer;
GimpProjection *projection;
GimpImage *image;
GimpLayer *layer;
GimpPickable *pickable;
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,
gimp_image_base_type_with_alpha (image),
_("Visible"),
......
......@@ -34,6 +34,7 @@
#include "gimplayer.h"
#include "gimplayer-floating-sel.h"
#include "gimplayermask.h"
#include "gimppickable.h"
#include "gimpprojection.h"
#include "gimpprojection-construct.h"
......@@ -125,9 +126,11 @@ gimp_projection_construct (GimpProjection *proj,
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);
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);
copy_region (&srcPR, &destPR);
......@@ -247,7 +250,8 @@ gimp_projection_construct_layers (GimpProjection *proj,
y2 = CLAMP (off_y + gimp_item_get_height (GIMP_ITEM (layer)), y, y + h);
/* 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),
TRUE);
......@@ -346,7 +350,7 @@ gimp_projection_construct_channels (GimpProjection *proj,
/* configure the pixel regions */
pixel_region_init (&src1PR,
gimp_projection_get_tiles (proj),
gimp_pickable_get_tiles (GIMP_PICKABLE (proj)),
x, y, w, h,
TRUE);
pixel_region_init (&src2PR,
......@@ -415,7 +419,8 @@ gimp_projection_initialize (GimpProjection *proj,
PixelRegion 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);
}
}
......
......@@ -55,59 +55,63 @@ GeglNode * gegl_node_add_child (GeglNode *self,
/* local function prototypes */
static void gimp_projection_pickable_iface_init (GimpPickableInterface *iface);
static void gimp_projection_finalize (GObject *object);
static gint64 gimp_projection_get_memsize (GimpObject *object,
gint64 *gui_size);
static void gimp_projection_pickable_flush (GimpPickable *pickable);
static gboolean gimp_projection_get_pixel_at (GimpPickable *pickable,
gint x,
gint y,
guchar *pixel);
static gint gimp_projection_get_opacity_at (GimpPickable *pickable,
gint x,
gint y);
static void gimp_projection_add_update_area (GimpProjection *proj,
gint x,
gint y,
gint w,
gint h);
static void gimp_projection_flush_whenever (GimpProjection *proj,
gboolean now);
static void gimp_projection_idle_render_init (GimpProjection *proj);
static gboolean gimp_projection_idle_render_callback (gpointer data);
static gboolean gimp_projection_idle_render_next_area (GimpProjection *proj);
static void gimp_projection_paint_area (GimpProjection *proj,
gboolean now,
gint x,
gint y,
gint w,
gint h);
static void gimp_projection_invalidate (GimpProjection *proj,
guint x,
guint y,
guint w,
guint h);
static void gimp_projection_validate_tile (TileManager *tm,
Tile *tile,
GimpProjection *proj);
static void gimp_projection_image_update (GimpImage *image,
gint x,
gint y,
gint w,
gint h,
GimpProjection *proj);
static void gimp_projection_image_size_changed (GimpImage *image,
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);
static void gimp_projection_pickable_iface_init (GimpPickableInterface *iface);
static void gimp_projection_finalize (GObject *object);
static gint64 gimp_projection_get_memsize (GimpObject *object,
gint64 *gui_size);
static void gimp_projection_pickable_flush (GimpPickable *pickable);
static GimpImage * gimp_projection_get_image (GimpPickable *pickable);
static GimpImageType gimp_projection_get_image_type (GimpPickable *pickable);
static gint gimp_projection_get_bytes (GimpPickable *pickable);
static TileManager * gimp_projection_get_tiles (GimpPickable *pickable);
static gboolean gimp_projection_get_pixel_at (GimpPickable *pickable,
gint x,
gint y,
guchar *pixel);
static gint gimp_projection_get_opacity_at (GimpPickable *pickable,
gint x,
gint y);
static void gimp_projection_add_update_area (GimpProjection *proj,
gint x,
gint y,
gint w,
gint h);
static void gimp_projection_flush_whenever (GimpProjection *proj,
gboolean now);
static void gimp_projection_idle_render_init (GimpProjection *proj);
static gboolean gimp_projection_idle_render_callback (gpointer data);
static gboolean gimp_projection_idle_render_next_area (GimpProjection *proj);
static void gimp_projection_paint_area (GimpProjection *proj,
gboolean now,
gint x,
gint y,
gint w,
gint h);
static void gimp_projection_invalidate (GimpProjection *proj,
guint x,
guint y,
guint w,
guint h);
static void gimp_projection_validate_tile (TileManager *tm,
Tile *tile,
GimpProjection *proj);
static void gimp_projection_image_update (GimpImage *image,
gint x,
gint y,
gint w,
gint h,
GimpProjection *proj);
static void gimp_projection_image_size_changed (GimpImage *image,
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,
......@@ -161,10 +165,10 @@ static void
gimp_projection_pickable_iface_init (GimpPickableInterface *iface)
{
iface->flush = gimp_projection_pickable_flush;
iface->get_image = (GimpImage * (*) (GimpPickable *pickable)) gimp_projection_get_image;
iface->get_image_type = (GimpImageType (*) (GimpPickable *pickable)) gimp_projection_get_image_type;
iface->get_bytes = (gint (*) (GimpPickable *pickable)) gimp_projection_get_bytes;
iface->get_tiles = (TileManager * (*) (GimpPickable *pickable)) gimp_projection_get_tiles;
iface->get_image = gimp_projection_get_image;
iface->get_image_type = gimp_projection_get_image_type;
iface->get_bytes = gimp_projection_get_bytes;
iface->get_tiles = gimp_projection_get_tiles;
iface->get_pixel_at = gimp_projection_get_pixel_at;
iface->get_opacity_at = gimp_projection_get_opacity_at;
}
......@@ -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
gimp_projection_get_pixel_at (GimpPickable *pickable,
gint x,
......@@ -284,7 +328,7 @@ gimp_projection_get_pixel_at (GimpPickable *pickable,
y >= gimp_image_get_height (proj->image))
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;
}
......@@ -324,13 +368,6 @@ gimp_projection_new (GimpImage *image)
return proj;
}
TileManager *
gimp_projection_get_tiles (GimpProjection *proj)
{
return gimp_projection_get_tiles_at_level (proj, 0, NULL);
}
GeglNode *
gimp_projection_get_sink_node (GimpProjection *proj)
{
......@@ -353,7 +390,7 @@ gimp_projection_get_sink_node (GimpProjection *proj)
proj->sink_node =
gegl_node_new_child (proj->graph,
"operation", "gimp:tilemanager-sink",
"tile-manager", gimp_projection_get_tiles (proj),
"tile-manager", gimp_projection_get_tiles (GIMP_PICKABLE (proj)),
"linear", TRUE,
NULL);
......@@ -372,7 +409,7 @@ gimp_projection_get_tiles_at_level (GimpProjection *proj,
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_height (proj->image));
......@@ -413,42 +450,6 @@ gimp_projection_get_level (GimpProjection *proj,
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
gimp_projection_flush (GimpProjection *proj)
{
......
......@@ -85,7 +85,6 @@ GType gimp_projection_get_type (void) G_GNUC_CONST;
GimpProjection * gimp_projection_new (GimpImage *image);
TileManager * gimp_projection_get_tiles (GimpProjection *proj);
GeglNode * gimp_projection_get_sink_node (GimpProjection *proj);
TileManager * gimp_projection_get_tiles_at_level
......@@ -96,10 +95,6 @@ gint gimp_projection_get_level (GimpProjection *proj,
gdouble scale_x,
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_now (GimpProjection *proj);
void gimp_projection_finish_draw (GimpProjection *proj);
......
......@@ -38,6 +38,7 @@
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpimage-colormap.h"
#include "core/gimppickable.h"
#include "core/gimpprojection.h"
#include "gimpcanvas.h"
......@@ -278,7 +279,7 @@ gimp_display_shell_render (const GimpDisplayShell *shell,
}
/* 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)
{
......
......@@ -369,9 +369,9 @@ gimp_paint_core_start (GimpPaintCore *core,
if (core->use_saved_proj)
{
GimpImage *image = gimp_item_get_image (item);
GimpProjection *projection = gimp_image_get_projection (image);
TileManager *tiles = gimp_projection_get_tiles (projection);
GimpImage *image = gimp_item_get_image (item);
GimpPickable *pickable = GIMP_PICKABLE (gimp_image_get_projection (image));
TileManager *tiles = gimp_pickable_get_tiles (pickable);
core->saved_proj_tiles = tile_manager_new (tile_manager_width (tiles),
tile_manager_height (tiles),
......
......@@ -35,8 +35,8 @@
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "core/gimpparamspecs.h"
#include "core/gimppickable.h"
#include "core/gimpprogress.h"
#include "core/gimpprojection.h"
#include "gimppdb.h"
#include "gimppdb-utils.h"
......@@ -112,9 +112,9 @@ layer_new_from_visible_invoker (GimpProcedure *procedure,
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,
gimp_image_base_type_with_alpha (dest_image),
name,
......
......@@ -95,9 +95,9 @@ HELP
%invoke = (
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,
gimp_image_base_type_with_alpha (dest_image),
name,
......@@ -1062,8 +1062,8 @@ CODE
"core/gimp.h"
"core/gimpimage-undo.h"
"core/gimpitem-linked.h"
"core/gimppickable.h"
"core/gimpprogress.h"
"core/gimpprojection.h"
"gimppdb-utils.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