plug-ins: use the new item-type specific get_by_id() functions

This commit is contained in:
Michael Natterer 2019-09-03 10:48:32 +02:00
parent 1f4a5d4004
commit 45d60acb65
14 changed files with 43 additions and 56 deletions

View File

@ -590,7 +590,7 @@ compose_run (GimpProcedure *procedure,
compose_by_drawable = TRUE;
composevals.do_recompose = TRUE;
composevals.source_layer = GIMP_LAYER (gimp_item_get_by_id (source));
composevals.source_layer = gimp_layer_get_by_id (source);
if (! composevals.source_layer)
{
@ -606,7 +606,7 @@ compose_run (GimpProcedure *procedure,
for (i = 0; i < MAX_COMPOSE_IMAGES; i++)
{
composevals.inputs[i].is_object = TRUE;
composevals.inputs[i].comp.object = gimp_item_get_by_id (input[i]);
composevals.inputs[i].comp.object = gimp_drawable_get_by_id (input[i]);
/* fourth input is optional */
if (i == 2 && nret == 5)
@ -1431,7 +1431,7 @@ combo_callback (GimpIntComboBox *widget,
gtk_widget_set_sensitive (composeint.color_spins[n], FALSE);
composeint.selected[n].is_object = TRUE;
composeint.selected[n].comp.object = gimp_item_get_by_id (id);
composeint.selected[n].comp.object = gimp_drawable_get_by_id (id);
}
}

View File

@ -303,8 +303,7 @@ DepthMerge_construct (DepthMerge *dm)
{
dm->interface = NULL;
dm->resultDrawable =
GIMP_DRAWABLE (gimp_item_get_by_id (dm->params.result_id));
dm->resultDrawable = gimp_drawable_get_by_id (dm->params.result_id);
if (! gimp_drawable_mask_intersect (dm->resultDrawable,
&(dm->selectionX), &(dm->selectionY),
@ -316,17 +315,11 @@ DepthMerge_construct (DepthMerge *dm)
dm->resultHasAlpha = gimp_drawable_has_alpha (dm->resultDrawable);
dm->source1Drawable =
GIMP_DRAWABLE (gimp_item_get_by_id (dm->params.source1_id));
dm->source1Drawable = gimp_drawable_get_by_id (dm->params.source1_id);
dm->source2Drawable = gimp_drawable_get_by_id (dm->params.source2_id);
dm->source2Drawable =
GIMP_DRAWABLE (gimp_item_get_by_id (dm->params.source2_id));
dm->depthMap1Drawable =
GIMP_DRAWABLE (gimp_item_get_by_id (dm->params.depthMap1_id));
dm->depthMap2Drawable =
GIMP_DRAWABLE (gimp_item_get_by_id (dm->params.depthMap2_id));
dm->depthMap1Drawable = gimp_drawable_get_by_id (dm->params.depthMap1_id);
dm->depthMap2Drawable = gimp_drawable_get_by_id (dm->params.depthMap2_id);
dm->params.overlap = CLAMP (dm->params.overlap, 0, 2);
dm->params.offset = CLAMP (dm->params.offset, -1, 1);
@ -898,8 +891,7 @@ dialogSource1ChangedCallback (GtkWidget *widget,
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget),
&dm->params.source1_id);
dm->source1Drawable =
GIMP_DRAWABLE (gimp_item_get_by_id (dm->params.source1_id));
dm->source1Drawable = gimp_drawable_get_by_id (dm->params.source1_id);
util_fillReducedBuffer (dm->interface->previewSource1,
babl_format ("R'G'B'A u8"),
@ -919,8 +911,7 @@ dialogSource2ChangedCallback (GtkWidget *widget,
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget),
&dm->params.source2_id);
dm->source2Drawable =
GIMP_DRAWABLE (gimp_item_get_by_id (dm->params.source2_id));
dm->source2Drawable = gimp_drawable_get_by_id (dm->params.source2_id);
util_fillReducedBuffer (dm->interface->previewSource2,
babl_format ("R'G'B'A u8"),
@ -940,8 +931,7 @@ dialogDepthMap1ChangedCallback (GtkWidget *widget,
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget),
&dm->params.depthMap1_id);
dm->depthMap1Drawable =
GIMP_DRAWABLE (gimp_item_get_by_id (dm->params.depthMap1_id));
dm->depthMap1Drawable = gimp_drawable_get_by_id (dm->params.depthMap1_id);
util_fillReducedBuffer (dm->interface->previewDepthMap1,
babl_format ("Y' u8"),
@ -961,8 +951,7 @@ dialogDepthMap2ChangedCallback (GtkWidget *widget,
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget),
&dm->params.depthMap2_id);
dm->depthMap2Drawable =
GIMP_DRAWABLE (gimp_item_get_by_id (dm->params.depthMap2_id));
dm->depthMap2Drawable = gimp_drawable_get_by_id (dm->params.depthMap2_id);
util_fillReducedBuffer (dm->interface->previewDepthMap2,
babl_format ("Y' u8"),

View File

@ -333,7 +333,7 @@ run (const gchar *name,
g_show_progress = FALSE;
run_mode = param[0].data.d_int32;
drawable = GIMP_DRAWABLE (gimp_item_get_by_id (param[2].data.d_drawable));
drawable = gimp_drawable_get_by_id (param[2].data.d_drawable);
*nreturn_vals = 1;
*return_vals = values;
@ -470,7 +470,7 @@ smp_toggle_callback (GtkWidget *widget,
if ((data == &g_di.sample_show_selection) ||
(data == &g_di.sample_show_color))
{
update_preview (GIMP_DRAWABLE (gimp_item_get_by_id (g_values.sample_id)));
update_preview (gimp_drawable_get_by_id (g_values.sample_id));
return;
}
@ -524,7 +524,7 @@ smp_sample_combo_callback (GtkWidget *widget)
}
else
{
update_preview (GIMP_DRAWABLE (gimp_item_get_by_id (g_values.sample_id)));
update_preview (gimp_drawable_get_by_id (g_values.sample_id));
gtk_dialog_set_response_sensitive (GTK_DIALOG (g_di.dialog),
RESPONSE_GET_COLORS, TRUE);
@ -538,7 +538,7 @@ smp_dest_combo_callback (GtkWidget *widget)
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &id);
g_values.dst = GIMP_DRAWABLE (gimp_item_get_by_id (id));
g_values.dst = gimp_drawable_get_by_id (id);
update_preview (g_values.dst);
@ -937,7 +937,7 @@ smp_get_colors (GtkWidget *dialog)
gint i;
guchar buffer[3 * DA_WIDTH * GRADIENT_HEIGHT];
update_preview (GIMP_DRAWABLE (gimp_item_get_by_id (g_values.sample_id)));
update_preview (gimp_drawable_get_by_id (g_values.sample_id));
if (dialog && main_colorize (MC_GET_SAMPLE_COLORS) >= 0) /* do not colorize, just analyze sample colors */
gtk_dialog_set_response_sensitive (GTK_DIALOG (g_di.dialog),
@ -3043,8 +3043,7 @@ main_colorize (gint mc_flags)
{
sample_drawable = TRUE;
init_gdrw (&sample_gdrw, GIMP_DRAWABLE (gimp_item_get_by_id (id)),
FALSE);
init_gdrw (&sample_gdrw, gimp_drawable_get_by_id (id), FALSE);
free_colors ();
rc = sample_analyze (&sample_gdrw);
}

View File

@ -216,7 +216,7 @@ run (const gchar *name,
run_mode = param[0].data.d_int32;
drawable_ID = param[2].data.d_drawable;
drawable = GIMP_DRAWABLE (gimp_item_get_by_id (drawable_ID));
drawable = gimp_drawable_get_by_id (drawable_ID);
if (! gimp_drawable_mask_intersect (drawable, &x, &y, &w, &h))
{

View File

@ -159,7 +159,7 @@ run (const gchar *name,
/* First acquire information with a dialog */
if (! tile_dialog (gimp_image_get_by_id (param[1].data.d_image),
GIMP_DRAWABLE (gimp_item_get_by_id (param[2].data.d_drawable))))
gimp_drawable_get_by_id (param[2].data.d_drawable)))
return;
break;
@ -197,7 +197,7 @@ run (const gchar *name,
gimp_progress_init (_("Tiling"));
tile (gimp_image_get_by_id (param[1].data.d_image),
GIMP_DRAWABLE (gimp_item_get_by_id (param[2].data.d_drawable)),
gimp_drawable_get_by_id (param[2].data.d_drawable),
&new_image,
&new_layer);

View File

@ -640,7 +640,7 @@ compute_image (GimpDrawable *drawable)
source_drw_has_alpha = gimp_drawable_has_alpha (drawable);
effect_image = GIMP_DRAWABLE (gimp_item_get_by_id (licvals.effect_image_id));
effect_image = gimp_drawable_get_by_id (licvals.effect_image_id);
effect_width = gimp_drawable_width (effect_image);
effect_height = gimp_drawable_height (effect_image);

View File

@ -267,7 +267,7 @@ run (const gchar *name,
&color_pixel[2]);
run_mode = param[0].data.d_int32;
drawable = GIMP_DRAWABLE (gimp_item_get_by_id (param[2].data.d_drawable));
drawable = gimp_drawable_get_by_id (param[2].data.d_drawable);
*nreturn_vals = 1;
*return_vals = values;
@ -1084,7 +1084,7 @@ diff (GimpDrawable *drawable,
if (do_vecmap)
{
vdraw = GIMP_DRAWABLE (gimp_item_get_by_id (dvals.vector_map_id));
vdraw = gimp_drawable_get_by_id (dvals.vector_map_id);
/* bytes per pixel in SOURCE drawable */
vformat = get_u8_format (vdraw);
@ -1099,7 +1099,7 @@ diff (GimpDrawable *drawable,
if (do_gradmap)
{
gdraw = GIMP_DRAWABLE (gimp_item_get_by_id (dvals.grad_map_id));
gdraw = gimp_drawable_get_by_id (dvals.grad_map_id);
gformat = get_u8_format (gdraw);
gbytes = babl_format_get_bytes_per_pixel (gformat);
@ -1116,7 +1116,7 @@ diff (GimpDrawable *drawable,
if (do_magmap)
{
mdraw = GIMP_DRAWABLE (gimp_item_get_by_id (dvals.mag_map_id));
mdraw = gimp_drawable_get_by_id (dvals.mag_map_id);
mformat = get_u8_format (mdraw);
mbytes = babl_format_get_bytes_per_pixel (mformat);
@ -1321,8 +1321,8 @@ warp (GimpDrawable *orig_draw)
/* index var. over all "warp" Displacement iterations */
gint warp_iter;
disp_map = GIMP_DRAWABLE (gimp_item_get_by_id (dvals.warp_map_id));
mag_draw = GIMP_DRAWABLE (gimp_item_get_by_id (dvals.mag_map_id));
disp_map = gimp_drawable_get_by_id (dvals.warp_map_id);
mag_draw = gimp_drawable_get_by_id (dvals.mag_map_id);
/* calculate new X,Y Displacement image maps */

View File

@ -308,7 +308,7 @@ drawable_to_cmap (control_point *cp)
}
else
{
GimpDrawable *drawable = GIMP_DRAWABLE (gimp_item_get_by_id (config.cmap_drawable_id));
GimpDrawable *drawable = gimp_drawable_get_by_id (config.cmap_drawable_id);
GeglBuffer *buffer = gimp_drawable_get_buffer (drawable);
gint width = gegl_buffer_get_width (buffer);
gint height = gegl_buffer_get_height (buffer);

View File

@ -130,7 +130,7 @@ brushdmenuselect (GtkWidget *widget,
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &drawable_id);
drawable = GIMP_DRAWABLE (gimp_item_get_by_id (drawable_id));
drawable = gimp_drawable_get_by_id (drawable_id);
if (! drawable)
return;

View File

@ -73,7 +73,7 @@ compute_image (void)
if (mapvals.bump_mapped == TRUE && mapvals.bumpmap_id != -1)
{
bumpmap_setup (GIMP_DRAWABLE (gimp_item_get_by_id (mapvals.bumpmap_id)));
bumpmap_setup (gimp_drawable_get_by_id (mapvals.bumpmap_id));
}
precompute_init (width, height);
@ -84,7 +84,7 @@ compute_image (void)
}
else
{
envmap_setup (GIMP_DRAWABLE (gimp_item_get_by_id (mapvals.envmap_id)));
envmap_setup (gimp_drawable_get_by_id (mapvals.envmap_id));
ray_func = get_ray_color_ref;
}

View File

@ -130,8 +130,8 @@ check_drawables (void)
}
else
{
drawable = GIMP_DRAWABLE (gimp_item_get_by_id (mapvals.drawable_id));
map = GIMP_DRAWABLE (gimp_item_get_by_id (mapvals.bumpmap_id));
drawable = gimp_drawable_get_by_id (mapvals.drawable_id);
map = gimp_drawable_get_by_id (mapvals.bumpmap_id);
if (gimp_drawable_is_indexed (map) ||
(gimp_drawable_width (drawable) != gimp_drawable_width (map)) ||
@ -152,7 +152,7 @@ check_drawables (void)
}
else
{
map = GIMP_DRAWABLE (gimp_item_get_by_id (mapvals.envmap_id));
map = gimp_drawable_get_by_id (mapvals.envmap_id);
if (gimp_drawable_is_gray (map) ||
gimp_drawable_has_alpha (map))
@ -246,7 +246,7 @@ run (const gchar *name,
/* ========================== */
run_mode = param[0].data.d_int32;
drawable = GIMP_DRAWABLE (gimp_item_get_by_id (param[2].data.d_drawable));
drawable = gimp_drawable_get_by_id (param[2].data.d_drawable);
mapvals.drawable_id = gimp_item_get_id (GIMP_ITEM (drawable));

View File

@ -96,7 +96,7 @@ compute_preview (gint startx, gint starty, gint w, gint h)
if (mapvals.bump_mapped == TRUE && mapvals.bumpmap_id != -1)
{
bumpmap_setup (GIMP_DRAWABLE (gimp_item_get_by_id (mapvals.bumpmap_id)));
bumpmap_setup (gimp_drawable_get_by_id (mapvals.bumpmap_id));
}
imagey = 0;
@ -108,7 +108,7 @@ compute_preview (gint startx, gint starty, gint w, gint h)
if (mapvals.env_mapped == TRUE && mapvals.envmap_id != -1)
{
envmap_setup (GIMP_DRAWABLE (gimp_item_get_by_id (mapvals.envmap_id)));
envmap_setup (gimp_drawable_get_by_id (mapvals.envmap_id));
if (mapvals.previewquality)
ray_func = get_ray_color_ref;

View File

@ -140,8 +140,7 @@ precompute_init (gint w,
if (mapvals.bumpmap_id != -1)
{
GimpDrawable *drawable =
GIMP_DRAWABLE (gimp_item_get_by_id (mapvals.bumpmap_id));
GimpDrawable *drawable = gimp_drawable_get_by_id (mapvals.bumpmap_id);
bpp = gimp_drawable_bpp (drawable);
}
@ -186,7 +185,7 @@ interpol_row (gint x1,
if (mapvals.bumpmap_id != -1)
{
bumpmap_setup (GIMP_DRAWABLE (gimp_item_get_by_id (mapvals.bumpmap_id)));
bumpmap_setup (gimp_drawable_get_by_id (mapvals.bumpmap_id));
bpp = babl_format_get_bytes_per_pixel (bump_format);
}
@ -316,7 +315,7 @@ precompute_normals (gint x1,
if (mapvals.bumpmap_id != -1)
{
bumpmap_setup (GIMP_DRAWABLE (gimp_item_get_by_id (mapvals.bumpmap_id)));
bumpmap_setup (gimp_drawable_get_by_id (mapvals.bumpmap_id));
bpp = babl_format_get_bytes_per_pixel (bump_format);
}

View File

@ -258,7 +258,7 @@ bumpmap_constrain (GimpImage *image,
GimpItem *item,
gpointer data)
{
GimpDrawable *dr = GIMP_DRAWABLE (gimp_item_get_by_id (mapvals.drawable_id));
GimpDrawable *dr = gimp_drawable_get_by_id (mapvals.drawable_id);
return ((gimp_drawable_width (GIMP_DRAWABLE (item)) ==
gimp_drawable_width (dr)) &&
@ -284,7 +284,7 @@ envmap_combo_callback (GtkWidget *widget,
gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget),
&mapvals.envmap_id);
env = GIMP_DRAWABLE (gimp_item_get_by_id (mapvals.envmap_id));
env = gimp_drawable_get_by_id (mapvals.envmap_id);
env_width = gimp_drawable_width (env);
env_height = gimp_drawable_height (env);