Commit 1e7f457c authored by Carlos Garcia Campos's avatar Carlos Garcia Campos

[cairo] Use ceil to convert double to int in tilingPatternFill()

Fixes rendering of page 2 of document attached to bug #28954.
parent 91a7605e
......@@ -718,6 +718,7 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Object *str,
cairo_t *old_cairo;
double xMin, yMin, xMax, yMax;
double width, height;
int surface_width, surface_height;
width = bbox[2] - bbox[0];
height = bbox[3] - bbox[1];
......@@ -726,9 +727,12 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Object *str,
return gFalse;
/* TODO: implement the other cases here too */
surface_width = (int) ceil (width);
surface_height = (int) ceil (height);
surface = cairo_surface_create_similar (cairo_get_target (cairo),
width, height);
surface_width, surface_height);
if (cairo_surface_status (surface))
return gFalse;
......@@ -751,7 +755,7 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Object *str,
state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax);
cairo_rectangle (cairo, xMin, yMin, xMax - xMin, yMax - yMin);
cairo_matrix_init_scale (&matrix, (int)width / width, (int)height / height);
cairo_matrix_init_scale (&matrix, surface_width / width, surface_height / height);
cairo_pattern_set_matrix (pattern, &matrix);
cairo_matrix_init (&matrix, mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment