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