summaryrefslogtreecommitdiff
path: root/src/cairo-win32-printing-surface.c
diff options
context:
space:
mode:
authorOwen W. Taylor <otaylor@fishsoup.net>2008-09-29 00:02:18 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-09-29 09:46:49 +0100
commit6d0f2c4421e34a078469a81646a52dfa47b4dcf1 (patch)
treebe24c025f6d9b62661de5d29314e8fad7448e5d8 /src/cairo-win32-printing-surface.c
parent117f643e49615295eb37af24efffd8327429cbf9 (diff)
[pattern] Remove the hack to support cloning surface patterns.
Remove instances (abuses) of calling _cairo_pattern_acquire_surface() on a known-surface-pattern with a hack to say "give me the entire surface". If you know you just want the entire surface as an image surface, that can be done more simply. (Split from original patch on https://bugs.freedesktop.org/attachment.cgi?id=15703, by Chris Wilson - as usual all bugs are his.)
Diffstat (limited to 'src/cairo-win32-printing-surface.c')
-rw-r--r--src/cairo-win32-printing-surface.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/src/cairo-win32-printing-surface.c b/src/cairo-win32-printing-surface.c
index 55d5b196..1ffedad6 100644
--- a/src/cairo-win32-printing-surface.c
+++ b/src/cairo-win32-printing-surface.c
@@ -490,7 +490,6 @@ _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_surface_t *surf
{
cairo_status_t status;
cairo_extend_t extend;
- cairo_surface_t *pat_surface;
cairo_surface_attributes_t pat_attr;
cairo_image_surface_t *image;
void *image_extra;
@@ -516,25 +515,20 @@ _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_surface_t *surf
background_color = CAIRO_COLOR_BLACK;
extend = cairo_pattern_get_extend (&pattern->base);
- status = _cairo_pattern_acquire_surface ((cairo_pattern_t *)pattern,
- (cairo_surface_t *)surface,
- 0, 0, -1, -1,
- &pat_surface, &pat_attr);
- if (status)
- return status;
- status = _cairo_surface_acquire_source_image (pat_surface, &image, &image_extra);
+ status = _cairo_surface_acquire_source_image (pattern->surface,
+ &image, &image_extra);
if (status)
- goto FINISH;
+ return status;
if (image->base.status) {
status = image->base.status;
- goto FINISH2;
+ goto CLEANUP_IMAGE;
}
if (image->width == 0 || image->height == 0) {
status = CAIRO_STATUS_SUCCESS;
- goto FINISH2;
+ goto CLEANUP_IMAGE;
}
if (image->format != CAIRO_FORMAT_RGB24) {
@@ -545,7 +539,7 @@ _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_surface_t *surf
image->height);
if (opaque_surface->status) {
status = opaque_surface->status;
- goto FINISH3;
+ goto CLEANUP_OPAQUE_IMAGE;
}
_cairo_pattern_init_for_surface (&opaque_pattern, &image->base);
@@ -557,7 +551,7 @@ _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_surface_t *surf
image->width, image->height);
if (status) {
_cairo_pattern_fini (&opaque_pattern.base);
- goto FINISH3;
+ goto CLEANUP_OPAQUE_IMAGE;
}
status = _cairo_surface_composite (CAIRO_OPERATOR_OVER,
@@ -571,7 +565,7 @@ _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_surface_t *surf
image->height);
if (status) {
_cairo_pattern_fini (&opaque_pattern.base);
- goto FINISH3;
+ goto CLEANUP_OPAQUE_IMAGE;
}
_cairo_pattern_fini (&opaque_pattern.base);
@@ -602,8 +596,10 @@ _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_surface_t *surf
SaveDC (surface->dc);
_cairo_matrix_to_win32_xform (&m, &xform);
- if (!SetWorldTransform (surface->dc, &xform))
- return _cairo_win32_print_gdi_error ("_win32_scaled_font_set_world_transform");
+ if (! SetWorldTransform (surface->dc, &xform)) {
+ status = _cairo_win32_print_gdi_error ("_win32_scaled_font_set_world_transform");
+ goto CLEANUP_OPAQUE_IMAGE;
+ }
oldmode = SetStretchBltMode(surface->dc, HALFTONE);
@@ -635,19 +631,20 @@ _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_surface_t *surf
&bi,
DIB_RGB_COLORS,
SRCCOPY))
- return _cairo_win32_print_gdi_error ("_cairo_win32_printing_surface_paint(StretchDIBits)");
+ {
+ status = _cairo_win32_print_gdi_error ("_cairo_win32_printing_surface_paint(StretchDIBits)");
+ goto CLEANUP_OPAQUE_IMAGE;
+ }
}
}
SetStretchBltMode(surface->dc, oldmode);
RestoreDC (surface->dc, -1);
-FINISH3:
+CLEANUP_OPAQUE_IMAGE:
if (opaque_image != image)
cairo_surface_destroy (opaque_surface);
-FINISH2:
- _cairo_surface_release_source_image (pat_surface, image, image_extra);
-FINISH:
- _cairo_pattern_release_surface ((cairo_pattern_t *)pattern, pat_surface, &pat_attr);
+CLEANUP_IMAGE:
+ _cairo_surface_release_source_image (pattern->surface, image, image_extra);
return status;
}