Commit graph

11081 commits

Author SHA1 Message Date
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
Behdad Esfahbod
34a747e7bd [ft] Fix alignment 2013-08-04 20:11:51 -04:00
Behdad Esfahbod
3cd6c5966a Revert accidentally committed stuff 2013-07-29 22:47:26 -04:00
Behdad Esfahbod
0554d76402 [ft] Add missing include 2013-07-29 22:41:46 -04:00
Behdad Esfahbod
7d26341072 [ft] Fix math 2013-07-29 19:20:33 -04:00
Behdad Esfahbod
9444ef09cc Support 2bit and 4bit embedded bitmaps 2013-07-29 19:10:46 -04:00
Adrian Johnson
274863be08 type1-subset: Don't try to rename non winansi glyphs
When the latin subset contains glyphs that use the seac operator to
combine two glyphs, additional non winansi glyphs are added to the
subset.  These extra glyphs do not have a winansi name so they can't
be renamed.

Based on a patch by Salvador Ortiz.

Bug 67324
2013-07-28 09:30:05 +09:30
Henry Song
03c81d414d gl/msaa: Always use scissor when clipping
Even when using the stencil buffer for clipping, always scissor the clip
extents. This simplifies the code a bit.
2013-07-15 19:27:29 -07:00
Henry Song
8c710ed872 gl/msaa: Disable stencil and scissor during framebuffer blit
When blitting the framebuffer during transitions to and from
multi-sampling mode, we need to disable the stencil and scissor test so
that the entire surface is preserved. This fixes the bitmap-font test
for the MSAA compositor.
2013-07-15 19:27:24 -07:00
Henry Song
be2c09a1f5 gl/msaa: Properly destroy stencil buffer clip cache
When replacing the stencil buffer clip cache or destroying a surface,
destroy the cached clip. This prevents the clip from leaking.
2013-07-15 19:27:19 -07:00
Behdad Esfahbod
2cc353c3db Towards support loading color glyphs from FreeType
See comments.
2013-07-05 16:03:25 -06:00
Behdad Esfahbod
e738079302 [ft] Fix wrong assumptions
If subpixel rendering is enabled, but FT returns a 8bit gray bitmap
(perhaps because the font has 8bit embedded bitmaps) we were hitting
the assertions because the assumptions made were wrong.  Fix up.
2013-07-05 15:59:45 -06:00
Behdad Esfahbod
a0f556f37f [ft] Fix memory bug in copying bitmaps 2013-07-05 15:59:45 -06:00
Uli Schlachter
9f9796920f xcb: Fix some uninitialized variable warnings
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-07-04 21:57:12 +02:00
Uli Schlachter
2170bdbb12 image compositor: Always finish the span renderer
In some obscure conditions that I don't really understand, the image compositor
did not finish a span renderer that it created. This could then cause the last
row of the span to be ignored.

Fixes: clip-complex-bug61492

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61592
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-07-04 21:57:12 +02:00
Uli Schlachter
9058e9ae28 Add new test for bug 61592
This test exercises some clipping-related failure that Seongwon Cho reported.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61592
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-07-04 21:57:12 +02:00
Uli Schlachter
54bee5e0fc Fix caps-tails-curve reference images
Commit d7f5a1bec fixed a bug. This caused 12 new test failures for the
test-traps test target:

caps-tails-curve degenerate-arc degenerate-path joins subsurface
subsurface-scale twin twin-antialias-gray twin-antialias-mixed
twin-antialias-none twin-antialias-subpixel user-font

Most of these are indeed (new?) bugs. However, caps-tails-curve actually started
producing the expected result and the reference image just wrongly captures the
old state of things.

At the time of that commit, just taking the output from test-traps as the new
reference image works fine for all backends. However, with current git,
something introduced more antialiasing noise and now test-traps changed again
while cairo-xcb stayed with the old result. Thus, we also need a new reference
image to fix this test.

(The wrong reference images come from commit 8488ae02 which turned test-traps'
results into reference images)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-07-04 21:57:12 +02:00
Chris Wilson
8b55703d76 test: Amend check-refs.sh to support out-of-tree builds 2013-07-04 10:04:30 +01:00
Chris Wilson
8b4151a5e5 test: Remove conflicting .ref.png, .argb32.ref.png, .rgb24.ref.png
Where a content specific reference image exists, prefer to have both
content reference images (i.e. both argb32.ref and rgb24.ref) rather
than a mix of .ref and argb32/rgb24.
2013-07-04 10:02:46 +01:00