+Fri Feb 8 23:11:15 2002 Owen Taylor <otaylor@redhat.com>
+
+ * pixops/pixops.c: Force all weight arrays to sum exactly
+ to 65535. (Fixes #70971, reported by Federico Mena Quintero)
+
+ * Makefile.am (libgdk_pixbuf_1_3_la_DEPENDENCIES): Add
+ libpixops.la.
+
2002-02-08 Federico Mena Quintero <federico@ximian.com>
* pixops/pixops.h: Fix comment; PixopsInterpType -> GdkInterpType.
double x = (double)j_offset / SUBSAMPLE;
double y = (double)i_offset / SUBSAMPLE;
int i,j;
+ int total = 0;
for (i = 0; i < n_y; i++)
{
if (i < y)
{
+
if (i + 1 > y)
th = MIN(i+1, y + 1/y_scale) - y;
else
for (j = 0; j < n_x; j++)
{
+ int weight;
+
if (j < x)
{
if (j + 1 > x)
tw = 0;
}
- *(pixel_weights + n_x * i + j) = 65536 * tw * x_scale * th * y_scale * overall_alpha;
+ weight = 65536 * tw * x_scale * th * y_scale * overall_alpha + 0.5;
+ total += weight;
+ *(pixel_weights + n_x * i + j) = weight;
}
+
+ *(pixel_weights + n_x * n_y - 1) += 65536 - total;
}
}
}
double x = (double)j_offset / SUBSAMPLE;
double y = (double)i_offset / SUBSAMPLE;
int i,j;
-
+ int total = 0;
+
if (x_scale > 1.0) /* Bilinear */
{
for (i = 0; i < n_x; i++)
for (i = 0; i < n_y; i++)
for (j = 0; j < n_x; j++)
- *(pixel_weights + n_x * i + j) = 65536 * x_weights[j] * x_scale * y_weights[i] * y_scale * overall_alpha + 0.5;
+ {
+ int weight = 65536 * x_weights[j] * x_scale * y_weights[i] * y_scale * overall_alpha + 0.5;
+ *(pixel_weights + n_x * i + j) = weight;
+ total += weight;
+ }
+
+ *(pixel_weights + n_x * n_y - 1) += 65536 - total;
}
g_free (x_weights);
double x = (double)j_offset / SUBSAMPLE;
double y = (double)i_offset / SUBSAMPLE;
int i,j;
-
+ int total = 0;
+
for (i = 0; i < n_y; i++)
for (j = 0; j < n_x; j++)
{
double w;
+ int weight;
w = bilinear_quadrant (0.5 + j - (x + 1 / x_scale), 0.5 + j - x, 0.5 + i - (y + 1 / y_scale), 0.5 + i - y);
w += bilinear_quadrant (1.5 + x - j, 1.5 + (x + 1 / x_scale) - j, 0.5 + i - (y + 1 / y_scale), 0.5 + i - y);
w += bilinear_quadrant (0.5 + j - (x + 1 / x_scale), 0.5 + j - x, 1.5 + y - i, 1.5 + (y + 1 / y_scale) - i);
w += bilinear_quadrant (1.5 + x - j, 1.5 + (x + 1 / x_scale) - j, 1.5 + y - i, 1.5 + (y + 1 / y_scale) - i);
-
- *(pixel_weights + n_x * i + j) = 65536 * w * x_scale * y_scale * overall_alpha;
+ weight = 65536 * w * x_scale * y_scale * overall_alpha + 0.5;
+ *(pixel_weights + n_x * i + j) = weight;
+ total += weight;
}
+
+ *(pixel_weights + n_x * n_y - 1) += 65536 - total;
}
}