Bug 1744524: part 2) Add `WindowContext::GetUserGestureStart` and remove `WindowConte...
[gecko.git] / gfx / cairo / quartz-fix-PAD.patch
blob0e5ed31072acd3d9c20fb8348475077a6b8d2ed5
1 From: Robert O'Callahan <robert@ocallahan.org>
2 Bug 593270. Part 2: Treat EXTEND_PAD like EXTEND_NONE when painting. r=jrmuizel,a=joe
4 diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c
5 --- a/gfx/cairo/cairo/src/cairo-quartz-surface.c
6 +++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c
7 @@ -1464,35 +1464,35 @@ static void
8 _cairo_quartz_setup_surface_source (cairo_quartz_surface_t *surface,
9 const cairo_surface_pattern_t *spat,
10 cairo_rectangle_int_t *extents,
11 cairo_quartz_drawing_state_t *state)
13 const cairo_pattern_t *source = &spat->base;
14 CGContextRef context = state->context;
16 - if (source->extend == CAIRO_EXTEND_NONE ||
17 + if (source->extend == CAIRO_EXTEND_NONE || source->extend == CAIRO_EXTEND_PAD ||
18 (CGContextDrawTiledImagePtr && source->extend == CAIRO_EXTEND_REPEAT))
20 cairo_surface_t *pat_surf = spat->surface;
21 CGImageRef img;
22 cairo_matrix_t m = spat->base.matrix;
23 cairo_rectangle_int_t extents;
24 CGAffineTransform xform;
25 CGRect srcRect;
26 cairo_fixed_t fw, fh;
27 cairo_bool_t is_bounded;
28 + cairo_bool_t repeat = source->extend == CAIRO_EXTEND_REPEAT;
29 cairo_status_t status;
31 cairo_matrix_invert(&m);
32 _cairo_quartz_cairo_matrix_to_quartz (&m, &state->transform);
34 /* Draw nonrepeating CGLayer surface using DO_LAYER */
35 - if (source->extend == CAIRO_EXTEND_NONE ||
36 - (CGContextDrawTiledImagePtr && source->extend == CAIRO_EXTEND_REPEAT))
37 + if (!repeat && cairo_surface_get_type (pat_surf) == CAIRO_SURFACE_TYPE_QUARTZ) {
38 cairo_quartz_surface_t *quartz_surf = (cairo_quartz_surface_t *) pat_surf;
39 if (quartz_surf->cgLayer) {
40 state->imageRect = CGRectMake (0, 0, quartz_surf->extents.width, quartz_surf->extents.height);
41 state->layer = quartz_surf->cgLayer;
42 state->action = DO_LAYER;
43 return;
46 @@ -1510,17 +1510,17 @@ _cairo_quartz_setup_surface_source (cair
47 /* XXXroc what is this for? */
48 CGContextSetRGBFillColor (surface->cgContext, 0, 0, 0, 1);
50 state->image = img;
52 is_bounded = _cairo_surface_get_extents (pat_surf, &extents);
53 assert (is_bounded);
55 - if (source->extend == CAIRO_EXTEND_NONE) {
56 + if (!repeat) {
57 state->imageRect = CGRectMake (0, 0, extents.width, extents.height);
58 state->action = DO_IMAGE;
59 return;
62 /* Quartz seems to tile images at pixel-aligned regions only -- this
63 * leads to seams if the image doesn't end up scaling to fill the
64 * space exactly. The CGPattern tiling approach doesn't have this