Commit graph

11177 commits

Author SHA1 Message Date
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
14df211b9c test: Add whole flipped replays
When investing the symmetry of the raterisation, we want to have a
simple replay of all of the original geometry through a the flipped
recording surface. This reduces the worry about artifacts from the
clipped rendering.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-02 13:08:50 +01: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
7aacd81bef test: Refresh reference images for tor rendering changes
(And include a git add missed from commit

ccd48b3464
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Sep 30 14:06:21 2014 +0100

    test: Remove more duplicated reference images

but were mostly invalidated by the rasteriser changes anyway).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-02 08:46:44 +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
79c8b14b9f test/simple: Tighten sanity checks in reference image generator
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-02 08:46:44 +01:00
Chris Wilson
50b41e2145 test: Add a simple rasteriser to check fidelity of edge rendering
In order to check the behaviour of the analytic rasteriser inside tor,
let's compare it against a very simple rasteriser that uses a rectiliner
256x256 sample grid.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-10-02 00:06:27 +01:00
Chris Wilson
2144e7f48b test: Fix coverage-abutting
Using CAIRO_OPERATOR_OVER in case causes oversampling of the coincident
edges, to measure coverage we should only use ADD. :|

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 16:18:34 +01:00
Chris Wilson
0c42d5c176 test: Add another coverage example demonstrating the seams in tor
References: https://bugs.freedesktop.org/show_bug.cgi?id=84396
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 16:15:33 +01:00
Chris Wilson
95e147bfa0 test: Explicitly flip the reference image for recordflip
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 14:33:50 +01:00
Chris Wilson
ccd48b3464 test: Remove more duplicated reference images
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 14:06:36 +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
ff23afd5f2 test: Include coverage in the normal test run
Currently coverage is marked as slow. It is slower than the typical
test, but it is quite a useful check on our rasterisation quality
without going too far overboard (unlike partial-coverage!).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 12:25:56 +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
Chris Wilson
8e1e2a5414 test: Remove redundant reference images
If we have both a argb32 and rgb24 reference image that are identical,
we can replace them with a plain reference image. I also prefer to have
argb32/rgb24 versions of the reference images if rgb24 differs from the
plain reference.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-30 11:47:44 +01:00
Ravi Nanjundappa
93c21e3fd3 test: Add test for egl-surface-source
This test file attempts to use a EGL backend surface as a source
surface for all other backends.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
2014-09-29 16:08:23 -07: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
5c03b20732 test/coverage: Exercise invariance under mirror symmetry
Massimo noticed that the record/record-flip were not being rasterised as
identical mirror images due to a half-subpixel offset in the tor scan
converter. This test attempts to reproduce this error by rendering a
rhombus around the origin of each cell (that is it generates 4 mirror
images of a triangle in the 4 different orientations0. The expectation
is that each pixel in the group is lit identically as the coverage is
identical.

References: https://bugs.freedesktop.org/show_bug.cgi?id=84396
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-29 08:42:17 +01:00
Marc-André Lureau
fbb0a260b7 build-sys: do not try to build util/sphinx on Windows
glib and dlfcn exist on windows, but sphinx code uses a lot of
Unix-only API

Fixes the following build error on mingw-fedora

  CC     cairo-boilerplate-system.lo
../../../util/cairo-sphinx/sphinx.c:8:22: fatal error: sys/mman.h: No such file or directory
compilation terminated.

Fixes:  https://bugs.freedesktop.org/show_bug.cgi?id=63043
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-09-24 12:20:53 -07:00
Bryce Harrington
42320793aa sphinx: Add ickle's explanation of what sphinx does 2014-09-24 12:12:47 -07:00
Chris Wilson
80359e73d8 test: Exercise stroking bugs with xlib/trapezoids
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84115
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-24 12:35:47 +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
Bryce Harrington
bdd0721dcd NEWS: Revise downscaling feature description
Updated feature description using text from Bill.  Also updated bugfix
list to include recent fixes.
2014-09-23 16:41:36 -07:00
Bryce Harrington
7cfebce152 build: Fix float endian configure test when using clang -O4
When using clang -O4, the compiled test object is output in bitcode
format rather than as an ELF object, so when we grep the test value from
the object it fails.  To work around this, go ahead and link the test
object into an executable, and then grep against this native binary
instead of the compiler's intermediary object.

We need to add __attribute__((used)) to ensure the d variable doesn't
get optimized out during linking, since it's not referenced in the
test's main().

Patch authored by cmuelle8 <abendstund@gmail.com>

Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
Bugzilla:  https://bugs.freedesktop.org/show_bug.cgi?id=63310
2014-09-23 12:40:25 -07: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
Bryce Harrington
150c1e7044 Don't return NULL to clients when getting image
Return an error surface instead.

Fixes:  https://bugs.freedesktop.org/show_bug.cgi?id=58061
2014-09-22 15:41:24 -07:00
Bryce Harrington
40e7576796 NEWS: Note that downscaling changes only affect image + fallback 2014-09-22 15:06:54 -07:00
Bryce Harrington
402b456a32 gl: Increase default VBO size on GL to 1M
The default VBO size was reduced from 256k to 16k because embedded
devices had trouble with the larger memory demands of a big VBO.  My
testing[1] indicates this incurred a 5% performance loss on at least one
of Cairo's performance tests.  Further testing showed that with
late-model graphics cards, further performance benefits can be seen with
even larger VBO sizes, up to 8.3% at 1M for Intel.

Now that we can set the vbo size differently for different backends, set
it to the lower value (16k) for EGL, and higher (1M) for GL.

1: http://www.bryceharrington.org/wordpress/2013/08/vbo-size/

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2014-09-19 17:23:50 -07:00
Bryce Harrington
aa820c13d7 gl: Track the VBO size as a property of the ctx
Change suggested by Chris Wilson.  This will enable setting different
vbo sizes for GL vs. EGL.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2014-09-19 17:23:50 -07:00
Bryce Harrington
036f47c345 cairo-gl: Make VBO size run-time settable
The default VBO size was reduced from 256k to 16k last year in commit
90860241 due to problems with larger VBOs on embedded hardware.
However, that change resulted in a 5% performance impact to the
firefox-fishbowl benchmark when using the spans or traps compositors.

This patch doesn't change the VBO size, but does permit it to be
altered via an environment variable, to facilitate testing.

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2014-09-19 17:23:50 -07:00
Ravi Nanjundappa
8479b60867 test: Add test oversized egl surfaces
This test exercises error scenario when creating over sized egl surface
that is larger than maximum framebuffer or texture dimensions of the
context

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
2014-09-19 15:46:14 -07:00
Bryce Harrington
3d68352e3c NEWS: Drop unfinished thought 2014-09-18 13:18:48 -07:00
Bryce Harrington
54670ec13d AUTHORS: Add Ravi, myself, and a couple other frequent contributors 2014-09-17 20:33:22 -07:00
Bryce Harrington
33a54e7c20 README: Update required dependencies
Also adds mention of the skia backend.
2014-09-17 20:25:37 -07:00
Bryce Harrington
d1fa4d44fe NEWS: Bring up to date with recent bug fixes. 2014-09-17 20:04:01 -07:00
Bryce Harrington
e0c0a673ee Disable font options for xcb.
This patch makes a bunch of tests pass again. The first hunk one fixes a
shameful oversight (whoops), the second one effectively reverts
e691d242.  That change broke 102 xcb and 70 xlib tests, including a
bunch of *twin-antialias-* test cases.  Patch thanks to Uli Schlachter.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-09-17 17:30:04 -07:00
Adrian Johnson
0aa43ed886 win32 printing: fix image scale when GDI scale is not identity 2014-09-14 22:02:12 +09:30
Lukáš Lalinský
e691d242d5 xcb: Initialize font options from Xft resources
There is a similar code in the Xlib backend. The logic here is the same, but
XCB doesn't support X resources directly, so there is some custom code
to get and parse the resources from the root window.

Signed-off-by: Lukáš Lalinský <lukas@oxygene.sk>
Reviewed-by: Uli Schlachter <psychon@znc.in>
2014-09-12 18:19:44 +02:00
David Weiß
e77d0a5611 made paths to pixman, libpng and zlib configurable by commandline for win32 builds
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2014-09-11 13:00:13 -07:00
Ravi Nanjundappa
3b9d7e583f qt: Suppress warnings in qt backend build
This patch fixes majorly 2 kinds of warning issues:

(1)
cc1plus: warning: command line option '-Wold-style-definition' is valid for Ada/C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option '-Wdeclaration-after-statement' is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option '-Wnested-externs' is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option '-Wmissing-prototypes' is valid for Ada/C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option '-Wbad-function-cast' is valid for C/ObjC but not for C++ [enabled by default]

Solution: Enable these warnings only for C compiler and not for C++

(2)
cairo-qt-surface.cpp: In function 'cairo_int_status_t _cairo_qt_surface_fill(void*, cairo_operator_t, const cairo_pattern_t*, const cairo_path_fixed_t*, cairo_fill_rule_t, double, cairo_antialias_t, const cairo_clip_t*)':
cairo-qt-surface.cpp:852:5: warning: inlining failed in call to 'PatternToBrushConverter::PatternToBrushConverter(const cairo_pattern_t*)': --param max-inline-insns-single limit reached [-Winline]
cairo-qt-surface.cpp:1339:38: warning: called from here [-Winline]
cairo-qt-surface.cpp:390:1: warning: inlining failed in call to 'QPainterPath _ZL10path_to_qtPK17_cairo_path_fixedPK13_cairo_matrix.part.13()': call is unlikely and code size would grow [-Winline]
cairo-qt-surface.cpp:1306:1: warning: called from here [-Winline]
cairo-qt-surface.cpp:1051:5: warning: inlining failed in call to 'PatternToBrushConverter::~PatternToBrushConverter()': call is unlikely and code size would grow [-Winline]

Solution: Add __attribute__ ((noinline)) to the function as mentioned in
http://stackoverflow.com/questions/11724235/warning-for-template-with-g-o2-or-os-o-o1 (Edit 3)

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2014-09-11 12:53:05 -07:00
Maks Naumov
29a8b4e970 Fix _cairo_mesh_pattern_equal() when cairo_mesh_patch_t structs are different
Signed-off-by: Maks Naumov <maksqwe1@ukr.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2014-08-28 13:16:47 -07:00
Maks Naumov
e6bf829d89 Fix font x_scale value in _compute_transform()
Signed-off-by: Maks Naumov <maksqwe1@ukr.net>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
2014-08-27 21:14:26 -07:00
Ravi Nanjundappa
c6ae5b1976 test: Fix null pointer issue reported by cppcheck static analysis tool
cppcheck analysis tool reports the following issues when run on the
latest Cairo source.

$ grep "(error)"  cppcheck_error_log.txt
[test/pdf-mime-data.c:58]: (error) Possible null pointer dereference: file - otherwise it is redundant to check if file is null at line 53
[test/pdf-mime-data.c:75]: (error) Resource leak: fp
$

The proposed changes fixes the above issues.

And also it does some refactoring to print the appropriate error messages
for each error condition in read_file() function and also to free the allocated
data buffer.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-27 20:39:57 -07:00
Ravi Nanjundappa
52c4f0f2da src: Fix memory issue reported by cppcheck static analysis tool
cppcheck analysis tool reports the following issues when run on the
latest Cairo source.

$ grep "(error)"  cppcheck_error_log.txt
[src/skia/cairo-skia-surface.cpp:245]: (error) Memory leak: surface
$

The proposed changes fixes the above issues.

Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-08-27 20:39:49 -07:00