gimp r26780 - in trunk: . app/paint-funcs
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26780 - in trunk: . app/paint-funcs
- Date: Tue, 26 Aug 2008 19:52:35 +0000 (UTC)
Author: neo
Date: Tue Aug 26 19:52:35 2008
New Revision: 26780
URL: http://svn.gnome.org/viewvc/gimp?rev=26780&view=rev
Log:
2008-08-26 Sven Neumann <sven gimp org>
* app/paint-funcs/scale-region.c: further simplified the code
path
that is executed when a brush is scaled up. We don't need to
scale
in several steps here.
Modified:
trunk/ChangeLog
trunk/app/paint-funcs/scale-region.c
Modified: trunk/app/paint-funcs/scale-region.c
==============================================================================
--- trunk/app/paint-funcs/scale-region.c (original)
+++ trunk/app/paint-funcs/scale-region.c Tue Aug 26 19:52:35 2008
@@ -62,9 +62,6 @@
gpointer progress_data,
gint *progress,
gint max_progress);
-static void scale_pr (PixelRegion *srcPR,
- PixelRegion *dstPR);
-
static void interpolate_nearest (TileManager *srcTM,
const gint x0,
const gint y0,
@@ -104,12 +101,6 @@
const gint bytes,
guchar *pixel,
const gfloat *kernel_lookup);
-static void decimate_average_pr (PixelRegion *srcPR,
- const gint x0,
- const gint y0,
- const gint x1,
- const gint y1,
- guchar *pixel);
static void interpolate_bilinear_pr (PixelRegion *srcPR,
const gint x0,
const gint y0,
@@ -321,143 +312,6 @@
}
static void
-scale_region_buffer (PixelRegion *srcPR,
- PixelRegion *dstPR)
-{
- PixelRegion tmpPR0;
- PixelRegion tmpPR1;
- const gint bytes = srcPR->bytes;
- gint width = srcPR->w;
- gint height = srcPR->h;
- gint levelx = 0;
- gint levely = 0;
-
- /* determine scaling levels */
- scale_determine_levels (srcPR, dstPR, &levelx, &levely);
-
- pixel_region_init_data (&tmpPR0,
- g_memdup (srcPR->data, width * height * bytes),
- bytes, width * bytes, 0, 0, width, height);
-
- while (levelx < 0 && levely < 0)
- {
- width <<= 1;
- height <<= 1;
-
- pixel_region_init_data (&tmpPR1,
- g_new (guchar, width * height * bytes),
- bytes, width * bytes, 0, 0, width, height);
-
- scale_pr (&tmpPR0, &tmpPR1);
-
- g_free (tmpPR0.data);
- pixel_region_init_data (&tmpPR0,
- tmpPR1.data,
- bytes, width * bytes, 0, 0, width, height);
-
- levelx++;
- levely++;
- }
-
- while (levelx < 0)
- {
- width <<= 1;
-
- pixel_region_init_data (&tmpPR1,
- g_new (guchar, width * height * bytes),
- bytes, width * bytes, 0, 0, width, height);
-
- scale_pr (&tmpPR0, &tmpPR1);
-
- g_free (tmpPR0.data);
- pixel_region_init_data (&tmpPR0,
- tmpPR1.data,
- bytes, width * bytes, 0, 0, width, height);
-
- levelx++;
- }
-
- while (levely < 0)
- {
- height <<= 1;
-
- pixel_region_init_data (&tmpPR1,
- g_new (guchar, width * height * bytes),
- bytes, width * bytes, 0, 0, width, height);
-
- scale_pr (&tmpPR0, &tmpPR1);
-
- g_free (tmpPR0.data);
- pixel_region_init_data (&tmpPR0,
- tmpPR1.data,
- bytes, width * bytes, 0, 0, width, height);
- levely++;
- }
-
- while (levelx > 0 && levely > 0)
- {
- width >>= 1;
- height >>= 1;
-
- pixel_region_init_data (&tmpPR1,
- g_new (guchar, width * height * bytes),
- bytes, width * bytes, 0, 0, width, height);
-
- scale_pr (&tmpPR0, &tmpPR1);
-
- g_free (tmpPR0.data);
- pixel_region_init_data (&tmpPR0,
- tmpPR1.data,
- bytes, width * bytes, 0, 0, width, height);
-
- levelx--;
- levely--;
- }
-
- while (levelx > 0)
- {
- width <<= 1;
-
- pixel_region_init_data (&tmpPR1,
- g_new (guchar, width * height * bytes),
- bytes, width * bytes, 0, 0, width, height);
-
- scale_pr (&tmpPR0, &tmpPR1);
-
- g_free (tmpPR0.data);
- pixel_region_init_data (&tmpPR0,
- tmpPR1.data,
- bytes, width * bytes, 0, 0, width, height);
-
- levelx--;
- }
-
- while (levely > 0)
- {
- height <<= 1;
-
- pixel_region_init_data (&tmpPR1,
- g_new (guchar, width * height * bytes),
- bytes, width * bytes, 0, 0, width, height);
-
- scale_pr (&tmpPR0, &tmpPR1);
-
- g_free (tmpPR0.data);
- pixel_region_init_data (&tmpPR0,
- tmpPR1.data,
- bytes, width * bytes, 0, 0, width, height);
-
- levely--;
- }
-
- scale_pr (&tmpPR0, dstPR);
-
- g_free (tmpPR0.data);
-
- return;
-}
-
-static void
scale_region_tile (PixelRegion *srcPR,
PixelRegion *dstPR,
GimpInterpolationType interpolation,
@@ -1528,8 +1382,8 @@
}
static void
-scale_pr (PixelRegion *srcPR,
- PixelRegion *dstPR)
+scale_region_buffer (PixelRegion *srcPR,
+ PixelRegion *dstPR)
{
const gdouble scalex = (gdouble) dstPR->w / (gdouble) srcPR->w;
const gdouble scaley = (gdouble) dstPR->h / (gdouble) srcPR->h;
@@ -1538,8 +1392,6 @@
const gint bytes = srcPR->bytes;
const gint dst_width = dstPR->w;
const gint dst_height = dstPR->h;
- const gboolean decimate = (src_width == 2 * dst_width ||
- src_height == 2 * dst_height);
guchar *pixel = dstPR->data;
gint x, y;
@@ -1561,41 +1413,15 @@
sx1 = (sx1 < src_width - 1) ? sx1 : src_width - 1;
xfrac = xfrac - sx0;
- if (decimate)
- {
- decimate_average_pr (srcPR, sx0, sy0, sx1, sy1, pixel);
- }
- else
- {
- interpolate_bilinear_pr (srcPR,
- sx0, sy0, sx1, sy1, xfrac, yfrac,
- pixel);
- }
-
+ interpolate_bilinear_pr (srcPR,
+ sx0, sy0, sx1, sy1, xfrac, yfrac,
+ pixel);
pixel += bytes;
}
}
}
static void
-decimate_average_pr (PixelRegion *srcPR,
- const gint x0,
- const gint y0,
- const gint x1,
- const gint y1,
- guchar *pixel)
-{
- const gint bytes = srcPR->bytes;
- const gint width = srcPR->w;
- guchar *p1 = srcPR->data + (y0 * width + x0) * bytes;
- guchar *p2 = srcPR->data + (y0 * width + x1) * bytes;
- guchar *p3 = srcPR->data + (y1 * width + x0) * bytes;
- guchar *p4 = srcPR->data + (y1 * width + x1) * bytes;
-
- pixel_average (p1, p2, p3, p4, pixel, bytes);
-}
-
-static void
interpolate_bilinear_pr (PixelRegion *srcPR,
const gint x0,
const gint y0,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]