Commit graph

7488 commits

Author SHA1 Message Date
Bryce Harrington
246d5c1d47 doc: Drop extraneous para's
These may have been required in the past, but just trip up distcheck
today.  The generated docs still look fine.
2015-03-06 19:19:13 -08:00
Henry (Yu) Song
e7fc8f405b xlib: Remove queued event from _XReadEvents
Following patch fixes a memory leak in xlib surface.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-05 17:27:14 -08:00
Michael Haubenwallner
4e680ff4bb headers: fix include order for AIX, bug#89354
also for cairo-xcb-private.h
2015-03-05 17:03:32 -08:00
Michael Haubenwallner
733de40e87 headers: fix include order for AIX, bug#89354 2015-03-05 17:03:28 -08:00
Michael Haubenwallner
ac75ab9f30 fix conflicting types for 'sync' on AIX, bug#89338 2015-03-05 12:00:48 -08:00
Andrea Canciani
70cc8f250b quartz: Remove call to obsolete CGFontGetGlyphPath
CGFontGetGlyphPath was not public and is not available anymore on
modern OSX/iOS systems. The same functionality is available through
the CoreText API since OSX 10.5.

Based on a patch by Simon Cozens.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=84324
2015-02-05 15:13:46 +01:00
Massimo Valentini
91f128bf7a win32: Fix crash from win32 surface's image size too small
Beginning in 1.12, a crash can occur when the win32 surface's image size
does not cover the entire surface (e.g. due to clipping regions).

This patch enlarges the fallback surface created of the amount
necessary not to write past the end of the DIB. It assumes that
Clip applied to an HDC are clamped to (0,0,width,height) of the HDC.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=53121
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-02-02 16:33:06 -08:00
Uli Schlachter
ebd23accc8 xlib-xcb: Don't be lazy and use the real xcb_screen_t
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-01-17 20:12:39 +01:00
Uli Schlachter
b47209a03f xcb: Query the display's subpixel order via RENDER
With commit e691d242, the xcb backend started parsing the resources, just like
cairo-xlib does. One behavior from cairo-xlib was missing: If no Xft.rgba
property was specified, cairo-xlib defaults to the screen's subpixel order.
This commit brings that last bit of functionality to cairo-xcb (but currently
disabled due to commit e0c0a673).

This commits adds a new array to cairo_xcb_connection_t that contains the
subpixel order for each screen. There is also a new member in cairo_xcb_screen_t
which contains the subpixel order of that screen and which is initialized from
the array when the screen is constructed. With this in place, the
resource-parsing code can just pick the subpixel order from the screen if
needed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-01-17 20:11:59 +01:00
Andrea Canciani
02e4efc961 font: Actually perform destruction of fonts
Commit 337ab1f8d9 introduced delayed
font destruction to overcome a race, but prevented the correct cleanup
of the font cache.

This caused fonts to stay in the cache and caused a crash in the
api-special-cases (when running the test suite with -f).

Fixes api-special-cases,
https://bugs.freedesktop.org/show_bug.cgi?id=87567
2015-01-03 14:59:51 +01:00
Chris Wilson
028d286e61 xlib: Bump reference count for recording surface replays
The snapshot takes a reference to the target recording surface in order
to enable it for use by multiple treads. In order to balance this, the
other two sources of recording surface must also take a reference and
for us to release that reference after the replay.

Otherwise, we end up with a memory leak:

==1== 1,392 bytes in 3 blocks are definitely lost in loss record 1 of 7
==1==    at 0x4A06BCF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==1==    by 0x4C7042D: _cairo_recording_surface_snapshot (cairo/src/cairo-recording-surface.c:1427)
==1==    by 0x4C842BE: _cairo_surface_snapshot_copy_on_write (cairo/src/cairo-surface-snapshot.c:189)
==1==    by 0x4C7E7E0: _cairo_surface_detach_snapshot (cairo/src/cairo-surface.c:348)
==1==    by 0x4C7E55B: _cairo_surface_detach_snapshots (cairo/src/cairo-surface.c:333)
==1==    by 0x4C7E55B: _cairo_surface_flush (cairo/src/cairo-surface.c:1545)
==1==    by 0x4C7E6CC: _cairo_surface_finish_snapshots (cairo/src/cairo-surface.c:1017)
==1==    by 0x4C7E6CC: cairo_surface_destroy (cairo/src/cairo-surface.c:961)
==1==    by 0x4C625A7: cairo_pattern_destroy (cairo/src/cairo-pattern.c:1131)
==1==    by 0x4C3FAC6: _cairo_gstate_fini (cairo/src/cairo-gstate.c:225)
==1==    by 0x4C3C68C: _cairo_default_context_fini (cairo/src/cairo-default-context.c:75)
==1==    by 0x4C3C708: _cairo_default_context_destroy (cairo/src/cairo-default-context.c:93)
==1==    by 0x43E576: record_get (cairo/test/record-extend.c:158)
==1==    by 0x43E576: record_replay (cairo/test/record-extend.c:173)
==1==    by 0x40E22D: cairo_test_for_target (cairo/test/cairo-test.c:929)
==1==    by 0x40E22D: _cairo_test_context_run_for_target (cairo/test/cairo-test.c:1532)
==1==    by 0x40B6C0: _cairo_test_runner_draw (cairo/test/cairo-test-runner.c:255)
==1==    by 0x40B6C0: main (cairo/test/cairo-test-runner.c:937)

Reported-by: Massimo Valentini <mvalentini@src.gnome.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87898
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-12-31 11:01:45 +00:00
Uli Schlachter
40201f4b1a tor-scan-converter: Correctly align 64bit types
On 32bit SPARC the scan converter was causing a SIGBUS due to an unaligned
memory access while accessing an int64_t. This memory accessing was to struct
quorem's rem member.

This crash occurred because the tor-scan-converter contains its own
implementation of a memory pool. This implementation only guarantees an
alignment of sizeof(void *), which is less than what a 64 bit type requires on
32bit platforms. This 4 byte alignment is guaranteed, because struct _pool_chunk
(which is the struct that is used for managing free space) contains elements of
that size and so the size of that struct is a multiple of this size as well.

This problem was introduced with commit 03c3d4b7c1.

To fix this problem, this commit introduces a int64_t member to struct
_pool_chunk that marks the beginning of the free data space. Thanks to this, the
compiler ensures proper alignment and sizeof(struct _pool_chunk) becomes a
multiple of 8.

However, previously the end of the struct marked the beginning of the data and
sizeof() was used for correctly calculating offsets to the data section. So,
just adding such a member would work, but would also waste some memory. To avoid
this, this commit also changes the rest of the pool implementation to
accommodate.

Reported-by: Nicolas Setton <setton@adacore.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2014-12-06 10:25:30 +01:00
Bryce Harrington
5c82d91a5e image: Fix crash in _fill_xrgb32_lerp_opaque_spans
If a span length is negative don't go out of bounds processing the fill
data.

Patch thanks to Ilya Sakhnenko <ilia.softway@gmail.com> on mailing list.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2014-12-05 19:16:43 -08:00
Hans Breuer
56da7adc3c win32: Fix compilation of 'cairo-path-stroke-traps.c' with MSVC8
"The issue here is that Visual Studio 2005+ is quite strict on type
conversions (so it wants code to be clear enough on conversions)."

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=84908
2014-11-20 12:26:52 -08:00
Adrian Johnson
ae608035c7 pdf-operators: fix bug with RTL text
bug 86461
2014-11-20 10:16:06 +10:30
Ravi Nanjundappa
121f384c0e Fix one more warning from check-doc-syntax.sh
$ ./check-doc-syntax.sh
Checking documentation for incorrect syntax
./cairo-pattern.c (3342): ERROR: Will invalid doc id (should be 'cairo_...:')

The proposed changes fixes the warning about the documentation style used in cairo.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
2014-11-12 10:38:52 -08:00
Adam Jackson
a03f2ff720 xcb: Don't crash when swapping a 0-sized glyph
malloc(0) needn't return NULL, and on glibc, doesn't.  Then we encounter
a loop of the form do { ... } while (--c), which doesn't do quite what
you were hoping for when c is initially 0.

Since there's nothing to swap in this case, just bomb out.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-11-06 12:56:18 -08:00
Adam Jackson
3cf862f6d9 xlib: Don't crash when swapping a 0-sized glyph
malloc(0) needn't return NULL, and on glibc, doesn't.  Then we encounter
a loop of the form do { ... } while (--c), which doesn't do quite what
you were hoping for when c is initially 0.

Since there's nothing to swap in this case, just bomb out.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-11-06 12:56:13 -08:00
Adrian Johnson
adbeb3d53c Improve performance of cpu_to_be32 and be32_to_cpu
By switching to the more common form, gcc and clang emit a single
bswap instruction and truetype subsetting of large fonts runs about
15% faster.
2014-10-31 22:55:14 +10:30
Adrian Johnson
e4b78424ac pdf-operators: only wrap text strings for PS output
since the PS Document Structing Conventions impose a 255 character
line limit. PDF does not require wrapping.

pdf-operators is designed to emit the same output for PS and PDF.
Unfortunately some PDF interpreters don't like strings split with
'\\\n' and some PS interpreters don't like strings split with ')('.
So we are forced to make pdf-operators handling string wrapping
differently for PDF and PS.

Bug 85662
2014-10-31 19:26:05 +10:30
Ravi Nanjundappa
caa4c9fdeb Fix warnings from check-doc-syntax.sh
$ ./check-doc-syntax.sh
Checking documentation for incorrect syntax
./cairo-pattern.c (3346): ERROR: Will bad line: ' */'
./cairo-pattern.c (3346): ERROR: Will documentation comment not closed with **/
./cairo-pattern.c (3422): ERROR: _cairo_pattern_sampled_area invalid doc id (should be 'cairo_...:')

The warnings are about the documentation style used in cairo

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
2014-10-28 22:24:55 -07:00
Massimo Valentini
2de69581c2 tor-scan-converter: can't do_fullrow when intersection in row + 0.5subrow
the active edges list must be left sorted at the next possible use
and since full_row does not deal with intersections it is not usable
when there is an intersection in the top half of the next row first
subrow

Reported-and-tested-by: Matthew Leach
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85151
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-19 12:47:23 +01:00
Adrian Johnson
1013d18a01 pdf: fix compiler warning 2014-10-19 12:08:55 +10:30
Adrian Johnson
99a35dd273 CFF: Fix unaligned access
Debian bug 712836 reported bus errors in cff subsetting when
running on a sparc. This is because unlike truetype, all data
in the compact font format is not aligned.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=712836
2014-10-19 11:54:25 +10:30
Adrian Johnson
f05e9332b3 Update mime type documentation. 2014-10-17 22:04:39 +10:30
Bryce Harrington
f6fd372a8b pattern: Restore dropped inclusion of cairoint.h
Fixes failure in make release-check due by check-preprocessor-syntax.sh
due to requirement that cairoint.h be the first include for source files.
2014-10-13 18:54:12 -07:00
Bryce Harrington
3e41f7b381 NEWS: Flesh out docs for new APIs 2014-10-13 18:30:23 -07:00
Adrian Johnson
ab2a7b61d5 pdf: don't use '\' to split strings across multiple lines
The PDF interpreter in my printer does not handle this correctly.
So instead we add the string delimiters '(' and ')' to each line.
2014-10-12 21:06:45 +10:30
Bill Spitzak
45934f69cd image: Corrected extents calculations
New implementations of _cairo_pattern_sampled_area and _cairo_pattern_get_extents
which produce a more accurate bounding box. These do not depend on side-effects
of analyze_filter, can handle different horizontal and vertical scales, filters
wider than 1 for down-scaling, and compute a somewhat tighter bounding box
in most cases.

I removed the pad output of _cairo_pattern_analyze_filter as it is unused.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-10-10 18:09:14 -07:00
Bill Spitzak
3cd7ed1f32 xcb: Use image fallback for GOOD/BEST filters
It will not use the fallback if the symbols in the previous patch
are turned on.

Also some code rearrangement to make this resemble the xlib version
more and to remove some suspect bugs. In particular meshes should not
work just because the translation is an integer.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-10-10 18:09:09 -07:00
Bill Spitzak
ca9aee4e62 xcb: Add switches for whether XRender supports GOOD/BEST filtering
Currently these are always false, but if XRender use a pixman that
supports filtering these could be turned on for that version.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-10-10 18:09:05 -07:00
Bill Spitzak
58728da6eb xlib: Use image fallback for GOOD/BEST filters
Fallback is not used if the symbols defined in the previous patch to
indicate if XRender does GOOD/BEST are true.

This patch also includes some changes to take advantage of the fact that
if there is an integer translation analyze_filter will already have set
the filter to NEAREST.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-10-10 18:09:01 -07:00
Bill Spitzak
c653dcd3e6 xlib: Add symbols to indicate if XRender supports GOOD/BEST filtering
Currently these are always false, but if some version of xlib uses
a pixman supporting filtering they could be changed to return true
for that version.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-10-10 18:08:56 -07:00
Bill Spitzak
c8b1bf55ad image: Move filter decision to _cairo_pattern_analyze_filter
The analysis to deterimine if the GOOD filter can be replaced with
the BILINEAR filter is moved to this function so it can be used
by backends other than the image backend.

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-10-10 18:08:48 -07:00
Chris Wilson
8047179bfc test: Teach check-preprocessor-syntax.sh about -inlines.h 2014-10-09 10:56:28 +01:00
Bryce Harrington
7c1db82a2e Get make check back to a happy spot
Fix header ordering for some recently added code so cairo internal
headers are included first.  Quells two make check errors.

Fixes:  https://bugs.freedesktop.org/show_bug.cgi?id=84638
2014-10-03 12:34:06 -07:00
Bryce Harrington
f57c0fd465 Declare as private the new cairo_lines_compare_at_y symbol
Fixes a make check error.

  Checking that .libs/libcairo.so has the same symbol list as cairo.def
  126a127
  > cairo_lines_compare_at_y

Fixes:  https://bugs.freedesktop.org/show_bug.cgi?id=84638
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-10-03 12:20:13 -07:00
Bryce Harrington
d9ba8337ab quartz: Check for quartz surface type before conversion
Fixes the following warning introduced in a recent commit reported by
~suv:

  CC       cairo-quartz-image-surface.lo
cairo-quartz-image-surface.c:382:37: warning: incompatible pointer types
passing 'cairo_quartz_image_surface_t *'
      (aka 'struct cairo_quartz_image_surface *') to parameter of type
       'const cairo_surface_t *' (aka 'const struct _cairo_surface *')
      [-Wincompatible-pointer-types]
    if (! _cairo_surface_is_quartz (surface)) {
                                    ^~~~~~~
./cairo-quartz-private.h:87:50: note: passing argument to parameter 'surface' here
_cairo_surface_is_quartz (const cairo_surface_t *surface);

References:  https://bugs.freedesktop.org/show_bug.cgi?id=84569
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-10-03 11:55:59 -07:00
Andrea Canciani
03756e042a quartz-image: Fix build
The quartz-image backend uses _cairo_surface_is_quartz(), which
therefore needs to be made available to it. Fixed as suggested by
Bryce in the referenced bugreport.

References: https://bugs.freedesktop.org/show_bug.cgi?id=84569
Signed-off-by: Andrea Canciani <ranma42@gmail.com>
2014-10-03 11:38:48 -07:00
Andrea Canciani
531da6fb91 quartz: Fix build
Cairo cannot build with Quartz enabled since
573ddfc3d5, because of a double
definition of _cairo_surface_is_quartz().

References: https://bugs.freedesktop.org/show_bug.cgi?id=84569
Signed-off-by: Andrea Canciani <ranma42@gmail.com>
2014-10-03 11:38:44 -07:00
Chris Wilson
7f7ed4c04e image: Eliminate self-intersections for the pixman traps compositor
As pixman uses an accumulation mask, it oversamples neighbouring edges
within a cell. We can reduce the impact of this by eliminating
overlapping triangles/trapezoids from being passed into pixman.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-02 09:16:04 +01:00
Chris Wilson
950f1e7103 tor: Enable analytic processing for starting rows
If all the edges start at the very beginning of the whole row, we can
merge them and include check for intersections/endings during the row.
This allows us to enable fast analytic processing for even the very
first row on pixel aligned vertices.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-02 08:46:44 +01:00
Chris Wilson
1a32ce83e4 tor: Perform analytic coverage over the pixel not sample points
We use two different methods within tor to compute the coverage.
The first is that we iterate over every sample point within the pixel
and see if it is covered. The second is that we look at a whole pixel
and analytically compute the coverage inside (if we have no
intersections within that row).

One side effect of

commit 03c3d4b7c1
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Sep 30 08:44:43 2014 +0100

    tor: Fix loss of precision from projection onto sample grid

was to compute our X coordinates for the sample locations (offset by
half a subrow) and that in order to compute the analytical pixel
coverage correctly, we therefore need to backstep by half the subrow to
the pixel boundary.

References: https://bugs.freedesktop.org/show_bug.cgi?id=84396
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-02 08:46:44 +01:00
Chris Wilson
167561f282 tor: Review full-row walker
When updating the quorem between cells, we would lose the overflow
increment as it was only applied locally and not preserved by updating
the quorem.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 13:57:05 +01:00
Chris Wilson
03c3d4b7c1 tor: Fix loss of precision from projection onto sample grid
The goal is to preserve the precision in the gradients of the edges and
only apply the projection into the final cell location. We also include
the half-subrow offset as spotted by Massimo.

References: https://bugs.freedesktop.org/show_bug.cgi?id=84396
Testcase: coverage-rhombus
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 12:01:13 +01:00
Ravi Nanjundappa
573ddfc3d5 src: check the surface backend for NULL
This is a follow-up patch on top of 150c1e7044
As discussed in the mailing list, http://lists.cairographics.org/archives/cairo/2014-September/025647.html,
check if the surfaces are of particular backend type or not, before proceeding further.

These changes are based on _cairo_surface_is_xlib() and _cairo_surface_is_image()

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
2014-09-29 15:59:26 -07:00
Chris Wilson
06b9f8fa2d stroke,traps: Emit join without loss of precision
As the target renderers operate at a different sample resolution then we
use internally for coordinate representation, there is always a potential
for discrepancies in the line gradients when passing around trapezoids.
To overcome this, the protocol specification of trapezoids uses the full
lines and vertical range as opposed to vertices and so long as we always
use the same lines for conjoint trapezoids, they remain abutting in the
rasteriser.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84115
Testcase: bug-84115
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-29 08:42:17 +01:00
Chris Wilson
06a737b74d arc: Insert the initial point on the arc
Currently the very first point on the arc will be the first interpreted
location along the spline used to approximate the arc. This will be
close, but not quite the exact point the user intended the arc to run
from, so begin the arc with a line-to the initial point.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-24 12:35:47 +01:00
Adrian Johnson
9a19ef1858 Fix compilation with bionic libc
Refactor out a cairo_get_locale_decimal_point() routine to handle a case
where localeconv() is not available.

Fixes:  https://bugs.freedesktop.org/show_bug.cgi?id=70492
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>

[edit:  Condensed cairo_get_locale_decimal_point and conditionalized
locale.h inclusion.  -- bryce]
2014-09-23 11:40:03 -07:00
Bryce Harrington
a02e29a12d Don't return NULL to clients when getting device
Return an error device instead

Fixes:  https://bugs.freedesktop.org/show_bug.cgi?id=58061
2014-09-22 15:48:49 -07:00