Cherry-pick https://gitlab.freedesktop.org/cairo/cairo/-/commit/38e486b34d435130f2fb38c429e6016c3c82cd53 draft
authorJonathan Kew <jkew@mozilla.com>
Mon, 19 Apr 2021 13:14:07 +0100
changeset 3667306 2aef1ea8afd40ad2d60641424d758dc69c86592f
parent 3667305 b6dbf53bdb1467e6bb35d94655072474c0486a9e
child 3667307 6cfc2b4cd55935f17cdb96aa307ea95fd7938287
push id683063
push userjkew@mozilla.com
push dateMon, 19 Apr 2021 13:15:26 +0000
treeherdertry@919daaf50d14 [default view] [failures only]
milestone89.0a1
Cherry-pick https://gitlab.freedesktop.org/cairo/cairo/-/commit/38e486b34d435130f2fb38c429e6016c3c82cd53 cairo-quartz-image-surface.c: Fix types
gfx/cairo/cairo/src/cairo-quartz-image-surface.c
--- a/gfx/cairo/cairo/src/cairo-quartz-image-surface.c
+++ b/gfx/cairo/cairo/src/cairo-quartz-image-surface.c
@@ -83,17 +83,17 @@ static cairo_surface_t *
 }
 
 static cairo_status_t
 _cairo_quartz_image_surface_finish (void *asurface)
 {
     cairo_quartz_image_surface_t *surface = (cairo_quartz_image_surface_t *) asurface;
 
     CGImageRelease (surface->image);
-    cairo_surface_destroy (surface->imageSurface);
+    cairo_surface_destroy ( (cairo_surface_t*) surface->imageSurface);
     return CAIRO_STATUS_SUCCESS;
 }
 
 static cairo_status_t
 _cairo_quartz_image_surface_acquire_source_image (void *asurface,
 						  cairo_image_surface_t **image_out,
 						  void **image_extra)
 {
@@ -336,18 +336,20 @@ cairo_quartz_image_surface_create (cairo
 
     qisurf = _cairo_malloc (sizeof(cairo_quartz_image_surface_t));
     if (qisurf == NULL)
 	return SURFACE_ERROR_NO_MEMORY;
 
     memset (qisurf, 0, sizeof(cairo_quartz_image_surface_t));
 
     image_data = _cairo_malloc_ab (height, stride);
-    if (unlikely (!image_data))
-	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+    if (unlikely (!image_data)) {
+	free(qisurf);
+	return SURFACE_ERROR_NO_MEMORY;
+    }
 
     memcpy (image_data, image_surface->data, height * stride);
     image = CairoQuartzCreateCGImage (format,
 				      width, height,
 				      stride,
 				      image_data,
 				      TRUE,
 				      NULL,
@@ -377,13 +379,13 @@ cairo_quartz_image_surface_create (cairo
 
 cairo_surface_t *
 cairo_quartz_image_surface_get_image (cairo_surface_t *asurface)
 {
     cairo_quartz_image_surface_t *surface = (cairo_quartz_image_surface_t*) asurface;
 
     /* Throw an error for a non-quartz surface */
     if (! _cairo_surface_is_quartz (asurface)) {
-        return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH));
+        return SURFACE_ERROR_TYPE_MISMATCH;
     }
 
     return (cairo_surface_t*) surface->imageSurface;
 }