diff options
author | David Reveman <davidr@novell.com> | 2005-03-03 18:20:28 +0000 |
---|---|---|
committer | David Reveman <davidr@novell.com> | 2005-03-03 18:20:28 +0000 |
commit | a97f4cce5e13cfa2dc3b843b3b37cb14cb16cf65 (patch) | |
tree | 86cc97682105bc6da48294fe85558846e67db38a | |
parent | 36b69fc7f4ff090f5d5eb6e9db4c13cbf25971a6 (diff) |
Removed surface backend functions set_matrix, set_filter and set_repeat
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | src/cairo-glitz-surface.c | 24 | ||||
-rw-r--r-- | src/cairo-image-surface.c | 26 | ||||
-rw-r--r-- | src/cairo-pdf-surface.c | 24 | ||||
-rw-r--r-- | src/cairo-ps-surface.c | 30 | ||||
-rw-r--r-- | src/cairo-surface.c | 8 | ||||
-rw-r--r-- | src/cairo-xlib-surface.c | 51 | ||||
-rw-r--r-- | src/cairo_glitz_surface.c | 24 | ||||
-rw-r--r-- | src/cairo_image_surface.c | 26 | ||||
-rw-r--r-- | src/cairo_pdf_surface.c | 24 | ||||
-rw-r--r-- | src/cairo_png_surface.c | 30 | ||||
-rw-r--r-- | src/cairo_ps_surface.c | 30 | ||||
-rw-r--r-- | src/cairo_surface.c | 8 | ||||
-rw-r--r-- | src/cairo_xlib_surface.c | 51 | ||||
-rw-r--r-- | src/cairoint.h | 12 |
15 files changed, 83 insertions, 298 deletions
@@ -1,5 +1,18 @@ 2005-03-04 David Reveman <davidr@novell.com> + * src/cairoint.h: + * src/cairo_xlib_surface.c: + (_cairo_xlib_surface_set_matrix): Setting identity transform should + always be successful. + + * src/cairo_surface.c: + * src/cairo_ps_surface.c: + * src/cairo_png_surface.c: + * src/cairo_pdf_surface.c: + * src/cairo_image_surface.c: + * src/cairo_glitz_surface.c: Removed surface backend functions + set_matrix, set_filter, set_repeat. + * configure.in: Enabled glitz backend. * src/cairo_glitz_surface.c: Major update to glitz backend. The output diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c index 3f10cde39..bf7e96658 100644 --- a/src/cairo-glitz-surface.c +++ b/src/cairo-glitz-surface.c @@ -396,11 +396,10 @@ _cairo_glitz_surface_clone_similar (void *abstract_surface, return CAIRO_INT_STATUS_UNSUPPORTED; } -static cairo_status_t -_cairo_glitz_surface_set_matrix (void *abstract_surface, - cairo_matrix_t *matrix) +static void +_cairo_glitz_surface_set_matrix (cairo_glitz_surface_t *surface, + cairo_matrix_t *matrix) { - cairo_glitz_surface_t *surface = abstract_surface; glitz_transform_t transform; transform.matrix[0][0] = _cairo_fixed_from_double (matrix->m[0][0]); @@ -416,20 +415,6 @@ _cairo_glitz_surface_set_matrix (void *abstract_surface, transform.matrix[2][2] = 1 << 16; glitz_surface_set_transform (surface->surface, &transform); - - return CAIRO_STATUS_SUCCESS; -} - -static cairo_status_t -_cairo_glitz_surface_set_filter (void *abstract_surface, cairo_filter_t filter) -{ - return CAIRO_STATUS_SUCCESS; -} - -static cairo_status_t -_cairo_glitz_surface_set_repeat (void *abstract_surface, int repeat) -{ - return CAIRO_STATUS_SUCCESS; } static glitz_operator_t @@ -1128,9 +1113,6 @@ static const cairo_surface_backend_t cairo_glitz_surface_backend = { _cairo_glitz_surface_acquire_dest_image, _cairo_glitz_surface_release_dest_image, _cairo_glitz_surface_clone_similar, - _cairo_glitz_surface_set_matrix, - _cairo_glitz_surface_set_filter, - _cairo_glitz_surface_set_repeat, _cairo_glitz_surface_composite, _cairo_glitz_surface_fill_rectangles, _cairo_glitz_surface_composite_trapezoids, diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index dbf3f3000..69e4f8d55 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -325,14 +325,6 @@ _cairo_image_surface_clone_similar (void *abstract_surface, return CAIRO_INT_STATUS_UNSUPPORTED; } -static cairo_status_t -_cairo_image_abstract_surface_set_matrix (void *abstract_surface, - cairo_matrix_t *matrix) -{ - cairo_image_surface_t *surface = abstract_surface; - return _cairo_image_surface_set_matrix (surface, matrix); -} - cairo_status_t _cairo_image_surface_set_matrix (cairo_image_surface_t *surface, cairo_matrix_t *matrix) @@ -356,14 +348,6 @@ _cairo_image_surface_set_matrix (cairo_image_surface_t *surface, return CAIRO_STATUS_SUCCESS; } -static cairo_status_t -_cairo_image_abstract_surface_set_filter (void *abstract_surface, cairo_filter_t filter) -{ - cairo_image_surface_t *surface = abstract_surface; - - return _cairo_image_surface_set_filter (surface, filter); -} - cairo_status_t _cairo_image_surface_set_filter (cairo_image_surface_t *surface, cairo_filter_t filter) { @@ -394,13 +378,6 @@ _cairo_image_surface_set_filter (cairo_image_surface_t *surface, cairo_filter_t return CAIRO_STATUS_SUCCESS; } -static cairo_status_t -_cairo_image_abstract_surface_set_repeat (void *abstract_surface, int repeat) -{ - cairo_image_surface_t *surface = abstract_surface; - return _cairo_image_surface_set_repeat (surface, repeat); -} - cairo_status_t _cairo_image_surface_set_repeat (cairo_image_surface_t *surface, int repeat) { @@ -678,9 +655,6 @@ static const cairo_surface_backend_t cairo_image_surface_backend = { _cairo_image_surface_acquire_dest_image, _cairo_image_surface_release_dest_image, _cairo_image_surface_clone_similar, - _cairo_image_abstract_surface_set_matrix, - _cairo_image_abstract_surface_set_filter, - _cairo_image_abstract_surface_set_repeat, _cairo_image_surface_composite, _cairo_image_surface_fill_rectangles, _cairo_image_surface_composite_trapezoids, diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index 2974efe5d..ea957c85f 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -1138,27 +1138,6 @@ _cairo_pdf_surface_clone_similar (void *abstract_surface, return CAIRO_INT_STATUS_UNSUPPORTED; } -static cairo_status_t -_cairo_pdf_surface_set_matrix (void *abstract_surface, - cairo_matrix_t *matrix) -{ - return CAIRO_STATUS_SUCCESS; -} - -static cairo_status_t -_cairo_pdf_surface_set_filter (void *abstract_surface, - cairo_filter_t filter) -{ - return CAIRO_STATUS_SUCCESS; -} - -static cairo_status_t -_cairo_pdf_surface_set_repeat (void *abstract_surface, - int repeat) -{ - return CAIRO_STATUS_SUCCESS; -} - static void * compress_dup (const void *data, unsigned long data_size, unsigned long *compressed_size) @@ -1818,9 +1797,6 @@ static const cairo_surface_backend_t cairo_pdf_surface_backend = { _cairo_pdf_surface_acquire_dest_image, _cairo_pdf_surface_release_dest_image, _cairo_pdf_surface_clone_similar, - _cairo_pdf_surface_set_matrix, - _cairo_pdf_surface_set_filter, - _cairo_pdf_surface_set_repeat, _cairo_pdf_surface_composite, _cairo_pdf_surface_fill_rectangles, _cairo_pdf_surface_composite_trapezoids, diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 6aa05df68..022ab0f26 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -263,33 +263,6 @@ _cairo_ps_surface_clone_similar (void *abstract_surface, return CAIRO_INT_STATUS_UNSUPPORTED; } -static cairo_status_t -_cairo_ps_surface_set_matrix (void *abstract_surface, - cairo_matrix_t *matrix) -{ - cairo_ps_surface_t *surface = abstract_surface; - - return _cairo_image_surface_set_matrix (surface->image, matrix); -} - -static cairo_status_t -_cairo_ps_surface_set_filter (void *abstract_surface, - cairo_filter_t filter) -{ - cairo_ps_surface_t *surface = abstract_surface; - - return _cairo_image_surface_set_filter (surface->image, filter); -} - -static cairo_status_t -_cairo_ps_surface_set_repeat (void *abstract_surface, - int repeat) -{ - cairo_ps_surface_t *surface = abstract_surface; - - return _cairo_image_surface_set_repeat (surface->image, repeat); -} - static cairo_int_status_t _cairo_ps_surface_composite (cairo_operator_t operator, cairo_pattern_t *src, @@ -460,9 +433,6 @@ static const cairo_surface_backend_t cairo_ps_surface_backend = { _cairo_ps_surface_acquire_dest_image, _cairo_ps_surface_release_dest_image, _cairo_ps_surface_clone_similar, - _cairo_ps_surface_set_matrix, - _cairo_ps_surface_set_filter, - _cairo_ps_surface_set_repeat, _cairo_ps_surface_composite, _cairo_ps_surface_fill_rectangles, _cairo_ps_surface_composite_trapezoids, diff --git a/src/cairo-surface.c b/src/cairo-surface.c index b2d36df94..e0e6d948f 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -304,9 +304,7 @@ cairo_surface_set_matrix (cairo_surface_t *surface, cairo_matrix_t *matrix) if (surface == NULL) return CAIRO_STATUS_NULL_POINTER; - cairo_matrix_copy (&surface->matrix, matrix); - - return surface->backend->set_matrix (surface, matrix); + return cairo_matrix_copy (&surface->matrix, matrix); } slim_hidden_def(cairo_surface_set_matrix); @@ -327,7 +325,7 @@ cairo_surface_set_filter (cairo_surface_t *surface, cairo_filter_t filter) return CAIRO_STATUS_NULL_POINTER; surface->filter = filter; - return surface->backend->set_filter (surface, filter); + return CAIRO_STATUS_SUCCESS; } cairo_filter_t @@ -359,7 +357,7 @@ cairo_surface_set_repeat (cairo_surface_t *surface, int repeat) surface->repeat = repeat; - return surface->backend->set_repeat (surface, repeat); + return CAIRO_STATUS_SUCCESS; } slim_hidden_def(cairo_surface_set_repeat); diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 626c0f69e..f7acf2763 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -442,10 +442,6 @@ _cairo_xlib_surface_clone_similar (void *abstract_surface, _draw_image_surface (clone, image_src, 0, 0); - cairo_surface_set_filter (&clone->base, src->filter); - cairo_surface_set_matrix (&clone->base, &src->matrix); - cairo_surface_set_repeat (&clone->base, src->repeat); - *clone_out = &clone->base; return CAIRO_STATUS_SUCCESS; @@ -455,14 +451,14 @@ _cairo_xlib_surface_clone_similar (void *abstract_surface, } static cairo_status_t -_cairo_xlib_surface_set_matrix (void *abstract_surface, cairo_matrix_t *matrix) +_cairo_xlib_surface_set_matrix (cairo_xlib_surface_t *surface, + cairo_matrix_t *matrix) { - cairo_xlib_surface_t *surface = abstract_surface; XTransform xtransform; if (!surface->picture) return CAIRO_STATUS_SUCCESS; - + xtransform.matrix[0][0] = _cairo_fixed_from_double (matrix->m[0][0]); xtransform.matrix[0][1] = _cairo_fixed_from_double (matrix->m[1][0]); xtransform.matrix[0][2] = _cairo_fixed_from_double (matrix->m[2][0]); @@ -475,26 +471,41 @@ _cairo_xlib_surface_set_matrix (void *abstract_surface, cairo_matrix_t *matrix) xtransform.matrix[2][1] = 0; xtransform.matrix[2][2] = _cairo_fixed_from_double (1); - if (CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM (surface)) + if (!CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM (surface)) { - XRenderSetPictureTransform (surface->dpy, surface->picture, &xtransform); - } else { - /* XXX: Need support here if using an old RENDER without support - for SetPictureTransform */ + static const XTransform identity = { { + { 1 << 16, 0x00000, 0x00000 }, + { 0x00000, 1 << 16, 0x00000 }, + { 0x00000, 0x00000, 1 << 16 }, + } }; + + if (memcmp (&xtransform, &identity, sizeof (XTransform)) == 0) + return CAIRO_STATUS_SUCCESS; + + return CAIRO_INT_STATUS_UNSUPPORTED; } + XRenderSetPictureTransform (surface->dpy, surface->picture, &xtransform); + return CAIRO_STATUS_SUCCESS; } static cairo_status_t -_cairo_xlib_surface_set_filter (void *abstract_surface, cairo_filter_t filter) +_cairo_xlib_surface_set_filter (cairo_xlib_surface_t *surface, + cairo_filter_t filter) { - cairo_xlib_surface_t *surface = abstract_surface; char *render_filter; - if (!(surface->picture - && CAIRO_SURFACE_RENDER_HAS_FILTERS(surface))) + if (!surface->picture) return CAIRO_STATUS_SUCCESS; + + if (!CAIRO_SURFACE_RENDER_HAS_FILTERS (surface)) + { + if (filter == CAIRO_FILTER_FAST || filter == CAIRO_FILTER_NEAREST) + return CAIRO_STATUS_SUCCESS; + + return CAIRO_INT_STATUS_UNSUPPORTED; + } switch (filter) { case CAIRO_FILTER_FAST: @@ -524,11 +535,10 @@ _cairo_xlib_surface_set_filter (void *abstract_surface, cairo_filter_t filter) } static cairo_status_t -_cairo_xlib_surface_set_repeat (void *abstract_surface, int repeat) +_cairo_xlib_surface_set_repeat (cairo_xlib_surface_t *surface, int repeat) { - cairo_xlib_surface_t *surface = abstract_surface; - unsigned long mask; XRenderPictureAttributes pa; + unsigned long mask; if (!surface->picture) return CAIRO_STATUS_SUCCESS; @@ -857,9 +867,6 @@ static const cairo_surface_backend_t cairo_xlib_surface_backend = { _cairo_xlib_surface_acquire_dest_image, _cairo_xlib_surface_release_dest_image, _cairo_xlib_surface_clone_similar, - _cairo_xlib_surface_set_matrix, - _cairo_xlib_surface_set_filter, - _cairo_xlib_surface_set_repeat, _cairo_xlib_surface_composite, _cairo_xlib_surface_fill_rectangles, _cairo_xlib_surface_composite_trapezoids, diff --git a/src/cairo_glitz_surface.c b/src/cairo_glitz_surface.c index 3f10cde39..bf7e96658 100644 --- a/src/cairo_glitz_surface.c +++ b/src/cairo_glitz_surface.c @@ -396,11 +396,10 @@ _cairo_glitz_surface_clone_similar (void *abstract_surface, return CAIRO_INT_STATUS_UNSUPPORTED; } -static cairo_status_t -_cairo_glitz_surface_set_matrix (void *abstract_surface, - cairo_matrix_t *matrix) +static void +_cairo_glitz_surface_set_matrix (cairo_glitz_surface_t *surface, + cairo_matrix_t *matrix) { - cairo_glitz_surface_t *surface = abstract_surface; glitz_transform_t transform; transform.matrix[0][0] = _cairo_fixed_from_double (matrix->m[0][0]); @@ -416,20 +415,6 @@ _cairo_glitz_surface_set_matrix (void *abstract_surface, transform.matrix[2][2] = 1 << 16; glitz_surface_set_transform (surface->surface, &transform); - - return CAIRO_STATUS_SUCCESS; -} - -static cairo_status_t -_cairo_glitz_surface_set_filter (void *abstract_surface, cairo_filter_t filter) -{ - return CAIRO_STATUS_SUCCESS; -} - -static cairo_status_t -_cairo_glitz_surface_set_repeat (void *abstract_surface, int repeat) -{ - return CAIRO_STATUS_SUCCESS; } static glitz_operator_t @@ -1128,9 +1113,6 @@ static const cairo_surface_backend_t cairo_glitz_surface_backend = { _cairo_glitz_surface_acquire_dest_image, _cairo_glitz_surface_release_dest_image, _cairo_glitz_surface_clone_similar, - _cairo_glitz_surface_set_matrix, - _cairo_glitz_surface_set_filter, - _cairo_glitz_surface_set_repeat, _cairo_glitz_surface_composite, _cairo_glitz_surface_fill_rectangles, _cairo_glitz_surface_composite_trapezoids, diff --git a/src/cairo_image_surface.c b/src/cairo_image_surface.c index dbf3f3000..69e4f8d55 100644 --- a/src/cairo_image_surface.c +++ b/src/cairo_image_surface.c @@ -325,14 +325,6 @@ _cairo_image_surface_clone_similar (void *abstract_surface, return CAIRO_INT_STATUS_UNSUPPORTED; } -static cairo_status_t -_cairo_image_abstract_surface_set_matrix (void *abstract_surface, - cairo_matrix_t *matrix) -{ - cairo_image_surface_t *surface = abstract_surface; - return _cairo_image_surface_set_matrix (surface, matrix); -} - cairo_status_t _cairo_image_surface_set_matrix (cairo_image_surface_t *surface, cairo_matrix_t *matrix) @@ -356,14 +348,6 @@ _cairo_image_surface_set_matrix (cairo_image_surface_t *surface, return CAIRO_STATUS_SUCCESS; } -static cairo_status_t -_cairo_image_abstract_surface_set_filter (void *abstract_surface, cairo_filter_t filter) -{ - cairo_image_surface_t *surface = abstract_surface; - - return _cairo_image_surface_set_filter (surface, filter); -} - cairo_status_t _cairo_image_surface_set_filter (cairo_image_surface_t *surface, cairo_filter_t filter) { @@ -394,13 +378,6 @@ _cairo_image_surface_set_filter (cairo_image_surface_t *surface, cairo_filter_t return CAIRO_STATUS_SUCCESS; } -static cairo_status_t -_cairo_image_abstract_surface_set_repeat (void *abstract_surface, int repeat) -{ - cairo_image_surface_t *surface = abstract_surface; - return _cairo_image_surface_set_repeat (surface, repeat); -} - cairo_status_t _cairo_image_surface_set_repeat (cairo_image_surface_t *surface, int repeat) { @@ -678,9 +655,6 @@ static const cairo_surface_backend_t cairo_image_surface_backend = { _cairo_image_surface_acquire_dest_image, _cairo_image_surface_release_dest_image, _cairo_image_surface_clone_similar, - _cairo_image_abstract_surface_set_matrix, - _cairo_image_abstract_surface_set_filter, - _cairo_image_abstract_surface_set_repeat, _cairo_image_surface_composite, _cairo_image_surface_fill_rectangles, _cairo_image_surface_composite_trapezoids, diff --git a/src/cairo_pdf_surface.c b/src/cairo_pdf_surface.c index 2974efe5d..ea957c85f 100644 --- a/src/cairo_pdf_surface.c +++ b/src/cairo_pdf_surface.c @@ -1138,27 +1138,6 @@ _cairo_pdf_surface_clone_similar (void *abstract_surface, return CAIRO_INT_STATUS_UNSUPPORTED; } -static cairo_status_t -_cairo_pdf_surface_set_matrix (void *abstract_surface, - cairo_matrix_t *matrix) -{ - return CAIRO_STATUS_SUCCESS; -} - -static cairo_status_t -_cairo_pdf_surface_set_filter (void *abstract_surface, - cairo_filter_t filter) -{ - return CAIRO_STATUS_SUCCESS; -} - -static cairo_status_t -_cairo_pdf_surface_set_repeat (void *abstract_surface, - int repeat) -{ - return CAIRO_STATUS_SUCCESS; -} - static void * compress_dup (const void *data, unsigned long data_size, unsigned long *compressed_size) @@ -1818,9 +1797,6 @@ static const cairo_surface_backend_t cairo_pdf_surface_backend = { _cairo_pdf_surface_acquire_dest_image, _cairo_pdf_surface_release_dest_image, _cairo_pdf_surface_clone_similar, - _cairo_pdf_surface_set_matrix, - _cairo_pdf_surface_set_filter, - _cairo_pdf_surface_set_repeat, _cairo_pdf_surface_composite, _cairo_pdf_surface_fill_rectangles, _cairo_pdf_surface_composite_trapezoids, diff --git a/src/cairo_png_surface.c b/src/cairo_png_surface.c index 282b33d7a..5606019cc 100644 --- a/src/cairo_png_surface.c +++ b/src/cairo_png_surface.c @@ -240,33 +240,6 @@ _cairo_png_surface_clone_similar (void *abstract_surface, return CAIRO_INT_STATUS_UNSUPPORTED; } -static cairo_status_t -_cairo_png_surface_set_matrix (void *abstract_surface, - cairo_matrix_t *matrix) -{ - cairo_png_surface_t *surface = abstract_surface; - - return _cairo_image_surface_set_matrix (surface->image, matrix); -} - -static cairo_status_t -_cairo_png_surface_set_filter (void *abstract_surface, - cairo_filter_t filter) -{ - cairo_png_surface_t *surface = abstract_surface; - - return _cairo_image_surface_set_filter (surface->image, filter); -} - -static cairo_status_t -_cairo_png_surface_set_repeat (void *abstract_surface, - int repeat) -{ - cairo_png_surface_t *surface = abstract_surface; - - return _cairo_image_surface_set_repeat (surface->image, repeat); -} - static cairo_int_status_t _cairo_png_surface_composite (cairo_operator_t operator, cairo_pattern_t *pattern, @@ -442,9 +415,6 @@ static const cairo_surface_backend_t cairo_png_surface_backend = { _cairo_png_surface_acquire_dest_image, _cairo_png_surface_release_dest_image, _cairo_png_surface_clone_similar, - _cairo_png_surface_set_matrix, - _cairo_png_surface_set_filter, - _cairo_png_surface_set_repeat, _cairo_png_surface_composite, _cairo_png_surface_fill_rectangles, _cairo_png_surface_composite_trapezoids, diff --git a/src/cairo_ps_surface.c b/src/cairo_ps_surface.c index 6aa05df68..022ab0f26 100644 --- a/src/cairo_ps_surface.c +++ b/src/cairo_ps_surface.c @@ -263,33 +263,6 @@ _cairo_ps_surface_clone_similar (void *abstract_surface, return CAIRO_INT_STATUS_UNSUPPORTED; } -static cairo_status_t -_cairo_ps_surface_set_matrix (void *abstract_surface, - cairo_matrix_t *matrix) -{ - cairo_ps_surface_t *surface = abstract_surface; - - return _cairo_image_surface_set_matrix (surface->image, matrix); -} - -static cairo_status_t -_cairo_ps_surface_set_filter (void *abstract_surface, - cairo_filter_t filter) -{ - cairo_ps_surface_t *surface = abstract_surface; - - return _cairo_image_surface_set_filter (surface->image, filter); -} - -static cairo_status_t -_cairo_ps_surface_set_repeat (void *abstract_surface, - int repeat) -{ - cairo_ps_surface_t *surface = abstract_surface; - - return _cairo_image_surface_set_repeat (surface->image, repeat); -} - static cairo_int_status_t _cairo_ps_surface_composite (cairo_operator_t operator, cairo_pattern_t *src, @@ -460,9 +433,6 @@ static const cairo_surface_backend_t cairo_ps_surface_backend = { _cairo_ps_surface_acquire_dest_image, _cairo_ps_surface_release_dest_image, _cairo_ps_surface_clone_similar, - _cairo_ps_surface_set_matrix, - _cairo_ps_surface_set_filter, - _cairo_ps_surface_set_repeat, _cairo_ps_surface_composite, _cairo_ps_surface_fill_rectangles, _cairo_ps_surface_composite_trapezoids, diff --git a/src/cairo_surface.c b/src/cairo_surface.c index b2d36df94..e0e6d948f 100644 --- a/src/cairo_surface.c +++ b/src/cairo_surface.c @@ -304,9 +304,7 @@ cairo_surface_set_matrix (cairo_surface_t *surface, cairo_matrix_t *matrix) if (surface == NULL) return CAIRO_STATUS_NULL_POINTER; - cairo_matrix_copy (&surface->matrix, matrix); - - return surface->backend->set_matrix (surface, matrix); + return cairo_matrix_copy (&surface->matrix, matrix); } slim_hidden_def(cairo_surface_set_matrix); @@ -327,7 +325,7 @@ cairo_surface_set_filter (cairo_surface_t *surface, cairo_filter_t filter) return CAIRO_STATUS_NULL_POINTER; surface->filter = filter; - return surface->backend->set_filter (surface, filter); + return CAIRO_STATUS_SUCCESS; } cairo_filter_t @@ -359,7 +357,7 @@ cairo_surface_set_repeat (cairo_surface_t *surface, int repeat) surface->repeat = repeat; - return surface->backend->set_repeat (surface, repeat); + return CAIRO_STATUS_SUCCESS; } slim_hidden_def(cairo_surface_set_repeat); diff --git a/src/cairo_xlib_surface.c b/src/cairo_xlib_surface.c index 626c0f69e..f7acf2763 100644 --- a/src/cairo_xlib_surface.c +++ b/src/cairo_xlib_surface.c @@ -442,10 +442,6 @@ _cairo_xlib_surface_clone_similar (void *abstract_surface, _draw_image_surface (clone, image_src, 0, 0); - cairo_surface_set_filter (&clone->base, src->filter); - cairo_surface_set_matrix (&clone->base, &src->matrix); - cairo_surface_set_repeat (&clone->base, src->repeat); - *clone_out = &clone->base; return CAIRO_STATUS_SUCCESS; @@ -455,14 +451,14 @@ _cairo_xlib_surface_clone_similar (void *abstract_surface, } static cairo_status_t -_cairo_xlib_surface_set_matrix (void *abstract_surface, cairo_matrix_t *matrix) +_cairo_xlib_surface_set_matrix (cairo_xlib_surface_t *surface, + cairo_matrix_t *matrix) { - cairo_xlib_surface_t *surface = abstract_surface; XTransform xtransform; if (!surface->picture) return CAIRO_STATUS_SUCCESS; - + xtransform.matrix[0][0] = _cairo_fixed_from_double (matrix->m[0][0]); xtransform.matrix[0][1] = _cairo_fixed_from_double (matrix->m[1][0]); xtransform.matrix[0][2] = _cairo_fixed_from_double (matrix->m[2][0]); @@ -475,26 +471,41 @@ _cairo_xlib_surface_set_matrix (void *abstract_surface, cairo_matrix_t *matrix) xtransform.matrix[2][1] = 0; xtransform.matrix[2][2] = _cairo_fixed_from_double (1); - if (CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM (surface)) + if (!CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM (surface)) { - XRenderSetPictureTransform (surface->dpy, surface->picture, &xtransform); - } else { - /* XXX: Need support here if using an old RENDER without support - for SetPictureTransform */ + static const XTransform identity = { { + { 1 << 16, 0x00000, 0x00000 }, + { 0x00000, 1 << 16, 0x00000 }, + { 0x00000, 0x00000, 1 << 16 }, + } }; + + if (memcmp (&xtransform, &identity, sizeof (XTransform)) == 0) + return CAIRO_STATUS_SUCCESS; + + return CAIRO_INT_STATUS_UNSUPPORTED; } + XRenderSetPictureTransform (surface->dpy, surface->picture, &xtransform); + return CAIRO_STATUS_SUCCESS; } static cairo_status_t -_cairo_xlib_surface_set_filter (void *abstract_surface, cairo_filter_t filter) +_cairo_xlib_surface_set_filter (cairo_xlib_surface_t *surface, + cairo_filter_t filter) { - cairo_xlib_surface_t *surface = abstract_surface; char *render_filter; - if (!(surface->picture - && CAIRO_SURFACE_RENDER_HAS_FILTERS(surface))) + if (!surface->picture) return CAIRO_STATUS_SUCCESS; + + if (!CAIRO_SURFACE_RENDER_HAS_FILTERS (surface)) + { + if (filter == CAIRO_FILTER_FAST || filter == CAIRO_FILTER_NEAREST) + return CAIRO_STATUS_SUCCESS; + + return CAIRO_INT_STATUS_UNSUPPORTED; + } switch (filter) { case CAIRO_FILTER_FAST: @@ -524,11 +535,10 @@ _cairo_xlib_surface_set_filter (void *abstract_surface, cairo_filter_t filter) } static cairo_status_t -_cairo_xlib_surface_set_repeat (void *abstract_surface, int repeat) +_cairo_xlib_surface_set_repeat (cairo_xlib_surface_t *surface, int repeat) { - cairo_xlib_surface_t *surface = abstract_surface; - unsigned long mask; XRenderPictureAttributes pa; + unsigned long mask; if (!surface->picture) return CAIRO_STATUS_SUCCESS; @@ -857,9 +867,6 @@ static const cairo_surface_backend_t cairo_xlib_surface_backend = { _cairo_xlib_surface_acquire_dest_image, _cairo_xlib_surface_release_dest_image, _cairo_xlib_surface_clone_similar, - _cairo_xlib_surface_set_matrix, - _cairo_xlib_surface_set_filter, - _cairo_xlib_surface_set_repeat, _cairo_xlib_surface_composite, _cairo_xlib_surface_fill_rectangles, _cairo_xlib_surface_composite_trapezoids, diff --git a/src/cairoint.h b/src/cairoint.h index 8782a199d..f46588ec6 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -585,18 +585,6 @@ typedef struct _cairo_surface_backend { cairo_surface_t *src, cairo_surface_t **clone_out); - cairo_status_t - (*set_matrix) (void *surface, - cairo_matrix_t *matrix); - - cairo_status_t - (*set_filter) (void *surface, - cairo_filter_t filter); - - cairo_status_t - (*set_repeat) (void *surface, - int repeat); - /* XXX: dst should be the first argument for consistency */ cairo_int_status_t (*composite) (cairo_operator_t operator, |