Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | From: Robert O'Callahan <robert@ocallahan.org> |
michael@0 | 2 | Bug 593270. Part 2: Treat EXTEND_PAD like EXTEND_NONE when painting. r=jrmuizel,a=joe |
michael@0 | 3 | |
michael@0 | 4 | diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c |
michael@0 | 5 | --- a/gfx/cairo/cairo/src/cairo-quartz-surface.c |
michael@0 | 6 | +++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c |
michael@0 | 7 | @@ -1464,35 +1464,35 @@ static void |
michael@0 | 8 | _cairo_quartz_setup_surface_source (cairo_quartz_surface_t *surface, |
michael@0 | 9 | const cairo_surface_pattern_t *spat, |
michael@0 | 10 | cairo_rectangle_int_t *extents, |
michael@0 | 11 | cairo_quartz_drawing_state_t *state) |
michael@0 | 12 | { |
michael@0 | 13 | const cairo_pattern_t *source = &spat->base; |
michael@0 | 14 | CGContextRef context = state->context; |
michael@0 | 15 | |
michael@0 | 16 | - if (source->extend == CAIRO_EXTEND_NONE || |
michael@0 | 17 | + if (source->extend == CAIRO_EXTEND_NONE || source->extend == CAIRO_EXTEND_PAD || |
michael@0 | 18 | (CGContextDrawTiledImagePtr && source->extend == CAIRO_EXTEND_REPEAT)) |
michael@0 | 19 | { |
michael@0 | 20 | cairo_surface_t *pat_surf = spat->surface; |
michael@0 | 21 | CGImageRef img; |
michael@0 | 22 | cairo_matrix_t m = spat->base.matrix; |
michael@0 | 23 | cairo_rectangle_int_t extents; |
michael@0 | 24 | CGAffineTransform xform; |
michael@0 | 25 | CGRect srcRect; |
michael@0 | 26 | cairo_fixed_t fw, fh; |
michael@0 | 27 | cairo_bool_t is_bounded; |
michael@0 | 28 | + cairo_bool_t repeat = source->extend == CAIRO_EXTEND_REPEAT; |
michael@0 | 29 | cairo_status_t status; |
michael@0 | 30 | |
michael@0 | 31 | cairo_matrix_invert(&m); |
michael@0 | 32 | _cairo_quartz_cairo_matrix_to_quartz (&m, &state->transform); |
michael@0 | 33 | |
michael@0 | 34 | /* Draw nonrepeating CGLayer surface using DO_LAYER */ |
michael@0 | 35 | - if (source->extend == CAIRO_EXTEND_NONE || |
michael@0 | 36 | - (CGContextDrawTiledImagePtr && source->extend == CAIRO_EXTEND_REPEAT)) |
michael@0 | 37 | + if (!repeat && cairo_surface_get_type (pat_surf) == CAIRO_SURFACE_TYPE_QUARTZ) { |
michael@0 | 38 | cairo_quartz_surface_t *quartz_surf = (cairo_quartz_surface_t *) pat_surf; |
michael@0 | 39 | if (quartz_surf->cgLayer) { |
michael@0 | 40 | state->imageRect = CGRectMake (0, 0, quartz_surf->extents.width, quartz_surf->extents.height); |
michael@0 | 41 | state->layer = quartz_surf->cgLayer; |
michael@0 | 42 | state->action = DO_LAYER; |
michael@0 | 43 | return; |
michael@0 | 44 | } |
michael@0 | 45 | } |
michael@0 | 46 | @@ -1510,17 +1510,17 @@ _cairo_quartz_setup_surface_source (cair |
michael@0 | 47 | /* XXXroc what is this for? */ |
michael@0 | 48 | CGContextSetRGBFillColor (surface->cgContext, 0, 0, 0, 1); |
michael@0 | 49 | |
michael@0 | 50 | state->image = img; |
michael@0 | 51 | |
michael@0 | 52 | is_bounded = _cairo_surface_get_extents (pat_surf, &extents); |
michael@0 | 53 | assert (is_bounded); |
michael@0 | 54 | |
michael@0 | 55 | - if (source->extend == CAIRO_EXTEND_NONE) { |
michael@0 | 56 | + if (!repeat) { |
michael@0 | 57 | state->imageRect = CGRectMake (0, 0, extents.width, extents.height); |
michael@0 | 58 | state->action = DO_IMAGE; |
michael@0 | 59 | return; |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | /* Quartz seems to tile images at pixel-aligned regions only -- this |
michael@0 | 63 | * leads to seams if the image doesn't end up scaling to fill the |
michael@0 | 64 | * space exactly. The CGPattern tiling approach doesn't have this |