mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 20:12:30 +00:00
sprinkled with const qualifiers. Fixed some portability problems.
2008-08-07 Sven Neumann <sven@gimp.org> * app/paint-funcs/scale-region.c: sprinkled with const qualifiers. Fixed some portability problems. svn path=/trunk/; revision=26429
This commit is contained in:
parent
1323200809
commit
5367771e4a
|
@ -1,3 +1,8 @@
|
|||
2008-08-07 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/paint-funcs/scale-region.c: sprinkled with const qualifiers.
|
||||
Fixed some portability problems.
|
||||
|
||||
2008-08-07 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/base/tile.c (tile_attach): renamed a variable.
|
||||
|
|
|
@ -62,7 +62,7 @@ static void interpolate_bilinear (TileManager *srcTM,
|
|||
gdouble xfrac,
|
||||
gdouble yfrac,
|
||||
guchar *pixel,
|
||||
gfloat *kernel_lookup);
|
||||
const gfloat *kernel_lookup);
|
||||
static void interpolate_nearest (TileManager *srcTM,
|
||||
gint x0,
|
||||
gint y0,
|
||||
|
@ -71,7 +71,7 @@ static void interpolate_nearest (TileManager *srcTM,
|
|||
gdouble xfrac,
|
||||
gdouble yfrac,
|
||||
guchar *pixel,
|
||||
gfloat *kernel_lookup);
|
||||
const gfloat *kernel_lookup);
|
||||
static void interpolate_cubic (TileManager *srcTM,
|
||||
gint x0,
|
||||
gint y0,
|
||||
|
@ -80,7 +80,7 @@ static void interpolate_cubic (TileManager *srcTM,
|
|||
gdouble xfrac,
|
||||
gdouble yfrac,
|
||||
guchar *pixel,
|
||||
gfloat *kernel_lookup);
|
||||
const gfloat *kernel_lookup);
|
||||
static void decimate_gauss (TileManager *srcTM,
|
||||
gint x0,
|
||||
gint y0,
|
||||
|
@ -89,7 +89,7 @@ static void decimate_gauss (TileManager *srcTM,
|
|||
gdouble xfrac,
|
||||
gdouble yfrac,
|
||||
guchar *pixel,
|
||||
gfloat *kernel_lookup);
|
||||
const gfloat *kernel_lookup);
|
||||
static void decimate_average (TileManager *srcTM,
|
||||
gint x0,
|
||||
gint y0,
|
||||
|
@ -98,7 +98,7 @@ static void decimate_average (TileManager *srcTM,
|
|||
gdouble xfrac,
|
||||
gdouble yfrac,
|
||||
guchar *pixel,
|
||||
gfloat *kernel_lookup);
|
||||
const gfloat *kernel_lookup);
|
||||
static gfloat * create_lanczos3_lookup (void);
|
||||
static void interpolate_lanczos3 (TileManager *srcTM,
|
||||
gint x1,
|
||||
|
@ -108,7 +108,7 @@ static void interpolate_lanczos3 (TileManager *srcTM,
|
|||
gdouble xfrac,
|
||||
gdouble yfrac,
|
||||
guchar *pixel,
|
||||
gfloat *kernel_lookup);
|
||||
const gfloat *kernel_lookup);
|
||||
static void decimate_average_pr (PixelRegion *srcPR,
|
||||
gint x0,
|
||||
gint y0,
|
||||
|
@ -128,7 +128,7 @@ static void determine_scale (PixelRegion *srcPR,
|
|||
gint *levelx,
|
||||
gint *levely,
|
||||
gint *max_progress);
|
||||
static inline void gaussan_lanczos2 (guchar *pixels,
|
||||
static inline void gaussan_lanczos2 (const guchar *pixels,
|
||||
gint bytes,
|
||||
guchar *pixel);
|
||||
static inline void decimate_lanczos2 (TileManager *srcTM,
|
||||
|
@ -139,15 +139,15 @@ static inline void decimate_lanczos2 (TileManager *srcTM,
|
|||
gdouble xfrac,
|
||||
gdouble yfrac,
|
||||
guchar *pixel,
|
||||
gfloat *kernel_lookup);
|
||||
static inline void pixel_average (guchar *p1,
|
||||
guchar *p2,
|
||||
guchar *p3,
|
||||
guchar *p4,
|
||||
const gfloat *kernel_lookup);
|
||||
static inline void pixel_average (const guchar *p1,
|
||||
const guchar *p2,
|
||||
const guchar *p3,
|
||||
const guchar *p4,
|
||||
guchar *p,
|
||||
gint bytes);
|
||||
static inline void gaussan_decimate (guchar *pixels,
|
||||
gint bytes,
|
||||
const gint bytes);
|
||||
static inline void gaussan_decimate (const guchar *pixels,
|
||||
const gint bytes,
|
||||
guchar *pixel);
|
||||
static inline gdouble cubic_spline_fit (gdouble dx,
|
||||
gint pt0,
|
||||
|
@ -161,16 +161,16 @@ static inline gdouble weighted_sum (gdouble dx,
|
|||
gint s01,
|
||||
gint s11);
|
||||
static inline gdouble sinc (gdouble x);
|
||||
static inline gdouble lanczos3_mul_alpha (guchar *pixels,
|
||||
gdouble *x_kernel,
|
||||
gdouble *y_kernel,
|
||||
gint bytes,
|
||||
gint byte);
|
||||
static inline gdouble lanczos3_mul (guchar *pixels,
|
||||
gdouble *x_kernel,
|
||||
gdouble *y_kernel,
|
||||
gint bytes,
|
||||
gint byte);
|
||||
static inline gdouble lanczos3_mul_alpha (const guchar *pixels,
|
||||
const gdouble *x_kernel,
|
||||
const gdouble *y_kernel,
|
||||
const gint bytes,
|
||||
const gint byte);
|
||||
static inline gdouble lanczos3_mul (const guchar *pixels,
|
||||
const gdouble *x_kernel,
|
||||
const gdouble *y_kernel,
|
||||
const gint bytes,
|
||||
const gint byte);
|
||||
|
||||
|
||||
static void
|
||||
|
@ -531,7 +531,7 @@ scale (TileManager *srcTM,
|
|||
gint x, y, x0, y0, x1, y1;
|
||||
gint sx0, sy0, sx1, sy1;
|
||||
gint col, row;
|
||||
guchar pixel[dst_bpp];
|
||||
guchar pixel[4];
|
||||
gfloat *kernel_lookup = NULL;
|
||||
|
||||
/* fall back if not enough pixels available */
|
||||
|
@ -576,6 +576,7 @@ scale (TileManager *srcTM,
|
|||
progress_data);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -600,7 +601,7 @@ scale (TileManager *srcTM,
|
|||
|
||||
for (y = y0; y <= y1; y++)
|
||||
{
|
||||
yfrac = ( y / scaley );
|
||||
yfrac = y / scaley;
|
||||
sy0 = (gint) yfrac;
|
||||
sy1 = sy0 + 1;
|
||||
sy1 = (sy1 >= src_height) ? src_height - 1 : sy1;
|
||||
|
@ -608,7 +609,7 @@ scale (TileManager *srcTM,
|
|||
|
||||
for (x = x0; x <= x1; x++)
|
||||
{
|
||||
xfrac = (x / scalex);
|
||||
xfrac = x / scalex;
|
||||
sx0 = (gint) xfrac;
|
||||
sx1 = sx0 + 1;
|
||||
sx1 = (sx1 >= src_width) ? src_width - 1 : sx1;
|
||||
|
@ -669,6 +670,7 @@ scale (TileManager *srcTM,
|
|||
kernel_lookup);
|
||||
break;
|
||||
}
|
||||
|
||||
write_pixel_data_1 (dstTM, x, y, pixel);
|
||||
}
|
||||
}
|
||||
|
@ -683,12 +685,12 @@ scale (TileManager *srcTM,
|
|||
}
|
||||
|
||||
static void inline
|
||||
pixel_average (guchar *p1,
|
||||
guchar *p2,
|
||||
guchar *p3,
|
||||
guchar *p4,
|
||||
pixel_average (const guchar *p1,
|
||||
const guchar *p2,
|
||||
const guchar *p3,
|
||||
const guchar *p4,
|
||||
guchar *p,
|
||||
gint bytes)
|
||||
const gint bytes)
|
||||
{
|
||||
gdouble sum, alphasum;
|
||||
gdouble alpha;
|
||||
|
@ -790,16 +792,16 @@ decimate_gauss (TileManager *srcTM,
|
|||
gdouble xfrac,
|
||||
gdouble yfrac,
|
||||
guchar *pixel,
|
||||
gfloat *kernel_lookup)
|
||||
const gfloat *kernel_lookup)
|
||||
{
|
||||
gint src_bpp = tile_manager_bpp (srcTM);
|
||||
guint src_width = tile_manager_width (srcTM);
|
||||
guint src_height = tile_manager_height (srcTM);
|
||||
guchar pixel1[src_bpp];
|
||||
guchar pixel2[src_bpp];
|
||||
guchar pixel3[src_bpp];
|
||||
guchar pixel4[src_bpp];
|
||||
guchar pixels[16 * src_bpp];
|
||||
guchar pixel1[4];
|
||||
guchar pixel2[4];
|
||||
guchar pixel3[4];
|
||||
guchar pixel4[4];
|
||||
guchar pixels[16 * 4];
|
||||
gint x, y, i;
|
||||
guchar *p;
|
||||
|
||||
|
@ -829,11 +831,11 @@ decimate_gauss (TileManager *srcTM,
|
|||
}
|
||||
|
||||
static inline void
|
||||
gaussan_decimate (guchar *pixels,
|
||||
gint bytes,
|
||||
gaussan_decimate (const guchar *pixels,
|
||||
const gint bytes,
|
||||
guchar *pixel)
|
||||
{
|
||||
guchar *p;
|
||||
const guchar *p;
|
||||
gdouble sum;
|
||||
gdouble alphasum;
|
||||
gdouble alpha;
|
||||
|
@ -890,6 +892,7 @@ gaussan_decimate (guchar *pixels,
|
|||
alphasum = p[3] + p[7] * 2 + p[11];
|
||||
alphasum += p[19] * 2 + p[23] * 4 + p[27] * 2;
|
||||
alphasum += p[35] + p[39] * 2 + p[43];
|
||||
|
||||
if (alphasum > 0)
|
||||
{
|
||||
for (b = 0; b < 3; b++)
|
||||
|
@ -919,16 +922,16 @@ decimate_lanczos2 (TileManager *srcTM,
|
|||
gdouble xfrac,
|
||||
gdouble yfrac,
|
||||
guchar *pixel,
|
||||
gfloat *kernel_lookup)
|
||||
const gfloat *kernel_lookup)
|
||||
{
|
||||
gint src_bpp = tile_manager_bpp (srcTM);
|
||||
guint src_width = tile_manager_width (srcTM);
|
||||
guint src_height = tile_manager_height (srcTM);
|
||||
guchar pixel1[src_bpp];
|
||||
guchar pixel2[src_bpp];
|
||||
guchar pixel3[src_bpp];
|
||||
guchar pixel4[src_bpp];
|
||||
guchar pixels[36 * src_bpp];
|
||||
guchar pixel1[4];
|
||||
guchar pixel2[4];
|
||||
guchar pixel3[4];
|
||||
guchar pixel4[4];
|
||||
guchar pixels[36 * 4];
|
||||
gint x, y, i;
|
||||
guchar *p;
|
||||
|
||||
|
@ -958,7 +961,7 @@ decimate_lanczos2 (TileManager *srcTM,
|
|||
}
|
||||
|
||||
static inline void
|
||||
gaussan_lanczos2 (guchar *pixels,
|
||||
gaussan_lanczos2 (const guchar *pixels,
|
||||
gint bytes,
|
||||
guchar *pixel)
|
||||
{
|
||||
|
@ -971,7 +974,7 @@ gaussan_lanczos2 (guchar *pixels,
|
|||
* Ken Turkowski, Apple computer
|
||||
*
|
||||
*/
|
||||
guchar *p;
|
||||
const guchar *p;
|
||||
gdouble sum;
|
||||
gdouble alphasum;
|
||||
gdouble alpha;
|
||||
|
@ -1108,20 +1111,19 @@ decimate_average (TileManager *srcTM,
|
|||
gdouble xfrac,
|
||||
gdouble yfrac,
|
||||
guchar *pixel,
|
||||
gfloat *kernel_lookup)
|
||||
const gfloat *kernel_lookup)
|
||||
{
|
||||
gint src_bpp = tile_manager_bpp (srcTM);
|
||||
guchar pixel1[src_bpp];
|
||||
guchar pixel2[src_bpp];
|
||||
guchar pixel3[src_bpp];
|
||||
guchar pixel4[src_bpp];
|
||||
guchar pixel1[4];
|
||||
guchar pixel2[4];
|
||||
guchar pixel3[4];
|
||||
guchar pixel4[4];
|
||||
|
||||
read_pixel_data_1 (srcTM, x0, y0, pixel1);
|
||||
read_pixel_data_1 (srcTM, x1, y0, pixel2);
|
||||
read_pixel_data_1 (srcTM, x0, y1, pixel3);
|
||||
read_pixel_data_1 (srcTM, x1, y1, pixel4);
|
||||
|
||||
pixel_average (pixel1, pixel2, pixel3, pixel4, pixel, src_bpp);
|
||||
pixel_average (pixel1, pixel2, pixel3, pixel4, pixel, tile_manager_bpp (srcTM));
|
||||
}
|
||||
|
||||
static inline gdouble
|
||||
|
@ -1186,7 +1188,7 @@ interpolate_nearest (TileManager *srcTM,
|
|||
gdouble xfrac,
|
||||
gdouble yfrac,
|
||||
guchar *pixel,
|
||||
gfloat *kernel_lookup)
|
||||
const gfloat *kernel_lookup)
|
||||
{
|
||||
gint x = (xfrac <= 0.5) ? x0 : x1;
|
||||
gint y = (yfrac <= 0.5) ? y0 : y1;
|
||||
|
@ -1215,13 +1217,13 @@ interpolate_bilinear (TileManager *srcTM,
|
|||
gdouble xfrac,
|
||||
gdouble yfrac,
|
||||
guchar *p,
|
||||
gfloat *kernel_lookup)
|
||||
const gfloat *kernel_lookup)
|
||||
{
|
||||
gint src_bpp = tile_manager_bpp (srcTM);
|
||||
guchar p1[src_bpp];
|
||||
guchar p2[src_bpp];
|
||||
guchar p3[src_bpp];
|
||||
guchar p4[src_bpp];
|
||||
guchar p1[4];
|
||||
guchar p2[4];
|
||||
guchar p3[4];
|
||||
guchar p4[4];
|
||||
|
||||
gint b;
|
||||
gdouble sum, alphasum;
|
||||
|
@ -1308,7 +1310,7 @@ interpolate_cubic (TileManager *srcTM,
|
|||
gdouble xfrac,
|
||||
gdouble yfrac,
|
||||
guchar *p,
|
||||
gfloat *kernel_lookup)
|
||||
const gfloat *kernel_lookup)
|
||||
{
|
||||
gint src_bpp = tile_manager_bpp (srcTM);
|
||||
guint src_width = tile_manager_width (srcTM);
|
||||
|
@ -1318,7 +1320,7 @@ interpolate_cubic (TileManager *srcTM,
|
|||
gint x0;
|
||||
gint y0;
|
||||
|
||||
guchar ps[16 * src_bpp];
|
||||
guchar ps[16 * 4];
|
||||
gdouble p0, p1, p2, p3;
|
||||
|
||||
gdouble sum, alphasum;
|
||||
|
@ -1421,15 +1423,15 @@ interpolate_cubic (TileManager *srcTM,
|
|||
}
|
||||
|
||||
static gdouble inline
|
||||
lanczos3_mul_alpha (guchar * pixels,
|
||||
gdouble * x_kernel,
|
||||
gdouble * y_kernel,
|
||||
gint bytes,
|
||||
gint byte)
|
||||
lanczos3_mul_alpha (const guchar *pixels,
|
||||
const gdouble *x_kernel,
|
||||
const gdouble *y_kernel,
|
||||
const gint bytes,
|
||||
const gint byte)
|
||||
{
|
||||
const guchar *p = pixels;
|
||||
const guchar alpha = bytes - 1;
|
||||
gdouble sum = 0.0;
|
||||
guchar *p = pixels;
|
||||
guchar alpha = bytes - 1;
|
||||
gint x, y;
|
||||
|
||||
for (y = 0; y < 6; y++)
|
||||
|
@ -1449,14 +1451,14 @@ lanczos3_mul_alpha (guchar * pixels,
|
|||
}
|
||||
|
||||
static gdouble inline
|
||||
lanczos3_mul (guchar *pixels,
|
||||
gdouble *x_kernel,
|
||||
gdouble *y_kernel,
|
||||
gint bytes,
|
||||
gint byte)
|
||||
lanczos3_mul (const guchar *pixels,
|
||||
const gdouble *x_kernel,
|
||||
const gdouble *y_kernel,
|
||||
const gint bytes,
|
||||
const gint byte)
|
||||
{
|
||||
const guchar *p = pixels;
|
||||
gdouble sum = 0.0;
|
||||
guchar *p = pixels;
|
||||
gint x, y;
|
||||
|
||||
for (y = 0; y < 6; y++)
|
||||
|
@ -1484,7 +1486,7 @@ interpolate_lanczos3 (TileManager *srcTM,
|
|||
gdouble xfrac,
|
||||
gdouble yfrac,
|
||||
guchar *pixel,
|
||||
gfloat *kernel_lookup)
|
||||
const gfloat *kernel_lookup)
|
||||
{
|
||||
gint src_bpp = tile_manager_bpp (srcTM);
|
||||
guint src_width = tile_manager_width (srcTM);
|
||||
|
@ -1496,7 +1498,7 @@ interpolate_lanczos3 (TileManager *srcTM,
|
|||
gint x_shift, y_shift;
|
||||
gdouble kx_sum, ky_sum;
|
||||
gdouble x_kernel[6], y_kernel[6];
|
||||
guchar pixels[36 * src_bpp];
|
||||
guchar pixels[36 * 4];
|
||||
gdouble sum, alphasum;
|
||||
|
||||
for (b = 0; b < src_bpp; b++)
|
||||
|
|
Loading…
Reference in a new issue