diff --git a/plug-ins/common/cartoon.c b/plug-ins/common/cartoon.c index 461da66f44..698bdc8e15 100644 --- a/plug-ins/common/cartoon.c +++ b/plug-ins/common/cartoon.c @@ -170,6 +170,9 @@ run (const gchar *name, /* Get the specified drawable */ drawable = gimp_drawable_get (param[2].data.d_drawable); + /* set the tile cache size */ + gimp_tile_cache_ntiles (TILE_CACHE_SIZE); + *nreturn_vals = 1; *return_vals = values; @@ -211,8 +214,6 @@ run (const gchar *name, { gimp_progress_init ("Cartoon..."); - /* set the tile cache size */ - gimp_tile_cache_ntiles (TILE_CACHE_SIZE); cartoon (drawable, NULL); diff --git a/plug-ins/common/cubism.c b/plug-ins/common/cubism.c index d928552441..67da4e5165 100644 --- a/plug-ins/common/cubism.c +++ b/plug-ins/common/cubism.c @@ -187,6 +187,10 @@ run (const gchar *name, /* get the active drawable */ drawable = gimp_drawable_get (param[2].data.d_drawable); + /* set cache size */ + /* asking for a lot here but seems to give a speedup -- WES 12-23-04 */ + gimp_tile_cache_ntiles (2 * drawable->ntile_rows * drawable->ntile_cols); + switch (run_mode) { case GIMP_RUN_INTERACTIVE: @@ -227,8 +231,6 @@ run (const gchar *name, (gimp_drawable_is_rgb (drawable->drawable_id) || gimp_drawable_is_gray (drawable->drawable_id))) { - /* set cache size */ - gimp_tile_cache_ntiles (SQR (4 * cvals.tile_size * cvals.tile_saturation) / SQR (gimp_tile_width ())); cubism (drawable, NULL); diff --git a/plug-ins/common/displace.c b/plug-ins/common/displace.c index 9bb7c45671..cb2c1a067e 100644 --- a/plug-ins/common/displace.c +++ b/plug-ins/common/displace.c @@ -179,6 +179,9 @@ run (const gchar *name, /* Get the specified drawable */ drawable = gimp_drawable_get (param[2].data.d_drawable); + /* set the tile cache size */ + gimp_tile_cache_ntiles (TILE_CACHE_SIZE); + *nreturn_vals = 1; *return_vals = values; @@ -227,9 +230,6 @@ run (const gchar *name, { gimp_progress_init (_("Displacing...")); - /* set the tile cache size */ - gimp_tile_cache_ntiles (TILE_CACHE_SIZE); - /* run the displace effect */ displace (drawable, NULL); diff --git a/plug-ins/common/dog.c b/plug-ins/common/dog.c index c4a93bb1f5..9062d09685 100755 --- a/plug-ins/common/dog.c +++ b/plug-ins/common/dog.c @@ -172,6 +172,11 @@ run (const gchar *name, image_ID = param[1].data.d_image; drawable = gimp_drawable_get (param[2].data.d_drawable); + /* set the tile cache size so that the gaussian blur works well */ + gimp_tile_cache_ntiles (2 * + (MAX (drawable->width, drawable->height) / + gimp_tile_width () + 1)); + if (strcmp (name, "plug_in_dog") == 0) { switch (run_mode) @@ -221,10 +226,6 @@ run (const gchar *name, { gimp_progress_init (_("DoG Edge Detect")); - /* set the tile cache size so that the gaussian blur works well */ - gimp_tile_cache_ntiles (2 * - (MAX (drawable->width, drawable->height) / - gimp_tile_width () + 1)); /* run the Difference of Gaussians */ gimp_image_undo_group_start (image_ID); diff --git a/plug-ins/common/emboss.c b/plug-ins/common/emboss.c index a34a3b7458..3c7df02b62 100644 --- a/plug-ins/common/emboss.c +++ b/plug-ins/common/emboss.c @@ -155,6 +155,8 @@ run (const gchar *name, INIT_I18N (); drawable = gimp_drawable_get (param[2].data.d_drawable); + gimp_tile_cache_ntiles (drawable->ntile_cols); + rvals[0].type = GIMP_PDB_STATUS; rvals[0].data.d_status = GIMP_PDB_SUCCESS; @@ -373,8 +375,6 @@ emboss (GimpDrawable *drawable, if (!preview) gimp_progress_init (_("Emboss")); - gimp_tile_cache_ntiles ((width + gimp_tile_width () - 1) / gimp_tile_width ()); - /* first row */ gimp_pixel_rgn_get_rect (&src, srcbuf, x1, y1, width, 3); memcpy (srcbuf, srcbuf + rowsize, rowsize); diff --git a/plug-ins/common/engrave.c b/plug-ins/common/engrave.c index 701b4e56f9..5eba4e7ddb 100644 --- a/plug-ins/common/engrave.c +++ b/plug-ins/common/engrave.c @@ -138,6 +138,7 @@ run (const gchar *name, /* Get the specified drawable */ drawable = gimp_drawable_get (param[2].data.d_drawable); + gimp_tile_cache_ntiles (TILE_CACHE_SIZE); switch (run_mode) { @@ -179,7 +180,6 @@ run (const gchar *name, if (status == GIMP_PDB_SUCCESS) { gimp_progress_init (_("Engraving...")); - gimp_tile_cache_ntiles (TILE_CACHE_SIZE); engrave (drawable, NULL); diff --git a/plug-ins/common/gauss.c b/plug-ins/common/gauss.c index a0cf79b1bf..70da252157 100644 --- a/plug-ins/common/gauss.c +++ b/plug-ins/common/gauss.c @@ -271,6 +271,12 @@ run (const gchar *name, image_ID = param[1].data.d_image; drawable = gimp_drawable_get (param[2].data.d_drawable); + /* set the tile cache size so that the gaussian blur works well */ + gimp_tile_cache_ntiles (2 * + (MAX (drawable->width, drawable->height) / + gimp_tile_width () + 1)); + + if (strcmp (name, "plug_in_gauss") == 0) { switch (run_mode) @@ -406,11 +412,6 @@ run (const gchar *name, { gimp_progress_init (_("Gaussian Blur...")); - /* set the tile cache size so that the gaussian blur works well */ - gimp_tile_cache_ntiles (2 * - (MAX (drawable->width, drawable->height) / - gimp_tile_width () + 1)); - /* run the gaussian blur */ gauss (drawable, bvals.horizontal, bvals.vertical, diff --git a/plug-ins/common/glasstile.c b/plug-ins/common/glasstile.c index af89c38f83..123c49b157 100644 --- a/plug-ins/common/glasstile.c +++ b/plug-ins/common/glasstile.c @@ -160,6 +160,7 @@ run (const gchar *name, /* Get the specified drawable */ drawable = gimp_drawable_get (param[2].data.d_drawable); + gimp_tile_cache_ntiles (2 * (drawable->ntile_cols)); switch (run_mode) { @@ -206,8 +207,6 @@ run (const gchar *name, gimp_drawable_is_gray (drawable->drawable_id)) { gimp_progress_init (_("Glass Tile...")); - gimp_tile_cache_ntiles (2 * - (drawable->width / gimp_tile_width () + 1)); glasstile (drawable, NULL); diff --git a/plug-ins/common/neon.c b/plug-ins/common/neon.c index 156f122522..b0253282e9 100644 --- a/plug-ins/common/neon.c +++ b/plug-ins/common/neon.c @@ -158,6 +158,9 @@ run (const gchar *name, /* Get the specified drawable */ drawable = gimp_drawable_get (param[2].data.d_drawable); + /* set the tile cache size so that the gaussian blur works well */ + gimp_tile_cache_ntiles (2 * (MAX (drawable->ntile_rows, drawable->ntile_cols))); + *nreturn_vals = 1; *return_vals = values; @@ -203,10 +206,6 @@ run (const gchar *name, { gimp_progress_init (_("Neon...")); - /* set the tile cache size so that the gaussian blur works well */ - gimp_tile_cache_ntiles (2 * (MAX (drawable->width, drawable->height) / - gimp_tile_width () + 1)); - /* run the neon effect */ neon (drawable, evals.radius, evals.amount, NULL); diff --git a/plug-ins/common/noisify.c b/plug-ins/common/noisify.c index d310a86d49..5511354242 100644 --- a/plug-ins/common/noisify.c +++ b/plug-ins/common/noisify.c @@ -204,6 +204,7 @@ run (const gchar *name, /* Get the specified drawable */ drawable = gimp_drawable_get (param[2].data.d_drawable); + gimp_tile_cache_ntiles (TILE_CACHE_SIZE); if (gimp_drawable_is_gray (drawable->drawable_id)) nvals.noise[1] = 0.0; @@ -282,7 +283,6 @@ run (const gchar *name, if (status == GIMP_PDB_SUCCESS) { gimp_progress_init (_("Adding Noise...")); - gimp_tile_cache_ntiles (TILE_CACHE_SIZE); /* compute the luminosity which exceeds the luminosity threshold */ gimp_rgn_iterate2 (drawable, 0 /* unused */, noisify_func, noise_gr); diff --git a/plug-ins/common/oilify.c b/plug-ins/common/oilify.c index 1f2babccc1..12276329c0 100644 --- a/plug-ins/common/oilify.c +++ b/plug-ins/common/oilify.c @@ -135,6 +135,7 @@ run (const gchar *name, /* Get the specified drawable */ drawable = gimp_drawable_get (param[2].data.d_drawable); + gimp_tile_cache_ntiles (2 * drawable->ntile_cols); *nreturn_vals = 2; *return_vals = values; @@ -186,7 +187,6 @@ run (const gchar *name, gimp_drawable_is_gray (drawable->drawable_id))) { gimp_progress_init (_("Oil Painting...")); - gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width () + 1)); oilify (drawable, NULL); diff --git a/plug-ins/common/photocopy.c b/plug-ins/common/photocopy.c index 0789e62f43..3767035b3c 100644 --- a/plug-ins/common/photocopy.c +++ b/plug-ins/common/photocopy.c @@ -181,6 +181,9 @@ run (const gchar *name, /* Get the specified drawable */ drawable = gimp_drawable_get (param[2].data.d_drawable); + /* set the tile cache size */ + gimp_tile_cache_ntiles (TILE_CACHE_SIZE); + *nreturn_vals = 1; *return_vals = values; @@ -224,9 +227,6 @@ run (const gchar *name, { gimp_progress_init ("Photocopy..."); - /* set the tile cache size */ - gimp_tile_cache_ntiles (TILE_CACHE_SIZE); - photocopy (drawable, NULL); if (run_mode != GIMP_RUN_NONINTERACTIVE) diff --git a/plug-ins/common/ripple.c b/plug-ins/common/ripple.c index 3ff9a35cad..c2c932826b 100644 --- a/plug-ins/common/ripple.c +++ b/plug-ins/common/ripple.c @@ -163,6 +163,9 @@ run (const gchar *name, /* Get the specified drawable */ drawable = gimp_drawable_get (param[2].data.d_drawable); + /* set the tile cache size */ + gimp_tile_cache_ntiles (TILE_CACHE_SIZE); + *nreturn_vals = 1; *return_vals = values; @@ -218,9 +221,6 @@ run (const gchar *name, { gimp_progress_init (_("Rippling...")); - /* set the tile cache size */ - gimp_tile_cache_ntiles (TILE_CACHE_SIZE); - /* run the ripple effect */ ripple (drawable, NULL); diff --git a/plug-ins/common/sel_gauss.c b/plug-ins/common/sel_gauss.c index 8cf08d7725..17c3fe8fca 100644 --- a/plug-ins/common/sel_gauss.c +++ b/plug-ins/common/sel_gauss.c @@ -138,6 +138,7 @@ run (const gchar *name, /* Get the specified drawable */ drawable = gimp_drawable_get (param[2].data.d_drawable); + gimp_tile_cache_ntiles (2 * drawable->ntile_cols); switch (run_mode) { diff --git a/plug-ins/common/sharpen.c b/plug-ins/common/sharpen.c index 2af70dc882..39eaf48585 100644 --- a/plug-ins/common/sharpen.c +++ b/plug-ins/common/sharpen.c @@ -164,6 +164,8 @@ run (const gchar *name, */ drawable = gimp_drawable_get (param[2].data.d_drawable); + gimp_tile_cache_ntiles (2 * drawable->ntile_cols); + /* * See how we will run @@ -215,12 +217,6 @@ run (const gchar *name, if ((gimp_drawable_is_rgb (drawable->drawable_id) || gimp_drawable_is_gray (drawable->drawable_id))) { - /* - * Set the tile cache size... - */ - gimp_tile_cache_ntiles (2 * (drawable->width + gimp_tile_width() - 1) / - gimp_tile_width() + 1); - /* * Run! */ diff --git a/plug-ins/common/shift.c b/plug-ins/common/shift.c index ac87b7d96d..a96a0b7f04 100644 --- a/plug-ins/common/shift.c +++ b/plug-ins/common/shift.c @@ -140,6 +140,9 @@ run (const gchar *name, /* Get the specified drawable */ drawable = gimp_drawable_get (param[2].data.d_drawable); + /* set the tile cache size */ + gimp_tile_cache_ntiles (TILE_CACHE_SIZE); + *nreturn_vals = 1; *return_vals = values; @@ -190,9 +193,6 @@ run (const gchar *name, { gimp_progress_init (_("Shifting...")); - /* set the tile cache size */ - gimp_tile_cache_ntiles (TILE_CACHE_SIZE); - /* run the shift effect */ shift (drawable, NULL); diff --git a/plug-ins/common/sobel.c b/plug-ins/common/sobel.c index d5e8c15b77..83dfb12bed 100644 --- a/plug-ins/common/sobel.c +++ b/plug-ins/common/sobel.c @@ -150,6 +150,8 @@ run (const gchar *name, /* Get the specified drawable */ drawable = gimp_drawable_get (param[2].data.d_drawable); + gimp_tile_cache_ntiles (2 * drawable->ntile_cols); + switch (run_mode) { case GIMP_RUN_INTERACTIVE: @@ -188,7 +190,6 @@ run (const gchar *name, if (gimp_drawable_is_rgb (drawable->drawable_id) || gimp_drawable_is_gray (drawable->drawable_id)) { - gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width () + 1)); sobel (drawable, bvals.horizontal, bvals.vertical, bvals.keep_sign, NULL); diff --git a/plug-ins/common/softglow.c b/plug-ins/common/softglow.c index e9fcf16d1b..2c8c001b35 100644 --- a/plug-ins/common/softglow.c +++ b/plug-ins/common/softglow.c @@ -161,6 +161,9 @@ run (const gchar *name, /* Get the specified drawable */ drawable = gimp_drawable_get (param[2].data.d_drawable); + /* set the tile cache size */ + gimp_tile_cache_ntiles (TILE_CACHE_SIZE); + *nreturn_vals = 1; *return_vals = values; @@ -203,9 +206,6 @@ run (const gchar *name, { gimp_progress_init ("Softglow..."); - /* set the tile cache size */ - gimp_tile_cache_ntiles (TILE_CACHE_SIZE); - softglow (drawable, NULL); if (run_mode != GIMP_RUN_NONINTERACTIVE) diff --git a/plug-ins/common/spread.c b/plug-ins/common/spread.c index cfd378afca..55740f8662 100644 --- a/plug-ins/common/spread.c +++ b/plug-ins/common/spread.c @@ -126,6 +126,9 @@ run (const gchar *name, image_ID = param[1].data.d_image; drawable = gimp_drawable_get (param[2].data.d_drawable); + /* set the tile cache size */ + gimp_tile_cache_ntiles (TILE_CACHE_SIZE); + *nreturn_vals = 1; *return_vals = values; @@ -178,8 +181,6 @@ run (const gchar *name, { gimp_progress_init (_("Spreading...")); - /* set the tile cache size */ - gimp_tile_cache_ntiles (TILE_CACHE_SIZE); /* run the spread effect */ spread (drawable); diff --git a/plug-ins/common/tileit.c b/plug-ins/common/tileit.c index 604769dcf1..c1f47655b4 100644 --- a/plug-ins/common/tileit.c +++ b/plug-ins/common/tileit.c @@ -256,6 +256,8 @@ run (const gchar *name, tileitdrawable = drawable = gimp_drawable_get (param[2].data.d_drawable); + gimp_tile_cache_ntiles (drawable->ntile_cols + 1); + has_alpha = gimp_drawable_has_alpha (tileitdrawable->drawable_id); gimp_drawable_mask_bounds (drawable->drawable_id, @@ -315,9 +317,6 @@ run (const gchar *name, { /* Set the tile cache size */ - gimp_tile_cache_ntiles ((drawable->width + gimp_tile_width () - 1) / - gimp_tile_width ()); - gimp_progress_init (_("Tiling...")); do_tiles (); diff --git a/plug-ins/common/whirlpinch.c b/plug-ins/common/whirlpinch.c index b8658c16d5..0c662b3096 100644 --- a/plug-ins/common/whirlpinch.c +++ b/plug-ins/common/whirlpinch.c @@ -201,6 +201,9 @@ run (const gchar *name, gimp_drawable_mask_bounds (drawable->drawable_id, &sel_x1, &sel_y1, &sel_x2, &sel_y2); + /* Set the tile cache size */ + gimp_tile_cache_ntiles (2 * drawable->ntile_cols); + /* Calculate scaling parameters */ sel_width = sel_x2 - sel_x1; @@ -273,9 +276,6 @@ run (const gchar *name, (gimp_drawable_is_rgb (drawable->drawable_id) || gimp_drawable_is_gray (drawable->drawable_id))) { - /* Set the tile cache size */ - gimp_tile_cache_ntiles (2 * (drawable->width + gimp_tile_width () - 1) / - gimp_tile_width ()); /* Run! */ whirl_pinch (drawable);