Commit graph

10509 commits

Author SHA1 Message Date
Henry Song
bdb9c2cb43 gl: Destroy glyph cache surface during finish
We must destroy glyph cache surface in device_finish instead of in
device_destroy because in device_destroy device status is
DEVICE_FINISHED and the operation is invalid.
2012-07-11 10:05:51 +01:00
Henry Song
64a236246b gl: generate correct gradient color texture
Pixman generates gradient color at the center of pixel.  We need to
adjust such accordingly in GL when generating gradient texture
2012-07-10 16:14:54 +01:00
Chris Wilson
6938592ec7 xlib: If a sample accesses outside of a repeating image, upload it all
Fixes bug-51910

Reported-by: Albertas Vyšniauskas <thezbyg@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51910
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-09 21:57:03 +01:00
Chris Wilson
ff22ab4c10 test: Add example from bug-51910
The calculation of the required source extents blows up under xlib.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-09 21:57:03 +01:00
Chris Wilson
7b6f9fd140 test: Add a simple exercise for raster sampling of subpixel geometry
Test that the rasteriser doesn't incorrectly merge disjoint geometry at
the subpixel level.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-09 21:57:03 +01:00
Adrian Johnson
1cac6e7fcc cff: initialise variable to prevent valgrind warning 2012-07-05 22:41:28 +09:30
Adrian Johnson
49c8e1b674 cff: use correct size for buffer
Bug 51443
2012-07-05 21:59:33 +09:30
Adrian Johnson
77106a038b cff: convert '.' to locale specific decimal point before using sscanf
to fix bug when decoding cff real numbers.

Bug 51443
2012-07-04 19:54:18 +09:30
Chris Wilson
64d65f72e5 boilerplate/gl: Round fractional window sizes up
A few test cases purposely create fractional surface sizes which can not
be natively supported by the raster backends such as GL. For these
backends we need to consistent in creating a surface that is large
enough to contain the test, so we need to use ceil() rather than
implicit truncation to integers.

A consequence of the misalignment between the Window size and the
surface size (where one was using ceil and the other not) is that the
first row of the cairo surface would not be visible on the output.

Based on a patch by Chuanbo Wen to fix 5 test cases, such as
group-unaligned.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-29 10:33:08 +01:00
Chris Wilson
cb85631c63 ft: Indentation fixup for _get_bitmap_surface()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-29 10:33:08 +01:00
Chuanbo Weng
1bdee6b1ad gl: Set correct operation extents.
The dst_x and dst_y should be considered when setting clip extents,
because they are not always be zero. (for example, in clip-operator.c)
2012-06-26 10:14:05 +01:00
Uli Schlachter
9f52261dd7 xcb: Correctly handle a recording surface's extents
The size of the target area doesn't really have much to do with the size of the
recording surface that we are painting from. Thus, let's use the recording
surface's size instead.

Since we apply the transformation before replaying the recording surface, we
need to transform the recording surface's size via the inverse of our pattern
matrix to get the size in the target surface. This makes this a little more
complex.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-06-25 21:18:18 +02:00
Uli Schlachter
e704f64d8f xcb: Handle recording surfaces differently
Let's say we are painting recording surface 'source' to xcb surface 'target' by
replaying the source to a temporary surface 'tmp'.

Previously, the xcb backend replayed the recording surface to tmp with just a
translation and then used that as its source surface with the pattern's
transformation. That means 'tmp' used the same coordinate system as 'source'.

This patch changes this so that the transformation is applied during the replay
and painting from 'tmp' to 'target' is just a simple translation, so 'tmp' now
uses the same coordinate system as 'target'.

This should produce way less better results, because transforming a recording
surface should have less artifacts than transforming a raster surface.

Fixes: record1414x-* record2x-* record90-* ps-surface-source

Breaks (or rather, "exposes unrelated bug that I have not yet figured out in"):
record-extend-*-similar

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-06-25 21:18:18 +02:00
Chuanbo Weng
13d61d7bdb gl: Set correct clip rectangle for non-texture destination surfaces
When the desintation surface is not a texture, it is flipped in the Y
axis. So we need to correct the Y coordinates when using glScissor to
the set the clip region.

Fixes 14 cases in cairo-test-suite, for example partial-clip-text-top
2012-06-24 12:13:02 +01:00
Chris Wilson
166e6f199e stroke: Skip inserting a round-join if within tolerance
If the angle between two segments is small we can simply replace the
round-join with a bevel-join. This is done automatically by the
insertion of the triangle fan as it will not be able to find a point
around the pen between the two vectors. However, we can make that search
cheaper by inspecting whether the bisection angle is small enough that
the bevel-join will be within geometric tolerance of the round-join.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-24 11:53:25 +01:00
Chris Wilson
b7bd5ae4f3 stroke: Use round-joins near inflection points of splines
Near an inflection, the angle between two segments of a spline increases
rapidly (as the radius of curvature decreases for the cusp). The angle
may increase so much that a simple line connecting the two outside
points of the spline is not within the user specified geometric
tolerance (with the result that you can generate severe ugliness around
a cusp). Extend the current detection of the exact inflection to cover
the sharp joins near the cusp by inspecting whether the bisection angle
is larger than acceptable.

Fixes bug-spline.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-24 11:53:18 +01:00
Chris Wilson
3d482e266f test: Exercise bug in joining together spline segments around cusps
Carl Worth demonstrated a glaring bug in the new stroking code,
introduced in commit 545f30856a (stroke: Convert the outlines
into contour and then into a polygon), whereby only a bevel join was
being used to connect segments around a sharp inflection point.

This adds the two examples he reported to the test suite.
2012-06-24 11:53:09 +01:00
Chris Wilson
185a351896 gl: Trim the glyph mask to the operation extents
In the case we try to use an unbounded operation, passing a NULL clip
causes that operation to clear the rest of the surface. Instead we need
to trim the _cairo_surface_mask() to the operation extents.

Fixes overlapping-glyphs.

Suggested-by: Chuanbo Weng <strgnm@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-20 09:20:06 +01:00
Chris Wilson
35e4ffd91c image: Fix up glyphs compositing
Jose Dapena Paz reported an assertion following the uninitialised status
value being returned. Also the function failed to free its allocations.

Based on a patch by Jose Dapena Paz <jdapena@igalia.com>.
Reported-by: Jose Dapena Paz <jdapena@igalia.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51104
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-15 10:52:25 +01:00
Henry Song
9bc1ea4431 subsurface: Disable subsurface-set-snapshot as it creates a ref cycle
_cairo_surface_subsurface_set_snapshot () sets the subsurface as the
snapshot of its target.  This creates a reference cycle (as the target
is already referenced by the surface) and thus a memory leak (assuming
the likely case that user doesn't call finish).

Test case: subsurface-similar-repeat.

So make this call as a no-op for the time being until the bug is fixed.
2012-06-14 23:07:34 +01:00
Andrea Canciani
13ba74a00d quart-image: Fix compilation
quartz-image uses _cairo_surface_is_image(), which is now declared in
cairo-image-surface-inline.h.

Fixes:
cairo-quartz-image-surface.c: In function 'cairo_quartz_image_surface_create':
cairo-quartz-image-surface.c:312: error: implicit declaration of function '_cairo_surface_is_image'
cairo-quartz-image-surface.c:312: warning: nested extern declaration of '_cairo_surface_is_image'
2012-06-14 08:12:41 +02:00
Søren Sandmann Pedersen
615205cf07 Use the new pixman_glyph_cache_t API that will be in pixman 0.28.0
This new pixman API allows glyphs to be cached and composited in one
go, which reduces overhead compared to individual calls to
pixman_image_composite_region32().

Notes:

- There is an explicit call to _cairo_image_scaled_glyph_fini(). This
  could instead be done with a private, but I chose not to do that
  since we don't need to store any actual data; we only need
  notification when the glyph dies.

- The slowdown in poppler-reseau is real and stable across runs. I'm
  not too concerned about it because this benchmark is only one run
  and so it is dominated by glyph cache setup costs and FreeType
  rasterizing.

Performance results, image backend:

    Speedups
       firefox-talos-gfx  5571.55 -> 4265.57:  1.31x speedup
      gnome-terminal-vim  1875.82 -> 1715.14:  1.09x speedup
               evolution  1128.24 -> 1047.68:  1.08x speedup
       xfce4-terminal-a1  1364.38 -> 1277.48:  1.07x speedup

    Slowdowns
          poppler-reseau   374.42 ->  394.29:  1.05x slowdown

Performance results, image16 backend:

    Speedups
       firefox-talos-gfx  5387.25 -> 4065.39:  1.33x speedup
      gnome-terminal-vim  2116.66 -> 1962.79:  1.08x speedup
               evolution   987.50 ->  924.27:  1.07x speedup
       xfce4-terminal-a1  1856.85 -> 1748.25:  1.06x speedup
                    gvim  1484.07 -> 1398.75:  1.06x speedup

    Slowdowns
          poppler-reseau   371.37 ->  393.99:  1.06x slowdown

Also bump pixman requirement to 0.27.1.
2012-06-09 15:52:59 -04:00
Chris Wilson
f228769dfe polygon-reduce: Reduce broken stopped-edge continuation
This is hopefully a lesser used path and the attempted optimisation to
continue a stopped edge with a colinear stopped edge highly unlikely and
lost in the noise of the general inefficiency of the routine. As it was
broken, rather than attempt to rectify the "optimisation" remove it.

Reported-by: Evangelos Foutras <evangelos@foutrelis.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50852
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-08 17:26:11 +01:00
Chris Wilson
fc501fd6b5 tor-scan-converter: Always recompute min-height following edge removal
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-08 17:26:11 +01:00
Chris Wilson
1bc696a8fd spans-compositor: After polygon intersection the fill rule is always non-zero
As it turns out due to the rules of polygon intersection, there is never
any overlapping spans so the choice is arbitrary. However, lets be
consistent with the rest of the code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-08 17:26:11 +01:00
Chris Wilson
37532b47c0 scaled-font: Take lock around disposing of an empty page upon alloc failure
Spotted by code inspection whilst looking at #50705

References: https://bugs.freedesktop.org/show_bug.cgi?id=50705
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-07 15:15:55 +01:00
Adrian Johnson
2f1d6b27e8 cff-subsetting: Ignore charset for non cid fonts
Fixes crash in https://bugzilla.gnome.org/show_bug.cgi?id=677422
2012-06-07 19:18:52 +09:30
Chris Wilson
9fa047c0ea composite-rectangles,scaled-font: Use accurate extents if the font is broken
If the font metrics appear broken, i.e. key values are being reported as
zero, skip approximating the bbox of the glyph string.

References: https://bugs.freedesktop.org/show_bug.cgi?id=50688
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-04 20:18:03 +01:00
Adrian Johnson
0210499578 pdf: fix the offset of padded images
Bug 50598
2012-06-02 19:01:18 +09:30
Chris Wilson
f1b546b1a2 Erradicate internal use of cairo_surface_get_type()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-01 18:17:33 +01:00
Chris Wilson
e23d179e08 Erradicate internal use of cairo_surface_get_content()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-01 17:46:25 +01:00
Søren Sandmann Pedersen
4b5d3436a3 image: Fix bugs related to glyph mask creation
In addition to fixing a bug 7d8d98b91c releated to
expanding a8 glyphs into a8r8g8b8, this commit also added an
optimization where if the first glyph had format a8r8g8b8, the mask
was created in this format from the beginning instead of later
converting from a8 to a8r8g8b8.

However, the optimization had two bugs in it:

(1) The computed stride was 3 * width, not 4 * times width, and
(2) In the case where the mask was allocated on the stack, it was
    allocated as PIXMAN_a8 and not a8r8g8b8.

The commit fixes both bugs.
2012-06-01 08:13:17 +01:00
Chris Wilson
c0a92bf832 surface: replace map-to-image clone's use of user_data with parent pointer
Removes an another undeclared PLT entry and prevents mixing of user_data
with internal state.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-05-31 18:30:58 +01:00
Chris Wilson
9e933d4b87 gl: Add missing cairo-private to _cairo_gl_composite_with_clip
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-05-31 18:25:09 +01:00
Chris Wilson
9275b4d5aa surface: Eliminate PLT entries for map-to-image
Use the internal symbols internally.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-05-31 18:22:11 +01:00
Chris Wilson
2c6ba9a873 image: silence make check
The check for standalone headers requires that the
cairo-image-surface-inline.h include the cairo-surface-private.h

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-05-31 18:10:36 +01:00
Chuanbo Weng
98c3ed1dbd gl: Do correct translation and lerp in gl-traps-compositor.
Coordinate translation is necessary in composite_boxes(), composite()
and composite_traps(). The translation value should set to correct
value in traps_to_operand(). Also fix the bug in lerp().
2012-05-31 11:38:19 +01:00
Chris Wilson
7d8d98b91c image: Upconvert glyphs through a WHITE source when adding to the glyph mask
We need to scale the channels of the glyph into the destination (and
indeed expand a8 into a8r8g8b8) when adding into the mask. Normally we
have matching formats for the glyph surfaces and the temporary mask,
for which we can continue to take the faster path.

Reported-by: Søren Sandmann <sandmann@cs.au.dk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-05-31 11:25:11 +01:00
Adrian Johnson
3f325764e5 pdf: Don't use extents when acquiring a RASTER_SOURCE pattern
because the pdf surface reuses the image each time the pattern is used.
2012-05-31 17:46:31 +09:30
Chris Wilson
43105a89d8 test: Restore bug-seams reference
An overzealous update after converting antialiasing missed the object of
this test was exactly to point out an error due to the antialiasing. So
restore it back to the prestine reference and mark the image backend as
failing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-05-31 08:49:39 +01:00
Yuanhan Liu
25317dbd88 configure.ac: remove annoying change of INSTALL file
Every time we run ./autogen.sh, the INSTALL file would be replace by
/usr/share/automake-1.11/INSTALL, which changes the file. This is very
annoying since it messes up the result of 'git diff' and git always
wants to commit it.

Declare it as foreign would fix this annoying issue. Since it's not a
GNU project, it makes sense to do so.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
2012-05-30 14:02:21 +01:00
Chris Wilson
f3a1ee5edd gl: Do no access ctx after release during map-to-image
Based on a patch by Yuanhan Liu.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-05-30 11:10:34 +01:00
Yuanhan Liu
9340fcd965 gl: use _cairo_gl_operand_copy to fix unblanced reference count
Use _cairo_gl_operand_copy to do the operand copy instead of by
something like *operand = surface->operand.

This would fix a crash introduced by operator-source test case, which
forgot to do reference while copying operand but did dereference while
destroying surface at combine_clip_as_traps().

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
[ickle: drop the extra reference for the owned surface]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-05-30 10:43:09 +01:00
Adrian Johnson
f3ae830207 pdf: merge _emit_recording_surface and _emit_recording_subsurface into the one function 2012-05-27 22:59:13 +09:30
Adrian Johnson
5dd119c1fe ps: check if EXTEND_PAD group can be painted with EXTEND_NONE 2012-05-27 22:32:41 +09:30
Adrian Johnson
fcfa45c9f7 pdf: fix smask gradient bbox 2012-05-27 11:55:09 +09:30
Chris Wilson
29a42ae682 surface: Kill imagesurf temporary variable
The local alias to &image->base is more confusing that the code it
replaces.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-05-26 15:21:23 +01:00
Chris Wilson
11e276753f image: Propagate errors from clone_subimage
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-05-26 15:21:23 +01:00
Andrea Canciani
fc33cc3c3a quartz: Provide a valid implementation of map_to_image
and reuse it to implement acquire_source.

Fixes

cairo-quartz-surface.c: In function '_cairo_quartz_surface_map_to_image':
cairo-quartz-surface.c:1568: warning: return from incompatible pointer type
cairo-quartz-surface.c:1576: warning: return from incompatible pointer type
2012-05-26 16:07:47 +02:00
Andrea Canciani
a8a4a8dfd4 quartz: Mark surfaces created clear as is_clear
This might provide a speedup when clearing an already clear surface
and is required by cairo_surface_create_similar().

Fixes zero-mask.
2012-05-26 16:07:33 +02:00