Commit graph

10949 commits

Author SHA1 Message Date
Adrian Johnson
266d6e7156 pdf: fix embedding of mime data that has been broken since 0a10982f
For some reason the mime-data test is not detecting this failure.
2013-09-13 22:01:02 +09:30
Bryce W. Harrington
5390c2bbca test: Document use of -k and CAIRO_TEST_TARGET to run test subsets
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-13 12:58:11 +02:00
Bryce W. Harrington
640eb02067 test: Space out keywords for clarity
As another nitpick, a comma alone is legal for separating keywords, but
most tests use a comma and a space.  Update the few tests that don't,
to make this consistent.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-13 12:57:42 +02:00
Bryce W. Harrington
a6ace0cf6b test: Comma separate keywords
The parser accepts spaces as separtors between keywords, so this is nit
picky.  But only a minority of tests don't follow the comma convention,
so change them to be consistent.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-13 12:57:17 +02:00
Bryce W. Harrington
aacc5e76ed gitignore: Ignore build chaff when configuring with --enable-gtk-doc
When this flag is enabled in configure, a couple extra build files are
created, which git should just ignore.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-13 12:56:16 +02:00
Bryce Harrington
ac5f3e2b8e test: Move cairo_pattern_set_filter to after cairo_set_source_surface
Also update the image.arg32 reference images, since for now we're just
accepting pixman's output as truth.  This fixes up several tests:

                   was   is
 Tests run:        420   420
 Passed:           224   261
 Failed:           195   159
 Expected Failed:  0     0
 Error:            0     0
 Crashed:          0     0
 Untested:         0     0
 Total:            420   420

Thanks to psychon for finding the code error in the test.
2013-09-11 19:32:08 +02:00
Bryce Harrington
ade7089f72 test: Exercise image scaling quality when downscaling
This adds testcases for the various cairo filter options, each of which
match to corresponding pixman filters.  Use the 'downscale' keyword if
invoking tests using cairo-test-suite.

The 24-pixel reference images were produced from quad-color.png using
Gimp's Scale Image command with Interpolation set to None.  It is
assumed that all filters should handle a 1:4 scaling cleanly with no
antialiased blurring.

The 95-pixel reference images assume differing types of antialiasing
based on the quality level.  We are using the image.argb32 output as
reference here.  Potentially some other rendering algorithm could
conceivably provide better results in the future.

The 96-pixel reference images are simply copies of the original
quad-color.png file.  It is assumed that 1:1 downscaling operations
should produce no visible change to the original image.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-09-11 19:32:08 +02:00
Bryce Harrington
0f554c36d3 test: Test a variety of scales when downscaling
Downscaling from 96 to 24 is easy since it's an even multiple, so try
scaling by -1 pixel too.

This adds a 1:1 scaling test case as well, which should pass through the
image unchanged.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-09-11 19:32:08 +02:00
Bryce Harrington
642b6d8091 test: Add test for image downscaling
This adds pixman-downscale.c, which tests correctness of PNG images
scaled down using pixman routines.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2013-09-11 19:32:08 +02:00
Martin Robinson
7270f22af3 gl: Extend oversize check to cairo_gl_surface_create_for_texture
If a texture is too large to render to via a framebuffer, then eagerly
fail with an error surface.
2013-09-11 08:52:31 -07:00
Uli Schlachter
279d5a2ed1 recording: Correctly determine alpha of all surfaces
This code has special cases for recording and image surfaces. For all other
kinds of source surfaces, has_bilevel_alpha was not modified, even though the
source surface could have an alpha channel.

Fix this by using the same checks as in the general path at the end of this
function.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-11 15:28:29 +02:00
Uli Schlachter
a6f51fed98 recording: Fix unitialized variable 'free_me'
This variable should be NULL by default and gets set only if a new reference to
a surface was acquired through _cairo_surface_snapshot_get_target(). This works,
because cairo_surface_destroy(NULL) is well-defined and doesn't do anything.

Fixes the following compiler warning:

cairo-recording-surface.c:1642:24: warning: 'free_me' may be used uninitialized
in this function [-Wmaybe-uninitialized]

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-11 15:24:53 +02:00
Adrian Johnson
8addb4798c pdf: avoid making groups a transparency group if not required
If the group contains only a combination of clear and opaque alpha and
only OPERATOR_OVER is used in the group and to paint the group, a
transparency group is not required. This allows the pdf viewer to
replay the group in place.
2013-09-11 21:18:45 +09:30
Bryce W. Harrington
53255625c0 svg, test: Refer to output filename by variable, not a hardcoded value
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-09 21:28:35 +02:00
Bryce W. Harrington
f9dcd07d22 test: Ensure output dirs exist, falling back to current dir if needed
This change makes several tests behave more like ps-eps.c, et al by
making them attempt to mkdir "output", and in case of trouble use "."
instead.  filenames are now allocated at runtime due to this change, so
ensure the corresponding free()'s are in place as well.

This should facilitate running the test suite with a relative path
outside cairo's source tree, such as when employing the CAIRO_REF_DIR
environment variable.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-09 21:25:12 +02:00
Bryce W. Harrington
be7f1ac98f test: Make cairo_test_mkdir() usable throughout tests.
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-09 21:21:43 +02:00
Bryce W. Harrington
6731023f1b test: Fix several tests to place output files in the output directory
The standard location for test output is cairo/test/output.  The harness
itself was updated to write automatically generated images in this
directory, however a number of tests generate their own local output
files.

This patch updates these tests to write their output into
CAIRO_TEST_OUTPUT_DIR (which defaults to cairo/test/output) as well, in
the interest of decluttering the test directory.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-09 21:15:50 +02:00
Bryce W. Harrington
f3574b8b3b test: Don't ignore test output files left in test directory
Tests should be placing output files in the output/ directory now,
although not all tests follow this standard practice.  Drop the
"*.out.*" from .gitignore to make improper test behavior more evident.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-09 21:15:12 +02:00
Adrian Johnson
f52165a7bb svg: Don't embed CMYK Jpeg images
None of the SVG viewers I tried (rsvg, firefox, inkscape) support CMYK
Jpeg images.

Bug 68965
2013-09-06 08:00:46 +09:30
Adrian Johnson
8e1a1ed863 Downscaling requires pixman 0.30 2013-09-06 07:54:28 +09:30
Chris Wilson
0266cb821f script: Add support for replaying device-scale
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-05 16:13:56 +01:00
Chris Wilson
a4164142f2 trace: Record set-device-scale
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-05 16:12:26 +01:00
Alexander Larsson
935c64a434 surface: Inherit device scale in cairo_surface_create_similar()
Without this most code that uses similar surfaces for offscreen
rendering will render in a pixelized fashion if the final
target uses a device scale.
2013-09-05 16:11:10 +01:00
Alexander Larsson
bc792a5e0e surface: Merge scratch construction into _cairo_surface_create_scratch
We merge _cairo_surface_create_similar_scratch and
_cairo_surface_create_similar_solid into a single function named
_cairo_surface_create_scratch, to avoid confusion with
cairo_surface_create_similar which now will have a different
behaviour wrt the sizes and the device-scale.

_create_scratch assumes the width and height are in backend
coordinates, while create_similar does not.
2013-09-05 16:11:09 +01:00
Alexander Larsson
bdccf4fe51 surface: Opencode create_similar
We copy the _cairo_surface_create_similar_solid code into
cairo_surface_create_similar so that we can separate these later
as one wants to use backend sizes and one not.
2013-09-05 16:11:08 +01:00
Chris Wilson
5f70148467 test: Allow CAIRO_TEST_MODE to independently enable extended testing
Such as CAIRO_TEST_MODE=scale for testing application of
cairo_surface_set_device_offset.

CAIRO_TEST_MODE=similar - test rendering through similar surfaces
CAIRO_TEST_MODE=offset - test rendering with a device offset
CAIRO_TEST_MODE=scale - test rendering with a device scale
2013-09-05 16:08:20 +01:00
Alexander Larsson
690c61aa54 tests: Add device scale test to "full" testrun similar to offsets 2013-09-05 16:08:20 +01:00
Alexander Larsson
7ab34f302b surface: expose the device scale
This adds the new public functions
cairo_surface_set_device_scale and cairo_surface_get_device_scale and
updates old users of the internal functions.
2013-09-05 16:08:19 +01:00
Chris Wilson
38217d67fc spans,traps: Undo device transform from source matrix for recording replays
As the replay of the recording surface applies the device_transform of
the matrix once again to all its operations, we end up with a repeated
transform through the source matrix of the recording surface. We need to
remove one of these, and the easiest way to do that appears to be to
undo the application to the source matrix.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-09-05 16:08:19 +01:00
Alexander Larsson
f0e2cd4494 gstate: Handle device scale on surface as source
When creating a transformed pattern we must apply the device
transform *before* the transform set on the pattern itself, otherwise
e.g. its translation will not be affected by the device scale.

We also fix up the device_transform related handling in
_cairo_default_context_pop_group().  With a device scale we can
no longer just use the device_transform_inverse to unset the
device offset for the extents, so we make that a simple translate
instead.

We also remove some weird code that tries to handle the device
transform but seems unnecessary (maybe a workaround for applying
the device transform in the wrong order?). With that code removed
things work fine, but with it things get translated wrongly when
there is a scale.
2013-09-05 16:08:19 +01:00
Alexander Larsson
900fc4a890 gstate: Move device-scale font scaling to gstate
If we do this in surface it will be applied twice then
we chain to a different surface, like e.g. a subsurface.

We also remove a hack in cairo-surface-wrapper where it compensated
for the device scale not being applied.

v2: Compute the backend CTM in ensure_scaled_font().
2013-09-05 16:08:19 +01:00
Alexander Larsson
25eaec0a38 subsurface: Handle device scales 2013-09-05 16:08:19 +01:00
Alexander Larsson
633d573889 default-context: Inherit device scale in push_group surface
Without this we will only render to part of the newly created
surface and then copy+scale that part back, which causes fuzziness.
2013-09-05 16:08:19 +01:00
Alexander Larsson
db7e551a6b gstate: Respect device transform in stroke
We need to apply the device transform to the ctm when stroking, as
otherwise line widths are not affected by the device scale.
2013-09-05 16:08:19 +01:00
Krzysztof Kosiński
fb57ea13e0 image: Use convolution filters for sample reconstruction when downscaling
I had a look at how complex would it be to add correct downscaling to
Cairo now that Pixman supports convolution filters. It turns out it
this is rather easy. Here is an initial, minimal attempt. It uses
convolution filters only if the image is being downscaled by more than
half a pixel in at least one dimension.

Some discussion:

1. The sampling and reconstruction kernels are picked in a way that
gives comparable quality when upscaling and downscaling. I paired box
sampling with bilinear reconstruction and impulse (point) sampling
with box reconstruction. This gives the expected result for NEAREST
filter. BEST filter uses Lanczos3 for both kernels.

> Do we need to use a reconstruction filter for NEAREST at all? Or maybe
> differentiate between NEAREST and FAST in that case?

If impulse (point) sampling is used, there must be some reconstruction
filter, otherwise no image is produced. That's because the sampling
grid does not match the data grid, and since there is no
reconstruction filter, values between data points are undefined. The
alternative is to use box sampling + no reconstruction.

2. Subsampling bits are always set to 1, since this doesn't seem to
affect quality at all.

3. I am not sure whether this code works correctly for matrices with a
skew component. It should be OK for any combination of scale, rotation
and translation.

4. This patch causes new failures in the test suite:
- recording-surface*: possibly an effect of improved quality.
- surface-pattern-scale-down*, surface-pattern-big-scale-down: the
reference images should be updated.
- pthread-same-source: I have no idea why this is failing, since this
test shouldn't even trigger the new code.
- large-source-roi: this test attempts to downscale an image which is
30000 pixels wide down to 7 pixels. The filter parameters seem to be
created correctly, but they might trigger an overflow somewhere in the
convolution code; the output rectangle is white instead of red, as if
nothing was drawn.
- device-offset-scale: there are subtle differences which look like
convolution-related smoothing; I'm not sure whether this is OK or not.
2013-09-05 16:08:19 +01:00
Chris Wilson
28ad0f9f3b Bump version for new development tree, 1.13.1 2013-09-05 16:08:19 +01:00
Chris Wilson
59e2a93b3c Post-release version bump 2013-08-26 18:46:19 +01:00
Chris Wilson
8e11a42e3e 1.12.16 release 2013-08-26 17:56:27 +01:00
Chris Wilson
b710a47309 Make "make check" happy
A recursive include should hide the bare header from
check-preprocessor-syntax.sh

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-26 17:56:27 +01:00
Chris Wilson
fb8881e84b win32: Prevent double-free of similar images
Based on a patch and analysis by Michael Henning.

When we create a similar-image surface for win32, we set up a couple of
back references from the image to the win32 surface, and vice versa. We
need to be careful when decoupling the reference cycle to avoid chasing
around the loop upon destruction. Currently we handled destroying the
similar-image via the parent win32 surface, but similar precaution is
required when destroying the surface via the similar-image.

Reported-by: Michael Henning <drawoc@darkrefraction.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63787
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-23 12:53:27 +01:00
Chris Wilson
054f34111d Provide backwards compatibilty with old pixman
The goal is to allow compilation against older pixman to ease regression
testing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-23 12:53:27 +01:00
Martin Robinson
95f320e3f2 gl: Return surface in error when creating oversized texture surfaces
When creating a texture surface that is larger than the maximum
framebuffer or texture dimensions of the context, return a surface in
error. Previously the code failed an assertion, but this prevents an
application from easily detecting when to fall back.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-19 14:54:28 -07:00
Henry Song
b5e1373c58 gl/msaa: Clean up msaa depth/stencil buffer for OpenGLES
OpenGLES also uses the depth/stencil buffer when doing multisampling, so
it's a leak to only clean up the buffer for desktop OpenGL.
2013-08-19 12:56:58 -07:00
Uli Schlachter
54a51968e8 surface_get_extents: Reject finished or error surface
This fixes a crash in the api-special-cases with xlib-xcb when calling
cairo_clip_extents() on a context that refers to a finished surface.

The crash was a simple NULL pointer dereference, because the underlying xcb
surface that was used in xlib-xcb was gone and set to NULL already.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-08-13 19:25:17 +02:00
Uli Schlachter
3c4e0f0f1a push_group: Refuse working with unusable surface
Make cairo_push_group() fail when the context's target surface is finished.

This fixes the api-special-cases for the xcb backend:

   Detected error during xcb run: error=9, seqno=0x13c, major=53, minor=0

The problem was that the Pixmap for the cairo surface was already freed and
cairo still tried to use it again as the drawable in a CreatePixmap request.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-08-13 19:21:57 +02:00
Uli Schlachter
18633b0810 surface: Error out on finished surfaces
Finished surfaces and surfaces with an error status must not be usable anymore,
so refuse to work on them.

This improves the result for api-special-cases.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68014

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-08-13 19:21:02 +02:00
Uli Schlachter
b64c83e891 api-special-cases: Also test contexts
This adds code to the api-special-cases test which also tests the behavior of
cairo when the cairo context or the surface that is target is in an error state
or finished. These new tests call into all public entry points defined in
cairo.h which receive a cairo_t * as their first argument.

Currently this causes a new crash in the testsuite:

  cairo-surface.c:394:
  _cairo_surface_begin_modification: Assertion `!  surface->finished' failed.

Reported-by: christophe.troestler@umons.ac.be
References: https://bugs.freedesktop.org/show_bug.cgi?id=68014
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-08-13 19:17:56 +02:00
Bryce W. Harrington
e438071e9d perf: Move macro-benchmark documentation to cairo-traces
The macro benchmarks were moved to a separate repository some time ago,
but the perf README still refers to these tests as if they were still
present, which may lead to some confusion.  Instead, consolodate the
macro benchmark documentation with the macro benchmarks, and focus this
README on just the (still in tree) micro-benchmarks.

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-08-11 16:37:02 +02:00
Bryce W. Harrington
4e133af60c HACKING: Make mention of the separate cairo-traces repo
Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-08-11 16:33:43 +02:00
Behdad Esfahbod
46d9db96d4 [ft] Ensure alignment of bitmaps received from FreeType 2013-08-04 20:12:06 -04:00