fixed the non-alpha case (bug #116470).
2003-07-01 Sven Neumann <sven@gimp.org> * plug-ins/common/ripple.c (average_four_pixels): fixed the non-alpha case (bug #116470).
This commit is contained in:

committed by
Sven Neumann

parent
7e6b71c8fd
commit
a6264ada31
@ -1,3 +1,8 @@
|
||||
2003-07-01 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/ripple.c (average_four_pixels): fixed the
|
||||
non-alpha case (bug #116470).
|
||||
|
||||
2003-07-01 Jakub Steiner <jimmac@ximian.com>
|
||||
|
||||
* app/gui/image-menu.c
|
||||
|
@ -299,6 +299,7 @@ ripple (GimpDrawable *drawable)
|
||||
|
||||
gimp_pixel_rgn_init (&dest_rgn, drawable,
|
||||
x1, y1, (x2 - x1), (y2 - y1), TRUE, TRUE);
|
||||
|
||||
for (pr = gimp_pixel_rgns_register (1, &dest_rgn);
|
||||
pr != NULL;
|
||||
pr = gimp_pixel_rgns_process (pr))
|
||||
@ -378,7 +379,7 @@ ripple (GimpDrawable *drawable)
|
||||
} /* for */
|
||||
|
||||
progress += dest_rgn.w * dest_rgn.h;
|
||||
gimp_progress_update ((double) progress / (double) max_progress);
|
||||
gimp_progress_update ((gdouble) progress / (gdouble) max_progress);
|
||||
}
|
||||
else /* HORIZONTAL */
|
||||
{
|
||||
@ -650,17 +651,20 @@ average_two_pixels (guchar *dest,
|
||||
gint b;
|
||||
|
||||
x = fmod (x, 1.0);
|
||||
|
||||
if (has_alpha)
|
||||
{
|
||||
double xa0 = pixels[0][bpp-1] * (1.0 - x);
|
||||
double xa1 = pixels[1][bpp-1] * x;
|
||||
double alpha;
|
||||
gdouble xa0 = pixels[0][bpp-1] * (1.0 - x);
|
||||
gdouble xa1 = pixels[1][bpp-1] * x;
|
||||
gdouble alpha;
|
||||
|
||||
alpha = xa0 + xa1;
|
||||
dest[bpp-1] = alpha;
|
||||
if (dest[bpp-1])
|
||||
|
||||
if (alpha)
|
||||
for (b = 0; b < bpp-1; b++)
|
||||
dest[b] = (xa0 * pixels[0][b] + xa1 * pixels[1][b]) / alpha;
|
||||
|
||||
dest[bpp-1] = alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -679,26 +683,31 @@ average_four_pixels (guchar *dest,
|
||||
gint b;
|
||||
|
||||
x = fmod (x, 1.0);
|
||||
|
||||
if (has_alpha)
|
||||
{
|
||||
double xa0 = pixels[0][bpp-1] * (1.0 - x)/2;
|
||||
double xa1 = pixels[1][bpp-1] * x/2;
|
||||
double xa2 = pixels[2][bpp-1] * (1.0 - x)/2;
|
||||
double xa3 = pixels[3][bpp-1] * x/2;
|
||||
double alpha;
|
||||
gdouble xa0 = pixels[0][bpp-1] * (1.0 - x) / 2;
|
||||
gdouble xa1 = pixels[1][bpp-1] * x / 2;
|
||||
gdouble xa2 = pixels[2][bpp-1] * (1.0 - x) / 2;
|
||||
gdouble xa3 = pixels[3][bpp-1] * x / 2;
|
||||
gdouble alpha;
|
||||
|
||||
alpha = xa0 + xa1 + xa2 + xa3;
|
||||
dest[bpp-1] = alpha;
|
||||
if (dest[bpp-1])
|
||||
|
||||
if (alpha)
|
||||
for (b = 0; b < bpp-1; b++)
|
||||
dest[b] = (xa0 * pixels[0][b] + xa1 * pixels[1][b]
|
||||
+ xa2 * pixels[2][b] + xa3 * pixels[3][b])/alpha;
|
||||
dest[b] = (xa0 * pixels[0][b] +
|
||||
xa1 * pixels[1][b] +
|
||||
xa2 * pixels[2][b] +
|
||||
xa3 * pixels[3][b]) / alpha;
|
||||
|
||||
dest[bpp-1] = alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (b = 0; b < bpp; b++)
|
||||
dest[b] = (1.0 - x) * (pixels[0][b] + pixels[2][b])
|
||||
+ x * (pixels[1][b] + pixels[3][b]);
|
||||
dest[b] = ((1.0 - x) * (pixels[0][b] + pixels[2][b]) / 2 +
|
||||
x * (pixels[1][b] + pixels[3][b]) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user