summaryrefslogtreecommitdiff
path: root/src/cairo-pattern.c
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2016-07-16 14:59:43 +0930
committerAdrian Johnson <ajohnson@redneon.com>2016-07-16 15:42:23 +0930
commit190678f6444ad879847d603c3c9eaf8e9ab6887a (patch)
treeb4385cf201778129a405851bd05897d91fac9d03 /src/cairo-pattern.c
parent1a380ef5f37339583b8ab7b964025445b4fbb215 (diff)
downloadcairo-190678f6444ad879847d603c3c9eaf8e9ab6887a.tar.gz
pattern: don't round extents to 0 on vector surfaces
In this bug a Type 3 font contains a dash glyph. The dash glyph consists of an 82x2 image. The image height, when scaled to user space, is < 1 resuling in the drawing operation for the image being culled. https://bugs.freedesktop.org/show_bug.cgi?id=94615
Diffstat (limited to 'src/cairo-pattern.c')
-rw-r--r--src/cairo-pattern.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 3aafcb214..aa78c324d 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -3524,13 +3524,17 @@ _cairo_pattern_sampled_area (const cairo_pattern_t *pattern,
* For unbounded patterns, the @extents will be initialized with
* "infinite" extents, (minimum and maximum fixed-point values).
*
+ * When is_vector is TRUE, avoid rounding to zero widths or heights that
+ * are less than 1 unit.
+ *
* XXX: Currently, bounded gradient patterns will also return
* "infinite" extents, though it would be possible to optimize these
* with a little more work.
**/
void
_cairo_pattern_get_extents (const cairo_pattern_t *pattern,
- cairo_rectangle_int_t *extents)
+ cairo_rectangle_int_t *extents,
+ cairo_bool_t is_vector)
{
double x1, y1, x2, y2;
int ix1, ix2, iy1, iy2;
@@ -3733,6 +3737,8 @@ _cairo_pattern_get_extents (const cairo_pattern_t *pattern,
else
ix2 = _cairo_lround (x2);
extents->x = ix1; extents->width = ix2 - ix1;
+ if (is_vector && extents->width == 0 && x1 != x2)
+ extents->width += 1;
if (!round_y) {
y1 -= 0.5;
@@ -3746,7 +3752,9 @@ _cairo_pattern_get_extents (const cairo_pattern_t *pattern,
iy2 = CAIRO_RECT_INT_MAX;
else
iy2 = _cairo_lround (y2);
- extents->y = iy1; extents->height = iy2 - iy1;
+ extents->y = iy1; extents->height = iy2 - iy1 + 1;
+ if (is_vector && extents->height == 0 && y1 != y2)
+ extents->height += 1;
return;
@@ -3798,7 +3806,7 @@ _cairo_pattern_get_ink_extents (const cairo_pattern_t *pattern,
}
}
- _cairo_pattern_get_extents (pattern, extents);
+ _cairo_pattern_get_extents (pattern, extents, TRUE);
return CAIRO_STATUS_SUCCESS;
}