mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-11-18 11:08:26 +00:00
126 lines
5.1 KiB
Diff
126 lines
5.1 KiB
Diff
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);
|
|
|