if (lx < 0)
lx = 0;
if (pixman_fixed_to_int (rx) >= width)
+#if N_BITS == 1
rx = pixman_int_to_fixed (width);
+#else
+ /* Use the last pixel of the scanline, covered 100%.
+ * We can't use the first pixel following the scanline,
+ * because accessing it could result in a buffer overrun.
+ */
+ rx = pixman_int_to_fixed (width) - 1;
+#endif
/* Skip empty (or backwards) sections */
if (rx > lx)
AddAlpha (N_X_FRAC(N_BITS));
StepAlpha;
}
- /* Do not add in a 0 alpha here. This check is necessary
- * to avoid a buffer overrun when rx is exactly on a pixel
- * boundary.
- */
- if (rxs != 0)
- AddAlpha (rxs);
+ AddAlpha (rxs);
}
}
#endif
lx = 0;
rx = r->x;
if (pixman_fixed_to_int (rx) >= width)
- rx = pixman_int_to_fixed (width);
+ /* Use the last pixel of the scanline, covered 100%.
+ * We can't use the first pixel following the scanline,
+ * because accessing it could result in a buffer overrun.
+ */
+ rx = pixman_int_to_fixed (width) - 1;
/* Skip empty (or backwards) sections */
if (rx > lx)
add_saturate_8 (ap + lxi, N_X_FRAC(8), rxi - lxi);
}
- /* Do not add in a 0 alpha here. This check is
- * necessary to avoid a buffer overrun, (when rx
- * is exactly on a pixel boundary). */
- if (rxs)
- WRITE(image, ap + rxi, clip255 (READ(image, ap + rxi) + rxs));
+ WRITE(image, ap + rxi, clip255 (READ(image, ap + rxi) + rxs));
}
}