gimp r26736 - in trunk: . app/paint-funcs
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26736 - in trunk: . app/paint-funcs
- Date: Sun, 24 Aug 2008 00:08:39 +0000 (UTC)
Author: neo
Date: Sun Aug 24 00:08:39 2008
New Revision: 26736
URL: http://svn.gnome.org/viewvc/gimp?rev=26736&view=rev
Log:
2008-08-24 Sven Neumann <sven gimp org>
* app/paint-funcs/scale-region.c (scale) (scale_pr): use a
constant to decide if we should decimate or interpolate.
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 Sun Aug 24 00:08:39 2008
@@ -494,15 +494,16 @@
gint *progress,
gint max_progress)
{
- PixelRegion region;
- const guint src_width = tile_manager_width (srcTM);
- const guint src_height = tile_manager_height (srcTM);
- const guint dst_width = tile_manager_width (dstTM);
- const guint dst_height = tile_manager_height (dstTM);
- const gdouble scaley = (gdouble) dst_height / (gdouble) src_height;
- const gdouble scalex = (gdouble) dst_width / (gdouble) src_width;
- gpointer pr;
- gfloat *kernel_lookup = NULL;
+ PixelRegion region;
+ const guint src_width = tile_manager_width (srcTM);
+ const guint src_height = tile_manager_height (srcTM);
+ const guint dst_width = tile_manager_width (dstTM);
+ const guint dst_height = tile_manager_height (dstTM);
+ const gdouble scaley = (gdouble) dst_height / (gdouble) src_height;
+ const gdouble scalex = (gdouble) dst_width / (gdouble) src_width;
+ const gboolean decimate = (scalex == 0.5 || scaley == 0.5);
+ gpointer pr;
+ gfloat *kernel_lookup = NULL;
/* fall back if not enough pixels available */
if (interpolation != GIMP_INTERPOLATION_NONE)
@@ -528,10 +529,10 @@
pr != NULL;
pr = pixel_regions_process (pr))
{
- const gint x1 = region.x + region.w;
- const gint y1 = region.y + region.h;
- guchar *row = region.data;
- gint y;
+ const gint x1 = region.x + region.w;
+ const gint y1 = region.y + region.h;
+ guchar *row = region.data;
+ gint y;
for (y = region.y; y < y1; y++)
{
@@ -569,7 +570,7 @@
break;
case GIMP_INTERPOLATION_LINEAR:
- if (scalex == 0.5 || scaley == 0.5)
+ if (decimate)
decimate_average (srcTM, sx0, sy0, sx1, sy1, pixel);
else
interpolate_bilinear (srcTM, sx0, sy0, sx1, sy1,
@@ -577,7 +578,7 @@
break;
case GIMP_INTERPOLATION_CUBIC:
- if (scalex == 0.5 || scaley == 0.5)
+ if (decimate)
decimate_gauss (srcTM, sx0, sy0, pixel);
else
interpolate_cubic (srcTM, sx0, sy0,
@@ -585,7 +586,7 @@
break;
case GIMP_INTERPOLATION_LANCZOS:
- if (scalex == 0.5 || scaley == 0.5)
+ if (decimate)
decimate_lanczos2 (srcTM, sx0, sy0, pixel);
else
interpolate_lanczos3 (srcTM, sx0, sy0, sx1, sy1,
@@ -1511,15 +1512,16 @@
PixelRegion *dstPR,
GimpInterpolationType interpolation)
{
- const gdouble scalex = (gdouble) dstPR->w / (gdouble) srcPR->w;
- const gdouble scaley = (gdouble) dstPR->h / (gdouble) srcPR->h;
- const gint src_width = srcPR->w;
- const gint src_height = srcPR->h;
- const gint bytes = srcPR->bytes;
- guchar *dstPtr = dstPR->data;
- gdouble xfrac, yfrac;
- gint b, x, sx0, sx1, y, sy0, sy1;
- guchar pixel[bytes];
+ const gdouble scalex = (gdouble) dstPR->w / (gdouble) srcPR->w;
+ const gdouble scaley = (gdouble) dstPR->h / (gdouble) srcPR->h;
+ const gint src_width = srcPR->w;
+ const gint src_height = srcPR->h;
+ const gint bytes = srcPR->bytes;
+ guchar *dstPtr = dstPR->data;
+ const gboolean decimate = (scalex == 0.5 || scaley == 0.5);
+ gdouble xfrac, yfrac;
+ gint b, x, sx0, sx1, y, sy0, sy1;
+ guchar pixel[bytes];
for (y = 0; y < dstPR->h; y++)
{
@@ -1544,20 +1546,15 @@
case GIMP_INTERPOLATION_LINEAR:
case GIMP_INTERPOLATION_CUBIC:
case GIMP_INTERPOLATION_LANCZOS:
- if (scalex == 0.5 || scaley == 0.5)
+ if (decimate)
{
- decimate_average_pr (srcPR,
- sx0, sy0,
- sx1, sy1,
- pixel);
+ decimate_average_pr (srcPR, sx0, sy0, sx1, sy1, pixel);
}
else
{
interpolate_bilinear_pr (srcPR,
- sx0, sy0,
- sx1, sy1,
- xfrac, yfrac,
- pixel);
+ sx0, sy0, sx1, sy1,
+ xfrac, yfrac, pixel);
}
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]