Commit 5165c1a5 authored by Adrian Johnson's avatar Adrian Johnson

cairo: fix bug in setAntialias()

Was setting the member cairo instead of cr parameter. Also rename the
function to avoid confusion with the public setAntialias() and make it
static to prevent this type of bug in future.
parent dfbb9832
......@@ -206,7 +206,7 @@ void CairoOutputDev::setCairo(cairo_t *cairo)
/* save the initial matrix so that we can use it for type3 fonts. */
//XXX: is this sufficient? could we miss changes to the matrix somehow?
cairo_get_matrix(cairo, &orig_matrix);
setAntialias(cairo, antialias);
setContextAntialias(cairo, antialias);
} else {
this->cairo = NULL;
this->cairo_shape = NULL;
......@@ -233,15 +233,15 @@ void CairoOutputDev::setAntialias(cairo_antialias_t antialias)
{
this->antialias = antialias;
if (cairo)
setAntialias (cairo, antialias);
setContextAntialias (cairo, antialias);
if (cairo_shape)
setAntialias (cairo_shape, antialias);
setContextAntialias (cairo_shape, antialias);
}
void CairoOutputDev::setAntialias(cairo_t *cr, cairo_antialias_t antialias)
void CairoOutputDev::setContextAntialias(cairo_t *cr, cairo_antialias_t antialias)
{
cairo_font_options_t *font_options;
cairo_set_antialias (cairo, antialias);
cairo_set_antialias (cr, antialias);
font_options = cairo_font_options_create ();
cairo_get_font_options (cr, font_options);
cairo_font_options_set_antialias (font_options, antialias);
......@@ -934,7 +934,7 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat
old_cairo = cairo;
cairo = cairo_create (surface);
cairo_surface_destroy (surface);
setAntialias(cairo, antialias);
setContextAntialias(cairo, antialias);
cairo_scale (cairo, surface_width / width, surface_height / height);
box.x1 = bbox[0]; box.y1 = bbox[1];
......@@ -1633,7 +1633,7 @@ void CairoOutputDev::beginTransparencyGroup(GfxState * /*state*/, double * /*bbo
cairo_surface_t *cairo_shape_surface = cairo_surface_create_similar_clip (cairo, CAIRO_CONTENT_ALPHA);
cairo_shape = cairo_create (cairo_shape_surface);
cairo_surface_destroy (cairo_shape_surface);
setAntialias(cairo_shape, antialias);
setContextAntialias(cairo_shape, antialias);
/* the color doesn't matter as long as it is opaque */
cairo_set_source_rgb (cairo_shape, 0, 0, 0);
......@@ -1788,7 +1788,7 @@ void CairoOutputDev::setSoftMask(GfxState * state, double * bbox, GBool alpha,
cairo_surface_t *source = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
cairo_t *maskCtx = cairo_create(source);
setAntialias(maskCtx, antialias);
setContextAntialias(maskCtx, antialias);
//XXX: hopefully this uses the correct color space */
if (!alpha && groupColorSpaceStack->cs) {
......
......@@ -289,7 +289,7 @@ protected:
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0)
GBool setMimeDataForJBIG2Globals (Stream *str, cairo_surface_t *image);
#endif
void setAntialias(cairo_t *cr, cairo_antialias_t antialias);
static void setContextAntialias(cairo_t *cr, cairo_antialias_t antialias);
GfxRGB fill_color, stroke_color;
cairo_pattern_t *fill_pattern, *stroke_pattern;
......
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