|
1 diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c |
|
2 --- a/gfx/cairo/cairo/src/cairo-quartz-surface.c |
|
3 +++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c |
|
4 @@ -2040,17 +2040,18 @@ _cairo_quartz_surface_create_similar (vo |
|
5 cairo_content_t content, |
|
6 int width, |
|
7 int height) |
|
8 { |
|
9 cairo_quartz_surface_t *surface = (cairo_quartz_surface_t *) abstract_surface; |
|
10 cairo_format_t format; |
|
11 |
|
12 if (surface->cgLayer) |
|
13 - return cairo_quartz_surface_create_cg_layer (abstract_surface, width, height); |
|
14 + return cairo_quartz_surface_create_cg_layer (abstract_surface, content, |
|
15 + width, height); |
|
16 |
|
17 if (content == CAIRO_CONTENT_COLOR_ALPHA) |
|
18 format = CAIRO_FORMAT_ARGB32; |
|
19 else if (content == CAIRO_CONTENT_COLOR) |
|
20 format = CAIRO_FORMAT_RGB24; |
|
21 else if (content == CAIRO_CONTENT_ALPHA) |
|
22 format = CAIRO_FORMAT_A8; |
|
23 else |
|
24 @@ -2960,54 +2961,55 @@ cairo_quartz_surface_create_for_cg_conte |
|
25 |
|
26 return (cairo_surface_t *) surf; |
|
27 } |
|
28 |
|
29 /** |
|
30 * cairo_quartz_cglayer_surface_create_similar |
|
31 * @surface: The returned surface can be efficiently drawn into this |
|
32 * destination surface (if tiling is not used)." |
|
33 + * @content: the content type of the surface |
|
34 * @width: width of the surface, in pixels |
|
35 * @height: height of the surface, in pixels |
|
36 * |
|
37 * Creates a Quartz surface backed by a CGLayer, if the given surface |
|
38 * is a Quartz surface; the CGLayer is created to match the surface's |
|
39 - * Quartz context. Otherwise just calls cairo_surface_create_similar |
|
40 - * with CAIRO_CONTENT_COLOR_ALPHA. |
|
41 + * Quartz context. Otherwise just calls cairo_surface_create_similar. |
|
42 * The returned surface can be efficiently blitted to the given surface, |
|
43 * but tiling and 'extend' modes other than NONE are not so efficient. |
|
44 * |
|
45 * Return value: the newly created surface. |
|
46 * |
|
47 * Since: 1.10 |
|
48 **/ |
|
49 cairo_surface_t * |
|
50 cairo_quartz_surface_create_cg_layer (cairo_surface_t *surface, |
|
51 + cairo_content_t content, |
|
52 unsigned int width, |
|
53 unsigned int height) |
|
54 { |
|
55 cairo_quartz_surface_t *surf; |
|
56 CGLayerRef layer; |
|
57 CGContextRef ctx; |
|
58 CGContextRef cgContext; |
|
59 |
|
60 cgContext = cairo_quartz_surface_get_cg_context (surface); |
|
61 if (!cgContext) |
|
62 - return cairo_surface_create_similar (surface, CAIRO_CONTENT_COLOR_ALPHA, |
|
63 + return cairo_surface_create_similar (surface, content, |
|
64 width, height); |
|
65 |
|
66 if (!_cairo_quartz_verify_surface_size(width, height)) |
|
67 return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE)); |
|
68 |
|
69 /* If we pass zero width or height into CGLayerCreateWithContext below, |
|
70 * it will fail. |
|
71 */ |
|
72 if (width == 0 || height == 0) { |
|
73 return (cairo_surface_t*) |
|
74 - _cairo_quartz_surface_create_internal (NULL, CAIRO_CONTENT_COLOR_ALPHA, |
|
75 + _cairo_quartz_surface_create_internal (NULL, content, |
|
76 width, height); |
|
77 } |
|
78 |
|
79 layer = CGLayerCreateWithContext (cgContext, |
|
80 CGSizeMake (width, height), |
|
81 NULL); |
|
82 if (!layer) |
|
83 return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); |
|
84 @@ -3016,18 +3018,18 @@ cairo_quartz_surface_create_cg_layer (ca |
|
85 /* Flip it when we draw into it, so that when we finally composite it |
|
86 * to a flipped target, the directions match and Quartz will optimize |
|
87 * the composition properly |
|
88 */ |
|
89 CGContextTranslateCTM (ctx, 0, height); |
|
90 CGContextScaleCTM (ctx, 1, -1); |
|
91 |
|
92 CGContextRetain (ctx); |
|
93 - surf = _cairo_quartz_surface_create_internal (ctx, CAIRO_CONTENT_COLOR_ALPHA, |
|
94 - width, height); |
|
95 + surf = _cairo_quartz_surface_create_internal (ctx, content, |
|
96 + width, height); |
|
97 if (surf->base.status) { |
|
98 CGLayerRelease (layer); |
|
99 // create_internal will have set an error |
|
100 return (cairo_surface_t*) surf; |
|
101 } |
|
102 surf->cgLayer = layer; |
|
103 |
|
104 return (cairo_surface_t *) surf; |
|
105 diff --git a/gfx/cairo/cairo/src/cairo-quartz.h b/gfx/cairo/cairo/src/cairo-quartz.h |
|
106 --- a/gfx/cairo/cairo/src/cairo-quartz.h |
|
107 +++ b/gfx/cairo/cairo/src/cairo-quartz.h |
|
108 @@ -46,16 +46,17 @@ CAIRO_BEGIN_DECLS |
|
109 |
|
110 cairo_public cairo_surface_t * |
|
111 cairo_quartz_surface_create (cairo_format_t format, |
|
112 unsigned int width, |
|
113 unsigned int height); |
|
114 |
|
115 cairo_public cairo_surface_t * |
|
116 cairo_quartz_surface_create_cg_layer (cairo_surface_t *surface, |
|
117 + cairo_content_t content, |
|
118 unsigned int width, |
|
119 unsigned int height); |
|
120 |
|
121 cairo_public cairo_surface_t * |
|
122 cairo_quartz_surface_create_for_cg_context (CGContextRef cgContext, |
|
123 unsigned int width, |
|
124 unsigned int height); |
|
125 |