diff options
author | Anton Danilkin <afdw@yandex.ru> | 2020-11-11 17:33:31 +0100 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2020-11-13 12:04:51 +0000 |
commit | b5175fd8a6c8ff555e0a127e3fe42cdad241aad1 (patch) | |
tree | fd65790664cf79f91075427e2f8a67fa52577885 /boilerplate/cairo-boilerplate-win32-printing.c | |
parent | ab7b45feb701032c73ef0c190d963ee3ff76a815 (diff) | |
download | cairo-b5175fd8a6c8ff555e0a127e3fe42cdad241aad1.tar.gz |
Fix testing in the full mode for PDF, PS and SVG backends
Fix how offset, scale and transparency are handled.
Also do the same change in the "win32-printing" backend as it has a copy of the code from PDS, PS and SVG backends.
Diffstat (limited to 'boilerplate/cairo-boilerplate-win32-printing.c')
-rw-r--r-- | boilerplate/cairo-boilerplate-win32-printing.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/boilerplate/cairo-boilerplate-win32-printing.c b/boilerplate/cairo-boilerplate-win32-printing.c index 5a630664b..4bc1dd459 100644 --- a/boilerplate/cairo-boilerplate-win32-printing.c +++ b/boilerplate/cairo-boilerplate-win32-printing.c @@ -270,22 +270,28 @@ _cairo_boilerplate_win32_printing_surface_write_to_png (cairo_surface_t *surface cairo_t *cr; cairo_status_t status; - /* Both surface and ptc->target were originally created at the - * same dimensions. We want a 1:1 copy here, so we first clear any - * device offset on surface. - * - * In a more realistic use case of device offsets, the target of - * this copying would be of a different size than the source, and - * the offset would be desirable during the copy operation. */ - cairo_surface_set_device_offset (surface, 0, 0); - if (ptc->target) { + /* Both surface and ptc->target were originally created at the + * same dimensions. We want a 1:1 copy here, so we first clear any + * device offset and scale on surface. + * + * In a more realistic use case of device offsets, the target of + * this copying would be of a different size than the source, and + * the offset would be desirable during the copy operation. */ + double x_offset, y_offset; + double x_scale, y_scale; + cairo_surface_get_device_offset (surface, &x_offset, &y_offset); + cairo_surface_get_device_scale (surface, &x_scale, &y_scale); + cairo_surface_set_device_offset (surface, 0, 0); + cairo_surface_set_device_scale (surface, 1, 1); cairo_t *cr; cr = cairo_create (ptc->target); cairo_set_source_surface (cr, surface, 0, 0); cairo_paint (cr); cairo_show_page (cr); cairo_destroy (cr); + cairo_surface_set_device_offset (surface, x_offset, y_offset); + cairo_surface_set_device_scale (surface, x_scale, y_scale); cairo_surface_finish (surface); surface = ptc->target; |