mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-17 03:40:28 +01:00
image: move surface definition to new header for subclassing
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
ee001b0b9f
commit
e849e7c929
28 changed files with 107 additions and 98 deletions
|
|
@ -75,6 +75,7 @@ cairo_private = \
|
|||
cairo-gstate-private.h \
|
||||
cairo-hash-private.h \
|
||||
cairo-image-info-private.h \
|
||||
cairo-image-surface-private.h \
|
||||
cairo-list-private.h \
|
||||
cairo-malloc-private.h \
|
||||
cairo-mutex-impl-private.h \
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
*/
|
||||
|
||||
#include "cairoint.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
|
||||
/**
|
||||
* cairo_debug_reset_static_data:
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
#include "cairoint.h"
|
||||
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-ft-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -42,10 +42,12 @@
|
|||
|
||||
#include "cairoint.h"
|
||||
|
||||
#include "cairo-gl-private.h"
|
||||
|
||||
#include "cairo-composite-rectangles-private.h"
|
||||
#include "cairo-clip-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-gl-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
|
||||
static cairo_int_status_t
|
||||
_cairo_gl_create_gradient_texture (cairo_gl_surface_t *dst,
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
|
||||
#include "cairo-composite-rectangles-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-rtree-private.h"
|
||||
|
||||
#define GLYPH_CACHE_WIDTH 1024
|
||||
|
|
|
|||
|
|
@ -40,10 +40,12 @@
|
|||
|
||||
#include "cairoint.h"
|
||||
|
||||
#include "cairo-gl-private.h"
|
||||
|
||||
#include "cairo-composite-rectangles-private.h"
|
||||
#include "cairo-default-context-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-gl-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
|
||||
static cairo_int_status_t
|
||||
_cairo_gl_surface_fill_rectangles (void *abstract_dst,
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "cairo-composite-rectangles-private.h"
|
||||
#include "cairo-default-context-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-paginated-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
#include "cairo-recording-surface-private.h"
|
||||
|
|
@ -144,13 +145,33 @@ _cairo_content_from_pixman_format (pixman_format_code_t pixman_format)
|
|||
return content;
|
||||
}
|
||||
|
||||
void
|
||||
_cairo_image_surface_init (cairo_image_surface_t *surface,
|
||||
pixman_image_t *pixman_image,
|
||||
pixman_format_code_t pixman_format)
|
||||
{
|
||||
surface->pixman_image = pixman_image;
|
||||
|
||||
surface->pixman_format = pixman_format;
|
||||
surface->format = _cairo_format_from_pixman_format (pixman_format);
|
||||
surface->data = (uint8_t *) pixman_image_get_data (pixman_image);
|
||||
surface->owns_data = FALSE;
|
||||
surface->transparency = CAIRO_IMAGE_UNKNOWN;
|
||||
surface->color = CAIRO_IMAGE_UNKNOWN_COLOR;
|
||||
|
||||
surface->width = pixman_image_get_width (pixman_image);
|
||||
surface->height = pixman_image_get_height (pixman_image);
|
||||
surface->stride = pixman_image_get_stride (pixman_image);
|
||||
surface->depth = pixman_image_get_depth (pixman_image);
|
||||
|
||||
surface->base.is_clear = surface->width == 0 || surface->height == 0;
|
||||
}
|
||||
|
||||
cairo_surface_t *
|
||||
_cairo_image_surface_create_for_pixman_image (pixman_image_t *pixman_image,
|
||||
pixman_format_code_t pixman_format)
|
||||
{
|
||||
cairo_image_surface_t *surface;
|
||||
int width = pixman_image_get_width (pixman_image);
|
||||
int height = pixman_image_get_height (pixman_image);
|
||||
|
||||
surface = malloc (sizeof (cairo_image_surface_t));
|
||||
if (unlikely (surface == NULL))
|
||||
|
|
@ -161,21 +182,7 @@ _cairo_image_surface_create_for_pixman_image (pixman_image_t *pixman_image,
|
|||
NULL, /* device */
|
||||
_cairo_content_from_pixman_format (pixman_format));
|
||||
|
||||
surface->pixman_image = pixman_image;
|
||||
|
||||
surface->pixman_format = pixman_format;
|
||||
surface->format = _cairo_format_from_pixman_format (pixman_format);
|
||||
surface->data = (uint8_t *) pixman_image_get_data (pixman_image);
|
||||
surface->owns_data = FALSE;
|
||||
surface->transparency = CAIRO_IMAGE_UNKNOWN;
|
||||
surface->color = CAIRO_IMAGE_UNKNOWN_COLOR;
|
||||
|
||||
surface->width = width;
|
||||
surface->height = height;
|
||||
surface->stride = pixman_image_get_stride (pixman_image);
|
||||
surface->depth = pixman_image_get_depth (pixman_image);
|
||||
|
||||
surface->base.is_clear = width == 0 || height == 0;
|
||||
_cairo_image_surface_init (surface, pixman_image, pixman_format);
|
||||
|
||||
return &surface->base;
|
||||
}
|
||||
|
|
@ -760,7 +767,7 @@ _cairo_image_surface_unmap_image (void *abstract_surface,
|
|||
return CAIRO_INT_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
cairo_status_t
|
||||
_cairo_image_surface_finish (void *abstract_surface)
|
||||
{
|
||||
cairo_image_surface_t *surface = abstract_surface;
|
||||
|
|
@ -3387,7 +3394,7 @@ _clip_and_composite_trapezoids (cairo_image_surface_t *dst,
|
|||
}
|
||||
|
||||
/* high level image interface */
|
||||
static cairo_bool_t
|
||||
cairo_bool_t
|
||||
_cairo_image_surface_get_extents (void *abstract_surface,
|
||||
cairo_rectangle_int_t *rectangle)
|
||||
{
|
||||
|
|
@ -4281,7 +4288,7 @@ _cairo_image_surface_glyphs (void *abstract_surface,
|
|||
return status;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
_cairo_image_surface_get_font_options (void *abstract_surface,
|
||||
cairo_font_options_t *options)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
#include "cairo-recording-surface-private.h"
|
||||
#include "cairo-analysis-surface-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
|
||||
static const cairo_surface_backend_t cairo_paginated_surface_backend;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
#include "cairo-freed-pool-private.h"
|
||||
#include "cairo-path-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
|
||||
#include <float.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@
|
|||
#include "cairo-composite-rectangles-private.h"
|
||||
#include "cairo-default-context-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-image-info-private.h"
|
||||
#include "cairo-recording-surface-private.h"
|
||||
#include "cairo-output-stream-private.h"
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include "cairoint.h"
|
||||
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-output-stream-private.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@
|
|||
#include "cairo-composite-rectangles-private.h"
|
||||
#include "cairo-default-context-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-scaled-font-subsets-private.h"
|
||||
#include "cairo-paginated-private.h"
|
||||
#include "cairo-recording-surface-private.h"
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@
|
|||
#include "cairo-composite-rectangles-private.h"
|
||||
#include "cairo-default-context-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-recording-surface-private.h"
|
||||
#include "cairo-surface-wrapper-private.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "cairoint.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
#include "cairo-scaled-font-private.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
#include "cairo-device-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-list-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-recording-surface-private.h"
|
||||
#include "cairo-output-stream-private.h"
|
||||
#include "cairo-scaled-font-private.h"
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "cairo-clip-private.h"
|
||||
#include "cairo-composite-rectangles-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
#include "cairo-region-private.h"
|
||||
#include "cairo-spans-private.h"
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include "cairoint.h"
|
||||
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-surface-snapshot-private.h"
|
||||
|
||||
static cairo_status_t
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include "cairoint.h"
|
||||
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-recording-surface-private.h"
|
||||
#include "cairo-surface-offset-private.h"
|
||||
#include "cairo-surface-subsurface-private.h"
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
#include "cairo-clip-private.h"
|
||||
#include "cairo-device-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-recording-surface-private.h"
|
||||
#include "cairo-region-private.h"
|
||||
#include "cairo-tee-surface-private.h"
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@
|
|||
#include "cairo-default-context-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-info-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-recording-surface-private.h"
|
||||
#include "cairo-output-stream-private.h"
|
||||
#include "cairo-path-fixed-private.h"
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "cairo-analysis-surface-private.h"
|
||||
#include "cairo-default-context-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-surface-clipper-private.h"
|
||||
|
||||
static const cairo_surface_backend_t cairo_type3_glyph_surface_backend;
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ struct _cairo_xcb_shm_info {
|
|||
|
||||
struct _cairo_xcb_surface {
|
||||
cairo_surface_t base;
|
||||
cairo_image_surface_t *fallback;
|
||||
cairo_surface_t *fallback;
|
||||
|
||||
cairo_xcb_connection_t *connection;
|
||||
cairo_xcb_screen_t *screen;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "cairo-boxes-private.h"
|
||||
#include "cairo-xcb-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
|
||||
/* XXX dithering */
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "cairo-boxes-private.h"
|
||||
#include "cairo-clip-private.h"
|
||||
#include "cairo-composite-rectangles-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-region-private.h"
|
||||
#include "cairo-surface-offset-private.h"
|
||||
#include "cairo-surface-snapshot-private.h"
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@
|
|||
#include "cairo-xcb-private.h"
|
||||
|
||||
#include "cairo-default-context-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
|
||||
#define XLIB_COORD_MAX 32767
|
||||
|
||||
|
|
@ -222,8 +223,8 @@ _cairo_xcb_surface_finish (void *abstract_surface)
|
|||
cairo_status_t status;
|
||||
|
||||
if (surface->fallback != NULL) {
|
||||
cairo_surface_finish (&surface->fallback->base);
|
||||
cairo_surface_destroy (&surface->fallback->base);
|
||||
cairo_surface_finish (surface->fallback);
|
||||
cairo_surface_destroy (surface->fallback);
|
||||
}
|
||||
|
||||
cairo_list_del (&surface->link);
|
||||
|
|
@ -297,7 +298,7 @@ _cairo_xcb_surface_create_shm_image (cairo_xcb_connection_t *connection,
|
|||
}
|
||||
#endif
|
||||
|
||||
static cairo_image_surface_t *
|
||||
static cairo_surface_t *
|
||||
_get_shm_image (cairo_xcb_surface_t *surface,
|
||||
int x, int y,
|
||||
int width, int height)
|
||||
|
|
@ -329,19 +330,19 @@ _get_shm_image (cairo_xcb_surface_t *surface,
|
|||
}
|
||||
|
||||
done:
|
||||
return (cairo_image_surface_t *) image;
|
||||
return image;
|
||||
#else
|
||||
return NULL;;
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static cairo_image_surface_t *
|
||||
static cairo_surface_t *
|
||||
_get_image (cairo_xcb_surface_t *surface,
|
||||
cairo_bool_t use_shm,
|
||||
int x, int y,
|
||||
int width, int height)
|
||||
{
|
||||
cairo_image_surface_t *image;
|
||||
cairo_surface_t *image;
|
||||
cairo_xcb_connection_t *connection;
|
||||
xcb_get_image_reply_t *reply;
|
||||
cairo_int_status_t status;
|
||||
|
|
@ -353,7 +354,7 @@ _get_image (cairo_xcb_surface_t *surface,
|
|||
assert (y + height <= surface->height);
|
||||
|
||||
if (surface->deferred_clear) {
|
||||
image = (cairo_image_surface_t *)
|
||||
image =
|
||||
_cairo_image_surface_create_with_pixman_format (NULL,
|
||||
surface->pixman_format,
|
||||
width, height,
|
||||
|
|
@ -362,14 +363,13 @@ _get_image (cairo_xcb_surface_t *surface,
|
|||
cairo_solid_pattern_t solid;
|
||||
|
||||
_cairo_pattern_init_solid (&solid, &surface->deferred_clear_color);
|
||||
status = _cairo_surface_paint (&image->base,
|
||||
status = _cairo_surface_paint (image,
|
||||
CAIRO_OPERATOR_SOURCE,
|
||||
&solid.base,
|
||||
NULL);
|
||||
if (unlikely (status)) {
|
||||
cairo_surface_destroy (&image->base);
|
||||
image = (cairo_image_surface_t *)
|
||||
_cairo_surface_create_in_error (status);
|
||||
cairo_surface_destroy (image);
|
||||
image = _cairo_surface_create_in_error (status);
|
||||
}
|
||||
}
|
||||
return image;
|
||||
|
|
@ -379,7 +379,7 @@ _get_image (cairo_xcb_surface_t *surface,
|
|||
|
||||
status = _cairo_xcb_connection_acquire (connection);
|
||||
if (unlikely (status))
|
||||
return (cairo_image_surface_t *) _cairo_surface_create_in_error (status);
|
||||
return _cairo_surface_create_in_error (status);
|
||||
|
||||
if (use_shm) {
|
||||
image = _get_shm_image (surface, x, y, width, height);
|
||||
|
|
@ -450,22 +450,20 @@ _get_image (cairo_xcb_surface_t *surface,
|
|||
/* XXX format conversion */
|
||||
assert (reply->depth == surface->depth);
|
||||
|
||||
image = (cairo_image_surface_t *)
|
||||
_cairo_image_surface_create_with_pixman_format
|
||||
image = _cairo_image_surface_create_with_pixman_format
|
||||
(xcb_get_image_data (reply),
|
||||
surface->pixman_format,
|
||||
width, height,
|
||||
CAIRO_STRIDE_FOR_WIDTH_BPP (width,
|
||||
PIXMAN_FORMAT_BPP (surface->pixman_format)));
|
||||
status = image->base.status;
|
||||
status = image->status;
|
||||
if (unlikely (status)) {
|
||||
free (reply);
|
||||
goto FAIL;
|
||||
}
|
||||
|
||||
assert (xcb_get_image_data_length (reply) == image->height * image->stride);
|
||||
|
||||
pixman_image_set_destroy_function (image->pixman_image, _destroy_image, reply);
|
||||
/* XXX */
|
||||
pixman_image_set_destroy_function (((cairo_image_surface_t *)image)->pixman_image, _destroy_image, reply);
|
||||
|
||||
_cairo_xcb_connection_release (connection);
|
||||
|
||||
|
|
@ -473,7 +471,7 @@ _get_image (cairo_xcb_surface_t *surface,
|
|||
|
||||
FAIL:
|
||||
_cairo_xcb_connection_release (connection);
|
||||
return (cairo_image_surface_t *) _cairo_surface_create_in_error (status);
|
||||
return _cairo_surface_create_in_error (status);
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
|
|
@ -482,29 +480,28 @@ _cairo_xcb_surface_acquire_source_image (void *abstract_surface,
|
|||
void **image_extra)
|
||||
{
|
||||
cairo_xcb_surface_t *surface = abstract_surface;
|
||||
cairo_image_surface_t *image;
|
||||
cairo_surface_t *image;
|
||||
|
||||
if (surface->fallback != NULL) {
|
||||
image = (cairo_image_surface_t *) cairo_surface_reference (&surface->fallback->base);
|
||||
image = cairo_surface_reference (surface->fallback);
|
||||
goto DONE;
|
||||
}
|
||||
|
||||
image = (cairo_image_surface_t *)
|
||||
_cairo_surface_has_snapshot (&surface->base,
|
||||
&_cairo_image_surface_backend);
|
||||
image = _cairo_surface_has_snapshot (&surface->base,
|
||||
&_cairo_image_surface_backend);
|
||||
if (image != NULL) {
|
||||
image = (cairo_image_surface_t *) cairo_surface_reference (&image->base);
|
||||
image = cairo_surface_reference (image);
|
||||
goto DONE;
|
||||
}
|
||||
|
||||
image = _get_image (surface, FALSE, 0, 0, surface->width, surface->height);
|
||||
if (unlikely (image->base.status))
|
||||
return image->base.status;
|
||||
if (unlikely (image->status))
|
||||
return image->status;
|
||||
|
||||
_cairo_surface_attach_snapshot (&surface->base, &image->base, NULL);
|
||||
_cairo_surface_attach_snapshot (&surface->base, image, NULL);
|
||||
|
||||
DONE:
|
||||
*image_out = image;
|
||||
*image_out = (cairo_image_surface_t *) image;
|
||||
*image_extra = NULL;
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
@ -629,20 +626,20 @@ _cairo_xcb_surface_flush (void *abstract_surface)
|
|||
|
||||
status = surface->base.status;
|
||||
if (status == CAIRO_STATUS_SUCCESS && ! surface->base.finished) {
|
||||
status = cairo_surface_status (&surface->fallback->base);
|
||||
status = cairo_surface_status (surface->fallback);
|
||||
|
||||
if (status == CAIRO_STATUS_SUCCESS) {
|
||||
status = _put_image (surface, surface->fallback);
|
||||
status = _put_image (surface, (cairo_image_surface_t *)surface->fallback);
|
||||
}
|
||||
|
||||
if (status == CAIRO_STATUS_SUCCESS) {
|
||||
_cairo_surface_attach_snapshot (&surface->base,
|
||||
&surface->fallback->base,
|
||||
surface->fallback,
|
||||
cairo_surface_finish);
|
||||
}
|
||||
}
|
||||
|
||||
cairo_surface_destroy (&surface->fallback->base);
|
||||
cairo_surface_destroy (surface->fallback);
|
||||
surface->fallback = NULL;
|
||||
|
||||
return status;
|
||||
|
|
@ -653,16 +650,16 @@ _cairo_xcb_surface_map_to_image (void *abstract_surface,
|
|||
const cairo_rectangle_int_t *extents)
|
||||
{
|
||||
cairo_xcb_surface_t *surface = abstract_surface;
|
||||
cairo_image_surface_t *image;
|
||||
cairo_surface_t *image;
|
||||
|
||||
if (surface->fallback)
|
||||
return surface->fallback->base.backend->map_to_image (surface->fallback, extents);
|
||||
return surface->fallback->backend->map_to_image (surface->fallback, extents);
|
||||
|
||||
image = _get_image (surface, TRUE,
|
||||
extents->x, extents->y,
|
||||
extents->width, extents->height);
|
||||
if (unlikely (image->base.status))
|
||||
return &image->base;
|
||||
if (unlikely (image->status))
|
||||
return image;
|
||||
|
||||
/* Do we have a deferred clear and this image surface does NOT cover the
|
||||
* whole xcb surface? Have to apply the clear in that case, else
|
||||
|
|
@ -675,14 +672,14 @@ _cairo_xcb_surface_map_to_image (void *abstract_surface,
|
|||
extents->height == surface->height)) {
|
||||
cairo_status_t status = _cairo_xcb_surface_clear (surface);
|
||||
if (unlikely (status)) {
|
||||
cairo_surface_destroy(&image->base);
|
||||
cairo_surface_destroy(image);
|
||||
return _cairo_surface_create_in_error (status);
|
||||
}
|
||||
}
|
||||
surface->deferred_clear = FALSE;
|
||||
|
||||
cairo_surface_set_device_offset (&image->base, -extents->x, -extents->y);
|
||||
return &image->base;
|
||||
cairo_surface_set_device_offset (image, -extents->x, -extents->y);
|
||||
return image;
|
||||
}
|
||||
|
||||
static cairo_int_status_t
|
||||
|
|
@ -692,18 +689,19 @@ _cairo_xcb_surface_unmap (void *abstract_surface,
|
|||
cairo_xcb_surface_t *surface = abstract_surface;
|
||||
|
||||
if (surface->fallback)
|
||||
return surface->fallback->base.backend->unmap_image (surface->fallback, image);
|
||||
return surface->fallback->backend->unmap_image (surface->fallback, image);
|
||||
return _put_image (abstract_surface, image);
|
||||
}
|
||||
|
||||
static cairo_image_surface_t *
|
||||
static cairo_surface_t *
|
||||
_cairo_xcb_surface_fallback (cairo_xcb_surface_t *surface)
|
||||
{
|
||||
cairo_image_surface_t *image;
|
||||
cairo_surface_t *image;
|
||||
|
||||
image = _get_image (surface, TRUE, 0, 0, surface->width, surface->height);
|
||||
|
||||
/* If there was a deferred clear, _get_image applied it */
|
||||
if (image->base.status == CAIRO_STATUS_SUCCESS)
|
||||
if (image->status == CAIRO_STATUS_SUCCESS)
|
||||
surface->deferred_clear = FALSE;
|
||||
|
||||
return image;
|
||||
|
|
@ -730,7 +728,7 @@ _cairo_xcb_surface_paint (void *abstract_surface,
|
|||
surface->fallback = _cairo_xcb_surface_fallback (surface);
|
||||
}
|
||||
|
||||
return _cairo_surface_paint (&surface->fallback->base, op, source, clip);
|
||||
return _cairo_surface_paint (surface->fallback, op, source, clip);
|
||||
}
|
||||
|
||||
static cairo_int_status_t
|
||||
|
|
@ -757,7 +755,7 @@ _cairo_xcb_surface_mask (void *abstract_surface,
|
|||
surface->fallback = _cairo_xcb_surface_fallback (surface);
|
||||
}
|
||||
|
||||
return _cairo_surface_mask (&surface->fallback->base,
|
||||
return _cairo_surface_mask (surface->fallback,
|
||||
op, source, mask,
|
||||
clip);
|
||||
}
|
||||
|
|
@ -799,7 +797,7 @@ _cairo_xcb_surface_stroke (void *abstract_surface,
|
|||
surface->fallback = _cairo_xcb_surface_fallback (surface);
|
||||
}
|
||||
|
||||
return _cairo_surface_stroke (&surface->fallback->base,
|
||||
return _cairo_surface_stroke (surface->fallback,
|
||||
op, source,
|
||||
path, style,
|
||||
ctm, ctm_inverse,
|
||||
|
|
@ -838,7 +836,7 @@ _cairo_xcb_surface_fill (void *abstract_surface,
|
|||
surface->fallback = _cairo_xcb_surface_fallback (surface);
|
||||
}
|
||||
|
||||
return _cairo_surface_fill (&surface->fallback->base,
|
||||
return _cairo_surface_fill (surface->fallback,
|
||||
op, source,
|
||||
path, fill_rule,
|
||||
tolerance, antialias,
|
||||
|
|
@ -878,7 +876,7 @@ _cairo_xcb_surface_glyphs (void *abstract_surface,
|
|||
surface->fallback = _cairo_xcb_surface_fallback (surface);
|
||||
}
|
||||
|
||||
return _cairo_surface_show_text_glyphs (&surface->fallback->base,
|
||||
return _cairo_surface_show_text_glyphs (surface->fallback,
|
||||
op, source,
|
||||
NULL, 0,
|
||||
glyphs, num_glyphs,
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@
|
|||
#include "cairo-clip-private.h"
|
||||
#include "cairo-default-context-private.h"
|
||||
#include "cairo-error-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
#include "cairo-pattern-private.h"
|
||||
#include "cairo-region-private.h"
|
||||
#include "cairo-scaled-font-private.h"
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
#include "cairo-xlib-xrender-private.h"
|
||||
|
||||
#include "cairo-default-context-private.h"
|
||||
#include "cairo-image-surface-private.h"
|
||||
|
||||
#include <X11/Xlib-xcb.h>
|
||||
#include <X11/Xlibint.h> /* For XESetCloseDisplay */
|
||||
|
|
|
|||
|
|
@ -254,6 +254,7 @@ _cairo_isdigit (int c)
|
|||
#include "cairo-cache-private.h"
|
||||
#include "cairo-reference-count-private.h"
|
||||
#include "cairo-spans-private.h"
|
||||
#include "cairo-surface-private.h"
|
||||
|
||||
cairo_private void
|
||||
_cairo_box_from_doubles (cairo_box_t *box,
|
||||
|
|
@ -795,7 +796,7 @@ struct _cairo_surface_backend {
|
|||
* FALSE the surface is considered to be
|
||||
* boundless and infinite bounds are used for it.
|
||||
*/
|
||||
cairo_warn cairo_bool_t
|
||||
cairo_bool_t
|
||||
(*get_extents) (void *surface,
|
||||
cairo_rectangle_int_t *extents);
|
||||
|
||||
|
|
@ -946,29 +947,6 @@ struct _cairo_surface_backend {
|
|||
void **image_extra);
|
||||
};
|
||||
|
||||
#include "cairo-surface-private.h"
|
||||
|
||||
struct _cairo_image_surface {
|
||||
cairo_surface_t base;
|
||||
|
||||
pixman_format_code_t pixman_format;
|
||||
cairo_format_t format;
|
||||
unsigned char *data;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
int stride;
|
||||
int depth;
|
||||
|
||||
pixman_image_t *pixman_image;
|
||||
|
||||
unsigned owns_data : 1;
|
||||
unsigned transparency : 2;
|
||||
unsigned color : 2;
|
||||
};
|
||||
|
||||
extern const cairo_private cairo_surface_backend_t _cairo_image_surface_backend;
|
||||
|
||||
#define CAIRO_EXTEND_SURFACE_DEFAULT CAIRO_EXTEND_NONE
|
||||
#define CAIRO_EXTEND_GRADIENT_DEFAULT CAIRO_EXTEND_PAD
|
||||
#define CAIRO_FILTER_DEFAULT CAIRO_FILTER_GOOD
|
||||
|
|
@ -1850,7 +1828,7 @@ cairo_private cairo_bool_t
|
|||
_cairo_surface_is_similar (cairo_surface_t *surface_a,
|
||||
cairo_surface_t *surface_b);
|
||||
|
||||
cairo_private cairo_bool_t
|
||||
cairo_private_no_warn cairo_bool_t
|
||||
_cairo_surface_get_extents (cairo_surface_t *surface,
|
||||
cairo_rectangle_int_t *extents);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue