Commit e849e7c9 authored by Chris Wilson's avatar Chris Wilson 🤔
Browse files

image: move surface definition to new header for subclassing


Signed-off-by: Chris Wilson's avatarChris Wilson <chris@chris-wilson.co.uk>
parent ee001b0b
......@@ -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"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment