mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-08 11:28:02 +02:00
image: Round down when rendering antialiased boxes
Matches Pixman's output when going via pixman_rasterize_trapezoid()
This commit is contained in:
parent
95179a5de9
commit
6d36f06751
2 changed files with 11 additions and 4 deletions
|
|
@ -165,6 +165,12 @@ _cairo_fixed_integer_round (cairo_fixed_t f)
|
|||
return (f + (CAIRO_FIXED_FRAC_MASK+1)/2) >> CAIRO_FIXED_FRAC_BITS;
|
||||
}
|
||||
|
||||
static inline int
|
||||
_cairo_fixed_integer_round_down (cairo_fixed_t f)
|
||||
{
|
||||
return (f + CAIRO_FIXED_FRAC_MASK/2) >> CAIRO_FIXED_FRAC_BITS;
|
||||
}
|
||||
|
||||
static inline int
|
||||
_cairo_fixed_fractional_part (cairo_fixed_t f)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2864,10 +2864,11 @@ _composite_boxes (cairo_image_surface_t *dst,
|
|||
cairo_box_t *box = chunk->base;
|
||||
|
||||
for (i = 0; i < chunk->count; i++) {
|
||||
int x1 = _cairo_fixed_integer_round (box[i].p1.x);
|
||||
int y1 = _cairo_fixed_integer_round (box[i].p1.y);
|
||||
int x2 = _cairo_fixed_integer_round (box[i].p2.x);
|
||||
int y2 = _cairo_fixed_integer_round (box[i].p2.y);
|
||||
/* round down here to match Pixman's behavior when using traps. */
|
||||
int x1 = _cairo_fixed_integer_round_down (box[i].p1.x);
|
||||
int y1 = _cairo_fixed_integer_round_down (box[i].p1.y);
|
||||
int x2 = _cairo_fixed_integer_round_down (box[i].p2.x);
|
||||
int y2 = _cairo_fixed_integer_round_down (box[i].p2.y);
|
||||
|
||||
if (x2 == x1 || y2 == y1)
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue