From ajohnson at kemper.freedesktop.org Mon Oct 5 04:46:28 2015 From: ajohnson at kemper.freedesktop.org (Adrian Johnson) Date: Mon, 5 Oct 2015 04:46:28 -0700 (PDT) Subject: [cairo-commit] src/cairo-ps-surface.c Message-ID: <20151005114628.5878C761E3@kemper.freedesktop.org> src/cairo-ps-surface.c | 130 +++++++++++-------------------------------------- 1 file changed, 31 insertions(+), 99 deletions(-) New commits: commit 0537479bd1d4c5a3bc0f6f41dec4deb98481f34a Author: Adrian Johnson Date: Mon Oct 5 16:10:02 2015 +1030 ps: merge emit_recording surface and emit_recording_subsurface into one function Most of each function was identical. diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 03eba62..12b682b 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -2914,8 +2914,10 @@ _cairo_ps_surface_emit_jpeg_image (cairo_ps_surface_t *surface, } static cairo_status_t -_cairo_ps_surface_emit_recording_surface (cairo_ps_surface_t *surface, - cairo_surface_t *recording_surface) +_cairo_ps_surface_emit_recording_surface (cairo_ps_surface_t *surface, + cairo_surface_t *recording_surface, + cairo_bool_t subsurface, + const cairo_rectangle_int_t *extents) { double old_width, old_height; cairo_matrix_t old_cairo_to_ps; @@ -2938,12 +2940,30 @@ _cairo_ps_surface_emit_recording_surface (cairo_ps_surface_t *surface, if (_cairo_surface_is_snapshot (recording_surface)) free_me = recording_surface = _cairo_surface_snapshot_get_target (recording_surface); - status = - _cairo_recording_surface_get_bbox ((cairo_recording_surface_t *) recording_surface, - &bbox, - NULL); - if (unlikely (status)) - goto err; + if (subsurface) { + surface->page_bbox.x = surface->page_bbox.y = 0; + surface->page_bbox.width = surface->width = extents->width; + surface->page_bbox.height = surface->height = extents->height; + +#if DEBUG_PS + _cairo_output_stream_printf (surface->stream, + "%% _cairo_ps_surface_emit_recording_subsurface" + " (%d, %d), (%d, %d)\n", + extents->x, extents->y, + extents->width, extents->height); +#endif + + } else { + status = + _cairo_recording_surface_get_bbox ((cairo_recording_surface_t *) recording_surface, + &bbox, + NULL); + if (unlikely (status)) + goto err; + + surface->width = _cairo_fixed_to_double (bbox.p2.x - bbox.p1.x); + surface->height = _cairo_fixed_to_double (bbox.p2.y - bbox.p1.y); + _cairo_box_round_to_rectangle (&bbox, &surface->page_bbox); #if DEBUG_PS _cairo_output_stream_printf (surface->stream, @@ -2953,93 +2973,8 @@ _cairo_ps_surface_emit_recording_surface (cairo_ps_surface_t *surface, _cairo_fixed_to_double (bbox.p2.x), _cairo_fixed_to_double (bbox.p2.y)); #endif - - surface->width = _cairo_fixed_to_double (bbox.p2.x - bbox.p1.x); - surface->height = _cairo_fixed_to_double (bbox.p2.y - bbox.p1.y); - _cairo_box_round_to_rectangle (&bbox, &surface->page_bbox); - - surface->current_pattern_is_solid_color = FALSE; - _cairo_pdf_operators_reset (&surface->pdf_operators); - cairo_matrix_init (&surface->cairo_to_ps, 1, 0, 0, -1, 0, surface->height); - _cairo_pdf_operators_set_cairo_to_pdf_matrix (&surface->pdf_operators, - &surface->cairo_to_ps); - _cairo_output_stream_printf (surface->stream, " q\n"); - - if (recording_surface->content == CAIRO_CONTENT_COLOR) { - surface->content = CAIRO_CONTENT_COLOR; - _cairo_output_stream_printf (surface->stream, - " 0 g %d %d %d %d rectfill\n", - surface->page_bbox.x, - surface->page_bbox.y, - surface->page_bbox.width, - surface->page_bbox.height); } - status = _cairo_recording_surface_replay_region (recording_surface, - NULL, - &surface->base, - CAIRO_RECORDING_REGION_NATIVE); - assert (status != CAIRO_INT_STATUS_UNSUPPORTED); - if (unlikely (status)) - goto err; - - status = _cairo_pdf_operators_flush (&surface->pdf_operators); - if (unlikely (status)) - goto err; - - _cairo_output_stream_printf (surface->stream, " Q\n"); - - _cairo_surface_clipper_reset (&surface->clipper); - surface->clipper = old_clipper; - surface->content = old_content; - surface->width = old_width; - surface->height = old_height; - surface->page_bbox = old_page_bbox; - surface->current_pattern_is_solid_color = FALSE; - _cairo_pdf_operators_reset (&surface->pdf_operators); - surface->cairo_to_ps = old_cairo_to_ps; - - _cairo_pdf_operators_set_cairo_to_pdf_matrix (&surface->pdf_operators, - &surface->cairo_to_ps); - -err: - cairo_surface_destroy (free_me); - return status; -} - -static cairo_int_status_t -_cairo_ps_surface_emit_recording_subsurface (cairo_ps_surface_t *surface, - cairo_surface_t *recording_surface, - const cairo_rectangle_int_t *extents) -{ - double old_width, old_height; - cairo_matrix_t old_cairo_to_ps; - cairo_content_t old_content; - cairo_rectangle_int_t old_page_bbox; - cairo_surface_clipper_t old_clipper; - cairo_surface_t *free_me = NULL; - cairo_int_status_t status; - - old_content = surface->content; - old_width = surface->width; - old_height = surface->height; - old_page_bbox = surface->page_bbox; - old_cairo_to_ps = surface->cairo_to_ps; - old_clipper = surface->clipper; - _cairo_surface_clipper_init (&surface->clipper, - _cairo_ps_surface_clipper_intersect_clip_path); - -#if DEBUG_PS - _cairo_output_stream_printf (surface->stream, - "%% _cairo_ps_surface_emit_recording_subsurface (%d, %d), (%d, %d)\n", - extents->x, extents->y, - extents->width, extents->height); -#endif - - surface->page_bbox.x = surface->page_bbox.y = 0; - surface->page_bbox.width = surface->width = extents->width; - surface->page_bbox.height = surface->height = extents->height; - surface->current_pattern_is_solid_color = FALSE; _cairo_pdf_operators_reset (&surface->pdf_operators); cairo_matrix_init (&surface->cairo_to_ps, 1, 0, 0, -1, 0, surface->height); @@ -3047,9 +2982,6 @@ _cairo_ps_surface_emit_recording_subsurface (cairo_ps_surface_t *surface, &surface->cairo_to_ps); _cairo_output_stream_printf (surface->stream, " q\n"); - if (_cairo_surface_is_snapshot (recording_surface)) - free_me = recording_surface = _cairo_surface_snapshot_get_target (recording_surface); - if (recording_surface->content == CAIRO_CONTENT_COLOR) { surface->content = CAIRO_CONTENT_COLOR; _cairo_output_stream_printf (surface->stream, @@ -3061,7 +2993,7 @@ _cairo_ps_surface_emit_recording_subsurface (cairo_ps_surface_t *surface, } status = _cairo_recording_surface_replay_region (recording_surface, - extents, + subsurface ? extents : NULL, &surface->base, CAIRO_RECORDING_REGION_NATIVE); assert (status != CAIRO_INT_STATUS_UNSUPPORTED); @@ -3158,9 +3090,9 @@ _cairo_ps_surface_emit_surface (cairo_ps_surface_t *surface, if (source_surface->type == CAIRO_SURFACE_TYPE_RECORDING) { if (source_surface->backend->type == CAIRO_SURFACE_TYPE_SUBSURFACE) { cairo_surface_subsurface_t *sub = (cairo_surface_subsurface_t *) source_surface; - status = _cairo_ps_surface_emit_recording_subsurface (surface, sub->target, &sub->extents); + status = _cairo_ps_surface_emit_recording_surface (surface, sub->target, TRUE, &sub->extents); } else { - status = _cairo_ps_surface_emit_recording_surface (surface, source_surface); + status = _cairo_ps_surface_emit_recording_surface (surface, source_surface, FALSE, NULL); } } else { cairo_image_surface_t *image = (cairo_image_surface_t *) source_surface; From psychon at kemper.freedesktop.org Wed Oct 14 05:27:19 2015 From: psychon at kemper.freedesktop.org (Uli Schlachter) Date: Wed, 14 Oct 2015 05:27:19 -0700 (PDT) Subject: [cairo-commit] 2 commits - src/cairo-xcb-surface.c Message-ID: <20151014122719.A875276105@kemper.freedesktop.org> src/cairo-xcb-surface.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) New commits: commit 25a55822b4e22728834c96c8e73176d42bb406e3 Author: Uli Schlachter Date: Wed Oct 14 14:24:16 2015 +0200 xcb: Fix _put_image_boxes() if no SHM is available This function tries to use _cairo_xcb_connection_put_image() to do the actual work. However, that function can only be used for images with "native" stride. If we only want to upload a rectangle from within an image, the function _cairo_xcb_connection_put_subimage() has to be used. This function makes sure that the correct information is sent to the X11 server. No unit test for this, because we currently do not test the !SHM case automatically. Perhaps we should? Signed-off-by: Uli Schlachter diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index 2403a0d..d4d60ad 100644 --- a/src/cairo-xcb-surface.c +++ b/src/cairo-xcb-surface.c @@ -691,15 +691,15 @@ _put_image_boxes (cairo_xcb_surface_t *surface, int y = _cairo_fixed_integer_part (b->p1.y); int width = _cairo_fixed_integer_part (b->p2.x - b->p1.x); int height = _cairo_fixed_integer_part (b->p2.y - b->p1.y); - _cairo_xcb_connection_put_image (surface->connection, - surface->drawable, gc, - width, height, - x, y, - image->depth, - image->stride, - image->data + - x * PIXMAN_FORMAT_BPP (image->pixman_format) / 8 + - y * image->stride); + _cairo_xcb_connection_put_subimage (surface->connection, + surface->drawable, gc, + x, y, + width, height, + PIXMAN_FORMAT_BPP (image->pixman_format) / 8, + image->stride, + x, y, + image->depth, + image->data); } } commit d31dc73f9ba1facdbeee722c022d438f15e5f264 Author: Uli Schlachter Date: Wed Oct 14 14:22:50 2015 +0200 xcb: Fix _put_shm_image_boxes if no SHM available This function always returned CAIRO_INT_STATUS_SUCCESS, even if it didn't do anything. This commit makes the function return CAIRO_INT_STATUS_UNSUPPORTED instead. No unit test for this, because we currently do not test the !SHM case automatically. Perhaps we should? Signed-off-by: Uli Schlachter diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index d7e0d73..2403a0d 100644 --- a/src/cairo-xcb-surface.c +++ b/src/cairo-xcb-surface.c @@ -646,9 +646,8 @@ _put_shm_image_boxes (cairo_xcb_surface_t *surface, shm_info->offset); } } + return CAIRO_INT_STATUS_SUCCESS; } - - return CAIRO_INT_STATUS_SUCCESS; #endif return CAIRO_INT_STATUS_UNSUPPORTED; From bryce at kemper.freedesktop.org Wed Oct 14 18:14:07 2015 From: bryce at kemper.freedesktop.org (Bryce Harrington) Date: Wed, 14 Oct 2015 18:14:07 -0700 (PDT) Subject: [cairo-commit] 2 commits - build/aclocal.cairo.m4 NEWS Message-ID: <20151015011407.8CE0876258@kemper.freedesktop.org> NEWS | 63 ++++++++++++++++++++++++------------------------- build/aclocal.cairo.m4 | 2 - 2 files changed, 33 insertions(+), 32 deletions(-) New commits: commit e294ca19f2777fa2abbd59eb7aa375f801c92eb6 Author: Bryce Harrington Date: Wed Oct 14 18:13:22 2015 -0700 NEWS: Whitespace cleanup diff --git a/NEWS b/NEWS index 29102a9..ffe3c28 100644 --- a/NEWS +++ b/NEWS @@ -117,6 +117,7 @@ Bug Fixes (fdo bugs #89338, #89340, #89356, #89354) * Fix various documentation warnings and errors + Release 1.14.0 (2014-10-13 Bryce Harrington ) ==================================================================== Hard to believe it's been over a year since our last release, but it's @@ -618,7 +619,7 @@ Bug fixes and then back again to user coordinates (cairo_copy_path, cairo_append_path) https://bugs.freedesktop.org/show_bug.cgi?id=54732 - + Fix extents computations for a degenerate path consisting only of a move-to https://bugs.freedesktop.org/show_bug.cgi?id=54549 @@ -626,7 +627,7 @@ Bug fixes Prevent crashing on a degenerate project edge after polygon intersection https://bugs.freedesktop.org/show_bug.cgi?id=54822 - + Release 1.12.2 (2012-04-29 Chris Wilson ) @@ -646,7 +647,7 @@ Bug fixes Allow applications to create 0x0 xlib surfaces, such as used by LibreOffice. https://bugs.freedesktop.org/show_bug.cgi?id=49118 - + Trim composite extents for SOURCE/CLEAR operators to the mask. Use fallback fonts in PDF for unhandled computed glyph widths @@ -960,7 +961,7 @@ drawing commands made by an application. This can be used to inspecting applications to understand issues and as a means for profiling real-world usage of cairo. -The traces generated by cairo-trace have been collected in +The traces generated by cairo-trace have been collected in git://git.cairographics.org/git/cairo-traces @@ -1176,7 +1177,7 @@ API additions The Cairo region API was actually added a couple of snapshots ago, but we forgot to mention it at the time. A simple API for the handling of rectangular pixel-aligned regions by Soeren Sandmann. - + Backend-specific improvements ----------------------------- @@ -1381,10 +1382,10 @@ New experimental backends: QT OpenVG - The initial work was done by Øyvind Kolås, and made ready for - inclusion by Pierre Tardy. + inclusion by Pierre Tardy. OpenGL - An advanced OpenGL compositor. The aim is to write a integrate - directed rendering using OpenGL at a high-level into Cairo. In + directed rendering using OpenGL at a high-level into Cairo. In contrast to the previous attempt using Glitz which tried to implement the RENDER protocol on top of OpenGL, using the high-level interface should permit greater flexibility and @@ -2823,7 +2824,7 @@ Rename ATSUI font backend to Quartz font backend. This affects the following usage: --enable-atsui -> --enable-quartz-font - CAIRO_HAS_ATSUI_FONT -> CAIRO_HAS_QUARTZ_FONT + CAIRO_HAS_ATSUI_FONT -> CAIRO_HAS_QUARTZ_FONT CAIRO_FONT_TYPE_ATSUI -> CAIRO_FONT_TYPE_QUARTZ cairo_atsui_font_face_create_for_atsu_font_id -> @@ -3636,8 +3637,8 @@ complain that some cleanup work is already done, but there you have it.) This fixes the bug causing OpenOffice.org to crash as described here: - XError on right click menus in OOo. - https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=243811 + XError on right click menus in OOo. + https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=243811 Use IncludeInferiors when using xlib surface as a source (Ryan Lortie) ---------------------------------------------------------------------- @@ -3817,16 +3818,16 @@ notes on using it: To build, do: - make malloc-stats.so + make malloc-stats.so inside util/, and to use, run: - LD_PRELOAD=malloc-stats.so some-program + LD_PRELOAD=malloc-stats.so some-program For binaries managed by libtool, eg, cairo-perf, do: - ../libtool --mode=execute /bin/true ./cairo-perf - LD_PRELOAD="../util/malloc-stats.so" .libs/lt-cairo-perf + ../libtool --mode=execute /bin/true ./cairo-perf + LD_PRELOAD="../util/malloc-stats.so" .libs/lt-cairo-perf Finally, the cairo-perf-diff-files utility was enhanced to allow for generating performance reports from several runs of the same backend @@ -5669,9 +5670,9 @@ support this use case, we have added 4 new function calls that are specific to the PostScript backend: cairo_ps_surface_set_size - cairo_ps_surface_dsc_comment - cairo_ps_surface_dsc_begin_setup - cairo_ps_surface_dsc_begin_page_setup + cairo_ps_surface_dsc_comment + cairo_ps_surface_dsc_begin_setup + cairo_ps_surface_dsc_begin_page_setup These functions allow variation of the page size/orientation from one page to the next in the PostScript output. They also allow the toolkit @@ -6957,23 +6958,23 @@ Major API changes cc `pkg-config --cflags --libs cairo` -o foo foo.c IMPORTANT: Users with old versions of cairo installed will need to - manually remove cairo.h and cairo-features.h from the - system include directories in order to prevent the old - headers from being used in preference to the new ones. + manually remove cairo.h and cairo-features.h from the + system include directories in order to prevent the old + headers from being used in preference to the new ones. 2) The backend-specific portions of the old monolithic cairo.h have been split out into individual public header files. The new files are: cairo-atsui.h - cairo-ft.h - cairo-glitz.h - cairo-pdf.h - cairo-png.h - cairo-ps.h + cairo-ft.h + cairo-glitz.h + cairo-pdf.h + cairo-png.h + cairo-ps.h cairo-quartz.h - cairo-xcb.h - cairo-xlib.h + cairo-xcb.h + cairo-xlib.h Applications will need to be modified to explicitly include the new header files where appropriate. @@ -7337,10 +7338,10 @@ Better text support This snapshot provides much better text support by implementing the following four functions: - cairo_text_extents - cairo_glyph_extents - cairo_text_path - cairo_glyph_path + cairo_text_extents + cairo_glyph_extents + cairo_text_path + cairo_glyph_path The text/glyph_extents functions can be used to determine the bounding box (and advance) for text as if drawn by show_text/glyphs. commit 7cc77d1ceea850d5728f4fad59ec18984dbc9ccb Author: Bryce Harrington Date: Wed Oct 14 18:10:22 2015 -0700 build: Use memory barriers for ARM ARM has much weaker memory ordering guarantees than x86 by default, and needs the memory barriers. A similar fix exists in the Skia codebase. Fix suggested by Nathan Froyd. Fixes: FDO #90302 Signed-off-by: Bryce Harrington Acked-by: "Henry (Yu) Song" diff --git a/build/aclocal.cairo.m4 b/build/aclocal.cairo.m4 index 44ba5fd..f0ea23c 100644 --- a/build/aclocal.cairo.m4 +++ b/build/aclocal.cairo.m4 @@ -215,7 +215,7 @@ AC_DEFUN([CAIRO_CHECK_ATOMIC_OP_NEEDS_MEMORY_BARRIER], case $host_cpu in i?86) cairo_cv_atomic_op_needs_memory_barrier="no" ;; x86_64) cairo_cv_atomic_op_needs_memory_barrier="no" ;; - arm*) cairo_cv_atomic_op_needs_memory_barrier="no" ;; + arm*) cairo_cv_atomic_op_needs_memory_barrier="yes" ;; *) cairo_cv_atomic_op_needs_memory_barrier="yes" ;; esac ]) From bryce at freedesktop.org Thu Oct 15 16:07:27 2015 From: bryce at freedesktop.org (Bryce Harrington) Date: Thu, 15 Oct 2015 16:07:27 -0700 (PDT) Subject: [cairo-commit] [cairo-www] src/matrix_transform src/matrix_transform.mdwn Message-ID: <20151015230727.B8E4518192@annarchy.freedesktop.org> src/matrix_transform.mdwn | 2 +- src/matrix_transform/matrix_multiplication.gif |binary 2 files changed, 1 insertion(+), 1 deletion(-) New commits: commit 0d57a3aeb51308cf3de138d2205dbc1dfcdfe386 Author: Lawrence D'Oliveiro Date: Fri Oct 2 18:26:50 2015 +1300 PATCH cairo-www: Bring External Image Into Wiki Here is a resubmission that gets rid of that external image altogether, and substitutes my GIF animation. I can tweak the format of the GIF image as necessary (is it too wide?). I generated it from a Python script using Qahirah. Reviewed-by: Bryce Harrington diff --git a/src/matrix_transform.mdwn b/src/matrix_transform.mdwn index 60f6396..93acde1 100644 --- a/src/matrix_transform.mdwn +++ b/src/matrix_transform.mdwn @@ -25,7 +25,7 @@ To apply more than one transformation you can multiply matrix. 'Unfortunately' m It's easy to figure out that for matrix multiplication *A\*B is not always the same as B\*A*. The rule of matrix multiplication is illustrated with a picture here: -Matrix multiplication rule +[[!img "matrix_multiplication.gif" width="911" height="117" link="no"]] In a cairo.matrix(1,2,3,4,5,6), 1 is a11, 2 is a21, 3 is a12, 4 is a22, 5 is a13 and 6 is a23. a31 and a32 are 0, a33 is 1. diff --git a/src/matrix_transform/matrix_multiplication.gif b/src/matrix_transform/matrix_multiplication.gif new file mode 100644 index 0000000..066c7ae Binary files /dev/null and b/src/matrix_transform/matrix_multiplication.gif differ From ajohnson at kemper.freedesktop.org Sat Oct 17 01:05:26 2015 From: ajohnson at kemper.freedesktop.org (Adrian Johnson) Date: Sat, 17 Oct 2015 01:05:26 -0700 (PDT) Subject: [cairo-commit] 6 commits - src/cairo-pdf-surface.c src/cairo-ps-surface.c src/cairo-surface-wrapper.c src/win32 test/reference Message-ID: <20151017080526.9CC7076264@kemper.freedesktop.org> src/cairo-pdf-surface.c | 33 + src/cairo-ps-surface.c | 36 +- src/cairo-surface-wrapper.c | 6 src/win32/cairo-win32-printing-surface.c | 523 +++++++++++++++++++++++-------- src/win32/cairo-win32-private.h | 1 test/reference/raster-source.ps.ref.png |binary 6 files changed, 444 insertions(+), 155 deletions(-) New commits: commit 6656cafebfdac3365e8f903eb408043507a5e551 Author: Adrian Johnson Date: Sat Oct 17 18:33:01 2015 +1030 win32-print: support raster_source patterns diff --git a/src/win32/cairo-win32-printing-surface.c b/src/win32/cairo-win32-printing-surface.c index 05964e5..ad54a4c 100644 --- a/src/win32/cairo-win32-printing-surface.c +++ b/src/win32/cairo-win32-printing-surface.c @@ -51,10 +51,12 @@ #include "cairo-paginated-private.h" #include "cairo-clip-private.h" +#include "cairo-composite-rectangles-private.h" #include "cairo-win32-private.h" #include "cairo-recording-surface-inline.h" #include "cairo-scaled-font-subsets-private.h" #include "cairo-image-info-private.h" +#include "cairo-image-surface-inline.h" #include "cairo-image-surface-private.h" #include "cairo-surface-backend-private.h" #include "cairo-surface-clipper-private.h" @@ -170,20 +172,145 @@ _cairo_win32_printing_surface_init_language_pack (cairo_win32_printing_surface_t } } +/** + * _cairo_win32_printing_surface_acquire_image_pattern: + * @surface: the win32 printing surface + * @pattern: A #cairo_pattern_t of type SURFACE or RASTER_SOURCE to use as the source + * @extents: extents of the operation that is using this source + * @image_pattern: returns pattern containing acquired image. The matrix (adjusted for + * the device offset of raster source) is copied from the pattern. + * @width: returns width of the pattern + * @height: returns height of pattern + * @image_extra: returns image extra for image type surface + * + * Acquire source surface or raster source pattern. + **/ +static cairo_status_t +_cairo_win32_printing_surface_acquire_image_pattern ( + cairo_win32_printing_surface_t *surface, + const cairo_pattern_t *pattern, + const cairo_rectangle_int_t *extents, + cairo_surface_pattern_t *image_pattern, + int *width, + int *height, + void **image_extra) +{ + cairo_status_t status; + cairo_image_surface_t *image; + cairo_matrix_t tm; + double x = 0; + double y = 0; + + switch (pattern->type) { + case CAIRO_PATTERN_TYPE_SURFACE: { + cairo_surface_t *surf = ((cairo_surface_pattern_t *) pattern)->surface; + + status = _cairo_surface_acquire_source_image (surf, &image, image_extra); + if (unlikely (status)) + return status; + + *width = image->width; + *height = image->height; + } break; + + case CAIRO_PATTERN_TYPE_RASTER_SOURCE: { + cairo_surface_t *surf; + cairo_box_t box; + cairo_rectangle_int_t rect; + cairo_raster_source_pattern_t *raster; + + /* get the operation extents in pattern space */ + _cairo_box_from_rectangle (&box, extents); + _cairo_matrix_transform_bounding_box_fixed (&pattern->matrix, &box, NULL); + _cairo_box_round_to_rectangle (&box, &rect); + surf = _cairo_raster_source_pattern_acquire (pattern, &surface->win32.base, &rect); + if (!surf) + return CAIRO_INT_STATUS_UNSUPPORTED; + + assert (_cairo_surface_is_image (surf)); + image = (cairo_image_surface_t *) surf; + cairo_surface_get_device_offset (surf, &x, &y); + + raster = (cairo_raster_source_pattern_t *) pattern; + *width = raster->extents.width; + *height = raster->extents.height; + } break; + + case CAIRO_PATTERN_TYPE_SOLID: + case CAIRO_PATTERN_TYPE_LINEAR: + case CAIRO_PATTERN_TYPE_RADIAL: + case CAIRO_PATTERN_TYPE_MESH: + default: + ASSERT_NOT_REACHED; + break; + } + + _cairo_pattern_init_for_surface (image_pattern, &image->base); + image_pattern->base.extend = pattern->extend; + cairo_matrix_init_translate (&tm, x, y); + status = cairo_matrix_invert (&tm); + /* translation matrices are invertibile */ + assert (status == CAIRO_STATUS_SUCCESS); + + image_pattern->base.matrix = pattern->matrix; + cairo_matrix_multiply (&image_pattern->base.matrix, &image_pattern->base.matrix, &tm); + + return CAIRO_STATUS_SUCCESS; +} + +static void +_cairo_win32_printing_surface_release_image_pattern (cairo_win32_printing_surface_t *surface, + const cairo_pattern_t *pattern, + cairo_surface_pattern_t *image_pattern, + void *image_extra) +{ + cairo_surface_t *surf = image_pattern->surface; + + _cairo_pattern_fini (&image_pattern->base); + switch (pattern->type) { + case CAIRO_PATTERN_TYPE_SURFACE: { + cairo_surface_pattern_t *surf_pat = (cairo_surface_pattern_t *) pattern; + cairo_image_surface_t *image = (cairo_image_surface_t *) surf; + _cairo_surface_release_source_image (surf_pat->surface, image, image_extra); + } break; + + case CAIRO_PATTERN_TYPE_RASTER_SOURCE: + _cairo_raster_source_pattern_release (pattern, surf); + break; + + case CAIRO_PATTERN_TYPE_SOLID: + case CAIRO_PATTERN_TYPE_LINEAR: + case CAIRO_PATTERN_TYPE_RADIAL: + case CAIRO_PATTERN_TYPE_MESH: + default: + ASSERT_NOT_REACHED; + break; + } +} + static cairo_int_status_t -analyze_surface_pattern_transparency (cairo_surface_pattern_t *pattern) +analyze_surface_pattern_transparency (cairo_win32_printing_surface_t *surface, + const cairo_pattern_t *pattern, + const cairo_rectangle_int_t *extents) { + cairo_surface_pattern_t image_pattern; cairo_image_surface_t *image; void *image_extra; cairo_int_status_t status; cairo_image_transparency_t transparency; - - status = _cairo_surface_acquire_source_image (pattern->surface, - &image, - &image_extra); + int pattern_width, pattern_height; + + status = _cairo_win32_printing_surface_acquire_image_pattern (surface, + pattern, + extents, + &image_pattern, + &pattern_width, + &pattern_height, + &image_extra); if (status) return status; + image = (cairo_image_surface_t *)(image_pattern.surface); transparency = _cairo_image_analyze_transparency (image); switch (transparency) { case CAIRO_IMAGE_UNKNOWN: @@ -198,7 +325,7 @@ analyze_surface_pattern_transparency (cairo_surface_pattern_t *pattern) break; } - _cairo_surface_release_source_image (pattern->surface, image, image_extra); + _cairo_win32_printing_surface_release_image_pattern (surface, pattern, &image_pattern, image_extra); return status; } @@ -209,8 +336,7 @@ surface_pattern_supported (const cairo_surface_pattern_t *pattern) if (_cairo_surface_is_recording (pattern->surface)) return TRUE; - if (cairo_surface_get_type (pattern->surface) != CAIRO_SURFACE_TYPE_WIN32 && - pattern->surface->backend->acquire_source_image == NULL) + if (pattern->surface->backend->acquire_source_image == NULL) { return FALSE; } @@ -221,22 +347,34 @@ surface_pattern_supported (const cairo_surface_pattern_t *pattern) static cairo_bool_t pattern_supported (cairo_win32_printing_surface_t *surface, const cairo_pattern_t *pattern) { - if (pattern->type == CAIRO_PATTERN_TYPE_SOLID) + switch (pattern->type) { + case CAIRO_PATTERN_TYPE_SOLID: return TRUE; - if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE) - return surface_pattern_supported ((const cairo_surface_pattern_t *) pattern); - - if (pattern->type == CAIRO_PATTERN_TYPE_LINEAR) + case CAIRO_PATTERN_TYPE_LINEAR: return surface->win32.flags & CAIRO_WIN32_SURFACE_CAN_RECT_GRADIENT; - return FALSE; + case CAIRO_PATTERN_TYPE_RADIAL: + case CAIRO_PATTERN_TYPE_MESH: + return FALSE; + + case CAIRO_PATTERN_TYPE_SURFACE: + return surface_pattern_supported ((cairo_surface_pattern_t *) pattern); + + case CAIRO_PATTERN_TYPE_RASTER_SOURCE: + return TRUE; + + default: + ASSERT_NOT_REACHED; + return FALSE; + } } static cairo_int_status_t _cairo_win32_printing_surface_analyze_operation (cairo_win32_printing_surface_t *surface, - cairo_operator_t op, - const cairo_pattern_t *pattern) + cairo_operator_t op, + const cairo_pattern_t *pattern, + const cairo_rectangle_int_t *extents) { if (! pattern_supported (surface, pattern)) return CAIRO_INT_STATUS_UNSUPPORTED; @@ -267,11 +405,8 @@ _cairo_win32_printing_surface_analyze_operation (cairo_win32_printing_surface_t * background to convert the pattern to opaque. */ - if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE) { - cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) pattern; - - return analyze_surface_pattern_transparency (surface_pattern); - } + if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE || pattern->type == CAIRO_PATTERN_TYPE_RASTER_SOURCE) + return analyze_surface_pattern_transparency (surface, pattern, extents); if (_cairo_pattern_is_opaque (pattern, NULL)) return CAIRO_STATUS_SUCCESS; @@ -281,10 +416,11 @@ _cairo_win32_printing_surface_analyze_operation (cairo_win32_printing_surface_t static cairo_bool_t _cairo_win32_printing_surface_operation_supported (cairo_win32_printing_surface_t *surface, - cairo_operator_t op, - const cairo_pattern_t *pattern) + cairo_operator_t op, + const cairo_pattern_t *pattern, + const cairo_rectangle_int_t *extents) { - if (_cairo_win32_printing_surface_analyze_operation (surface, op, pattern) != CAIRO_INT_STATUS_UNSUPPORTED) + if (_cairo_win32_printing_surface_analyze_operation (surface, op, pattern, extents) != CAIRO_INT_STATUS_UNSUPPORTED) return TRUE; else return FALSE; @@ -605,11 +741,12 @@ _cairo_win32_printing_surface_check_png (cairo_win32_printing_surface_t *surfa } static cairo_status_t -_cairo_win32_printing_surface_paint_image_pattern (cairo_win32_printing_surface_t *surface, - cairo_surface_pattern_t *pattern) +_cairo_win32_printing_surface_paint_image_pattern (cairo_win32_printing_surface_t *surface, + const cairo_pattern_t *pattern, + const cairo_rectangle_int_t *extents) { cairo_int_status_t status; - cairo_extend_t extend; + cairo_surface_pattern_t image_pattern; cairo_image_surface_t *image; void *image_extra; cairo_image_surface_t *opaque_image = NULL; @@ -618,6 +755,7 @@ _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_printing_surface_ int oldmode; XFORM xform; int x_tile, y_tile, left, right, top, bottom; + int pattern_width, pattern_height; RECT clip; const cairo_color_t *background_color; const unsigned char *mime_data; @@ -637,13 +775,17 @@ _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_printing_surface_ else background_color = CAIRO_COLOR_BLACK; - extend = cairo_pattern_get_extend (&pattern->base); - - status = _cairo_surface_acquire_source_image (pattern->surface, - &image, &image_extra); + status = _cairo_win32_printing_surface_acquire_image_pattern (surface, + pattern, + extents, + &image_pattern, + &pattern_width, + &pattern_height, + &image_extra); if (status) return status; + image = (cairo_image_surface_t *)(image_pattern.surface); if (image->base.status) { status = image->base.status; goto CLEANUP_IMAGE; @@ -656,14 +798,14 @@ _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_printing_surface_ mime_type = BI_JPEG; status = _cairo_win32_printing_surface_check_jpeg (surface, - pattern->surface, + image_pattern.surface, &mime_data, &mime_size, &mime_info); if (status == CAIRO_INT_STATUS_UNSUPPORTED) { mime_type = BI_PNG; status = _cairo_win32_printing_surface_check_png (surface, - pattern->surface, + image_pattern.surface, &mime_data, &mime_size, &mime_info); @@ -721,7 +863,7 @@ _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_printing_surface_ bi.bmiHeader.biClrUsed = 0; bi.bmiHeader.biClrImportant = 0; - m = pattern->base.matrix; + m = image_pattern.base.matrix; status = cairo_matrix_invert (&m); /* _cairo_pattern_set_matrix guarantees invertibility */ assert (status == CAIRO_INT_STATUS_SUCCESS); @@ -739,7 +881,7 @@ _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_printing_surface_ oldmode = SetStretchBltMode(surface->win32.dc, HALFTONE); GetClipBox (surface->win32.dc, &clip); - if (extend == CAIRO_EXTEND_REPEAT || extend == CAIRO_EXTEND_REFLECT) { + if (pattern->extend == CAIRO_EXTEND_REPEAT || pattern->extend == CAIRO_EXTEND_REFLECT) { left = floor ( clip.left / (double) opaque_image->width); right = ceil (clip.right / (double) opaque_image->width); top = floor (clip.top / (double) opaque_image->height); @@ -779,24 +921,11 @@ CLEANUP_OPAQUE_IMAGE: if (opaque_image != image) cairo_surface_destroy (&opaque_image->base); CLEANUP_IMAGE: - _cairo_surface_release_source_image (pattern->surface, image, image_extra); + _cairo_win32_printing_surface_release_image_pattern (surface, pattern, &image_pattern, image_extra); return status; } -static cairo_status_t -_cairo_win32_printing_surface_paint_surface_pattern (cairo_win32_printing_surface_t *surface, - cairo_surface_pattern_t *pattern) -{ - if (_cairo_surface_is_recording (pattern->surface)) { - return _cairo_win32_printing_surface_paint_recording_pattern (surface, - pattern); - } else { - return _cairo_win32_printing_surface_paint_image_pattern (surface, - pattern); - } -} - static void vertex_set_color (TRIVERTEX *vert, cairo_color_stop_t *color) { @@ -955,7 +1084,8 @@ _cairo_win32_printing_surface_paint_linear_pattern (cairo_win32_printing_surface static cairo_int_status_t _cairo_win32_printing_surface_paint_pattern (cairo_win32_printing_surface_t *surface, - const cairo_pattern_t *pattern) + const cairo_pattern_t *pattern, + const cairo_rectangle_int_t *extents) { cairo_status_t status; @@ -966,9 +1096,20 @@ _cairo_win32_printing_surface_paint_pattern (cairo_win32_printing_surface_t *sur return status; break; - case CAIRO_PATTERN_TYPE_SURFACE: - status = _cairo_win32_printing_surface_paint_surface_pattern (surface, - (cairo_surface_pattern_t *) pattern); + case CAIRO_PATTERN_TYPE_SURFACE: { + cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) pattern; + + if ( _cairo_surface_is_recording (surface_pattern->surface)) + status = _cairo_win32_printing_surface_paint_recording_pattern (surface, surface_pattern); + else + status = _cairo_win32_printing_surface_paint_image_pattern (surface, pattern, extents); + + if (status) + return status; + break; + } + case CAIRO_PATTERN_TYPE_RASTER_SOURCE: + status = _cairo_win32_printing_surface_paint_image_pattern (surface, pattern, extents); if (status) return status; break; @@ -1198,24 +1339,37 @@ _cairo_win32_printing_surface_paint (void *abstract_surface, { cairo_win32_printing_surface_t *surface = abstract_surface; cairo_solid_pattern_t clear; + cairo_composite_rectangles_t extents; cairo_status_t status; - status = _cairo_surface_clipper_set_clip (&surface->clipper, clip); - if (status) + status = _cairo_composite_rectangles_init_for_paint (&extents, + &surface->win32.base, + op, source, clip); + if (unlikely (status)) return status; + status = _cairo_surface_clipper_set_clip (&surface->clipper, clip); + if (unlikely (status)) + goto cleanup_composite; + if (op == CAIRO_OPERATOR_CLEAR) { _cairo_win32_printing_surface_init_clear_color (surface, &clear); source = (cairo_pattern_t*) &clear; op = CAIRO_OPERATOR_SOURCE; } - if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) - return _cairo_win32_printing_surface_analyze_operation (surface, op, source); + if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) { + status = _cairo_win32_printing_surface_analyze_operation (surface, op, source, &extents.bounded); + goto cleanup_composite; + } + + assert (_cairo_win32_printing_surface_operation_supported (surface, op, source, &extents.bounded)); - assert (_cairo_win32_printing_surface_operation_supported (surface, op, source)); + status = _cairo_win32_printing_surface_paint_pattern (surface, source, &extents.bounded); - return _cairo_win32_printing_surface_paint_pattern (surface, source); + cleanup_composite: + _cairo_composite_rectangles_fini (&extents); + return status; } static int @@ -1292,10 +1446,37 @@ _cairo_win32_printing_surface_stroke (void *abstract_surface, cairo_solid_pattern_t clear; cairo_matrix_t mat; double scale; + cairo_composite_rectangles_t extents; + + status = _cairo_composite_rectangles_init_for_stroke (&extents, + &surface->win32.base, + op, source, + path, style, stroke_ctm, + clip); + if (unlikely (status)) + return status; + + /* use the more accurate extents */ + { + cairo_rectangle_int_t r; + cairo_box_t b; + + status = _cairo_path_fixed_stroke_extents (path, style, + stroke_ctm, stroke_ctm_inverse, + tolerance, + &r); + if (unlikely (status)) + goto cleanup_composite; + + _cairo_box_from_rectangle (&b, &r); + status = _cairo_composite_rectangles_intersect_mask_extents (&extents, &b); + if (unlikely (status)) + goto cleanup_composite; + } status = _cairo_surface_clipper_set_clip (&surface->clipper, clip); - if (status) - return status; + if (unlikely (status)) + goto cleanup_composite; if (op == CAIRO_OPERATOR_CLEAR) { _cairo_win32_printing_surface_init_clear_color (surface, &clear); @@ -1306,12 +1487,14 @@ _cairo_win32_printing_surface_stroke (void *abstract_surface, if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) { /* Win32 does not support a dash offset. */ if (style->num_dashes > 0 && style->dash_offset != 0.0) - return CAIRO_INT_STATUS_UNSUPPORTED; + status = CAIRO_INT_STATUS_UNSUPPORTED; + else + status = _cairo_win32_printing_surface_analyze_operation (surface, op, source, &extents.bounded); - return _cairo_win32_printing_surface_analyze_operation (surface, op, source); + goto cleanup_composite; } - assert (_cairo_win32_printing_surface_operation_supported (surface, op, source)); + assert (_cairo_win32_printing_surface_operation_supported (surface, op, source, &extents.bounded)); assert (!(style->num_dashes > 0 && style->dash_offset != 0.0)); cairo_matrix_multiply (&mat, stroke_ctm, &surface->ctm); @@ -1350,17 +1533,22 @@ _cairo_win32_printing_surface_stroke (void *abstract_surface, &brush, style->num_dashes, dash_array); - if (pen == NULL) - return _cairo_win32_print_gdi_error ("_win32_surface_stroke:ExtCreatePen"); + if (pen == NULL) { + status = _cairo_win32_print_gdi_error ("_win32_surface_stroke:ExtCreatePen"); + goto cleanup_composite; + } + obj = SelectObject (surface->win32.dc, pen); - if (obj == NULL) - return _cairo_win32_print_gdi_error ("_win32_surface_stroke:SelectObject"); + if (obj == NULL) { + status = _cairo_win32_print_gdi_error ("_win32_surface_stroke:SelectObject"); + goto cleanup_composite; + } BeginPath (surface->win32.dc); status = _cairo_win32_printing_surface_emit_path (surface, path); EndPath (surface->win32.dc); - if (status) - return status; + if (unlikely (status)) + goto cleanup_composite; /* * Switch to user space to set line parameters @@ -1371,27 +1559,37 @@ _cairo_win32_printing_surface_stroke (void *abstract_surface, xform.eDx = 0.0f; xform.eDy = 0.0f; - if (!ModifyWorldTransform (surface->win32.dc, &xform, MWT_LEFTMULTIPLY)) - return _cairo_win32_print_gdi_error ("_win32_surface_stroke:SetWorldTransform"); + if (!ModifyWorldTransform (surface->win32.dc, &xform, MWT_LEFTMULTIPLY)) { + status = _cairo_win32_print_gdi_error ("_win32_surface_stroke:SetWorldTransform"); + goto cleanup_composite; + } if (source->type == CAIRO_PATTERN_TYPE_SOLID) { StrokePath (surface->win32.dc); } else { - if (!WidenPath (surface->win32.dc)) - return _cairo_win32_print_gdi_error ("_win32_surface_stroke:WidenPath"); - if (!SelectClipPath (surface->win32.dc, RGN_AND)) - return _cairo_win32_print_gdi_error ("_win32_surface_stroke:SelectClipPath"); + if (!WidenPath (surface->win32.dc)) { + status = _cairo_win32_print_gdi_error ("_win32_surface_stroke:WidenPath"); + goto cleanup_composite; + } + if (!SelectClipPath (surface->win32.dc, RGN_AND)) { + status = _cairo_win32_print_gdi_error ("_win32_surface_stroke:SelectClipPath"); + goto cleanup_composite; + } /* Return to device space to paint the pattern */ _cairo_matrix_to_win32_xform (&surface->gdi_ctm, &xform); - if (!SetWorldTransform (surface->win32.dc, &xform)) - return _cairo_win32_print_gdi_error ("_win32_surface_stroke:ModifyWorldTransform"); - status = _cairo_win32_printing_surface_paint_pattern (surface, source); + if (!SetWorldTransform (surface->win32.dc, &xform)) { + status = _cairo_win32_print_gdi_error ("_win32_surface_stroke:ModifyWorldTransform"); + goto cleanup_composite; + } + status = _cairo_win32_printing_surface_paint_pattern (surface, source, &extents.bounded); } RestoreDC (surface->win32.dc, -1); DeleteObject (pen); free (dash_array); +cleanup_composite: + _cairo_composite_rectangles_fini (&extents); return status; } @@ -1408,21 +1606,47 @@ _cairo_win32_printing_surface_fill (void *abstract_surface, cairo_win32_printing_surface_t *surface = abstract_surface; cairo_int_status_t status; cairo_solid_pattern_t clear; + cairo_composite_rectangles_t extents; - status = _cairo_surface_clipper_set_clip (&surface->clipper, clip); - if (status) + status = _cairo_composite_rectangles_init_for_fill (&extents, + &surface->win32.base, + op, source, path, + clip); + if (unlikely (status)) return status; + /* use the more accurate extents */ + { + cairo_rectangle_int_t r; + cairo_box_t b; + + _cairo_path_fixed_fill_extents (path, + fill_rule, + tolerance, + &r); + + _cairo_box_from_rectangle (&b, &r); + status = _cairo_composite_rectangles_intersect_mask_extents (&extents, &b); + if (unlikely (status)) + goto cleanup_composite; + } + + status = _cairo_surface_clipper_set_clip (&surface->clipper, clip); + if (unlikely (status)) + goto cleanup_composite; + if (op == CAIRO_OPERATOR_CLEAR) { _cairo_win32_printing_surface_init_clear_color (surface, &clear); source = (cairo_pattern_t*) &clear; op = CAIRO_OPERATOR_SOURCE; } - if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) - return _cairo_win32_printing_surface_analyze_operation (surface, op, source); + if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) { + status = _cairo_win32_printing_surface_analyze_operation (surface, op, source, &extents.bounded); + goto cleanup_composite; + } - assert (_cairo_win32_printing_surface_operation_supported (surface, op, source)); + assert (_cairo_win32_printing_surface_operation_supported (surface, op, source, &extents.bounded)); surface->path_empty = TRUE; BeginPath (surface->win32.dc); @@ -1442,20 +1666,22 @@ _cairo_win32_printing_surface_fill (void *abstract_surface, if (source->type == CAIRO_PATTERN_TYPE_SOLID) { status = _cairo_win32_printing_surface_select_solid_brush (surface, source); - if (status) - return status; + if (unlikely (status)) + goto cleanup_composite; FillPath (surface->win32.dc); _cairo_win32_printing_surface_done_solid_brush (surface); } else if (surface->path_empty == FALSE) { SaveDC (surface->win32.dc); SelectClipPath (surface->win32.dc, RGN_AND); - status = _cairo_win32_printing_surface_paint_pattern (surface, source); + status = _cairo_win32_printing_surface_paint_pattern (surface, source, &extents.bounded); RestoreDC (surface->win32.dc, -1); } fflush(stderr); +cleanup_composite: + _cairo_composite_rectangles_fini (&extents); return status; } @@ -1560,10 +1786,22 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac cairo_matrix_t old_ctm; cairo_bool_t old_has_ctm; cairo_solid_pattern_t clear; + cairo_composite_rectangles_t extents; + cairo_bool_t overlap; + + status = _cairo_composite_rectangles_init_for_glyphs (&extents, + &surface->win32.base, + op, source, + scaled_font, + glyphs, num_glyphs, + clip, + &overlap); + if (unlikely (status)) + return status; status = _cairo_surface_clipper_set_clip (&surface->clipper, clip); - if (status) - return status; + if (unlikely (status)) + goto cleanup_composite; if (op == CAIRO_OPERATOR_CLEAR) { _cairo_win32_printing_surface_init_clear_color (surface, &clear); @@ -1583,10 +1821,13 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac */ #if CAIRO_HAS_WIN32_FONT if (cairo_scaled_font_get_type (scaled_font) == CAIRO_FONT_TYPE_WIN32) { - if (_cairo_win32_scaled_font_is_bitmap (scaled_font)) - return CAIRO_INT_STATUS_UNSUPPORTED; - else - return _cairo_win32_printing_surface_analyze_operation (surface, op, source); + if (_cairo_win32_scaled_font_is_bitmap (scaled_font)) { + status = CAIRO_INT_STATUS_UNSUPPORTED; + goto cleanup_composite; + } else { + status = _cairo_win32_printing_surface_analyze_operation (surface, op, source, &extents.bounded); + goto cleanup_composite; + } } #endif @@ -1606,10 +1847,11 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac break; } _cairo_scaled_font_thaw_cache (scaled_font); - if (status) - return status; + if (unlikely (status)) + goto cleanup_composite; - return _cairo_win32_printing_surface_analyze_operation (surface, op, source); + status = _cairo_win32_printing_surface_analyze_operation (surface, op, source, &extents.bounded); + goto cleanup_composite; } if (source->type == CAIRO_PATTERN_TYPE_SOLID) { @@ -1621,8 +1863,10 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac opaque = cairo_pattern_create_rgb (GetRValue (color) / 255.0, GetGValue (color) / 255.0, GetBValue (color) / 255.0); - if (opaque->status) - return opaque->status; + if (unlikely (opaque->status)) { + status = opaque->status; + goto cleanup_composite; + } source = opaque; } @@ -1630,13 +1874,14 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac if (cairo_scaled_font_get_type (scaled_font) == CAIRO_FONT_TYPE_WIN32 && source->type == CAIRO_PATTERN_TYPE_SOLID) { - return _cairo_win32_printing_surface_emit_win32_glyphs (surface, - op, - source, - glyphs, - num_glyphs, - scaled_font, - clip); + status = _cairo_win32_printing_surface_emit_win32_glyphs (surface, + op, + source, + glyphs, + num_glyphs, + scaled_font, + clip); + goto cleanup_composite; } #endif @@ -1665,15 +1910,15 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac if (status == CAIRO_STATUS_SUCCESS && surface->path_empty == FALSE) { if (source->type == CAIRO_PATTERN_TYPE_SOLID) { status = _cairo_win32_printing_surface_select_solid_brush (surface, source); - if (status) - return status; + if (unlikely (status)) + goto cleanup_composite; SetPolyFillMode (surface->win32.dc, WINDING); FillPath (surface->win32.dc); _cairo_win32_printing_surface_done_solid_brush (surface); } else { SelectClipPath (surface->win32.dc, RGN_AND); - status = _cairo_win32_printing_surface_paint_pattern (surface, source); + status = _cairo_win32_printing_surface_paint_pattern (surface, source, &extents.bounded); } } RestoreDC (surface->win32.dc, -1); @@ -1681,6 +1926,8 @@ _cairo_win32_printing_surface_show_glyphs (void *abstract_surfac if (opaque) cairo_pattern_destroy (opaque); +cleanup_composite: + _cairo_composite_rectangles_fini (&extents); return status; } commit 9fcb42f7fe530da40d96dbc56ea7a8423fa3505a Author: Adrian Johnson Date: Sat Oct 17 18:32:59 2015 +1030 win32-print: fix warnings diff --git a/src/win32/cairo-win32-printing-surface.c b/src/win32/cairo-win32-printing-surface.c index 4d3b8ce..05964e5 100644 --- a/src/win32/cairo-win32-printing-surface.c +++ b/src/win32/cairo-win32-printing-surface.c @@ -402,7 +402,7 @@ _cairo_win32_printing_surface_paint_recording_pattern (cairo_win32_printing_surf cairo_matrix_t old_ctm; cairo_bool_t old_has_ctm; cairo_rectangle_int_t recording_extents; - cairo_status_t status; + cairo_int_status_t status; cairo_extend_t extend; cairo_matrix_t p2d; XFORM xform; @@ -416,7 +416,7 @@ _cairo_win32_printing_surface_paint_recording_pattern (cairo_win32_printing_surf p2d = pattern->base.matrix; status = cairo_matrix_invert (&p2d); /* _cairo_pattern_set_matrix guarantees invertibility */ - assert (status == CAIRO_STATUS_SUCCESS); + assert (status == CAIRO_INT_STATUS_SUCCESS); old_ctm = surface->ctm; old_has_ctm = surface->has_ctm; @@ -608,7 +608,7 @@ static cairo_status_t _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_printing_surface_t *surface, cairo_surface_pattern_t *pattern) { - cairo_status_t status; + cairo_int_status_t status; cairo_extend_t extend; cairo_image_surface_t *image; void *image_extra; @@ -668,10 +668,10 @@ _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_printing_surface_ &mime_size, &mime_info); } - if (_cairo_status_is_error (status)) + if (_cairo_int_status_is_error (status)) return status; - use_mime = (status == CAIRO_STATUS_SUCCESS); + use_mime = (status == CAIRO_INT_STATUS_SUCCESS); if (!use_mime && image->format != CAIRO_FORMAT_RGB24) { cairo_surface_t *opaque_surface; @@ -724,7 +724,7 @@ _cairo_win32_printing_surface_paint_image_pattern (cairo_win32_printing_surface_ m = pattern->base.matrix; status = cairo_matrix_invert (&m); /* _cairo_pattern_set_matrix guarantees invertibility */ - assert (status == CAIRO_STATUS_SUCCESS); + assert (status == CAIRO_INT_STATUS_SUCCESS); cairo_matrix_multiply (&m, &m, &surface->ctm); cairo_matrix_multiply (&m, &m, &surface->gdi_ctm); commit 2c45fdfc15a81eae6196f92c9768f3d895bd0819 Author: Adrian Johnson Date: Sat Oct 17 18:32:57 2015 +1030 win32-print: Fix the page extents As the page size can be changed between pages, set the extents in _start_page. The extents are invalidated in _show_page since the page size on the DC may be changed after this call. The only thing that uses the extents between _show_page and _start_page (and before the first _start_page) is the creation of the recording surface in the paginated surface. In this case, when the paginated surface can't get the extents, it will create an unbounded recording surface. The extents x,y is always set to 0 to prevent the replay from translating the page. diff --git a/src/win32/cairo-win32-printing-surface.c b/src/win32/cairo-win32-printing-surface.c index cce7040..4d3b8ce 100644 --- a/src/win32/cairo-win32-printing-surface.c +++ b/src/win32/cairo-win32-printing-surface.c @@ -1116,6 +1116,11 @@ _cairo_win32_printing_surface_show_page (void *abstract_surface) /* Undo both SaveDC's that we did in start_page */ RestoreDC (surface->win32.dc, -2); + /* Invalidate extents since the size of the next page is not known at + * this point. + */ + surface->extents_valid = FALSE; + return CAIRO_STATUS_SUCCESS; } @@ -1161,6 +1166,18 @@ _cairo_win32_printing_surface_clipper_intersect_clip_path (cairo_surface_clipper return status; } +static cairo_bool_t +_cairo_win32_printing_surface_get_extents (void *abstract_surface, + cairo_rectangle_int_t *rectangle) +{ + cairo_win32_printing_surface_t *surface = abstract_surface; + + if (surface->extents_valid) + *rectangle = surface->win32.extents; + + return surface->extents_valid; +} + static void _cairo_win32_printing_surface_get_font_options (void *abstract_surface, cairo_font_options_t *options) @@ -1706,6 +1723,27 @@ _cairo_win32_printing_surface_start_page (void *abstract_surface) double x_res, y_res; cairo_matrix_t inverse_ctm; cairo_status_t status; + RECT rect; + + /* Since the page size may be changed after _show_page() and before the + * next drawing command, the extents are set in _start_page() and invalidated + * in _show_page(). The paginated surface will obtain the extents immediately + * after calling _show_page() and before any drawing commands. At this point + * the next page will not have been setup on the DC so we return invalid + * extents and the paginated surface will create an unbounded recording surface. + * Prior to replay of the record surface, the paginated surface will call + * _start_page and we setup the correct extents. + * + * Note that we always set the extents x,y to 0 so prevent replay from translating + * the coordinates of objects. Windows will clip anything outside of the page clip + * area. + */ + GetClipBox(surface->win32.dc, &rect); + surface->win32.extents.x = 0; + surface->win32.extents.y = 0; + surface->win32.extents.width = rect.right; + surface->win32.extents.height = rect.bottom; + surface->extents_valid = TRUE; SaveDC (surface->win32.dc); /* Save application context first, before doing MWT */ @@ -1823,7 +1861,6 @@ cairo_win32_printing_surface_create (HDC hdc) { cairo_win32_printing_surface_t *surface; cairo_surface_t *paginated; - RECT rect; surface = malloc (sizeof (cairo_win32_printing_surface_t)); if (surface == NULL) @@ -1843,6 +1880,7 @@ cairo_win32_printing_surface_create (HDC hdc) surface->content = CAIRO_CONTENT_COLOR_ALPHA; surface->win32.dc = hdc; + surface->extents_valid = FALSE; surface->brush = NULL; surface->old_brush = NULL; @@ -1852,12 +1890,6 @@ cairo_win32_printing_surface_create (HDC hdc) return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); } - GetClipBox(hdc, &rect); - surface->win32.extents.x = rect.left; - surface->win32.extents.y = rect.top; - surface->win32.extents.width = rect.right - rect.left; - surface->win32.extents.height = rect.bottom - rect.top; - surface->win32.flags = _cairo_win32_flags_for_dc (surface->win32.dc); surface->win32.flags |= CAIRO_WIN32_SURFACE_FOR_PRINTING; @@ -1898,7 +1930,7 @@ static const cairo_surface_backend_t cairo_win32_printing_surface_backend = { NULL, /* copy_page */ _cairo_win32_printing_surface_show_page, - _cairo_win32_surface_get_extents, + _cairo_win32_printing_surface_get_extents, _cairo_win32_printing_surface_get_font_options, NULL, /* flush */ diff --git a/src/win32/cairo-win32-private.h b/src/win32/cairo-win32-private.h index b6c2431..6fdf96f 100644 --- a/src/win32/cairo-win32-private.h +++ b/src/win32/cairo-win32-private.h @@ -139,6 +139,7 @@ typedef struct _cairo_win32_printing_surface { cairo_matrix_t ctm; cairo_bool_t has_gdi_ctm; cairo_matrix_t gdi_ctm; + cairo_bool_t extents_valid; HBRUSH brush, old_brush; cairo_scaled_font_subsets_t *font_subsets; } cairo_win32_printing_surface_t; commit 094f0e0fa0153f290061635eed51e8d1dbe2cf4a Author: Adrian Johnson Date: Sat Oct 17 16:50:50 2015 +1030 pdf: fix subsurface recordings diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index 4bc2947..1733a86 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -1249,21 +1249,22 @@ _get_source_surface_size (cairo_surface_t *source, unsigned long mime_data_length; if (source->type == CAIRO_SURFACE_TYPE_RECORDING) { + cairo_surface_t *free_me = NULL; + + if (_cairo_surface_is_snapshot (source)) + free_me = source = _cairo_surface_snapshot_get_target (source); + if (source->backend->type == CAIRO_SURFACE_TYPE_SUBSURFACE) { - cairo_surface_subsurface_t *sub = (cairo_surface_subsurface_t *) source; + cairo_surface_subsurface_t *sub = (cairo_surface_subsurface_t *) source; - *extents = sub->extents; - *width = extents->width; - *height = extents->height; + *extents = sub->extents; + *width = extents->width; + *height = extents->height; } else { - cairo_surface_t *free_me = NULL; cairo_rectangle_int_t surf_extents; cairo_box_t box; cairo_bool_t bounded; - if (_cairo_surface_is_snapshot (source)) - free_me = source = _cairo_surface_snapshot_get_target (source); - status = _cairo_recording_surface_get_ink_bbox ((cairo_recording_surface_t *)source, &box, NULL); if (unlikely (status)) { @@ -1272,13 +1273,13 @@ _get_source_surface_size (cairo_surface_t *source, } bounded = _cairo_surface_get_extents (source, &surf_extents); - cairo_surface_destroy (free_me); *width = surf_extents.width; *height = surf_extents.height; _cairo_box_round_to_rectangle (&box, extents); } + cairo_surface_destroy (free_me); return CAIRO_STATUS_SUCCESS; } @@ -3010,9 +3011,10 @@ _cairo_pdf_surface_emit_recording_surface (cairo_pdf_surface_t *surface, height = pdf_source->hash_entry->height; is_subsurface = FALSE; source = pdf_source->surface; - if (_cairo_surface_is_snapshot (source)) { + if (_cairo_surface_is_snapshot (source)) free_me = source = _cairo_surface_snapshot_get_target (source); - } else if (source->backend->type == CAIRO_SURFACE_TYPE_SUBSURFACE) { + + if (source->backend->type == CAIRO_SURFACE_TYPE_SUBSURFACE) { cairo_surface_subsurface_t *sub = (cairo_surface_subsurface_t *) source; source = sub->target; @@ -3040,7 +3042,14 @@ _cairo_pdf_surface_emit_recording_surface (cairo_pdf_surface_t *surface, */ surface->paginated_mode = CAIRO_PAGINATED_MODE_RENDER; _cairo_pdf_group_resources_clear (&surface->resources); - _get_bbox_from_extents (height, extents, &bbox); + if (is_subsurface) { + bbox.p1.x = 0; + bbox.p1.y = 0; + bbox.p2.x = extents->width; + bbox.p2.y = extents->height; + } else { + _get_bbox_from_extents (height, extents, &bbox); + } /* We can optimize away the transparency group allowing the viewer * to replay the group in place when all operators are OVER and the commit 2215b4e0c0f90a90f659aa0cfc28fc02dfce3339 Author: Adrian Johnson Date: Sat Oct 17 16:25:16 2015 +1030 ps: fix subsurface recordings diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 557daca..cd03e1a 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -1739,32 +1739,33 @@ _cairo_ps_surface_acquire_source_surface_from_pattern (cairo_ps_surface_t cairo_image_surface_t *image; *x_offset = *y_offset = 0; + *image_extra = NULL; switch (pattern->type) { case CAIRO_PATTERN_TYPE_SURFACE: { cairo_surface_t *surf = ((cairo_surface_pattern_t *) pattern)->surface; if (surf->type == CAIRO_SURFACE_TYPE_RECORDING) { + if (_cairo_surface_is_snapshot (surf)) { + surf = _cairo_surface_snapshot_get_target (surf); + *image_extra = surf; + } if (surf->backend->type == CAIRO_SURFACE_TYPE_SUBSURFACE) { cairo_surface_subsurface_t *sub = (cairo_surface_subsurface_t *) surf; *width = sub->extents.width; *height = sub->extents.height; } else { - cairo_surface_t *free_me = NULL; cairo_recording_surface_t *recording_surface; cairo_box_t bbox; cairo_rectangle_int_t extents; recording_surface = (cairo_recording_surface_t *) surf; - if (_cairo_surface_is_snapshot (&recording_surface->base)) { - free_me = _cairo_surface_snapshot_get_target (&recording_surface->base); - recording_surface = (cairo_recording_surface_t *) free_me; - } status = _cairo_recording_surface_get_bbox (recording_surface, &bbox, NULL); - cairo_surface_destroy (free_me); - if (unlikely (status)) + if (unlikely (status)) { + cairo_surface_destroy (*image_extra); return status; + } _cairo_box_round_to_rectangle (&bbox, &extents); *width = extents.width; @@ -1775,8 +1776,10 @@ _cairo_ps_surface_acquire_source_surface_from_pattern (cairo_ps_surface_t return CAIRO_STATUS_SUCCESS; } else { status = _cairo_surface_acquire_source_image (surf, &image, image_extra); - if (unlikely (status)) + if (unlikely (status)) { + cairo_surface_destroy (*image_extra); return status; + } } } break; @@ -1821,7 +1824,9 @@ _cairo_ps_surface_release_source_surface_from_pattern (cairo_ps_surface_t switch (pattern->type) { case CAIRO_PATTERN_TYPE_SURFACE: { cairo_surface_pattern_t *surf_pat = (cairo_surface_pattern_t *) pattern; - if (surf_pat->surface->type != CAIRO_SURFACE_TYPE_RECORDING) { + if (surf_pat->surface->type == CAIRO_SURFACE_TYPE_RECORDING) { + cairo_surface_destroy (image_extra); + } else { cairo_image_surface_t *image = (cairo_image_surface_t *) source; _cairo_surface_release_source_image (surf_pat->surface, image, image_extra); } @@ -2924,7 +2929,6 @@ _cairo_ps_surface_emit_recording_surface (cairo_ps_surface_t *surface, cairo_matrix_t old_cairo_to_ps; cairo_content_t old_content; cairo_rectangle_int_t old_page_bbox; - cairo_surface_t *free_me = NULL; cairo_surface_clipper_t old_clipper; cairo_box_t bbox; cairo_int_status_t status; @@ -2938,9 +2942,6 @@ _cairo_ps_surface_emit_recording_surface (cairo_ps_surface_t *surface, _cairo_surface_clipper_init (&surface->clipper, _cairo_ps_surface_clipper_intersect_clip_path); - if (_cairo_surface_is_snapshot (recording_surface)) - free_me = recording_surface = _cairo_surface_snapshot_get_target (recording_surface); - if (subsurface) { surface->page_bbox.x = surface->page_bbox.y = 0; surface->page_bbox.width = surface->width = extents->width; @@ -2960,7 +2961,7 @@ _cairo_ps_surface_emit_recording_surface (cairo_ps_surface_t *surface, &bbox, NULL); if (unlikely (status)) - goto err; + return status; surface->width = _cairo_fixed_to_double (bbox.p2.x - bbox.p1.x); surface->height = _cairo_fixed_to_double (bbox.p2.y - bbox.p1.y); @@ -2999,11 +3000,11 @@ _cairo_ps_surface_emit_recording_surface (cairo_ps_surface_t *surface, CAIRO_RECORDING_REGION_NATIVE); assert (status != CAIRO_INT_STATUS_UNSUPPORTED); if (unlikely (status)) - goto err; + return status; status = _cairo_pdf_operators_flush (&surface->pdf_operators); if (unlikely (status)) - goto err; + return status; _cairo_output_stream_printf (surface->stream, " Q\n"); @@ -3020,8 +3021,6 @@ _cairo_ps_surface_emit_recording_surface (cairo_ps_surface_t *surface, _cairo_pdf_operators_set_cairo_to_pdf_matrix (&surface->pdf_operators, &surface->cairo_to_ps); -err: - cairo_surface_destroy (free_me); return status; } diff --git a/src/cairo-surface-wrapper.c b/src/cairo-surface-wrapper.c index 9236c8b..64e2d1e 100644 --- a/src/cairo-surface-wrapper.c +++ b/src/cairo-surface-wrapper.c @@ -119,14 +119,14 @@ _cairo_surface_wrapper_get_clip (cairo_surface_wrapper_t *wrapper, const cairo_clip_t *clip) { cairo_clip_t *copy; + cairo_matrix_t m; copy = _cairo_clip_copy (clip); if (wrapper->has_extents) { copy = _cairo_clip_intersect_rectangle (copy, &wrapper->extents); } - copy = _cairo_clip_transform (copy, &wrapper->transform); - if (! _cairo_matrix_is_identity (&wrapper->target->device_transform)) - copy = _cairo_clip_transform (copy, &wrapper->target->device_transform); + _cairo_surface_wrapper_get_transform (wrapper, &m); + copy = _cairo_clip_transform (copy, &m); if (wrapper->clip) copy = _cairo_clip_intersect_clip (copy, wrapper->clip); commit 6952e03262717751716f48114e6a921b62a0ecee Author: Adrian Johnson Date: Sat Oct 17 13:15:56 2015 +1030 ps: fix raster source patterns diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 12b682b..557daca 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -1794,6 +1794,7 @@ _cairo_ps_surface_acquire_source_surface_from_pattern (cairo_ps_surface_t return CAIRO_INT_STATUS_UNSUPPORTED; assert (_cairo_surface_is_image (surf)); image = (cairo_image_surface_t *) surf; + cairo_surface_get_device_offset (surf, x_offset, y_offset); } break; case CAIRO_PATTERN_TYPE_SOLID: diff --git a/test/reference/raster-source.ps.ref.png b/test/reference/raster-source.ps.ref.png index 2ffc114..524477d 100644 Binary files a/test/reference/raster-source.ps.ref.png and b/test/reference/raster-source.ps.ref.png differ From ajohnson at kemper.freedesktop.org Sat Oct 17 01:10:57 2015 From: ajohnson at kemper.freedesktop.org (Adrian Johnson) Date: Sat, 17 Oct 2015 01:10:57 -0700 (PDT) Subject: [cairo-commit] 2 commits - src/cairo-analysis-surface.c src/cairo-composite-rectangles.c src/cairo-gstate.c src/cairo-image-source.c src/cairo-image-surface.c src/cairoint.h src/cairo-paginated-surface.c src/cairo-path-bounds.c src/cairo-pdf-surface.c src/cairo-ps-surface.c src/cairo-recording-surface.c src/cairo-script-surface.c src/cairo-surface.c src/cairo-surface-observer.c src/cairo-surface-private.h src/cairo-surface-snapshot.c src/cairo-surface-subsurface.c src/cairo-svg-surface.c src/cairo-type3-glyph-surface.c src/cairo-xcb-surface.c src/cairo-xcb-surface-core.c src/cairo-xcb-surface-render.c src/cairo-xlib-source.c src/cairo-xlib-surface.c src/cairo-xlib-surface-shm.c src/win32 test/Makefile.sources test/reference test/thin-lines.c Message-ID: <20151017081057.C06A776264@kemper.freedesktop.org> src/cairo-analysis-surface.c | 8 +- src/cairo-composite-rectangles.c | 2 src/cairo-gstate.c | 1 src/cairo-image-source.c | 5 - src/cairo-image-surface.c | 3 src/cairo-paginated-surface.c | 3 src/cairo-path-bounds.c | 23 ++++++ src/cairo-pdf-surface.c | 3 src/cairo-ps-surface.c | 3 src/cairo-recording-surface.c | 8 +- src/cairo-script-surface.c | 6 + src/cairo-surface-observer.c | 3 src/cairo-surface-private.h | 1 src/cairo-surface-snapshot.c | 3 src/cairo-surface-subsurface.c | 6 + src/cairo-surface.c | 7 +- src/cairo-svg-surface.c | 3 src/cairo-type3-glyph-surface.c | 3 src/cairo-xcb-surface-core.c | 6 + src/cairo-xcb-surface-render.c | 3 src/cairo-xcb-surface.c | 3 src/cairo-xlib-source.c | 9 +- src/cairo-xlib-surface-shm.c | 3 src/cairo-xlib-surface.c | 3 src/cairoint.h | 4 - src/win32/cairo-win32-printing-surface.c | 3 test/Makefile.sources | 1 test/reference/thin-lines.pdf.ref.png |binary test/reference/thin-lines.ps.argb32.ref.png |binary test/reference/thin-lines.ps.rgb24.ref.png |binary test/reference/thin-lines.ref.png |binary test/thin-lines.c | 95 ++++++++++++++++++++++++++++ 32 files changed, 187 insertions(+), 34 deletions(-) New commits: commit 30eb1b0e9778a96c2eb984f243dec5e3c8859e05 Author: Adrian Johnson Date: Mon Sep 21 21:35:05 2015 +0930 Add test case for thin lines Bug 77298 diff --git a/test/Makefile.sources b/test/Makefile.sources index e4fedb4..24ded46 100644 --- a/test/Makefile.sources +++ b/test/Makefile.sources @@ -352,6 +352,7 @@ test_sources = \ text-rotate.c \ text-transform.c \ text-zero-len.c \ + thin-lines.c \ tighten-bounds.c \ tiger.c \ toy-font-face.c \ diff --git a/test/reference/thin-lines.pdf.ref.png b/test/reference/thin-lines.pdf.ref.png new file mode 100644 index 0000000..3d79c8e Binary files /dev/null and b/test/reference/thin-lines.pdf.ref.png differ diff --git a/test/reference/thin-lines.ps.argb32.ref.png b/test/reference/thin-lines.ps.argb32.ref.png new file mode 100644 index 0000000..4839311 Binary files /dev/null and b/test/reference/thin-lines.ps.argb32.ref.png differ diff --git a/test/reference/thin-lines.ps.rgb24.ref.png b/test/reference/thin-lines.ps.rgb24.ref.png new file mode 100644 index 0000000..97f6f21 Binary files /dev/null and b/test/reference/thin-lines.ps.rgb24.ref.png differ diff --git a/test/reference/thin-lines.ref.png b/test/reference/thin-lines.ref.png new file mode 100644 index 0000000..49e2a3f Binary files /dev/null and b/test/reference/thin-lines.ref.png differ diff --git a/test/thin-lines.c b/test/thin-lines.c new file mode 100644 index 0000000..c501254 --- /dev/null +++ b/test/thin-lines.c @@ -0,0 +1,95 @@ +/* + * Copyright © 2015 Adrian Johnson + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Red Hat, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Red Hat, Inc. makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Adrian Johnson + */ + +#include "cairo-test.h" + +#define CELL_WIDTH 20 +#define CELL_HEIGHT 20 +#define PAD 2 +#define IMAGE_WIDTH (CELL_WIDTH*3 + PAD*4) +#define IMAGE_HEIGHT (CELL_HEIGHT*4 + PAD*5) + + +static void +draw_lines(cairo_t *cr) +{ + /* horizontal line */ + cairo_translate (cr, PAD, PAD); + cairo_move_to (cr, 0, CELL_HEIGHT/2); + cairo_line_to (cr, CELL_WIDTH, CELL_HEIGHT/2); + cairo_stroke (cr); + + /* vertical line */ + cairo_translate (cr, 0, CELL_HEIGHT + PAD); + cairo_move_to (cr, CELL_WIDTH/2, 0); + cairo_line_to (cr, CELL_WIDTH/2, CELL_HEIGHT); + cairo_stroke (cr); + + /* diagonal line */ + cairo_translate (cr, 0, CELL_HEIGHT + PAD); + cairo_move_to (cr, 0, CELL_HEIGHT); + cairo_line_to (cr, CELL_WIDTH, 0); + cairo_stroke (cr); + + /* curved line */ + cairo_translate (cr, 0, CELL_HEIGHT + PAD); + cairo_move_to (cr, CELL_WIDTH, 0); + cairo_curve_to (cr, 0, 0, + CELL_WIDTH, CELL_HEIGHT, + 0, CELL_HEIGHT); + cairo_stroke (cr); +} + +#define FIXED_POINT_MIN (1.0/256) + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + cairo_save (cr); + cairo_set_line_width (cr, FIXED_POINT_MIN*10.0); + draw_lines (cr); + cairo_restore (cr); + + cairo_translate (cr, CELL_WIDTH + PAD, 0); + cairo_save (cr); + cairo_set_line_width (cr, FIXED_POINT_MIN); + draw_lines (cr); + cairo_restore (cr); + + cairo_translate (cr, CELL_WIDTH + PAD, 0); + cairo_save (cr); + cairo_set_line_width (cr, FIXED_POINT_MIN/10.0); + draw_lines (cr); + cairo_restore (cr); + + return CAIRO_TEST_SUCCESS; +} + +CAIRO_TEST (thin_lines, + "Tests that very thin lines are output to vector surfaces", + "stroke", /* keywords */ + NULL, /* requirements */ + IMAGE_WIDTH, IMAGE_HEIGHT, + NULL, draw) commit b1192beac7c5b56a8ff356d20af5ebfb65404109 Author: Adrian Johnson Date: Mon Sep 21 21:35:05 2015 +0930 Don't cull very thin lines on vector surfaces On vector surfaces, use a minimum line width when calculating extents. Bug 77298 diff --git a/src/cairo-analysis-surface.c b/src/cairo-analysis-surface.c index 8516094..b4069ea 100644 --- a/src/cairo-analysis-surface.c +++ b/src/cairo-analysis-surface.c @@ -122,7 +122,7 @@ attach_proxy (cairo_surface_t *source, if (unlikely (proxy == NULL)) return _cairo_surface_create_in_error (CAIRO_STATUS_NO_MEMORY); - _cairo_surface_init (&proxy->base, &proxy_backend, NULL, target->content); + _cairo_surface_init (&proxy->base, &proxy_backend, NULL, target->content, target->is_vector); proxy->target = target; _cairo_surface_attach_snapshot (source, &proxy->base, NULL); @@ -740,7 +740,8 @@ _cairo_analysis_surface_create (cairo_surface_t *target) _cairo_surface_init (&surface->base, &cairo_analysis_surface_backend, NULL, /* device */ - CAIRO_CONTENT_COLOR_ALPHA); + CAIRO_CONTENT_COLOR_ALPHA, + target->is_vector); cairo_matrix_init_identity (&surface->ctm); surface->has_ctm = FALSE; @@ -928,7 +929,8 @@ _cairo_null_surface_create (cairo_content_t content) _cairo_surface_init (surface, &cairo_null_surface_backend, NULL, /* device */ - content); + content, + TRUE); /* is_vector */ return surface; } diff --git a/src/cairo-composite-rectangles.c b/src/cairo-composite-rectangles.c index 6c3e97d..495d200 100644 --- a/src/cairo-composite-rectangles.c +++ b/src/cairo-composite-rectangles.c @@ -353,7 +353,7 @@ _cairo_composite_rectangles_init_for_stroke (cairo_composite_rectangles_t *exten return CAIRO_INT_STATUS_NOTHING_TO_DO; } - _cairo_path_fixed_approximate_stroke_extents (path, style, ctm, &extents->mask); + _cairo_path_fixed_approximate_stroke_extents (path, style, ctm, surface->is_vector, &extents->mask); return _cairo_composite_rectangles_intersect (extents, clip); } diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c index 4bf945c..4c7eb11 100644 --- a/src/cairo-gstate.c +++ b/src/cairo-gstate.c @@ -1228,6 +1228,7 @@ _cairo_gstate_in_stroke (cairo_gstate_t *gstate, _cairo_path_fixed_approximate_stroke_extents (path, &gstate->stroke_style, &gstate->ctm, + gstate->target->is_vector, &extents); if (x < extents.x || x > extents.x + extents.width || y < extents.y || y > extents.y + extents.height) diff --git a/src/cairo-image-source.c b/src/cairo-image-source.c index 950053d..4b79db9 100644 --- a/src/cairo-image-source.c +++ b/src/cairo-image-source.c @@ -1081,7 +1081,7 @@ attach_proxy (cairo_surface_t *source, if (unlikely (proxy == NULL)) return _cairo_surface_create_in_error (CAIRO_STATUS_NO_MEMORY); - _cairo_surface_init (&proxy->base, &proxy_backend, NULL, image->content); + _cairo_surface_init (&proxy->base, &proxy_backend, NULL, image->content, FALSE); proxy->image = image; _cairo_surface_attach_snapshot (source, &proxy->base, NULL); @@ -1592,7 +1592,8 @@ _cairo_image_source_create_for_pattern (cairo_surface_t *dst, _cairo_surface_init (&source->base, &_cairo_image_source_backend, NULL, /* device */ - CAIRO_CONTENT_COLOR_ALPHA); + CAIRO_CONTENT_COLOR_ALPHA, + FALSE); /* is_vector */ source->is_opaque_solid = pattern == NULL || _cairo_pattern_is_opaque_solid (pattern); diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 1fd563d..13d6272 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -188,7 +188,8 @@ _cairo_image_surface_create_for_pixman_image (pixman_image_t *pixman_image, _cairo_surface_init (&surface->base, &_cairo_image_surface_backend, NULL, /* device */ - _cairo_content_from_pixman_format (pixman_format)); + _cairo_content_from_pixman_format (pixman_format), + FALSE); /* is_vector */ _cairo_image_surface_init (surface, pixman_image, pixman_format); diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c index 68e4e0e..b81215a 100644 --- a/src/cairo-paginated-surface.c +++ b/src/cairo-paginated-surface.c @@ -107,7 +107,8 @@ _cairo_paginated_surface_create (cairo_surface_t *target, _cairo_surface_init (&surface->base, &cairo_paginated_surface_backend, NULL, /* device */ - content); + content, + target->is_vector); /* Override surface->base.type with target's type so we don't leak * evidence of the paginated wrapper out to the user. */ diff --git a/src/cairo-path-bounds.c b/src/cairo-path-bounds.c index 9c72224..624b3cb 100644 --- a/src/cairo-path-bounds.c +++ b/src/cairo-path-bounds.c @@ -154,6 +154,7 @@ void _cairo_path_fixed_approximate_stroke_extents (const cairo_path_fixed_t *path, const cairo_stroke_style_t *style, const cairo_matrix_t *ctm, + cairo_bool_t is_vector, cairo_rectangle_int_t *extents) { if (path->has_extents) { @@ -161,6 +162,17 @@ _cairo_path_fixed_approximate_stroke_extents (const cairo_path_fixed_t *path, double dx, dy; _cairo_stroke_style_max_distance_from_path (style, path, ctm, &dx, &dy); + if (is_vector) + { + /* When calculating extents for vector surfaces, ensure lines thinner + * than the fixed point resolution are not optimized away. */ + double min = _cairo_fixed_to_double (CAIRO_FIXED_EPSILON*2); + if (dx < min) + dx = min; + + if (dy < min) + dy = min; + } box_extents = path->extents; box_extents.p1.x -= _cairo_fixed_from_double (dx); @@ -185,6 +197,17 @@ _cairo_path_fixed_stroke_extents (const cairo_path_fixed_t *path, { cairo_polygon_t polygon; cairo_status_t status; + cairo_stroke_style_t style; + + /* When calculating extents for vector surfaces, ensure lines thinner + * than the fixed point resolution are not optimized away. */ + double min_line_width = _cairo_fixed_to_double (CAIRO_FIXED_EPSILON*2); + if (stroke_style->line_width < min_line_width) + { + style = *stroke_style; + style.line_width = min_line_width; + stroke_style = &style; + } _cairo_polygon_init (&polygon, NULL, 0); status = _cairo_path_fixed_stroke_to_polygon (path, diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index 1733a86..a6274bd 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -367,7 +367,8 @@ _cairo_pdf_surface_create_for_stream_internal (cairo_output_stream_t *output, _cairo_surface_init (&surface->base, &cairo_pdf_surface_backend, NULL, /* device */ - CAIRO_CONTENT_COLOR_ALPHA); + CAIRO_CONTENT_COLOR_ALPHA, + TRUE); /* is_vector */ surface->output = output; surface->width = width; diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index cd03e1a..fd0d284 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -1017,7 +1017,8 @@ _cairo_ps_surface_create_for_stream_internal (cairo_output_stream_t *stream, _cairo_surface_init (&surface->base, &cairo_ps_surface_backend, NULL, /* device */ - CAIRO_CONTENT_COLOR_ALPHA); + CAIRO_CONTENT_COLOR_ALPHA, + TRUE); /* is_vector */ surface->final_stream = stream; diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c index 78e7cfa..c7cd4a1 100644 --- a/src/cairo-recording-surface.c +++ b/src/cairo-recording-surface.c @@ -393,7 +393,8 @@ cairo_recording_surface_create (cairo_content_t content, _cairo_surface_init (&surface->base, &cairo_recording_surface_backend, NULL, /* device */ - content); + content, + TRUE); /* is_vector */ surface->unbounded = TRUE; @@ -556,7 +557,7 @@ attach_proxy (cairo_surface_t *source, if (unlikely (proxy == NULL)) return _cairo_surface_create_in_error (CAIRO_STATUS_NO_MEMORY); - _cairo_surface_init (&proxy->base, &proxy_backend, NULL, image->content); + _cairo_surface_init (&proxy->base, &proxy_backend, NULL, image->content, FALSE); proxy->image = image; _cairo_surface_attach_snapshot (source, &proxy->base, NULL); @@ -1431,7 +1432,8 @@ _cairo_recording_surface_snapshot (void *abstract_other) _cairo_surface_init (&surface->base, &cairo_recording_surface_backend, NULL, /* device */ - other->base.content); + other->base.content, + other->base.is_vector); surface->extents_pixels = other->extents_pixels; surface->extents = other->extents; diff --git a/src/cairo-script-surface.c b/src/cairo-script-surface.c index a4cefde..ea0117d 100644 --- a/src/cairo-script-surface.c +++ b/src/cairo-script-surface.c @@ -1111,7 +1111,8 @@ attach_snapshot (cairo_script_context_t *ctx, _cairo_surface_init (&surface->base, &script_snapshot_backend, &ctx->base, - source->content); + source->content, + source->is_vector); _cairo_output_stream_printf (ctx->stream, "dup /s%d exch def ", @@ -3648,7 +3649,8 @@ _cairo_script_surface_create_internal (cairo_script_context_t *ctx, _cairo_surface_init (&surface->base, &_cairo_script_surface_backend, &ctx->base, - content); + content, + TRUE); /* is_vector */ _cairo_surface_wrapper_init (&surface->wrapper, passthrough); diff --git a/src/cairo-surface-observer.c b/src/cairo-surface-observer.c index 52b0136..9d12fcd 100644 --- a/src/cairo-surface-observer.c +++ b/src/cairo-surface-observer.c @@ -385,7 +385,8 @@ _cairo_surface_create_observer_internal (cairo_device_t *device, _cairo_surface_init (&surface->base, &_cairo_surface_observer_backend, device, - target->content); + target->content, + target->is_vector); status = log_init (&surface->log, ((cairo_device_observer_t *)device)->log.record != NULL); diff --git a/src/cairo-surface-private.h b/src/cairo-surface-private.h index f20ab07..e4ad5f3 100644 --- a/src/cairo-surface-private.h +++ b/src/cairo-surface-private.h @@ -70,6 +70,7 @@ struct _cairo_surface { unsigned is_clear : 1; unsigned has_font_options : 1; unsigned owns_device : 1; + unsigned is_vector : 1; cairo_user_data_array_t user_data; cairo_user_data_array_t mime_data; diff --git a/src/cairo-surface-snapshot.c b/src/cairo-surface-snapshot.c index 68bf905..3477ac5 100644 --- a/src/cairo-surface-snapshot.c +++ b/src/cairo-surface-snapshot.c @@ -265,7 +265,8 @@ _cairo_surface_snapshot (cairo_surface_t *surface) _cairo_surface_init (&snapshot->base, &_cairo_surface_snapshot_backend, NULL, /* device */ - surface->content); + surface->content, + surface->is_vector); snapshot->base.type = surface->type; CAIRO_MUTEX_INIT (snapshot->mutex); diff --git a/src/cairo-surface-subsurface.c b/src/cairo-surface-subsurface.c index b7dfd9d..5b7ce0c 100644 --- a/src/cairo-surface-subsurface.c +++ b/src/cairo-surface-subsurface.c @@ -478,7 +478,8 @@ cairo_surface_create_for_rectangle (cairo_surface_t *target, _cairo_surface_init (&surface->base, &_cairo_surface_subsurface_backend, NULL, /* device */ - target->content); + target->content, + target->is_vector); /* XXX forced integer alignment */ surface->extents.x = ceil (x); @@ -528,7 +529,8 @@ _cairo_surface_create_for_rectangle_int (cairo_surface_t *target, _cairo_surface_init (&surface->base, &_cairo_surface_subsurface_backend, NULL, /* device */ - target->content); + target->content, + target->is_vector); surface->extents = *extents; surface->extents.x *= target->device_transform.xx; diff --git a/src/cairo-surface.c b/src/cairo-surface.c index bfe3fa1..46f6894 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -113,7 +113,8 @@ const cairo_surface_t name = { \ FALSE, /* finished */ \ TRUE, /* is_clear */ \ FALSE, /* has_font_options */ \ - FALSE, /* owns_device */ \ + FALSE, /* owns_device */ \ + FALSE, /* is_vector */ \ { 0, 0, 0, NULL, }, /* user_data */ \ { 0, 0, 0, NULL, }, /* mime_data */ \ { 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 }, /* device_transform */ \ @@ -400,7 +401,8 @@ void _cairo_surface_init (cairo_surface_t *surface, const cairo_surface_backend_t *backend, cairo_device_t *device, - cairo_content_t content) + cairo_content_t content, + cairo_bool_t is_vector) { CAIRO_MUTEX_INITIALIZE (); @@ -408,6 +410,7 @@ _cairo_surface_init (cairo_surface_t *surface, surface->device = cairo_device_reference (device); surface->content = content; surface->type = backend->type; + surface->is_vector = is_vector; CAIRO_REFERENCE_COUNT_INIT (&surface->ref_count, 1); surface->status = CAIRO_STATUS_SUCCESS; diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c index 372ef45..2e023b3 100644 --- a/src/cairo-svg-surface.c +++ b/src/cairo-svg-surface.c @@ -483,7 +483,8 @@ _cairo_svg_surface_create_for_document (cairo_svg_document_t *document, _cairo_surface_init (&surface->base, &cairo_svg_surface_backend, NULL, /* device */ - content); + content, + TRUE); /* is_vector */ surface->width = width; surface->height = height; diff --git a/src/cairo-type3-glyph-surface.c b/src/cairo-type3-glyph-surface.c index c99d461..8c154b3 100644 --- a/src/cairo-type3-glyph-surface.c +++ b/src/cairo-type3-glyph-surface.c @@ -90,7 +90,8 @@ _cairo_type3_glyph_surface_create (cairo_scaled_font_t *scaled_font, _cairo_surface_init (&surface->base, &cairo_type3_glyph_surface_backend, NULL, /* device */ - CAIRO_CONTENT_COLOR_ALPHA); + CAIRO_CONTENT_COLOR_ALPHA, + TRUE); /* is_vector */ surface->scaled_font = scaled_font; surface->stream = stream; diff --git a/src/cairo-xcb-surface-core.c b/src/cairo-xcb-surface-core.c index 9c0c0a0..40d0ca4 100644 --- a/src/cairo-xcb-surface-core.c +++ b/src/cairo-xcb-surface-core.c @@ -93,7 +93,8 @@ _cairo_xcb_pixmap_create (cairo_xcb_surface_t *target, _cairo_surface_init (&surface->base, &_cairo_xcb_pixmap_backend, NULL, - target->base.content); + target->base.content, + FALSE); /* is_vector */ surface->connection = target->connection; surface->screen = target->screen; @@ -126,7 +127,8 @@ _cairo_xcb_pixmap_copy (cairo_xcb_surface_t *target) _cairo_surface_init (&surface->base, &_cairo_xcb_pixmap_backend, NULL, - target->base.content); + target->base.content, + FALSE); /* is_vector */ surface->connection = target->connection; surface->screen = target->screen; diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c index 044339b..64a3d5a 100644 --- a/src/cairo-xcb-surface-render.c +++ b/src/cairo-xcb-surface-render.c @@ -122,7 +122,8 @@ _cairo_xcb_picture_create (cairo_xcb_screen_t *screen, _cairo_surface_init (&surface->base, &_cairo_xcb_picture_backend, &screen->connection->device, - _cairo_content_from_pixman_format (pixman_format)); + _cairo_content_from_pixman_format (pixman_format), + FALSE); /* is_vector */ cairo_list_add (&surface->link, &screen->pictures); diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index d4d60ad..b319b7f 100644 --- a/src/cairo-xcb-surface.c +++ b/src/cairo-xcb-surface.c @@ -1081,7 +1081,8 @@ _cairo_xcb_surface_create_internal (cairo_xcb_screen_t *screen, _cairo_surface_init (&surface->base, &_cairo_xcb_surface_backend, &screen->connection->device, - _cairo_content_from_pixman_format (pixman_format)); + _cairo_content_from_pixman_format (pixman_format), + FALSE); /* is_vector */ surface->connection = _cairo_xcb_connection_reference (screen->connection); surface->screen = screen; diff --git a/src/cairo-xlib-source.c b/src/cairo-xlib-source.c index 1591f58..d6ea06a 100644 --- a/src/cairo-xlib-source.c +++ b/src/cairo-xlib-source.c @@ -120,7 +120,8 @@ source (cairo_xlib_surface_t *dst, Picture picture, Pixmap pixmap) _cairo_surface_init (&source->base, &cairo_xlib_source_backend, NULL, /* device */ - CAIRO_CONTENT_COLOR_ALPHA); + CAIRO_CONTENT_COLOR_ALPHA, + FALSE); /* is_vector */ /* The source exists only within an operation */ source->picture = picture; @@ -626,7 +627,8 @@ static cairo_xlib_source_t *init_source (cairo_xlib_surface_t *dst, _cairo_surface_init (&source->base, &cairo_xlib_source_backend, NULL, /* device */ - CAIRO_CONTENT_COLOR_ALPHA); + CAIRO_CONTENT_COLOR_ALPHA, + FALSE); /* is_vector */ pa.subwindow_mode = IncludeInferiors; source->picture = XRenderCreatePicture (dpy, @@ -971,7 +973,8 @@ surface_source (cairo_xlib_surface_t *dst, _cairo_surface_init (&proxy->source.base, &cairo_xlib_proxy_backend, dst->base.device, - src->content); + src->content, + src->is_vector); proxy->source.dpy = dst->display->display; proxy->source.picture = XRenderCreatePicture (proxy->source.dpy, diff --git a/src/cairo-xlib-surface-shm.c b/src/cairo-xlib-surface-shm.c index fb40699..3187223 100644 --- a/src/cairo-xlib-surface-shm.c +++ b/src/cairo-xlib-surface-shm.c @@ -821,7 +821,8 @@ _cairo_xlib_shm_surface_create (cairo_xlib_surface_t *other, _cairo_surface_init (&shm->image.base, &cairo_xlib_shm_surface_backend, other->base.device, - _cairo_content_from_pixman_format (format)); + _cairo_content_from_pixman_format (format), + FALSE); /* is_vector */ if (_cairo_xlib_display_acquire (other->base.device, &display)) goto cleanup_shm; diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 029a542..3f407c3 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -1796,7 +1796,8 @@ found: _cairo_surface_init (&surface->base, &cairo_xlib_surface_backend, screen->device, - _xrender_format_to_content (xrender_format)); + _xrender_format_to_content (xrender_format), + FALSE); /* is_vector */ surface->screen = screen; surface->compositor = display->compositor; diff --git a/src/cairoint.h b/src/cairoint.h index 555aa89..f781748 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -1021,6 +1021,7 @@ cairo_private void _cairo_path_fixed_approximate_stroke_extents (const cairo_path_fixed_t *path, const cairo_stroke_style_t *style, const cairo_matrix_t *ctm, + cairo_bool_t vector, cairo_rectangle_int_t *extents); cairo_private cairo_status_t @@ -1335,7 +1336,8 @@ cairo_private void _cairo_surface_init (cairo_surface_t *surface, const cairo_surface_backend_t *backend, cairo_device_t *device, - cairo_content_t content); + cairo_content_t content, + cairo_bool_t is_vector); cairo_private void _cairo_surface_set_font_options (cairo_surface_t *surface, diff --git a/src/win32/cairo-win32-printing-surface.c b/src/win32/cairo-win32-printing-surface.c index ad54a4c..510c563 100644 --- a/src/win32/cairo-win32-printing-surface.c +++ b/src/win32/cairo-win32-printing-surface.c @@ -2146,7 +2146,8 @@ cairo_win32_printing_surface_create (HDC hdc) _cairo_surface_init (&surface->win32.base, &cairo_win32_printing_surface_backend, NULL, /* device */ - CAIRO_CONTENT_COLOR_ALPHA); + CAIRO_CONTENT_COLOR_ALPHA, + TRUE); /* is_vector */ paginated = _cairo_paginated_surface_create (&surface->win32.base, CAIRO_CONTENT_COLOR_ALPHA, From ajohnson at kemper.freedesktop.org Sat Oct 17 04:33:58 2015 From: ajohnson at kemper.freedesktop.org (Adrian Johnson) Date: Sat, 17 Oct 2015 04:33:58 -0700 (PDT) Subject: [cairo-commit] src/cairo-cogl-surface.c src/cairo-directfb-surface.c src/cairo-gl-surface.c src/cairo-os2-surface.c src/cairo-quartz-image-surface.c src/cairo-quartz-surface.c src/cairo-tee-surface.c src/cairo-vg-surface.c src/cairo-xml-surface.c src/test-compositor-surface.c src/test-null-compositor-surface.c src/test-paginated-surface.c Message-ID: <20151017113358.C5BAE76264@kemper.freedesktop.org> src/cairo-cogl-surface.c | 3 ++- src/cairo-directfb-surface.c | 3 ++- src/cairo-gl-surface.c | 3 ++- src/cairo-os2-surface.c | 3 ++- src/cairo-quartz-image-surface.c | 3 ++- src/cairo-quartz-surface.c | 3 ++- src/cairo-tee-surface.c | 3 ++- src/cairo-vg-surface.c | 3 ++- src/cairo-xml-surface.c | 3 ++- src/test-compositor-surface.c | 3 ++- src/test-null-compositor-surface.c | 3 ++- src/test-paginated-surface.c | 3 ++- 12 files changed, 24 insertions(+), 12 deletions(-) New commits: commit aa1323f04cd2c71317e9173fbe26fe7d0ba34908 Author: Adrian Johnson Date: Sat Oct 17 22:02:11 2015 +1030 Fix some surfaces missed in b1192bea diff --git a/src/cairo-cogl-surface.c b/src/cairo-cogl-surface.c index c57fd7f..f61e16c 100644 --- a/src/cairo-cogl-surface.c +++ b/src/cairo-cogl-surface.c @@ -2544,7 +2544,8 @@ _cairo_cogl_surface_create_full (cairo_cogl_device_t *dev, _cairo_surface_init (&surface->base, &_cairo_cogl_surface_backend, &dev->base, - CAIRO_CONTENT_COLOR_ALPHA); + CAIRO_CONTENT_COLOR_ALPHA, + FALSE); /* is_vector */ return &surface->base; } diff --git a/src/cairo-directfb-surface.c b/src/cairo-directfb-surface.c index 5ac64ba..0deedf0 100644 --- a/src/cairo-directfb-surface.c +++ b/src/cairo-directfb-surface.c @@ -522,7 +522,8 @@ cairo_directfb_surface_create (IDirectFB *dfb, IDirectFBSurface *dfbsurface) _cairo_surface_init (&surface->image.base, &_cairo_dfb_surface_backend, NULL, /* device */ - _directfb_format_to_content (format)); + _directfb_format_to_content (format), + FALSE); /* is_vector */ surface->image.pixman_format = pixman_format; surface->image.format = _cairo_format_from_pixman_format (pixman_format); diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c index cfccf4d..5950fbb 100644 --- a/src/cairo-gl-surface.c +++ b/src/cairo-gl-surface.c @@ -389,7 +389,8 @@ _cairo_gl_surface_init (cairo_device_t *device, _cairo_surface_init (&surface->base, &_cairo_gl_surface_backend, device, - content); + content, + FALSE); /* is_vector */ surface->width = width; surface->height = height; diff --git a/src/cairo-os2-surface.c b/src/cairo-os2-surface.c index 1ab50f9..226eec0 100644 --- a/src/cairo-os2-surface.c +++ b/src/cairo-os2-surface.c @@ -780,7 +780,8 @@ cairo_os2_surface_create (HPS hps_client_window, _cairo_surface_init (&local_os2_surface->base, &cairo_os2_surface_backend, NULL, /* device */ - _cairo_content_from_format (CAIRO_FORMAT_ARGB32)); + _cairo_content_from_format (CAIRO_FORMAT_ARGB32), + FALSE); /* is_vector */ /* Successful exit */ return (cairo_surface_t *)local_os2_surface; diff --git a/src/cairo-quartz-image-surface.c b/src/cairo-quartz-image-surface.c index 498a7b0..8dc3c79 100644 --- a/src/cairo-quartz-image-surface.c +++ b/src/cairo-quartz-image-surface.c @@ -361,7 +361,8 @@ cairo_quartz_image_surface_create (cairo_surface_t *surface) _cairo_surface_init (&qisurf->base, &cairo_quartz_image_surface_backend, NULL, /* device */ - _cairo_content_from_format (format)); + _cairo_content_from_format (format), + FALSE); /* is_vector */ qisurf->width = width; qisurf->height = height; diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c index 5e9b376..e047b22 100644 --- a/src/cairo-quartz-surface.c +++ b/src/cairo-quartz-surface.c @@ -2262,7 +2262,8 @@ _cairo_quartz_surface_create_internal (CGContextRef cgContext, _cairo_surface_init (&surface->base, &cairo_quartz_surface_backend, NULL, /* device */ - content); + content, + FALSE); /* is_vector */ _cairo_surface_clipper_init (&surface->clipper, _cairo_quartz_surface_clipper_intersect_clip_path); diff --git a/src/cairo-tee-surface.c b/src/cairo-tee-surface.c index 294e5f1..48e9d43 100644 --- a/src/cairo-tee-surface.c +++ b/src/cairo-tee-surface.c @@ -435,7 +435,8 @@ cairo_tee_surface_create (cairo_surface_t *master) _cairo_surface_init (&surface->base, &cairo_tee_surface_backend, master->device, - master->content); + master->content, + TRUE); /* is_vector */ _cairo_surface_wrapper_init (&surface->master, master); diff --git a/src/cairo-vg-surface.c b/src/cairo-vg-surface.c index 6e0d9a0..b94b7aa 100644 --- a/src/cairo-vg-surface.c +++ b/src/cairo-vg-surface.c @@ -1529,7 +1529,8 @@ _vg_surface_create_internal (cairo_vg_context_t *context, _cairo_surface_init (&surface->base, &cairo_vg_surface_backend, NULL, /* device */ - _vg_format_to_content (format)); + _vg_format_to_content (format), + FALSE); /* is_vector */ surface->width = width; surface->height = height; diff --git a/src/cairo-xml-surface.c b/src/cairo-xml-surface.c index 6dbafdb..b885fff 100644 --- a/src/cairo-xml-surface.c +++ b/src/cairo-xml-surface.c @@ -1105,7 +1105,8 @@ _cairo_xml_surface_create_internal (cairo_device_t *device, _cairo_surface_init (&surface->base, &_cairo_xml_surface_backend, device, - content); + content, + TRUE); /* is_vector */ surface->width = width; surface->height = height; diff --git a/src/test-compositor-surface.c b/src/test-compositor-surface.c index 1cc5f69..945d65b 100644 --- a/src/test-compositor-surface.c +++ b/src/test-compositor-surface.c @@ -87,7 +87,8 @@ test_compositor_surface_create (const cairo_compositor_t *compositor, _cairo_surface_init (&surface->base.base, &test_compositor_surface_backend, NULL, /* device */ - content); + content, + FALSE); /* is_vector */ _cairo_image_surface_init (&surface->base, pixman_image, pixman_format); surface->base.compositor = compositor; diff --git a/src/test-null-compositor-surface.c b/src/test-null-compositor-surface.c index 2301055..d5d98c8 100644 --- a/src/test-null-compositor-surface.c +++ b/src/test-null-compositor-surface.c @@ -90,7 +90,8 @@ test_compositor_surface_create (const cairo_compositor_t *compositor, _cairo_surface_init (&surface->base.base, &test_compositor_surface_backend, NULL, /* device */ - content); + content, + FALSE); /* is_vector */ _cairo_image_surface_init (&surface->base, pixman_image, pixman_format); surface->base.compositor = compositor; diff --git a/src/test-paginated-surface.c b/src/test-paginated-surface.c index 0a7c79b..a0d4c1c 100644 --- a/src/test-paginated-surface.c +++ b/src/test-paginated-surface.c @@ -81,7 +81,8 @@ _cairo_test_paginated_surface_create (cairo_surface_t *target) _cairo_surface_init (&surface->base, &test_paginated_surface_backend, NULL, /* device */ - target->content); + target->content, + TRUE); /* is_vector */ surface->target = cairo_surface_reference (target); From ajohnson at kemper.freedesktop.org Sat Oct 17 05:12:56 2015 From: ajohnson at kemper.freedesktop.org (Adrian Johnson) Date: Sat, 17 Oct 2015 05:12:56 -0700 (PDT) Subject: [cairo-commit] 2 commits - src/cairo-gl-source.c src/win32 Message-ID: <20151017121256.6876A76264@kemper.freedesktop.org> src/cairo-gl-source.c | 6 +++-- src/win32/cairo-win32-display-surface.c | 6 +++-- src/win32/cairo-win32-printing-surface.c | 36 ++++++++++++++++++++++++------- 3 files changed, 36 insertions(+), 12 deletions(-) New commits: commit 2d026bd2cf4d8cb1973f56b30a7ba8609e3ebb5f Author: Adrian Johnson Date: Sat Oct 17 22:39:09 2015 +1030 win32-print: support subsurface recording patterns diff --git a/src/win32/cairo-win32-display-surface.c b/src/win32/cairo-win32-display-surface.c index 1571480..025b2c9 100644 --- a/src/win32/cairo-win32-display-surface.c +++ b/src/win32/cairo-win32-display-surface.c @@ -334,7 +334,8 @@ _cairo_win32_display_surface_create_for_dc (HDC original_dc, _cairo_surface_init (&surface->win32.base, &cairo_win32_display_surface_backend, device, - _cairo_content_from_format (format)); + _cairo_content_from_format (format), + FALSE); /* is_vector */ cairo_device_destroy (device); @@ -979,7 +980,8 @@ cairo_win32_surface_create_with_format (HDC hdc, cairo_format_t format) _cairo_surface_init (&surface->win32.base, &cairo_win32_display_surface_backend, device, - _cairo_content_from_format (format)); + _cairo_content_from_format (format), + FALSE); /* is_vector */ cairo_device_destroy (device); diff --git a/src/win32/cairo-win32-printing-surface.c b/src/win32/cairo-win32-printing-surface.c index 510c563..afc0b11 100644 --- a/src/win32/cairo-win32-printing-surface.c +++ b/src/win32/cairo-win32-printing-surface.c @@ -60,6 +60,8 @@ #include "cairo-image-surface-private.h" #include "cairo-surface-backend-private.h" #include "cairo-surface-clipper-private.h" +#include "cairo-surface-snapshot-inline.h" +#include "cairo-surface-subsurface-private.h" #include @@ -546,6 +548,8 @@ _cairo_win32_printing_surface_paint_recording_pattern (cairo_win32_printing_surf RECT clip; cairo_recording_surface_t *recording_surface = (cairo_recording_surface_t *) pattern->surface; cairo_box_t bbox; + cairo_surface_t *free_me = NULL; + cairo_bool_t is_subsurface; extend = cairo_pattern_get_extend (&pattern->base); @@ -561,15 +565,28 @@ _cairo_win32_printing_surface_paint_recording_pattern (cairo_win32_printing_surf SaveDC (surface->win32.dc); _cairo_matrix_to_win32_xform (&p2d, &xform); - status = _cairo_recording_surface_get_bbox (recording_surface, &bbox, NULL); - if (status) - return status; + if (_cairo_surface_is_snapshot (&recording_surface->base)) { + free_me = _cairo_surface_snapshot_get_target (&recording_surface->base); + recording_surface = (cairo_recording_surface_t *) free_me; + } + + if (recording_surface->base.backend->type == CAIRO_SURFACE_TYPE_SUBSURFACE) { + cairo_surface_subsurface_t *sub = (cairo_surface_subsurface_t *) recording_surface; + + recording_surface = (cairo_recording_surface_t *) (sub->target); + recording_extents = sub->extents; + is_subsurface = TRUE; + } else { + status = _cairo_recording_surface_get_bbox (recording_surface, &bbox, NULL); + if (status) + goto err; - _cairo_box_round_to_rectangle (&bbox, &recording_extents); + _cairo_box_round_to_rectangle (&bbox, &recording_extents); + } status = _cairo_win32_printing_surface_get_ctm_clip_box (surface, &clip); if (status) - return status; + goto err; if (extend == CAIRO_EXTEND_REPEAT || extend == CAIRO_EXTEND_REFLECT) { left = floor (clip.left / _cairo_fixed_to_double (bbox.p2.x - bbox.p1.x)); @@ -589,7 +606,7 @@ _cairo_win32_printing_surface_paint_recording_pattern (cairo_win32_printing_surf status = _cairo_win32_printing_surface_paint_solid_pattern (surface, &_cairo_pattern_black.base); if (status) - return status; + goto err; } for (y_tile = top; y_tile < bottom; y_tile++) { @@ -643,7 +660,8 @@ _cairo_win32_printing_surface_paint_recording_pattern (cairo_win32_printing_surf SelectClipPath (surface->win32.dc, RGN_AND); SaveDC (surface->win32.dc); /* Allow clip path to be reset during replay */ - status = _cairo_recording_surface_replay_region (&recording_surface->base, NULL, + status = _cairo_recording_surface_replay_region (&recording_surface->base, + is_subsurface ? &recording_extents : NULL, &surface->win32.base, CAIRO_RECORDING_REGION_NATIVE); assert (status != CAIRO_INT_STATUS_UNSUPPORTED); @@ -651,7 +669,7 @@ _cairo_win32_printing_surface_paint_recording_pattern (cairo_win32_printing_surf RestoreDC (surface->win32.dc, -2); if (status) - return status; + goto err; } } @@ -660,6 +678,8 @@ _cairo_win32_printing_surface_paint_recording_pattern (cairo_win32_printing_surf surface->has_ctm = old_has_ctm; RestoreDC (surface->win32.dc, -1); + err: + cairo_surface_destroy (free_me); return status; } commit b7d864e8c18e4407e69ff897cae7a42eb09b03c9 Author: Adrian Johnson Date: Sat Oct 17 22:38:50 2015 +1030 Compile fix diff --git a/src/cairo-gl-source.c b/src/cairo-gl-source.c index 1223529..ba11b7e 100644 --- a/src/cairo-gl-source.c +++ b/src/cairo-gl-source.c @@ -76,7 +76,8 @@ _cairo_gl_pattern_to_source (cairo_surface_t *dst, _cairo_surface_init (&source->base, &cairo_gl_source_backend, NULL, /* device */ - CAIRO_CONTENT_COLOR_ALPHA); + CAIRO_CONTENT_COLOR_ALPHA, + FALSE); /* is_vector */ *src_x = *src_y = 0; status = _cairo_gl_operand_init (&source->operand, pattern, @@ -103,7 +104,8 @@ _cairo_gl_white_source (void) _cairo_surface_init (&source->base, &cairo_gl_source_backend, NULL, /* device */ - CAIRO_CONTENT_COLOR_ALPHA); + CAIRO_CONTENT_COLOR_ALPHA, + FALSE); /* is_vector */ _cairo_gl_solid_operand_init (&source->operand, CAIRO_COLOR_WHITE); From ajohnson at kemper.freedesktop.org Sat Oct 17 05:16:52 2015 From: ajohnson at kemper.freedesktop.org (Adrian Johnson) Date: Sat, 17 Oct 2015 05:16:52 -0700 (PDT) Subject: [cairo-commit] src/cairo-gl-msaa-compositor.c Message-ID: <20151017121652.A52D176264@kemper.freedesktop.org> src/cairo-gl-msaa-compositor.c | 1 + 1 file changed, 1 insertion(+) New commits: commit 481e5986f982238c5603ae3b2feea74aaa964adb Author: Adrian Johnson Date: Sat Oct 17 22:46:23 2015 +1030 Compile fix diff --git a/src/cairo-gl-msaa-compositor.c b/src/cairo-gl-msaa-compositor.c index 83e8eb2..4904b9a 100644 --- a/src/cairo-gl-msaa-compositor.c +++ b/src/cairo-gl-msaa-compositor.c @@ -582,6 +582,7 @@ _prevent_overlapping_strokes (cairo_gl_context_t *ctx, scissor_was_enabled = glIsEnabled (GL_SCISSOR_TEST); if (! scissor_was_enabled) { _cairo_path_fixed_approximate_stroke_extents (path, style, ctm, + FALSE, /* is_vector */ &stroke_extents); _cairo_gl_scissor_to_rectangle (setup->dst, &stroke_extents); } From bryce at kemper.freedesktop.org Tue Oct 27 11:10:45 2015 From: bryce at kemper.freedesktop.org (Bryce Harrington) Date: Tue, 27 Oct 2015 11:10:45 -0700 (PDT) Subject: [cairo-commit] NEWS Message-ID: <20151027181045.3DCBD76188@kemper.freedesktop.org> NEWS | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) New commits: commit 04a40d2ff34a9443bb2f71b57a523878fa9f4d11 Author: Bryce Harrington Date: Tue Oct 27 11:10:23 2015 -0700 NEWS: Update to cover changes to date diff --git a/NEWS b/NEWS index ffe3c28..8c0b82c 100644 --- a/NEWS +++ b/NEWS @@ -41,6 +41,66 @@ Bug Fixes * Fix compilation problem on AIX due to conflicting usage of symbol 'jmpbuf'. (Bug #89339) +* Fix broken rendering with XCB due to snapshotting of uploaded part of + surfaces. (Bug #67505) + +* Fix loss of alpha when copying a mask for a cairo recording surface, + resulting in a double copy. (Bugs #73038, #73901) + +* Fix incorrect recording of certain paths with script surfaces. + (Bug #91054) + +* Avoid using uninitialised variable on impossible error path + (Bug #87893) + +* Fix use of filename variable after it's been freed. + (Bug #91206) + +* Fix redundant check of truetype struct. + (Bug #29010) + +* Fix out of bounds access when printing pattern. + (Bug #91266) + +* Fix incorrect size calculation in glyph cache unlocking for Cairo GL + compositor. + (Bug #91321) + +* Fix filter quality with image backend for the Quartz framework, such + that CAIRO_FILTER_GOOD and CAIRO_FILTER_BILINEAR map to + kCGInterpolationLow. + +* Fix potential bug with incorrect rendering of SVG paths with more than + one subpath. + (Bug #90984) + +* Fix memory leak in _cairo_gl_pattern_texture_setup() + (Bug #91537) + +* Fix crash in PDF backend when rendering certain glyphs. + (Bug #91902) + +* Fix broken PDFs that use glyph 0 in embedded fonts for rendering + instead of .notdef. Map it to a non-0 glyph in the subset. + (Bug #89082) + +* Fix transparent images in win32-print. + (Bug #91835) + +* Fix _put_shm_image_boxes and _put_image_boxes when no SHM available + with XCB. + +* Fix use of memory barriers by default for ARM. + (Bug #90302) + +* Fix page extents for win32-print to avoid unbounded recording surfaces + with paginated surfaces. + +* Fix culling of very thin lines on vector surfaces. + (Bug #77298) + +* Cleanup various compiler and run-time warnings, valgrind errors, test + misbehaviors, etc. Release 1.14.2 (2015-03-09 Bryce Harrington ) ==================================================================== From bryce at kemper.freedesktop.org Wed Oct 28 21:54:47 2015 From: bryce at kemper.freedesktop.org (Bryce Harrington) Date: Wed, 28 Oct 2015 21:54:47 -0700 (PDT) Subject: [cairo-commit] 2 commits - cairo-version.h NEWS RELEASING Message-ID: <20151029045447.C10E3761E3@kemper.freedesktop.org> NEWS | 16 ++++++++++++---- RELEASING | 13 ++++++++----- cairo-version.h | 2 +- 3 files changed, 21 insertions(+), 10 deletions(-) New commits: commit 3fd993a2b16ab75fa8d7afbd1da577c89f020463 Author: Bryce Harrington Date: Tue Oct 27 13:53:55 2015 -0700 WIP news and release diff --git a/NEWS b/NEWS index 8c0b82c..2f1b775 100644 --- a/NEWS +++ b/NEWS @@ -1,14 +1,15 @@ -Release Next (DATE Bryce Harrington ) +Release 1.14.4 (2015-10-27 Bryce Harrington ) ======================================================================== -Documentation and tests Features -------- -Added a cairo API to set up Win32 surfaces for HDC with alpha channels. +New cairo API routine to set up Win32 surfaces for HDC with alpha +channels. API Changes ----------- -None +* Add cairo_win32_surface_create_with_format() API to set up a Win32 + psurface for an HDX with an alpha channel. Dependency Changes ------------------ @@ -102,6 +103,13 @@ Bug Fixes * Cleanup various compiler and run-time warnings, valgrind errors, test misbehaviors, etc. +Change Logs +----------- +For a detailed list of new changes in this release, see: + + http://cairographics.org/releases/ChangeLog.1.14.4 + + Release 1.14.2 (2015-03-09 Bryce Harrington ) ==================================================================== This release provides collected bug fixes, along with one feature diff --git a/RELEASING b/RELEASING index b857c59..97397d3 100644 --- a/RELEASING +++ b/RELEASING @@ -58,13 +58,14 @@ Here are the steps to follow to create a new cairo release: the following command will show each patch that has changed a public header file since the given version: - find src/ -name '*.h' ! -name '*-private.h' ! -name 'cairoint.h' ! -name 'cairo-*features*.h' | \ + find src/ -name '*.h' ! -name '*-private.h' \ + ! -name 'cairoint.h' ! -name 'cairo-*features*.h' | \ xargs git diff X.Y.Z.. -- - Produce a complete ChangeLog with all changes, and a - ChangeLog.X.Y with just the delta since the last release. - Upload both these to the website, and include a link to them in - the NEWS announce. + Include a link to the incremental ChangeLog for this release, + which we'll be uploading in a later step: + + http://cairographics.org/releases/ChangeLog.X.Y.Z 4) Increment cairo_version_{minor|micro} in cairo-version.h: @@ -112,6 +113,8 @@ Here are the steps to follow to create a new cairo release: If for some reason you lost this message, "make release-publish-message" prints it for you. + scp ChangeLog.xxx cairographics.org:releases/ChangeLog.X.Y.Z + 7) Increment cairo_version_micro to the next larger (odd) number in cairo-version.h, commit, and push. commit d7371acfe5f54bc14c25c725448fb6401c526f6a Author: Bryce Harrington Date: Tue Oct 27 11:53:14 2015 -0700 1.14.4 release diff --git a/cairo-version.h b/cairo-version.h index 31168dd..515ea26 100644 --- a/cairo-version.h +++ b/cairo-version.h @@ -3,6 +3,6 @@ #define CAIRO_VERSION_MAJOR 1 #define CAIRO_VERSION_MINOR 14 -#define CAIRO_VERSION_MICRO 3 +#define CAIRO_VERSION_MICRO 4 #endif From bryce at kemper.freedesktop.org Wed Oct 28 21:54:47 2015 From: bryce at kemper.freedesktop.org (Bryce Harrington) Date: Wed, 28 Oct 2015 21:54:47 -0700 (PDT) Subject: [cairo-commit] Changes to 'refs/tags/1.14.4' Message-ID: <20151029045447.DFD00760B5@kemper.freedesktop.org> Tag '1.14.4' created by Bryce Harrington at 2015-10-29 04:27 -0700 cairo 1.14.4 release -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEABECAAYFAlYxkiMACgkQEaMBVuDmdhH0FACgoi01huKC9SNyBha3KYDuyn6I YkUAoKfLb+KhBJHk3BPDH2bBR6gnpnBC =Ho2m -----END PGP SIGNATURE----- Changes since 1.14.0-103: --- 0 files changed --- From bryce at kemper.freedesktop.org Wed Oct 28 21:56:26 2015 From: bryce at kemper.freedesktop.org (Bryce Harrington) Date: Wed, 28 Oct 2015 21:56:26 -0700 (PDT) Subject: [cairo-commit] Branch '1.14' - 18 commits - boilerplate/cairo-boilerplate-glx.c build/configure.ac.warnings cairo-version.h NEWS src/cairo-gl-composite.c src/cairo-gl-operand.c src/cairo-pattern.c src/cairo-recording-surface.c src/cairo-scaled-font-subsets.c src/cairo-script-surface.c src/cairo-surface-observer-private.h src/cairo-win32.h src/cairo-xcb-surface.c src/win32 test/bitmap-font.c test/pdf-mime-data.c Message-ID: <20151029045626.40C0A761E3@kemper.freedesktop.org> NEWS | 88 +++++++++++++++++++++++++++++++ boilerplate/cairo-boilerplate-glx.c | 4 - build/configure.ac.warnings | 2 cairo-version.h | 2 src/cairo-gl-composite.c | 2 src/cairo-gl-operand.c | 8 ++ src/cairo-pattern.c | 10 +-- src/cairo-recording-surface.c | 2 src/cairo-scaled-font-subsets.c | 6 +- src/cairo-script-surface.c | 4 - src/cairo-surface-observer-private.h | 2 src/cairo-win32.h | 4 - src/cairo-xcb-surface.c | 21 +++---- src/win32/cairo-win32-display-surface.c | 68 +++++------------------ src/win32/cairo-win32-printing-surface.c | 2 test/bitmap-font.c | 4 + test/pdf-mime-data.c | 2 17 files changed, 143 insertions(+), 88 deletions(-) New commits: commit 0317ee7f61f1f4d154f7cb7e56d2b1080c2c644a Author: Bryce Harrington Date: Wed Oct 28 20:15:53 2015 -0700 1.14.4 release diff --git a/cairo-version.h b/cairo-version.h index 31168dd..515ea26 100644 --- a/cairo-version.h +++ b/cairo-version.h @@ -3,6 +3,6 @@ #define CAIRO_VERSION_MAJOR 1 #define CAIRO_VERSION_MINOR 14 -#define CAIRO_VERSION_MICRO 3 +#define CAIRO_VERSION_MICRO 4 #endif commit 01fff9f2d1646f27bd6f5cefcd880028330a2f67 Author: Bryce Harrington Date: Wed Oct 28 18:02:23 2015 -0700 NEWS: Update for 1.14.4 release diff --git a/NEWS b/NEWS index 6511af0..7bfa618 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,91 @@ +Release 1.14.4 (2015-10-28 Bryce Harrington ) +======================================================================== +Just in time for Halloween we see another bug-fix release for Cairo. +This brings a few dozen straightforward bug fixes with no API changes. + +In addition, this includes a typical assortment of fixes to tests, +cleanup of warnings and memory leaks, correction of misspellings, +updates to documentation, etc. + +For a complete log of changes since 1.14.2, please see: + + http://cairographics.org/releases/ChangeLog.1.14.4 + + +Features +-------- +None + +API Changes +----------- +None + +Dependency Changes +------------------ +None + +Performance Optimizations +------------------------- +None + +Bug Fixes +--------- +* Avoid appending empty slots to user data arrays. Fixes a memory + consumption regression since commit 9341c254a. + +* Return a better error (file-not-found) when setting up pango on + devices where the font files don't have read permissions. + +* Fix regression in the font size of canvas text in Inkscape when + compiled with the Quartz backend. (Bug #84324) + +* Fix _cairo_gl_shader_bind_matrix() to maintain compatibility with + OpenGL ES 2.0. Manually transpose the matrix. + +* Fix incorrect font descriptor conversion when the font matrix yy is + negative. (Bug #90538) + +* Fix crash when using a complex path for clip and stroke due to + discarding the intersection exactly at the top edge. + (Bug #74779) + +* Fix cairo_get_locale_decimal_point() on Android + +* Fix compilation problem on AIX due to conflicting usage of symbol + 'jmpbuf'. (Bug #89339) + +* Fix broken rendering with XCB due to snapshotting of uploaded part of + surfaces. (Bug #67505) + +* Fix loss of alpha when copying a mask for a cairo recording surface, + resulting in a double copy. (Bugs #73038, #73901) + +* Fix incorrect recording of certain paths with script surfaces. + (Bug #91054) + +* Fix typo in definition of MAYBE_WARN in configure script. + (Bug #89750) + +* Fix use of filename variable after it's been freed. + (Bug #91206) + +* Fix out of bounds access when printing pattern. + (Bug #91266) + +* Fix incorrect size calculation in glyph cache unlocking for Cairo GL + compositor. + (Bug #91321) + +* Fix memory leak in _cairo_gl_pattern_texture_setup() + (Bug #91537) + +* Fix transparent images in win32-print. + (Bug #91835) + +* Fix _put_shm_image_boxes and _put_image_boxes when no SHM available + with XCB. + + Release 1.14.2 (2014-03-09 Bryce Harrington ) ==================================================================== This release provides collected bug fixes, along with one feature commit 6eba71d2170443fb33e4d64261607f39b37245d6 Author: Bryce Harrington Date: Wed Oct 28 17:37:41 2015 -0700 Revert "win32: Add cairo API to set up a Win32 surface for an HDC with an alpha channel." This adds a new API call, which we generally avoid in micro releases. This reverts commit 3d489616a2fc624dc5e94164f23a4c8536d466d0. diff --git a/src/cairo-win32.h b/src/cairo-win32.h index db4cac6..3d2e1c6 100644 --- a/src/cairo-win32.h +++ b/src/cairo-win32.h @@ -49,10 +49,6 @@ cairo_public cairo_surface_t * cairo_win32_surface_create (HDC hdc); cairo_public cairo_surface_t * -cairo_win32_surface_create_with_format (HDC hdc, - cairo_format_t format); - -cairo_public cairo_surface_t * cairo_win32_printing_surface_create (HDC hdc); cairo_public cairo_surface_t * diff --git a/src/win32/cairo-win32-display-surface.c b/src/win32/cairo-win32-display-surface.c index 1571480..965f2c4 100644 --- a/src/win32/cairo-win32-display-surface.c +++ b/src/win32/cairo-win32-display-surface.c @@ -917,41 +917,31 @@ static const cairo_surface_backend_t cairo_win32_display_surface_backend = { */ /** - * cairo_win32_surface_create_with_format: + * cairo_win32_surface_create: * @hdc: the DC to create a surface for - * @format: format of pixels in the surface to create * * Creates a cairo surface that targets the given DC. The DC will be * queried for its initial clip extents, and this will be used as the - * size of the cairo surface. - * - * Supported formats are: - * %CAIRO_FORMAT_ARGB32 - * %CAIRO_FORMAT_RGB24 - * - * Note: @format only tells cairo how to draw on the surface, not what - * the format of the surface is. Namely, cairo does not (and cannot) - * check that @hdc actually supports alpha-transparency. + * size of the cairo surface. The resulting surface will always be of + * format %CAIRO_FORMAT_RGB24; should you need another surface format, + * you will need to create one through + * cairo_win32_surface_create_with_dib(). * - * Return value: the newly created surface, NULL on failure + * Return value: the newly created surface * - * Since: 1.14.3 + * Since: 1.0 **/ cairo_surface_t * -cairo_win32_surface_create_with_format (HDC hdc, cairo_format_t format) +cairo_win32_surface_create (HDC hdc) { cairo_win32_display_surface_t *surface; + cairo_format_t format; cairo_status_t status; cairo_device_t *device; - switch (format) { - default: - return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT)); - case CAIRO_FORMAT_ARGB32: - case CAIRO_FORMAT_RGB24: - break; - } + /* Assume that everything coming in as a HDC is RGB24 */ + format = CAIRO_FORMAT_RGB24; surface = malloc (sizeof (*surface)); if (surface == NULL) @@ -987,28 +977,6 @@ cairo_win32_surface_create_with_format (HDC hdc, cairo_format_t format) } /** - * cairo_win32_surface_create: - * @hdc: the DC to create a surface for - * - * Creates a cairo surface that targets the given DC. The DC will be - * queried for its initial clip extents, and this will be used as the - * size of the cairo surface. The resulting surface will always be of - * format %CAIRO_FORMAT_RGB24; should you need another surface format, - * you will need to create one through - * cairo_win32_surface_create_with_format() or - * cairo_win32_surface_create_with_dib(). - * - * Return value: the newly created surface, NULL on failure - * - * Since: 1.0 - **/ -cairo_surface_t * -cairo_win32_surface_create (HDC hdc) -{ - return cairo_win32_surface_create_with_format (hdc, CAIRO_FORMAT_RGB24); -} - -/** * cairo_win32_surface_create_with_dib: * @format: format of pixels in the surface to create * @width: width of the surface, in pixels @@ -1059,16 +1027,12 @@ cairo_win32_surface_create_with_ddb (HDC hdc, HDC screen_dc, ddb_dc; HBITMAP saved_dc_bitmap; - switch (format) { - default: -/* XXX handle these eventually */ - case CAIRO_FORMAT_A8: - case CAIRO_FORMAT_A1: + if (format != CAIRO_FORMAT_RGB24) return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT)); - case CAIRO_FORMAT_ARGB32: - case CAIRO_FORMAT_RGB24: - break; - } +/* XXX handle these eventually + format != CAIRO_FORMAT_A8 || + format != CAIRO_FORMAT_A1) +*/ if (!hdc) { screen_dc = GetDC (NULL); commit b15e18fb9045b21d6ab2eb531ac62f3693fd302c Author: Bryce Harrington Date: Fri Jul 17 12:07:18 2015 -0700 Revert "pattern: allow for a floating one pixel rounded difference." While this fixed a real bug, in testing this patch was found to fail a number of tests and thus needs further work. This reverts commit e7acf4b6dc6666c2a2c54fb08e9ad6f01a1d415f. diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index 562724d..ac5d7af 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -3531,7 +3531,7 @@ _cairo_pattern_get_extents (const cairo_pattern_t *pattern, cairo_rectangle_int_t *extents) { double x1, y1, x2, y2; - double ix1, ix2, iy1, iy2; + int ix1, ix2, iy1, iy2; cairo_bool_t round_x = FALSE; cairo_bool_t round_y = FALSE; @@ -3725,12 +3725,12 @@ _cairo_pattern_get_extents (const cairo_pattern_t *pattern, if (x1 < CAIRO_RECT_INT_MIN) ix1 = CAIRO_RECT_INT_MIN; else - ix1 = x1; + ix1 = _cairo_lround (x1); if (x2 > CAIRO_RECT_INT_MAX) ix2 = CAIRO_RECT_INT_MAX; else - ix2 = x2; - extents->x = ix1; extents->width = _cairo_lround(ix2 - ix1); + ix2 = _cairo_lround (x2); + extents->x = ix1; extents->width = ix2 - ix1; if (!round_y) { y1 -= 0.5; @@ -3744,7 +3744,7 @@ _cairo_pattern_get_extents (const cairo_pattern_t *pattern, iy2 = CAIRO_RECT_INT_MAX; else iy2 = _cairo_lround (y2); - extents->y = iy1; extents->height = _cairo_lround(iy2 - iy1); + extents->y = iy1; extents->height = iy2 - iy1; return; commit 580a1b6c39ea2a3c5fab5f2b6764a78f80f48aa2 Author: Uli Schlachter Date: Wed Oct 14 14:24:16 2015 +0200 xcb: Fix _put_image_boxes() if no SHM is available This function tries to use _cairo_xcb_connection_put_image() to do the actual work. However, that function can only be used for images with "native" stride. If we only want to upload a rectangle from within an image, the function _cairo_xcb_connection_put_subimage() has to be used. This function makes sure that the correct information is sent to the X11 server. No unit test for this, because we currently do not test the !SHM case automatically. Perhaps we should? Signed-off-by: Uli Schlachter diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index 2403a0d..d4d60ad 100644 --- a/src/cairo-xcb-surface.c +++ b/src/cairo-xcb-surface.c @@ -691,15 +691,15 @@ _put_image_boxes (cairo_xcb_surface_t *surface, int y = _cairo_fixed_integer_part (b->p1.y); int width = _cairo_fixed_integer_part (b->p2.x - b->p1.x); int height = _cairo_fixed_integer_part (b->p2.y - b->p1.y); - _cairo_xcb_connection_put_image (surface->connection, - surface->drawable, gc, - width, height, - x, y, - image->depth, - image->stride, - image->data + - x * PIXMAN_FORMAT_BPP (image->pixman_format) / 8 + - y * image->stride); + _cairo_xcb_connection_put_subimage (surface->connection, + surface->drawable, gc, + x, y, + width, height, + PIXMAN_FORMAT_BPP (image->pixman_format) / 8, + image->stride, + x, y, + image->depth, + image->data); } } commit 853c29eed12ab5539247acb130ffef559df82b38 Author: Uli Schlachter Date: Wed Oct 14 14:22:50 2015 +0200 xcb: Fix _put_shm_image_boxes if no SHM available This function always returned CAIRO_INT_STATUS_SUCCESS, even if it didn't do anything. This commit makes the function return CAIRO_INT_STATUS_UNSUPPORTED instead. No unit test for this, because we currently do not test the !SHM case automatically. Perhaps we should? Signed-off-by: Uli Schlachter diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index d7e0d73..2403a0d 100644 --- a/src/cairo-xcb-surface.c +++ b/src/cairo-xcb-surface.c @@ -646,9 +646,8 @@ _put_shm_image_boxes (cairo_xcb_surface_t *surface, shm_info->offset); } } + return CAIRO_INT_STATUS_SUCCESS; } - - return CAIRO_INT_STATUS_SUCCESS; #endif return CAIRO_INT_STATUS_UNSUPPORTED; commit 3fb344fefd16751d42121bf7864a9878661cabe9 Author: Rodrigo Rivas Costa Date: Wed Sep 30 23:53:23 2015 +0930 win32-print: fix transparent images have black background Bug 91835 diff --git a/src/win32/cairo-win32-printing-surface.c b/src/win32/cairo-win32-printing-surface.c index 6005cb5..cce7040 100644 --- a/src/win32/cairo-win32-printing-surface.c +++ b/src/win32/cairo-win32-printing-surface.c @@ -1840,7 +1840,7 @@ cairo_win32_printing_surface_create (HDC hdc) _cairo_win32_printing_surface_clipper_intersect_clip_path); surface->win32.format = CAIRO_FORMAT_RGB24; - surface->win32.base.content = CAIRO_CONTENT_COLOR_ALPHA; + surface->content = CAIRO_CONTENT_COLOR_ALPHA; surface->win32.dc = hdc; commit aa458ef5367eee727a421eb97f89e8eb8643ce10 Author: Bryce Harrington Date: Fri Aug 28 13:23:45 2015 -0700 Ensure null-terminated result from strncpy() diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c index 2121761..196fa99 100644 --- a/src/cairo-scaled-font-subsets.c +++ b/src/cairo-scaled-font-subsets.c @@ -1206,10 +1206,12 @@ _cairo_scaled_font_subset_create_glyph_names (cairo_scaled_font_subset_t *subset if (utf16_len == 1) { int ch = _cairo_unicode_to_winansi (utf16[0]); - if (ch > 0 && _cairo_winansi_to_glyphname (ch)) + if (ch > 0 && _cairo_winansi_to_glyphname (ch)) { strncpy (buf, _cairo_winansi_to_glyphname (ch), sizeof (buf)); - else + buf[sizeof (buf)-1] = '\0'; + } else { snprintf (buf, sizeof (buf), "uni%04X", (int) utf16[0]); + } _cairo_string_init_key (&key, buf); entry = _cairo_hash_table_lookup (names, &key.base); commit 6bde9f35df56ffaf574d098f61c60f6291f34b72 Author: Sahil Vij Date: Fri Aug 7 18:01:18 2015 -0700 gl: Fix bug in _cairo_gl_pattern_texture_setup() The memory allocated to "image" at line 298 is not freed before moving to label fail at line 305 and 314. This patch takes care of this memory leak in above mentioned cases. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91537 Signed-off-by: Sahil Vij Reviewed-by: Bryce Harrington diff --git a/src/cairo-gl-operand.c b/src/cairo-gl-operand.c index 4015747..1d1465a 100644 --- a/src/cairo-gl-operand.c +++ b/src/cairo-gl-operand.c @@ -301,8 +301,10 @@ _cairo_gl_pattern_texture_setup (cairo_gl_operand_t *operand, so we need to release this device while we paint it to the image. */ if (src_is_gl_surface) { status = _cairo_gl_context_release (ctx, status); - if (unlikely (status)) + if (unlikely (status)) { + _cairo_surface_unmap_image (&surface->base, image); goto fail; + } } status = _cairo_surface_offset_paint (&image->base, extents->x, extents->y, @@ -310,8 +312,10 @@ _cairo_gl_pattern_texture_setup (cairo_gl_operand_t *operand, if (src_is_gl_surface) { status = _cairo_gl_context_acquire (dst->base.device, &ctx); - if (unlikely (status)) + if (unlikely (status)) { + _cairo_surface_unmap_image (&surface->base, image); goto fail; + } } status = _cairo_surface_unmap_image (&surface->base, image); commit eb56bf8a5079c87d38d5eae63064308c14fdb876 Author: Bryce Harrington Date: Thu Jul 30 17:16:53 2015 -0700 boilerplate: Fix list termination for glXChooseVisual The attribute list is terminated by GLX_NONE (defined as 0x8000), but the man page of 'glXChooseVisual' says it must be terminated with None (0L). Issue found and fix suggested by Massimo. Signed-off-by: Bryce Harrington Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91293 diff --git a/boilerplate/cairo-boilerplate-glx.c b/boilerplate/cairo-boilerplate-glx.c index 3d58215..7701d90 100644 --- a/boilerplate/cairo-boilerplate-glx.c +++ b/boilerplate/cairo-boilerplate-glx.c @@ -82,13 +82,13 @@ _cairo_boilerplate_gl_create_surface (const char *name, GLX_BLUE_SIZE, 1, GLX_ALPHA_SIZE, 1, GLX_DOUBLEBUFFER, - GLX_NONE }; + None }; int rgb_attribs[] = { GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER, - GLX_NONE }; + None }; XVisualInfo *visinfo; GLXContext ctx; gl_target_closure_t *gltc; commit d18212f67d0a772737e10b862f615c3822d6d13b Author: Bryce Harrington Date: Thu Jul 30 16:45:15 2015 -0700 test: Free the memory, not the pointer to the memory In read_file(), we see: *data = malloc (*len); ... if (fread(*data, *len, 1, fp) != 1) { free(data); ... The free call needs to be free(*data), to match the malloc call. Matthias Clasen found this via Coverity and proposed the fix. Signed-off-by: Bryce Harrington Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91381 diff --git a/test/pdf-mime-data.c b/test/pdf-mime-data.c index fd5af1f..b49a1d1 100644 --- a/test/pdf-mime-data.c +++ b/test/pdf-mime-data.c @@ -82,7 +82,7 @@ read_file (const cairo_test_context_t *ctx, } if (fread(*data, *len, 1, fp) != 1) { - free (data); + free (*data); fclose(fp); cairo_test_log (ctx, "Could not read data from file %s\n", file); return CAIRO_TEST_FAILURE; commit 6c41ed5b9b0bfb63d576ec378dc1ef3dd2f9b891 Author: Arpit Jain Date: Mon Jul 13 11:31:48 2015 +0530 gl: Fix incorrect size of expression The sizeof operator now applied to the correct variable "ctx->glyph_cache", instead of its pointer address, in function "_cairo_gl_composite_flush". Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91321 Signed-off-by: Arpit Jain Reviewed-by: Bryce Harrington diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c index b50f9a7..5b14114 100644 --- a/src/cairo-gl-composite.c +++ b/src/cairo-gl-composite.c @@ -861,7 +861,7 @@ _cairo_gl_composite_flush (cairo_gl_context_t *ctx) _cairo_gl_composite_draw_triangles_with_clip_region (ctx, count); } - for (i = 0; i < ARRAY_LENGTH (&ctx->glyph_cache); i++) + for (i = 0; i < ARRAY_LENGTH (ctx->glyph_cache); i++) _cairo_gl_glyph_cache_unlock (&ctx->glyph_cache[i]); } commit 776cc09016951a72fce5eb4f05d08a3fb56e3589 Author: Ashim Date: Thu Jul 9 10:43:30 2015 +0530 Fix out of bound access in struct pattern->type The pattern structure is hardcoded to hold 7 elements, yet the pattern_names array in cairo-surface-observer.c is initialized with 8 strings. This causes a crash in print_array at line 1587 when it tries to access the 8th member. Hence changed the 'type' array from type[7] to type[8] to avoid out of bound access. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91266 Signed-off-by: Ashim Reviewed-by: Bryce Harrington diff --git a/src/cairo-surface-observer-private.h b/src/cairo-surface-observer-private.h index 70c87db..6ed0c18 100644 --- a/src/cairo-surface-observer-private.h +++ b/src/cairo-surface-observer-private.h @@ -62,7 +62,7 @@ struct extents { }; struct pattern { - unsigned int type[7]; /* native/record/other surface/gradients */ + unsigned int type[8]; /* native/record/other surface/gradients */ }; struct path { commit da1dcfa6c6240443abe61de1694eafca88346c32 Author: Arpit Jain Date: Fri Jul 3 15:31:48 2015 +0530 test/bitmap-font: Fix use of pointer after freed pointer The pointer 'filename' is already freed and still used as a function argument. This patch will free the pointer 'filename' only after it is used. Also, the patch ensures that it frees the pointer 'filename' before any return of this function. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91206 Signed-off-by: Arpit Jain Reviewed-by: Bryce Harrington diff --git a/test/bitmap-font.c b/test/bitmap-font.c index 0ec9b3d..525bafb 100644 --- a/test/bitmap-font.c +++ b/test/bitmap-font.c @@ -94,9 +94,9 @@ draw (cairo_t *cr, int width, int height) } pattern = FcFreeTypeQuery ((unsigned char *)filename, 0, NULL, &face_count); - free (filename); if (! pattern) { cairo_test_log (ctx, "FcFreeTypeQuery failed.\n"); + free (filename); return cairo_test_status_from_status (ctx, CAIRO_STATUS_NO_MEMORY); } @@ -108,9 +108,11 @@ draw (cairo_t *cr, int width, int height) cairo_test_log (ctx, "Error creating font face for %s: %s\n", filename, cairo_status_to_string (status)); + free (filename); return cairo_test_status_from_status (ctx, status); } + free (filename); if (cairo_font_face_get_type (font_face) != CAIRO_FONT_TYPE_FT) { cairo_test_log (ctx, "Unexpected value from cairo_font_face_get_type: %d (expected %d)\n", cairo_font_face_get_type (font_face), CAIRO_FONT_TYPE_FT); commit be9eda28616e60a082b72d884f4ab4dafba5b0db Author: Bryce Harrington Date: Sat Jun 27 00:43:04 2015 -0700 configure: Fix typo for missing line continuation character There is an unintentional (benign) missing line continuation "\" in the definition of MAYBE_WARN in configure. configure completes and issues a WARNING: configure: WARNING: cache variable cairo_cv_warn_maybe contains a newline Found and solved by Larry Baker. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=89750 Signed-off-by: Bryce Harrington diff --git a/build/configure.ac.warnings b/build/configure.ac.warnings index 74e6634..96c7f6f 100644 --- a/build/configure.ac.warnings +++ b/build/configure.ac.warnings @@ -12,7 +12,7 @@ dnl MAYBE_WARN in an ignorable way (like adding whitespace) MAYBE_WARN="-Wall -Wextra \ -Wmissing-declarations -Werror-implicit-function-declaration \ --Wpointer-arith -Wwrite-strings -Wsign-compare -Wpacked +-Wpointer-arith -Wwrite-strings -Wsign-compare -Wpacked \ -Wswitch-enum -Wmissing-format-attribute -Wvolatile-register-var \ -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \ -Wno-missing-field-initializers -Wno-unused-parameter \ commit e3635de87d6bab7ec7b53a76c53188e0b04d675a Author: Bryce Harrington Date: Fri Jun 26 16:30:06 2015 -0700 cairo-script: Return a cairo_status_t error, not FALSE This typo results in certain paths being incorrectly recorded with script surfaces. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91054 Signed-off-by: Bryce Harrington diff --git a/src/cairo-script-surface.c b/src/cairo-script-surface.c index b73a145..a4cefde 100644 --- a/src/cairo-script-surface.c +++ b/src/cairo-script-surface.c @@ -1837,7 +1837,7 @@ _emit_path_boxes (cairo_script_surface_t *surface, if (! _cairo_path_fixed_iter_at_end (&iter)) { _cairo_boxes_fini (&boxes); - return FALSE; + return CAIRO_STATUS_INVALID_PATH_DATA; } for (chunk = &boxes.chunks; chunk; chunk = chunk->next) { commit 0f85e035e693f4cad03703ab619d299ba1ebd13e Author: Bryce Harrington Date: Thu Jun 25 18:54:23 2015 -0700 cairo-recording-surface: Fix loss of alpha when clipping Commit 8020e0bc introduced a regression due to a typo when copying a mask for a cairo recording surface. It should copy the source and mask members from the command source to the recording surface, but instead it copies the source twice. Fix suggested by Massimo. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73038 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73901 diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c index ce29b93..78e7cfa 100644 --- a/src/cairo-recording-surface.c +++ b/src/cairo-recording-surface.c @@ -1165,7 +1165,7 @@ _cairo_recording_surface_copy__mask (cairo_recording_surface_t *surface, goto err_command; status = _cairo_pattern_init_copy (&command->mask.base, - &src->mask.source.base); + &src->mask.mask.base); if (unlikely (status)) goto err_source; commit 5d656f3e86cab791f80c8ddf401bb863accec36d Author: Bryce Harrington Date: Thu Jun 25 17:41:26 2015 -0700 cairo-script: Fix sp. "directoriy" Signed-off-by: Bryce Harrington diff --git a/src/cairo-script-surface.c b/src/cairo-script-surface.c index b84aed9..b73a145 100644 --- a/src/cairo-script-surface.c +++ b/src/cairo-script-surface.c @@ -50,7 +50,7 @@ * * The script surface provides the ability to render to a native * script that matches the cairo drawing model. The scripts can - * be replayed using tools under the util/cairo-script directoriy, + * be replayed using tools under the util/cairo-script directory, * or with cairo-perf-trace. **/ From bryce at freedesktop.org Wed Oct 28 22:07:58 2015 From: bryce at freedesktop.org (Bryce Harrington) Date: Wed, 28 Oct 2015 22:07:58 -0700 (PDT) Subject: [cairo-commit] [cairo-www] src/news Message-ID: <20151029050758.8DDE9181A6@annarchy.freedesktop.org> src/news/cairo-1.14.4.mdwn | 273 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 273 insertions(+) New commits: commit 87b6e77bbe8fb809e98eeea6f97e4b7e92aa783f Author: Bryce Harrington Date: Wed Oct 28 22:07:40 2015 -0700 Add news announcement for 1.14.4 diff --git a/src/news/cairo-1.14.4.mdwn b/src/news/cairo-1.14.4.mdwn new file mode 100644 index 0000000..aad76ef --- /dev/null +++ b/src/news/cairo-1.14.4.mdwn @@ -0,0 +1,273 @@ +[[!meta title="cairo 1.14.4 release available"]] +[[!meta date="2015-10-28"]] + + A new cairo release 1.14.4 is now available from: + + http://cairographics.org/releases/cairo-1.14.4.tar.xz + + which can be verified with: + + http://cairographics.org/releases/cairo-1.14.4.tar.xz.sha1 + 5b44471e7c328f96de6830baf8ea65030de797f9 cairo-1.14.4.tar.xz + + http://cairographics.org/releases/cairo-1.14.4.tar.xz.sha1.asc + (signed by Bryce Harrington) + + Additionally, a git clone of the source tree: + + git clone git://git.cairographics.org/git/cairo + + will include a signed 1.14.4 tag which points to a commit named: + 0317ee7f61f1f4d154f7cb7e56d2b1080c2c644a + + which can be verified with: + git verify-tag 1.14.4 + + and can be checked out with a command such as: + git checkout -b build 1.14.4 + + + Release 1.14.4 (2015-10-28 Bryce Harrington ) + ======================================================================== + Just in time for Halloween we see another bug-fix release for Cairo. + This brings a few dozen straightforward bug fixes with no API changes. + + In addition, this includes a typical assortment of fixes to tests, + cleanup of warnings and memory leaks, correction of misspellings, + updates to documentation, etc. + + For a complete log of changes since 1.14.2, please see: + + http://cairographics.org/releases/ChangeLog.cairo-1.14.4 + + + Features + -------- + None + + API Changes + ----------- + None + + Dependency Changes + ------------------ + None + + Performance Optimizations + ------------------------- + None + + Bug Fixes + --------- + * Avoid appending empty slots to user data arrays. Fixes a memory + consumption regression since commit 9341c254a. + + * Return a better error (file-not-found) when setting up pango on + devices where the font files don't have read permissions. + + * Fix regression in the font size of canvas text in Inkscape when + compiled with the Quartz backend. (Bug #84324) + + * Fix _cairo_gl_shader_bind_matrix() to maintain compatibility with + OpenGL ES 2.0. Manually transpose the matrix. + + * Fix incorrect font descriptor conversion when the font matrix yy is + negative. (Bug #90538) + + * Fix crash when using a complex path for clip and stroke due to + discarding the intersection exactly at the top edge. + (Bug #74779) + + * Fix cairo_get_locale_decimal_point() on Android + + * Fix compilation problem on AIX due to conflicting usage of symbol + 'jmpbuf'. (Bug #89339) + + * Fix broken rendering with XCB due to snapshotting of uploaded part of + surfaces. (Bug #67505) + + * Fix loss of alpha when copying a mask for a cairo recording surface, + resulting in a double copy. (Bugs #73038, #73901) + + * Fix incorrect recording of certain paths with script surfaces. + (Bug #91054) + + * Fix typo in definition of MAYBE_WARN in configure script. + (Bug #89750) + + * Fix use of filename variable after it's been freed. + (Bug #91206) + + * Fix out of bounds access when printing pattern. + (Bug #91266) + + * Fix incorrect size calculation in glyph cache unlocking for Cairo GL + compositor. + (Bug #91321) + + * Fix memory leak in _cairo_gl_pattern_texture_setup() + (Bug #91537) + + * Fix transparent images in win32-print. + (Bug #91835) + + * Fix _put_shm_image_boxes and _put_image_boxes when no SHM available + with XCB. + + + ------------------------------------------------------------------------ + Adam Jackson (2): + xlib: Don't crash when swapping a 0-sized glyph + xcb: Don't crash when swapping a 0-sized glyph + + Adrian Johnson (9): + Update mime type documentation. + CFF: Fix unaligned access + pdf: fix compiler warning + build: fix regression on mingw + pdf-operators: only wrap text strings for PS output + Improve performance of cpu_to_be32 and be32_to_cpu + pdf-operators: fix bug with RTL text + doc: add index of new symbols in 1.14 + cff: ensure glyph widths are positive when font matrix yy is negative + + Alban Browaeys (1): + pattern: allow for a floating one pixel rounded difference. + + Andrea Canciani (9): + test: Release owned pattern + test: Free test list + font: Actually perform destruction of fonts + quartz: Remove call to obsolete CGFontGetGlyphPath + Update KNOWN_ISSUES documentation + Update README with new minimum MacOSX requirements + Harden make-cairo-test-constructors.sh + test: Fix coverage-intersecting-triangles reference + test: Correct bug number in clip-complex-bug61592 + + Arpit Jain (2): + test/bitmap-font: Fix use of pointer after freed pointer + gl: Fix incorrect size of expression + + Ashim (1): + Fix out of bound access in struct pattern->type + + Behdad Esfahbod (1): + [ft] Return CAIRO_STATUS_FILE_NOT_FOUND if font file can't be opened + + Bryce Harrington (44): + Start 1.14.1 development + RELEASING: Update tags push command + Add execution bit for make-cairo-test-constructors.sh + Revert "Add execution bit for make-cairo-test-constructors.sh" + RELEASING: Be explicit as to which tag is pushed + Drop the target-specific huge-radial.pdf.*.ref.png images + test: Use ARRAY_LENGTH macro + Refactor ARRAY_LENGTH macro definitions in test code + image: Fix crash in _fill_xrgb32_lerp_opaque_spans + gitignore: logs, manuals + doc: Drop extraneous para's + git-ignore: Add build's test-driver + Revert "xlib: Remove queued event from _XReadEvents" + csi-trace: Add --version and --help args to utility + HACKING: Add link to git tutorial and wordsmith a bit + NEWS: Update for changes through Nov 2014 + NEWS: Finish filling in changes + On MacOSX, the sed utility errors out when parsing non-UTF8 files + NEWS: Note about the OS X support + KNOWN_ISSUES: Restore known issues file as a stub + version: bump for cairo-1.14.2 release + RELEASING: Update contacts + Start 1.14.3 development + surface: Clarify flush documentation + NEWS: Sp. fix + Fix spellings descibed, indicies, stange + Fix broken canvas text font size in Inkscape + cairo-script: Improve buffer length check + cairo-script: Always include config.h first thing + cairo-script: Add missing copyright and boilerplate + cairo-script: Cleanup boilerplate header for consistency + cairo-script: Prefer cairo from local tree + cairo-script: Rename struct member to avoid name collision on AIX + cairo-script: Fix sp. "directoriy" + cairo-recording-surface: Fix loss of alpha when clipping + cairo-script: Return a cairo_status_t error, not FALSE + configure: Fix typo for missing line continuation character + test: Free the memory, not the pointer to the memory + boilerplate: Fix list termination for glXChooseVisual + Ensure null-terminated result from strncpy() + Revert "pattern: allow for a floating one pixel rounded difference." + Revert "win32: Add cairo API to set up a Win32 surface for an HDC with an alpha channel." + NEWS: Update for 1.14.4 release + 1.14.4 release + + Chris Wilson (1): + xlib: Bump reference count for recording surface replays + + Emanuele Aina (1): + cairo-trace: Fix duplicated surface push on similar-image + + Fredrik Fornwall (1): + Fix cairo_get_locale_decimal_point() on Android + + Hans Breuer (1): + win32: Fix compilation of 'cairo-path-stroke-traps.c' with MSVC8 + + Henry (Yu) Song (1): + xlib: Remove queued event from _XReadEvents + + Julien Isorce (1): + build: Show all disabled features in cairo-features.h + + Massimo Valentini (6): + tor-scan-converter: can't do_fullrow when intersection in row + 0.5subrow + win32: Fix crash from win32 surface's image size too small + polygon-intersection: Do not discard intersection exactly at top edge + polygon-intersection: Include approximation in intersection points + polygon-intersection: Try not to invoke undefined behaviour + polygon-intersection: Delete misleading comments and dead-code + + Michael Haubenwallner (8): + fix conflicting types for 'sync' on AIX, bug#89338 + skip MAP_NORESERVE when unsupported + define _GETDELIM for getline() on AIX + test: fix include order for AIX, bug#89354 + perf/micro: fix include order for AIX, bug#89354 + perf: fix include order for AIX, bug#89354 + headers: fix include order for AIX, bug#89354 + headers: fix include order for AIX, bug#89354 + + Nathan Froyd (1): + Support new-style __atomic_* primitives + + Ravi Nanjundappa (2): + Fix warnings from check-doc-syntax.sh + Fix one more warning from check-doc-syntax.sh + + Rodrigo Rivas Costa (1): + win32-print: fix transparent images have black background + + Sahil Vij (1): + gl: Fix bug in _cairo_gl_pattern_texture_setup() + + Uli Schlachter (6): + tor-scan-converter: Correctly align 64bit types + XCB: Don't attach uploaded surfaces as snapshots + xcb: Query the display's subpixel order via RENDER + xlib-xcb: Don't be lazy and use the real xcb_screen_t + xcb: Fix _put_shm_image_boxes if no SHM available + xcb: Fix _put_image_boxes() if no SHM is available + + Zan Dobersek (1): + Manually transpose the matrix in _cairo_gl_shader_bind_matrix() + + Руслан Ижбулатов (2): + win32: Add cairo API to set up a Win32 surface for an HDC with an alpha channel. + win32: Add a win32 boilerplate that uses a real window + + 江頭幸路 (1): + Avoid appending an empty slot to an user data array when user_data is NULL. + -- + cairo mailing list + cairo at cairographics.org + http://lists.cairographics.org/mailman/listinfo/cairo From bryce at kemper.freedesktop.org Thu Oct 29 11:58:00 2015 From: bryce at kemper.freedesktop.org (Bryce Harrington) Date: Thu, 29 Oct 2015 11:58:00 -0700 (PDT) Subject: [cairo-commit] 3 commits - NEWS RELEASING Message-ID: <20151029185800.CD91776105@kemper.freedesktop.org> NEWS | 58 +++++++++++++++++----------------------------------------- RELEASING | 11 ++++++++++- 2 files changed, 27 insertions(+), 42 deletions(-) New commits: commit e03ab054c129307596b9ec090a0e32a64b0cda71 Author: Bryce Harrington Date: Thu Oct 29 11:57:32 2015 -0700 RELEASING: Doc what's required to properly undo a publish diff --git a/RELEASING b/RELEASING index 373cd3c..2094910 100644 --- a/RELEASING +++ b/RELEASING @@ -118,6 +118,12 @@ Here are the steps to follow to create a new cairo release: scp ChangeLog.cache-X.Y.Z-1.. \ cairographics.org:/srv/cairo.freedesktop.org/www/releases/ChangeLog.cairo-X.Y.Z + To undo a release-publish, before you've sent any emails or + pushed changes to master, delete the locally created tag (git + tag -d X.Y.Z); then log into the webserver, repoint the manual + and LATEST-cairo-X.Y.Z symlinks to the previous versions, remove + manual-X.Y.Z and release/cairo-1.14.4. + 7) Increment cairo_version_micro to the next larger (odd) number in cairo-version.h, commit, and push. commit 62ceb0abd970dd23dd03d2a279f62a1e2c63aa2d Author: Bryce Harrington Date: Wed Oct 28 22:15:54 2015 -0700 RELEASING: Note how to upload the changelog diff --git a/RELEASING b/RELEASING index 97397d3..373cd3c 100644 --- a/RELEASING +++ b/RELEASING @@ -113,7 +113,10 @@ Here are the steps to follow to create a new cairo release: If for some reason you lost this message, "make release-publish-message" prints it for you. - scp ChangeLog.xxx cairographics.org:releases/ChangeLog.X.Y.Z + Upload the incremental ChangeLog generated by the above: + + scp ChangeLog.cache-X.Y.Z-1.. \ + cairographics.org:/srv/cairo.freedesktop.org/www/releases/ChangeLog.cairo-X.Y.Z 7) Increment cairo_version_micro to the next larger (odd) number in cairo-version.h, commit, and push. commit 247ef2bd63e755963f7930ac06c79b95aed2adb4 Author: Bryce Harrington Date: Tue Oct 27 14:27:20 2015 -0700 NEWS: Update for 1.14.4 release diff --git a/NEWS b/NEWS index 2f1b775..41598d8 100644 --- a/NEWS +++ b/NEWS @@ -1,10 +1,19 @@ -Release 1.14.4 (2015-10-27 Bryce Harrington ) +Release 1.14.4 (2015-10-28 Bryce Harrington ) ======================================================================== +Just in time for Halloween we see another bug-fix release for Cairo. +This brings a few dozen straightforward bug fixes with no API changes. + +In addition, this includes a typical assortment of fixes to tests, +cleanup of warnings and memory leaks, correction of misspellings, +updates to documentation, etc. + +For a complete log of changes since 1.14.2, please see: + + http://cairographics.org/releases/ChangeLog.cairo-1.14.4 Features -------- -New cairo API routine to set up Win32 surfaces for HDC with alpha -channels. +None API Changes ----------- @@ -30,6 +39,9 @@ Bug Fixes * Fix regression in the font size of canvas text in Inkscape when compiled with the Quartz backend. (Bug #84324) +* Fix _cairo_gl_shader_bind_matrix() to maintain compatibility with + OpenGL ES 2.0. Manually transpose the matrix. + * Fix incorrect font descriptor conversion when the font matrix yy is negative. (Bug #90538) @@ -51,15 +63,12 @@ Bug Fixes * Fix incorrect recording of certain paths with script surfaces. (Bug #91054) -* Avoid using uninitialised variable on impossible error path - (Bug #87893) +* Fix typo in definition of MAYBE_WARN in configure script. + (Bug #89750) * Fix use of filename variable after it's been freed. (Bug #91206) -* Fix redundant check of truetype struct. - (Bug #29010) - * Fix out of bounds access when printing pattern. (Bug #91266) @@ -67,48 +76,15 @@ Bug Fixes compositor. (Bug #91321) -* Fix filter quality with image backend for the Quartz framework, such - that CAIRO_FILTER_GOOD and CAIRO_FILTER_BILINEAR map to - kCGInterpolationLow. - -* Fix potential bug with incorrect rendering of SVG paths with more than - one subpath. - (Bug #90984) - * Fix memory leak in _cairo_gl_pattern_texture_setup() (Bug #91537) -* Fix crash in PDF backend when rendering certain glyphs. - (Bug #91902) - -* Fix broken PDFs that use glyph 0 in embedded fonts for rendering - instead of .notdef. Map it to a non-0 glyph in the subset. - (Bug #89082) - * Fix transparent images in win32-print. (Bug #91835) * Fix _put_shm_image_boxes and _put_image_boxes when no SHM available with XCB. -* Fix use of memory barriers by default for ARM. - (Bug #90302) - -* Fix page extents for win32-print to avoid unbounded recording surfaces - with paginated surfaces. - -* Fix culling of very thin lines on vector surfaces. - (Bug #77298) - -* Cleanup various compiler and run-time warnings, valgrind errors, test - misbehaviors, etc. - -Change Logs ------------ -For a detailed list of new changes in this release, see: - - http://cairographics.org/releases/ChangeLog.1.14.4 - Release 1.14.2 (2015-03-09 Bryce Harrington ) ==================================================================== From bryce at kemper.freedesktop.org Thu Oct 29 18:18:44 2015 From: bryce at kemper.freedesktop.org (Bryce Harrington) Date: Thu, 29 Oct 2015 18:18:44 -0700 (PDT) Subject: [cairo-commit] cairo-version.h Message-ID: <20151030011844.41E1876105@kemper.freedesktop.org> cairo-version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit bc4271a1392e5462c875a051c8720d8dd461d4fe Author: Bryce Harrington Date: Thu Oct 29 18:17:39 2015 -0700 Bump version for new development tree, 1.15.1 diff --git a/cairo-version.h b/cairo-version.h index 515ea26..57deff0 100644 --- a/cairo-version.h +++ b/cairo-version.h @@ -2,7 +2,7 @@ #define CAIRO_VERSION_H #define CAIRO_VERSION_MAJOR 1 -#define CAIRO_VERSION_MINOR 14 -#define CAIRO_VERSION_MICRO 4 +#define CAIRO_VERSION_MINOR 15 +#define CAIRO_VERSION_MICRO 1 #endif From bryce at kemper.freedesktop.org Thu Oct 29 18:19:39 2015 From: bryce at kemper.freedesktop.org (Bryce Harrington) Date: Thu, 29 Oct 2015 18:19:39 -0700 (PDT) Subject: [cairo-commit] Branch '1.14' - cairo-version.h NEWS Message-ID: <20151030011940.1CB3276105@kemper.freedesktop.org> NEWS | 2 +- cairo-version.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) New commits: commit 5d336c66ab9fbb64c8dbefbacb2b846aaed1d9e7 Author: Bryce Harrington Date: Thu Oct 29 18:19:01 2015 -0700 Bump version for new stable tree, 1.14.5 diff --git a/NEWS b/NEWS index 7bfa618..5959b67 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,7 @@ updates to documentation, etc. For a complete log of changes since 1.14.2, please see: - http://cairographics.org/releases/ChangeLog.1.14.4 + http://cairographics.org/releases/ChangeLog.cairo-1.14.4 Features diff --git a/cairo-version.h b/cairo-version.h index 515ea26..55f7e5b 100644 --- a/cairo-version.h +++ b/cairo-version.h @@ -3,6 +3,6 @@ #define CAIRO_VERSION_MAJOR 1 #define CAIRO_VERSION_MINOR 14 -#define CAIRO_VERSION_MICRO 4 +#define CAIRO_VERSION_MICRO 5 #endif From bryce at kemper.freedesktop.org Thu Oct 29 18:21:55 2015 From: bryce at kemper.freedesktop.org (Bryce Harrington) Date: Thu, 29 Oct 2015 18:21:55 -0700 (PDT) Subject: [cairo-commit] RELEASING Message-ID: <20151030012155.849CD76105@kemper.freedesktop.org> RELEASING | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) New commits: commit fc689d7d351cca1f1b11cef9137fa2c6eec0ee25 Author: Bryce Harrington Date: Thu Oct 29 18:21:34 2015 -0700 RELEASING: Doc handling devel versions for micro vs minor releases diff --git a/RELEASING b/RELEASING index 2094910..635969a 100644 --- a/RELEASING +++ b/RELEASING @@ -124,8 +124,14 @@ Here are the steps to follow to create a new cairo release: and LATEST-cairo-X.Y.Z symlinks to the previous versions, remove manual-X.Y.Z and release/cairo-1.14.4. -7) Increment cairo_version_micro to the next larger (odd) number in - cairo-version.h, commit, and push. +7) Update trunk (or the stable branch) version number. + + For micro releases (X.Y.Z), increment cairo_version_micro to the next + larger (odd) number in cairo-version.h, commit, and push. + + For minor releases (X.Y.0), increment cairo_version_minor to the next + larger (odd) number, and set cairo_version_micro to 1. Then commit + and push. 8) Push the newly created tag out to the central tree with a command something like: