2001-02-07 08:06:58 +08:00
|
|
|
/* The GIMP -- an image manipulation program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
2001-08-14 22:53:55 +08:00
|
|
|
#include <glib-object.h>
|
2001-02-07 08:06:58 +08:00
|
|
|
|
|
|
|
#include "libgimpmath/gimpmath.h"
|
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "core-types.h"
|
2001-02-07 08:06:58 +08:00
|
|
|
|
2001-05-15 19:25:25 +08:00
|
|
|
#include "base/pixel-region.h"
|
|
|
|
#include "base/temp-buf.h"
|
|
|
|
|
2001-04-07 23:58:26 +08:00
|
|
|
#include "paint-funcs/paint-funcs.h"
|
|
|
|
|
2003-03-07 00:47:34 +08:00
|
|
|
#include "config/gimpcoreconfig.h"
|
|
|
|
|
|
|
|
#include "gimp.h"
|
2001-02-07 08:06:58 +08:00
|
|
|
#include "gimpchannel.h"
|
|
|
|
#include "gimpimage.h"
|
2003-09-06 01:44:39 +08:00
|
|
|
#include "gimpimage-colormap.h"
|
2003-04-01 21:53:47 +08:00
|
|
|
#include "gimpdrawable-preview.h"
|
2001-02-07 08:06:58 +08:00
|
|
|
#include "gimplayer.h"
|
|
|
|
#include "gimppreviewcache.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* local function prototypes */
|
|
|
|
|
2004-12-15 22:40:52 +08:00
|
|
|
static TempBuf * gimp_drawable_preview_private (GimpDrawable *drawable,
|
|
|
|
gint width,
|
|
|
|
gint height);
|
|
|
|
static void gimp_drawable_preview_scale (GimpImageType type,
|
|
|
|
const guchar *cmap,
|
|
|
|
PixelRegion *srcPR,
|
|
|
|
PixelRegion *destPR,
|
|
|
|
gint subsample);
|
2001-02-07 08:06:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
|
|
|
TempBuf *
|
|
|
|
gimp_drawable_get_preview (GimpViewable *viewable,
|
2004-12-15 22:40:52 +08:00
|
|
|
gint width,
|
|
|
|
gint height)
|
2001-02-07 08:06:58 +08:00
|
|
|
{
|
|
|
|
GimpDrawable *drawable;
|
2002-02-26 01:58:50 +08:00
|
|
|
GimpImage *gimage;
|
2001-02-07 08:06:58 +08:00
|
|
|
|
|
|
|
drawable = GIMP_DRAWABLE (viewable);
|
2003-03-23 06:53:29 +08:00
|
|
|
gimage = gimp_item_get_image (GIMP_ITEM (drawable));
|
2002-02-26 01:58:50 +08:00
|
|
|
|
2004-12-12 05:03:52 +08:00
|
|
|
if (! gimage->gimp->config->layer_previews)
|
2003-03-07 00:47:34 +08:00
|
|
|
return NULL;
|
|
|
|
|
2001-02-07 08:06:58 +08:00
|
|
|
/* Ok prime the cache with a large preview if the cache is invalid */
|
2002-02-26 01:58:50 +08:00
|
|
|
if (! drawable->preview_valid &&
|
|
|
|
width <= PREVIEW_CACHE_PRIME_WIDTH &&
|
|
|
|
height <= PREVIEW_CACHE_PRIME_HEIGHT &&
|
|
|
|
gimage &&
|
|
|
|
gimage->width > PREVIEW_CACHE_PRIME_WIDTH &&
|
|
|
|
gimage->height > PREVIEW_CACHE_PRIME_HEIGHT)
|
2001-02-07 08:06:58 +08:00
|
|
|
{
|
|
|
|
TempBuf *tb = gimp_drawable_preview_private (drawable,
|
2004-12-15 22:40:52 +08:00
|
|
|
PREVIEW_CACHE_PRIME_WIDTH,
|
|
|
|
PREVIEW_CACHE_PRIME_HEIGHT);
|
2001-02-07 08:06:58 +08:00
|
|
|
|
|
|
|
/* Save the 2nd call */
|
|
|
|
if (width == PREVIEW_CACHE_PRIME_WIDTH &&
|
2004-12-15 22:40:52 +08:00
|
|
|
height == PREVIEW_CACHE_PRIME_HEIGHT)
|
|
|
|
return tb;
|
2001-02-07 08:06:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Second call - should NOT visit the tile cache...*/
|
|
|
|
return gimp_drawable_preview_private (drawable, width, height);
|
|
|
|
}
|
|
|
|
|
2004-12-15 22:40:52 +08:00
|
|
|
gint
|
|
|
|
gimp_drawable_preview_bytes (GimpDrawable *drawable)
|
|
|
|
{
|
|
|
|
GimpImageBaseType base_type;
|
|
|
|
gint bytes = 0;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), 0);
|
|
|
|
|
|
|
|
base_type = GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (drawable));
|
|
|
|
|
|
|
|
switch (base_type)
|
|
|
|
{
|
|
|
|
case GIMP_RGB:
|
|
|
|
case GIMP_GRAY:
|
|
|
|
bytes = gimp_drawable_bytes (drawable);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_INDEXED:
|
|
|
|
bytes = gimp_drawable_has_alpha (drawable) ? 4 : 3;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return bytes;
|
|
|
|
}
|
|
|
|
|
2004-12-11 09:22:58 +08:00
|
|
|
TempBuf *
|
|
|
|
gimp_drawable_get_sub_preview (GimpDrawable *drawable,
|
|
|
|
gint src_x,
|
|
|
|
gint src_y,
|
|
|
|
gint src_width,
|
|
|
|
gint src_height,
|
|
|
|
gint dest_width,
|
|
|
|
gint dest_height)
|
|
|
|
{
|
2004-12-15 22:40:52 +08:00
|
|
|
GimpItem *item;
|
|
|
|
GimpImage *gimage;
|
|
|
|
TempBuf *preview_buf;
|
|
|
|
PixelRegion srcPR;
|
|
|
|
PixelRegion destPR;
|
|
|
|
gint bytes;
|
|
|
|
gint subsample;
|
2004-12-11 09:22:58 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL);
|
2004-12-13 06:52:00 +08:00
|
|
|
g_return_val_if_fail (src_x >= 0, NULL);
|
|
|
|
g_return_val_if_fail (src_y >= 0, NULL);
|
|
|
|
g_return_val_if_fail (src_width > 0, NULL);
|
|
|
|
g_return_val_if_fail (src_height > 0, NULL);
|
|
|
|
g_return_val_if_fail (dest_width > 0, NULL);
|
|
|
|
g_return_val_if_fail (dest_height > 0, NULL);
|
|
|
|
|
|
|
|
item = GIMP_ITEM (drawable);
|
|
|
|
|
|
|
|
g_return_val_if_fail ((src_x + src_width) <= gimp_item_width (item), NULL);
|
|
|
|
g_return_val_if_fail ((src_y + src_height) <= gimp_item_height (item), NULL);
|
2004-12-11 09:22:58 +08:00
|
|
|
|
|
|
|
gimage = gimp_item_get_image (item);
|
|
|
|
|
|
|
|
if (! gimage->gimp->config->layer_previews)
|
|
|
|
return NULL;
|
|
|
|
|
2004-12-15 22:40:52 +08:00
|
|
|
bytes = gimp_drawable_preview_bytes (drawable);
|
2004-12-11 09:22:58 +08:00
|
|
|
|
|
|
|
/* calculate 'acceptable' subsample */
|
|
|
|
subsample = 1;
|
|
|
|
|
|
|
|
while ((dest_width * (subsample + 1) * 2 < src_width) &&
|
|
|
|
(dest_height * (subsample + 1) * 2 < src_width))
|
|
|
|
subsample += 1;
|
|
|
|
|
|
|
|
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
|
|
|
|
src_x, src_y, src_width, src_height,
|
|
|
|
FALSE);
|
|
|
|
|
|
|
|
preview_buf = temp_buf_new (dest_width, dest_height, bytes, 0, 0, NULL);
|
|
|
|
|
|
|
|
destPR.bytes = preview_buf->bytes;
|
|
|
|
destPR.x = 0;
|
|
|
|
destPR.y = 0;
|
|
|
|
destPR.w = dest_width;
|
|
|
|
destPR.h = dest_height;
|
|
|
|
destPR.rowstride = dest_width * destPR.bytes;
|
|
|
|
destPR.data = temp_buf_data (preview_buf);
|
|
|
|
|
|
|
|
if (GIMP_IS_LAYER (drawable))
|
|
|
|
{
|
2004-12-15 22:40:52 +08:00
|
|
|
gimp_drawable_preview_scale (gimp_drawable_type (drawable),
|
2004-12-11 09:22:58 +08:00
|
|
|
gimp_image_get_colormap (gimage),
|
|
|
|
&srcPR, &destPR,
|
|
|
|
subsample);
|
|
|
|
}
|
|
|
|
else if (GIMP_IS_CHANNEL (drawable))
|
|
|
|
{
|
|
|
|
subsample_region (&srcPR, &destPR, subsample);
|
|
|
|
}
|
|
|
|
|
|
|
|
return preview_buf;
|
|
|
|
}
|
|
|
|
|
2001-02-07 08:06:58 +08:00
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static TempBuf *
|
|
|
|
gimp_drawable_preview_private (GimpDrawable *drawable,
|
2004-12-15 22:40:52 +08:00
|
|
|
gint width,
|
|
|
|
gint height)
|
2001-02-07 08:06:58 +08:00
|
|
|
{
|
2003-09-06 01:44:39 +08:00
|
|
|
TempBuf *ret_buf;
|
|
|
|
|
2004-12-12 05:03:52 +08:00
|
|
|
if (! drawable->preview_valid ||
|
|
|
|
! (ret_buf = gimp_preview_cache_get (&drawable->preview_cache,
|
|
|
|
width, height)))
|
2001-02-07 08:06:58 +08:00
|
|
|
{
|
2004-12-12 05:03:52 +08:00
|
|
|
GimpItem *item = GIMP_ITEM (drawable);
|
2003-09-06 01:44:39 +08:00
|
|
|
|
2004-12-12 05:03:52 +08:00
|
|
|
ret_buf = gimp_drawable_get_sub_preview (drawable,
|
|
|
|
0, 0,
|
|
|
|
gimp_item_width (item),
|
|
|
|
gimp_item_height (item),
|
|
|
|
width,
|
|
|
|
height);
|
2001-02-07 08:06:58 +08:00
|
|
|
|
|
|
|
if (! drawable->preview_valid)
|
2004-12-15 22:40:52 +08:00
|
|
|
gimp_preview_cache_invalidate (&drawable->preview_cache);
|
2001-02-07 08:06:58 +08:00
|
|
|
|
|
|
|
drawable->preview_valid = TRUE;
|
|
|
|
|
2004-12-12 05:03:52 +08:00
|
|
|
gimp_preview_cache_add (&drawable->preview_cache, ret_buf);
|
2001-02-07 08:06:58 +08:00
|
|
|
}
|
2004-12-12 05:03:52 +08:00
|
|
|
|
|
|
|
return ret_buf;
|
2001-02-07 08:06:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-12-15 22:40:52 +08:00
|
|
|
gimp_drawable_preview_scale (GimpImageType type,
|
|
|
|
const guchar *cmap,
|
|
|
|
PixelRegion *srcPR,
|
|
|
|
PixelRegion *destPR,
|
|
|
|
gint subsample)
|
2001-02-07 08:06:58 +08:00
|
|
|
{
|
|
|
|
#define EPSILON 0.000001
|
2003-09-29 04:13:59 +08:00
|
|
|
guchar *src, *s;
|
2001-02-07 08:06:58 +08:00
|
|
|
guchar *dest, *d;
|
2003-09-29 04:13:59 +08:00
|
|
|
gdouble *row, *r;
|
2001-02-07 08:06:58 +08:00
|
|
|
gint destwidth;
|
|
|
|
gint src_row, src_col;
|
|
|
|
gint bytes, b;
|
|
|
|
gint width, height;
|
|
|
|
gint orig_width, orig_height;
|
|
|
|
gdouble x_rat, y_rat;
|
|
|
|
gdouble x_cum, y_cum;
|
|
|
|
gdouble x_last, y_last;
|
|
|
|
gdouble *x_frac, y_frac, tot_frac;
|
|
|
|
gint i, j;
|
|
|
|
gint frac;
|
|
|
|
gboolean advance_dest;
|
2004-12-15 09:36:22 +08:00
|
|
|
gboolean has_alpha;
|
2001-02-07 08:06:58 +08:00
|
|
|
|
2004-12-15 22:40:52 +08:00
|
|
|
g_return_if_fail (! GIMP_IMAGE_TYPE_IS_INDEXED (type) || cmap != NULL);
|
2004-05-07 04:18:53 +08:00
|
|
|
|
2001-02-07 08:06:58 +08:00
|
|
|
orig_width = srcPR->w / subsample;
|
|
|
|
orig_height = srcPR->h / subsample;
|
|
|
|
width = destPR->w;
|
|
|
|
height = destPR->h;
|
|
|
|
|
|
|
|
/* Some calculations... */
|
|
|
|
bytes = destPR->bytes;
|
|
|
|
destwidth = destPR->rowstride;
|
|
|
|
|
2004-12-15 22:40:52 +08:00
|
|
|
has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (type);
|
2004-12-15 09:36:22 +08:00
|
|
|
|
2001-02-07 08:06:58 +08:00
|
|
|
/* the data pointers... */
|
|
|
|
src = g_new (guchar, orig_width * bytes);
|
|
|
|
dest = destPR->data;
|
|
|
|
|
|
|
|
/* find the ratios of old x to new x and old y to new y */
|
|
|
|
x_rat = (gdouble) orig_width / (gdouble) width;
|
|
|
|
y_rat = (gdouble) orig_height / (gdouble) height;
|
|
|
|
|
|
|
|
/* allocate an array to help with the calculations */
|
2002-08-22 23:16:36 +08:00
|
|
|
row = g_new0 (gdouble, width * bytes);
|
2001-02-07 08:06:58 +08:00
|
|
|
x_frac = g_new (gdouble, width + orig_width);
|
|
|
|
|
|
|
|
/* initialize the pre-calculated pixel fraction array */
|
|
|
|
src_col = 0;
|
2004-12-15 22:40:52 +08:00
|
|
|
x_cum = (gdouble) src_col;
|
|
|
|
x_last = x_cum;
|
2001-02-07 08:06:58 +08:00
|
|
|
|
|
|
|
for (i = 0; i < width + orig_width; i++)
|
|
|
|
{
|
|
|
|
if (x_cum + x_rat <= (src_col + 1 + EPSILON))
|
2004-12-15 22:40:52 +08:00
|
|
|
{
|
|
|
|
x_cum += x_rat;
|
|
|
|
x_frac[i] = x_cum - x_last;
|
|
|
|
}
|
2001-02-07 08:06:58 +08:00
|
|
|
else
|
2004-12-15 22:40:52 +08:00
|
|
|
{
|
|
|
|
src_col++;
|
|
|
|
x_frac[i] = src_col - x_last;
|
|
|
|
}
|
2003-09-29 04:13:59 +08:00
|
|
|
|
2001-02-07 08:06:58 +08:00
|
|
|
x_last += x_frac[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* counters... */
|
|
|
|
src_row = 0;
|
2004-12-15 22:40:52 +08:00
|
|
|
y_cum = (gdouble) src_row;
|
|
|
|
y_last = y_cum;
|
2001-02-07 08:06:58 +08:00
|
|
|
|
2003-09-29 04:13:59 +08:00
|
|
|
pixel_region_get_row (srcPR,
|
2004-12-15 22:40:52 +08:00
|
|
|
srcPR->x,
|
|
|
|
srcPR->y + src_row * subsample,
|
|
|
|
orig_width * subsample,
|
|
|
|
src,
|
|
|
|
subsample);
|
2001-02-07 08:06:58 +08:00
|
|
|
|
|
|
|
/* Scale the selected region */
|
|
|
|
for (i = 0; i < height; )
|
|
|
|
{
|
|
|
|
src_col = 0;
|
2004-12-15 22:40:52 +08:00
|
|
|
x_cum = (gdouble) src_col;
|
2001-02-07 08:06:58 +08:00
|
|
|
|
|
|
|
/* determine the fraction of the src pixel we are using for y */
|
|
|
|
if (y_cum + y_rat <= (src_row + 1 + EPSILON))
|
2004-12-15 22:40:52 +08:00
|
|
|
{
|
|
|
|
y_cum += y_rat;
|
|
|
|
y_frac = y_cum - y_last;
|
|
|
|
advance_dest = TRUE;
|
|
|
|
}
|
2001-02-07 08:06:58 +08:00
|
|
|
else
|
2004-12-15 22:40:52 +08:00
|
|
|
{
|
|
|
|
src_row++;
|
|
|
|
y_frac = src_row - y_last;
|
|
|
|
advance_dest = FALSE;
|
|
|
|
}
|
2001-02-07 08:06:58 +08:00
|
|
|
|
|
|
|
y_last += y_frac;
|
|
|
|
|
|
|
|
s = src;
|
|
|
|
r = row;
|
|
|
|
|
|
|
|
frac = 0;
|
|
|
|
|
2004-12-15 22:40:52 +08:00
|
|
|
j = width;
|
2001-02-07 08:06:58 +08:00
|
|
|
while (j)
|
2004-12-15 22:40:52 +08:00
|
|
|
{
|
|
|
|
tot_frac = x_frac[frac++] * y_frac;
|
2001-02-07 08:06:58 +08:00
|
|
|
|
2004-12-15 22:40:52 +08:00
|
|
|
/* If indexed, transform the color to RGB */
|
|
|
|
if (GIMP_IMAGE_TYPE_IS_INDEXED (type))
|
|
|
|
{
|
2003-09-06 01:44:39 +08:00
|
|
|
gint index = *s * 3;
|
2001-02-07 08:06:58 +08:00
|
|
|
|
2004-12-15 09:36:22 +08:00
|
|
|
if (has_alpha)
|
|
|
|
{
|
|
|
|
if (s[ALPHA_I_PIX] & 0x80)
|
|
|
|
{
|
|
|
|
r[RED_PIX] += cmap[index++] * tot_frac;
|
|
|
|
r[GREEN_PIX] += cmap[index++] * tot_frac;
|
|
|
|
r[BLUE_PIX] += cmap[index++] * tot_frac;
|
|
|
|
r[ALPHA_PIX] += tot_frac;
|
|
|
|
}
|
|
|
|
/* else the pixel contributes nothing and needs
|
|
|
|
* not to be added
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
r[RED_PIX] += cmap[index++] * tot_frac;
|
|
|
|
r[GREEN_PIX] += cmap[index++] * tot_frac;
|
|
|
|
r[BLUE_PIX] += cmap[index++] * tot_frac;
|
|
|
|
}
|
|
|
|
}
|
2004-12-15 22:40:52 +08:00
|
|
|
else
|
|
|
|
{
|
2004-12-15 09:36:22 +08:00
|
|
|
if (has_alpha)
|
|
|
|
{
|
|
|
|
/* premultiply */
|
|
|
|
|
|
|
|
gdouble local_frac = tot_frac * (gdouble) s[bytes - 1] / 255.0;
|
|
|
|
|
|
|
|
for (b = 0; b < (bytes - 1); b++)
|
|
|
|
r[b] += s[b] * local_frac;
|
|
|
|
|
|
|
|
r[bytes - 1] += local_frac;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (b = 0; b < bytes; b++)
|
|
|
|
r[b] += s[b] * tot_frac;
|
|
|
|
}
|
2004-12-15 22:40:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* increment the destination */
|
|
|
|
if (x_cum + x_rat <= (src_col + 1 + EPSILON))
|
|
|
|
{
|
|
|
|
r += bytes;
|
|
|
|
x_cum += x_rat;
|
|
|
|
j--;
|
|
|
|
}
|
|
|
|
/* increment the source */
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s += srcPR->bytes;
|
|
|
|
src_col++;
|
|
|
|
}
|
|
|
|
}
|
2001-02-07 08:06:58 +08:00
|
|
|
|
|
|
|
if (advance_dest)
|
2004-12-15 22:40:52 +08:00
|
|
|
{
|
|
|
|
tot_frac = 1.0 / (x_rat * y_rat);
|
2001-02-07 08:06:58 +08:00
|
|
|
|
2004-12-15 22:40:52 +08:00
|
|
|
/* copy "row" to "dest" */
|
|
|
|
d = dest;
|
|
|
|
r = row;
|
2001-02-07 08:06:58 +08:00
|
|
|
|
2004-12-15 22:40:52 +08:00
|
|
|
j = width;
|
|
|
|
while (j--)
|
|
|
|
{
|
2004-12-15 09:36:22 +08:00
|
|
|
if (has_alpha)
|
|
|
|
{
|
|
|
|
/* unpremultiply */
|
|
|
|
|
|
|
|
gdouble alpha = r[bytes - 1];
|
|
|
|
|
|
|
|
if (alpha > EPSILON)
|
|
|
|
{
|
|
|
|
for (b = 0; b < (bytes - 1); b++)
|
|
|
|
d[b] = (guchar) ((r[b] / alpha) + 0.5);
|
|
|
|
|
|
|
|
d[bytes - 1] = (guchar) ((alpha * tot_frac * 255.0) + 0.5);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (b = 0; b < bytes; b++)
|
|
|
|
d[b] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (b = 0; b < bytes; b++)
|
|
|
|
d[b] = (guchar) ((r[b] * tot_frac) + 0.5);
|
|
|
|
}
|
|
|
|
|
|
|
|
r += bytes;
|
|
|
|
d += bytes;
|
2004-12-15 22:40:52 +08:00
|
|
|
}
|
2001-02-07 08:06:58 +08:00
|
|
|
|
2004-12-15 22:40:52 +08:00
|
|
|
dest += destwidth;
|
2001-02-07 08:06:58 +08:00
|
|
|
|
2004-12-15 22:40:52 +08:00
|
|
|
/* clear the "row" array */
|
|
|
|
memset (row, 0, sizeof (gdouble) * destwidth);
|
2001-02-07 08:06:58 +08:00
|
|
|
|
2004-12-15 22:40:52 +08:00
|
|
|
i++;
|
|
|
|
}
|
2001-02-07 08:06:58 +08:00
|
|
|
else
|
2004-12-15 22:40:52 +08:00
|
|
|
{
|
|
|
|
pixel_region_get_row (srcPR,
|
|
|
|
srcPR->x,
|
|
|
|
srcPR->y + src_row * subsample,
|
|
|
|
orig_width * subsample,
|
|
|
|
src,
|
|
|
|
subsample);
|
|
|
|
}
|
2001-02-07 08:06:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* free up temporary arrays */
|
|
|
|
g_free (row);
|
|
|
|
g_free (x_frac);
|
|
|
|
g_free (src);
|
|
|
|
}
|