Commit graph

7144 commits

Author SHA1 Message Date
Chris Wilson
2ecafb025c [script] Reuse glyph advance cache over multiple invocations
Store the metric cache as user-data on the scaled-font so that we can
retrieve it on future calls to show-glyphs and friends.
2009-06-28 10:09:01 +01:00
Chris Wilson
663da31bbe [boilerplate] Propagate original error from create_from_png()
During cairo_boilerplate_get_image_surface_from_png() the original status
returned by cairo_image_surface_create_from_png() could have been masked
by inappropriate context construction when flattening or extracting.
Simply check after creating the surface from the png file, and return
immediately if in error.
2009-06-28 01:17:13 +01:00
Chris Wilson
2bbb694202 [test] Disable fallback16 testing
Only use the RGB16_565 surface as a source during testing. We presume that
pixman is itself rigorously tested and the output is equivalent to the
image surface. Enabling this test surface would require too large of a
burden to maintain the reference images for the 16-bit backend.
2009-06-28 01:00:53 +01:00
Chris Wilson
34ac8673b2 [script] Use setjmp exception handling during scanning
Save ~5% of overhead by using longjmp on error to terminate scanning
instead of propagating the error, incurring lots of redundant error
checks.
2009-06-28 00:48:05 +01:00
Chris Wilson
2b1ec7a4d8 [cairo] Report true error via pattern from cairo_pop_group()
Report the correct error via the returned pattern->status rather than
simply returning the NO_MEMORY nil object.
2009-06-27 22:48:19 +01:00
Chris Wilson
5c3be3ece2 [cairo] Mark cr->status guard as unlikely
For correct operation, the context should never be in error, so mark the
error context as being unlikely to optimize the common path.
2009-06-27 22:40:15 +01:00
Chris Wilson
f388028333 [gstate] Avoid temporary allocation for transformed patterns
Observe that patterns are not altered during an operation and so we are
safe to use the data from the original pattern without copying. (This is
enforced through the declaration that the backends operate on constant
patterns which are not allowed to be referenced or destroyed.)
2009-06-27 20:18:18 +01:00
Chris Wilson
3759c7b34b [perf] Enable the null-backend for trace replays. 2009-06-27 19:38:30 +01:00
Chris Wilson
8d4c704129 [ft] Cache the resolved font face
Keep the resolved font face alive whilst the default FcConfig remains
identical i.e. resolve the pattern again if the system configuration
changes (e.g. a new font is added or the rules are updated). This should
retain the benefits of lazily resolving font patterns whilst improving
performance by reducing the number of calls to FcFontMatch().
2009-06-27 19:34:20 +01:00
Chris Wilson
ddadd41a6c [test] Remove broken PDF reference images for push-group
More XFAIL reference images that are now invalidated by changes in
poppler.
2009-06-27 18:07:36 +01:00
Chris Wilson
4d233fa4a6 [test] Remove invalid smask PDF reference images
These need to be recorded using an XFAIL reference. In the meantime, as
the poppler output has changed, just remove all the invalid PDF reference
images.
2009-06-27 18:04:37 +01:00
Chris Wilson
86624627e4 [test] Add group-unaligned
Test case for:
   Bug 22441 -- Unexpected shift with push_group and pop_group
   https://bugs.freedesktop.org/show_bug.cgi?id=22441

This is a test that demonstrates the error in the pdf backend when using
groups on surfaces with non-integer sizes. In order to create such a
surface, we need to update the boilerplate to use doubles instead of
integers when specifying the surface size.
2009-06-27 17:53:18 +01:00
Chris Wilson
c506ddb586 [pdf] Restore original surface size after emitting group mask
A trivial fix to reset the original surface size after emitting the group.
The annoying aspect is that this should have been caught by the test suite.
Alas, no. A gentle reminder that simple line coverage is insufficient. :(
2009-06-27 16:57:35 +01:00
Chris Wilson
f8a2665840 [cairo] Trivial code tidy 2009-06-27 16:32:51 +01:00
M Joonas Pihlaja
c7cf5317f5 [test] Fix Makefile.am for Solaris make.
Sun's make doesn't like conditional assignments to variables
in dependencies in the form of "target: VAR+=VAL".  This
construct was used to force the test suite run in the foreground
in the check-valgrind target.  It is replaced by a more
explicit set of the CAIRO_TEST_MODE environment variable.
2009-06-24 23:33:44 +01:00
Chris Wilson
b82e7740c1 [atomic] Silence compiler warnings by defining an intptr_t
Evaulate the integer sizes during configure to find one of the exact same
size as a void* to use in the conversion of the atomic ptr cmpxchg to an
atomic int cmpxchg.
2009-06-21 22:25:08 +01:00
M Joonas Pihlaja
a2d4fb5009 [test] Fix a typo in the _POSIX_SOURCE version number.
I hope POSIX isn't around in 20000 AD!
2009-06-21 17:34:13 +03:00
M Joonas Pihlaja
80990c7f72 [atomic] Use an integer __sync_val_compare_and_swap() for pointer CAS.
Fix an implicit pointer/integer cast in _cairo_atomic_ptr_cmpxchg()
when building with LLVM/clang.

The Intel synchronization primitives __sync_val_compare_and_swap()
are only defined by Intel for types int, long, long long and their
unsigned variants.  This patch uses one of those for
_cairo_atomic_ptr_cmpxchg() instead of relying on a gcc extension of
__sync_val_compare_and_swap() to pointer types.
2009-06-21 17:34:12 +03:00
Chris Wilson
d0c1c92821 [boilerplate] Implement a reference xlib surface
Create an xlib target that uses a separate display, specified by
CAIRO_REFERENCE_DISPLAY, that can be used as a reference implementation
for the normal display. So this can be used by cairo-trace-test to create
a reference surface that mimics exactly the true surface, but if it
targets an Xvfb display will be entirely rendered in software. If
CAIRO_REFERENCE_DISPLAY is not set, the reference surface degrades into an
xlib-fallback surface which is a close approximation (but still has
behavioural differences).
2009-06-21 10:13:31 +01:00
Chris Wilson
d2244053dc [perf] Force rebuild if make fails
The build system has a singular failure whereby if a backend disappears
between on compile and the next, automake will fail to reconstruct the
Makefiles - resulting in a broken build. Attempt to fix this by removing
the build dir and recloning, which should work for any corrupt caches but
obviously will fail again at a true build failure.
2009-06-21 10:13:31 +01:00
Chris Wilson
ef0d307d54 [perf] Need to version surface types
As cairo-perf-diff will execute the current cairo-perf against historical
revisions, any introduced api must be protect in order to compile on old
versions.
2009-06-21 10:13:31 +01:00
Chris Wilson
44b72ba6d7 [perf] Add a non-build mode to graph
Add --show to cairo-perf-graph just to graph perf files that currently
exist and not build the missing cases.
2009-06-21 10:13:31 +01:00
Chris Wilson
d4dd6fcf3a [perf] Show speedup/slowdownn labels on graph
Add labels show that it is clear which direction is faster on the graph.
2009-06-21 10:13:30 +01:00
Chris Wilson
b71b6ecb59 [test] Fix the image compare
Oh, it's a bad sign when I can't even correctly compare a bunch of pixels.
2009-06-21 10:13:30 +01:00
M Joonas Pihlaja
d544828934 [build] Look for libpng.pc as well when configuring.
The OpenBSD png package installs only libpng.pc and not
any of libpng{13,12,10}.pc.
2009-06-20 06:16:51 -06:00
M Joonas Pihlaja
5733d8d6c3 [build] Remove a level of quoting from CAIRO_PARSE_VERSION.
The m4 that comes with OpenBSD gets confused by the extra quoting
applied to the version number argument when building the
bodies of the cairo_version_{major,minor,micro} macros using
m4_bpatsubst(). Since we're making sure that the argument is always
a number, we can safely use the unquoted \2 body rather than \[\2\].
2009-06-20 06:11:44 -06:00
Chris Wilson
3bad3efaa2 [test] Add cairo-test-trace to .gitignore 2009-06-19 19:09:03 +01:00
Chris Wilson
62dc0ae46c [cairo] Offset the current path when pushing/popping groups.
We need to translate the path in order to compensate for the device offset
applied to the group surface when pushing and popping. (The path is
transformed to device space on creation, and so needs recomputing for the
new device.)
2009-06-19 19:08:34 +01:00
Chris Wilson
851c883962 [test] Add group-clip
Larry Ewing found an ancient and nasty bug whereby a path was not
corrected whilst pushing and popping groups.
2009-06-19 19:08:29 +01:00
Chris Wilson
0a34abace7 [test] Experiment with reference targets
Specify another boilerplate target to use as the reference for this
target. We then use this in cairo-test-trace in preference to using the
image surface. Still not perfect, though the framework is improving.
2009-06-19 19:06:17 +01:00
Chris Wilson
cec8579348 [xlib] Remove redundant code to query a xrender_format from a visual
We always query an xrender_format for a Visual upon surface creation, so
checking again in create_similar() is redundant. (It also interferes with
disabling XRender...)
2009-06-19 19:06:17 +01:00
Chris Wilson
dd842a2bed [boilerplate] Missing static on pdf user data key. 2009-06-19 19:06:17 +01:00
M Joonas Pihlaja
2da906f476 [script] Include unistd.h if we're twiddling file descriptors.
Including sys/mman.h doesn't pull in unistd.h on Solaris 9 so
we have to include it explicitly.
2009-06-19 19:01:15 +03:00
M Joonas Pihlaja
1b6dbcbbeb [trace] Compile without fontconfig.
Use CAIRO_HAS_FC_FONT to decide whether to export
cairo_ft_font_face_create_for_pattern() or not.
2009-06-19 19:01:14 +03:00
M Joonas Pihlaja
d9b5a98a78 [build] Require fontconfig >= 2.2.95 if we're using it at all.
We require at least fontconfig 2.2.95 when we're using
fontconfig because we depend on the FcResultOutOfMemory
error code introduced in that version.
2009-06-19 19:01:14 +03:00
Chris Wilson
84e587bbfa [trace] Prevent a child process from writing to the same file
After opening a specific file or fd for ourselves, reset the
CAIRO_TRACE_FD to point to an invalid fd in order to prevent any child
processes (who inherit our environment) from attempting to trace cairo
calls. If we allow them to continue, then the two traces will intermix
and be unreplayable.
2009-06-19 14:41:39 +01:00
Chris Wilson
18edea36ba [perf] Report line of error during trace
Query the number of new lines processed so far and report that on hitting
an error.
2009-06-19 14:14:32 +01:00
Chris Wilson
55721d380d [script] Report line number
Count the number of newlines processed in the trace and provide an API for
the user to query.
2009-06-19 14:13:34 +01:00
Chris Wilson
030ef4ca00 [trace] Change the threshold at which pixel data is immediately copied
Embed the pixels for images less than 32*32 as this catches most icons
which are frequently uploaded, but is still an unlikely size for a
destination image surface.
2009-06-19 11:56:14 +01:00
Chris Wilson
d3330d7beb [ft] Substitute twin if there are no fonts
Fixes bug 22356 -- Spurious "out of memory" error on system without fonts
https://bugs.freedesktop.org/show_bug.cgi?id=22356

If FcFontMatch() fails, then it means that there are no fonts available on
the system (or it may have been a malloc error, we have no way of telling).
Instead of report NO_MEMORY and disabling all drawing, one of the
rationales for including a builtin font was so that we could continue even
in the face of this error and show *something* to the user. (This being a
last resort (and especially important for demos!) and hopefully easier to
diagnose than no output at all.)
2009-06-19 11:20:48 +01:00
M Joonas Pihlaja
6d8b353658 [spans] Squash a compiler warning when creating error objects.
Handle the new CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED status code
in the switch/case of the ..._create_in_error() functions for
creating span renderers or scan converters.
2009-06-19 02:45:39 +03:00
M Joonas Pihlaja
7651227d3d Revert "[test] Make the xlib-fallback use the image refs."
This reverts commit 903b39c304.

The xlib-fallback actually renders mostly via traps at the moment,
so staying with xlib refs is the right thing to do.
2009-06-19 02:45:39 +03:00
M Joonas Pihlaja
729457b174 [test] Add trap rendered ref images for fill-image.
The fill code path for the xlib and fallback surfaces use trapezoids
rather than spans, so there's lots of differences due to antialising
differences at the edge of the fill.  This patch adds a ref image
for the xlib and test-fallback surfaces.
2009-06-19 02:45:39 +03:00
M Joonas Pihlaja
8e7f667abb [test] Mark scale-offset tests as XFAIL for image, xlib-fallback.
The scale-offset tests trigger a loss-of-precision bug when
converting double matrices from cairo to pixman format.

http://lists.cairographics.org/archives/cairo/2008-November/015671.html
2009-06-19 02:45:38 +03:00
Chris Wilson
c12533b135 [pattern] Add _cairo_pattern_fini_snapshot
Symmetric operation to _cairo_pattern_init_snapshot() this exists simply
to break the circular reference between the meta-surface and snapshot-cow.
2009-06-19 00:29:00 +01:00
Chris Wilson
2213c44737 [svg] Break circular snapshot reference by explicit finish
The svg backend snapshots the meta surface which because of snapshot-cow
creates a circular reference back to the creator. So in order to break the
circular reference when we have finished with the snapshot, we need to
call cairo_surface_finish() in addition to simply destroying the surface.
2009-06-19 00:29:00 +01:00
Chris Wilson
cd9eef1aad [scaled-font] Check the MRU font before resolving the implementor
This should hide most of the overhead of resolving a frequently used toy font.
2009-06-19 00:29:00 +01:00
Chris Wilson
5ad64dfda2 [test] Add the sha1sum of the required fonts
(Note, I think these are currently out-of-date... But it will serve as a
useful reminder to verify and update them in future.)
2009-06-19 00:28:59 +01:00
Chris Wilson
3063f0f44c [scaled-font-subset] Check for matching font-face implementors
Catch toy and user fonts which may have different font-faces for their
implementation than the original ones they were created with.
2009-06-19 00:28:59 +01:00
Chris Wilson
6e78c94615 [test] Move calls to the getters from out of the innermost loops.
Tidy the code slightly by removing excess and unsightly calls to
cairo_test_get_context() and cairo_get_scaled_font().
2009-06-19 00:28:58 +01:00