summaryrefslogtreecommitdiffstats
path: root/gfx/cairo/15-remove-quartz-surface-for-data.patch
blob: a82d4aab2164e8f03169bed3977ca50acde208b2 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
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
@@ -2856,117 +2856,6 @@ cairo_quartz_surface_create (cairo_forma
 }
 
 /**
- * cairo_quartz_surface_create_for_data
- * @data: a pointer to a buffer supplied by the application in which
- *     to write contents. This pointer must be suitably aligned for any
- *     kind of variable, (for example, a pointer returned by malloc).
- * @format: format of pixels in the surface to create
- * @width: width of the surface, in pixels
- * @height: height of the surface, in pixels
- *
- * Creates a Quartz surface backed by a CGBitmap.  The surface is
- * created using the Device RGB (or Device Gray, for A8) color space.
- * All Cairo operations, including those that require software
- * rendering, will succeed on this surface.
- *
- * Return value: the newly created surface.
- *
- * Since: 1.12 [Mozilla addition]
- **/
-cairo_surface_t *
-cairo_quartz_surface_create_for_data (unsigned char *data,
-				      cairo_format_t format,
-				      unsigned int width,
-				      unsigned int height,
-				      unsigned int stride)
-{
-    cairo_quartz_surface_t *surf;
-    CGContextRef cgc;
-    CGColorSpaceRef cgColorspace;
-    CGBitmapInfo bitinfo;
-    void *imageData = data;
-    int bitsPerComponent;
-    unsigned int i;
-
-    // verify width and height of surface
-    if (!_cairo_quartz_verify_surface_size(width, height))
-	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
-
-    if (width == 0 || height == 0) {
-	return (cairo_surface_t*) _cairo_quartz_surface_create_internal (NULL, _cairo_content_from_format (format),
-									 width, height);
-    }
-
-    if (format == CAIRO_FORMAT_ARGB32 ||
-	format == CAIRO_FORMAT_RGB24)
-    {
-	cgColorspace = CGColorSpaceCreateDeviceRGB();
-	bitinfo = kCGBitmapByteOrder32Host;
-	if (format == CAIRO_FORMAT_ARGB32)
-	    bitinfo |= kCGImageAlphaPremultipliedFirst;
-	else
-	    bitinfo |= kCGImageAlphaNoneSkipFirst;
-	bitsPerComponent = 8;
-    } else if (format == CAIRO_FORMAT_A8) {
-	cgColorspace = NULL;
-	bitinfo = kCGImageAlphaOnly;
-	bitsPerComponent = 8;
-    } else if (format == CAIRO_FORMAT_A1) {
-	/* I don't think we can usefully support this, as defined by
-	 * cairo_format_t -- these are 1-bit pixels stored in 32-bit
-	 * quantities.
-	 */
-	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
-    } else {
-	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
-    }
-
-    cgc = CGBitmapContextCreate (imageData,
-				 width,
-				 height,
-				 bitsPerComponent,
-				 stride,
-				 cgColorspace,
-				 bitinfo);
-    CGColorSpaceRelease (cgColorspace);
-
-    if (!cgc) {
-	free (imageData);
-	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
-    }
-
-    /* flip the Y axis */
-    CGContextTranslateCTM (cgc, 0.0, height);
-    CGContextScaleCTM (cgc, 1.0, -1.0);
-
-    surf = _cairo_quartz_surface_create_internal (cgc, _cairo_content_from_format (format),
-						  width, height);
-    if (surf->base.status) {
-	CGContextRelease (cgc);
-	free (imageData);
-	// create_internal will have set an error
-	return (cairo_surface_t*) surf;
-    }
-
-    surf->imageData = imageData;
-
-    cairo_surface_t* tmpImageSurfaceEquiv =
-      cairo_image_surface_create_for_data (imageData, format,
-                                           width, height, stride);
-
-    if (cairo_surface_status (tmpImageSurfaceEquiv)) {
-        // Tried & failed to create an imageSurfaceEquiv!
-        cairo_surface_destroy (tmpImageSurfaceEquiv);
-        surf->imageSurfaceEquiv = NULL;
-    } else {
-        surf->imageSurfaceEquiv = tmpImageSurfaceEquiv;
-        surf->ownsData = FALSE;
-    }
-
-    return (cairo_surface_t *) surf;
-}
-
-/**
  * cairo_quartz_surface_get_cg_context:
  * @surface: the Cairo Quartz surface
  *
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
@@ -54,13 +54,6 @@ cairo_quartz_surface_create_for_cg_conte
                                             unsigned int width,
                                             unsigned int height);
 
-cairo_surface_t *
-cairo_quartz_surface_create_for_data (unsigned char *data,
-                                      cairo_format_t format,
-                                      unsigned int width,
-                                      unsigned int height,
-                                      unsigned int stride);
-
 cairo_public cairo_surface_t *
 cairo_quartz_surface_create_cg_layer (cairo_surface_t *surface,
                                       cairo_content_t content,