Commit graph

1900 commits

Author SHA1 Message Date
Chris Wilson
7439c45039 [ps] Only use fallback images if the gradient has non-constant alpha.
If the gradient has constant alpha, then we can express it as a flattened
linear gradient. Otherwise, should the opacity vary across the gradient we
need to fallback.
2008-09-07 15:03:47 +01:00
Chris Wilson
94fd60d5ec [test] Add gradient-constant-alpha.
PostScript can handle alpha gradients, iff they have a constant alpha. So
exercise that path.
2008-09-07 15:03:37 +01:00
Chris Wilson
a33f2f6962 Revert "[ps] A flattened gradient is not linear."
This reverts commit 85ed37da33.

Adrian Johnson pointed out that iff the gradient has constant alpha then
it can be flattened. Reverting this commit in order to restore the
capability to handle gradient flattening.
2008-09-07 15:03:21 +01:00
Chris Wilson
85ed37da33 [ps] A flattened gradient is not linear.
We cannot express an alpha-gradient as a simple linear interpolation
between 2 flattened colors. So fallback.
2008-09-06 09:10:25 +01:00
Chris Wilson
c1c86afa87 [ps] Use floating point values when flattening color.
Use the full-precision color values when computing the alpha-blended
color.
2008-09-06 09:10:20 +01:00
Behdad Esfahbod
965b0e51ec [test] Do not include "xmalloc.h" directly
Not needed, it's renamed and included by boilerplate directly.
2008-09-04 23:25:27 -04:00
Behdad Esfahbod
a7951081f1 Move _GNU_SOURCE declarations to where it's used
Such that we don't rely on more GNU extensions accidentally.
2008-09-02 21:54:09 -04:00
Behdad Esfahbod
5926257770 Revamp the build system.
Quick summary of changes:

  - Move list of cairo source files out of src/Makefile.am and into
    src/Sources.mk,

  - Generate files src/Config.mk and src/Config.mk.win32 that choose
    the right set of source files and headers based on configured
    backends and features.  This drastically simplifies building
    using other build systems.  The src/Makefile.win32 file needs
    to be updated to reflect these changes.

  - Add README files to various directories,

  - Add toplevel HACKING file.
2008-09-02 20:24:08 -04:00
Chris Wilson
7b2e8035f2 [cairo-test] Fixup a few memleaks on failure.
Free the test image before jumping to UNWIND_CAIRO.
2008-09-02 10:54:13 +01:00
Chris Wilson
bd21b2f630 [test] Ensure that the output is always saved.
Do the saving of the output first before checking for various failures
with respect to the reference images.
2008-08-26 23:03:08 +01:00
Chris Wilson
08ea9d1f2a [pdiff] Get the surface data pointer once.
Don't call cairo_image_surface_get_data() for every single component of
the two surfaces to compare.
2008-08-26 23:01:30 +01:00
Chris Wilson
17a6d541f8 [test] Explicity save a fail image.
Be explicit about handling cached FAIL images, instead of relying on the
sequences of failed matches as the files are an external resource and we
can not guarantee their individual accessibility.

Note this also changes the filename, so you may want to run:
$ find -name '*-last.*' -print | xargs rm
after this checkout.
2008-08-21 08:45:06 +01:00
Chris Wilson
b9287e6669 [test] Cache last output and compare next time.
Compare the current output against a previous run to determine if there
has been any change since last time, and only run through imagediff if
there has been. For the vector surfaces, we can check the vector output
first and potentially skip the rasterisation. On my machine this reduces
the time for a second run from 6 minutes to 2m30s. As most of the time,
most test output will remain unchanged, so this seems to be a big win. On
unix systems, hard linking is used to reduce the amount of storage space
required - others will see about a three-fold increase in the amount of
disk used.  The directory continues to be a stress test for file selectors.

In order to reduce the changes between runs, the current time is no longer
written to the PNG files (justified by that it only exists as a debugging
aid) and the boilerplate tweaks the PS surface so that the creation date
is fixed. To fully realise the benefits here, we need to strip the
creation time from all the reference images...

The biggest problem with using the caches is that different runs of the
test suite can go through different code paths, introducing potential
Heisenbergs. If you suspect that caching is interfering with the test
results, use 'make -C test clean-caches check'.
2008-08-20 23:56:56 +01:00
Chris Wilson
b47c772934 [test/bufferdiff] Move unused code.
Only imagediff calls png_diff, so it makes sense to move that function out
of the cairo-test and into the utility.
2008-08-20 23:20:09 +01:00
Chris Wilson
5712a2c619 [test] Destroy test ouput image on failure.
Add the missing cairo_surface_destroy(). Sigh, less haste more speed.
2008-08-19 15:17:45 +01:00
Chris Wilson
0354457bed [test] Always write the test output to a png.
Always write the test output to a png so that it can be copied and used as
a reference image with CAIRO_REF_DIR.
2008-08-19 15:10:51 +01:00
Chris Wilson
86d221521b [test] Pass extended output name to ref_name_for_test().
Having included some extra details in the test output PNG filename, we
need to pass the extra information to
cairo_ref_name_for_test_target_format() in order to find the match.
2008-08-19 14:58:48 +01:00
Chris Wilson
776844eb9e [boilerplate] Daemonic conversion utility.
In order to achieve substantial speed improvements the external conversion
utilities are rewritten as a daemon that communicates with the test suite
over a local socket. This is faster as it avoids the libtool and dynamic
linker overhead for each invocation, the caches persist between tests and
we no longer require a round trip through libpng.

The daemon is started automatically by the test suite and if communication
cannot be established then it falls back to using a pipe to a normal
conversion utility. The daemon will then persist for 60 seconds waiting
for further connections.

Of course any memory leak (stares at poppler) is exacerbated.
2008-08-19 11:15:12 +01:00
Chris Wilson
4cd478b95f [test] Initialise test context.
Fixup a couple more tests that do not initialise a test context for
themselves.
2008-08-18 17:56:21 +01:00
Chris Wilson
c56385eacc [test/make-html.pl] Don't include links to non-existent images.
Some tests do not generate output images, so do not insert a link if we
don't have an image.
2008-08-18 16:18:57 +01:00
Chris Wilson
17fbb652b1 [test] Avoid redundant writes/reads of test surfaces via png.
As Behdad suggested, we can dramatically speed up the test suite by
short-circuiting the write to a png file, only to then immediately read it
back in. So for the raster based surfaces, we avoid the round-trip through
libpng by implementing a new boilerplate method to directly extract the image
buffer from the test result. A secondary speedup is achieved by caching the
most recent reference image.
2008-08-18 16:18:52 +01:00
Chris Wilson
9b0b55cea7 [test/leaky-dashed-rectangle] Add ref to bug report.
Yevgen Muntyan has filed a bug report with the same symptoms as
leaky-dashed-rectangle, so add a reminder for when it is finally fixed.
2008-08-18 08:26:57 +01:00
Chris Wilson
212cbd3f1b [test/user-font] Correct the lifetime of the user font face.
By keeping a static reference to the user font face, it is erroneously kept
alive during a call to cairo_debug_reset_static_data(). (A violation of
the caller's contract to ensure that no active reference to a cairo object
is held by the caller.)
2008-08-18 08:26:43 +01:00
Chris Wilson
c745a622db [test/toy-font-face] Use cairo_test_init/fini().
Minor step to harmonise the test with the rest of the suite.
2008-08-17 17:33:29 +01:00
Chris Wilson
37bca38772 [test/create-from-png] Return the failure.
Having checked all the possible PNG formats, report any failures.
2008-08-17 15:30:51 +01:00
Chris Wilson
db7e3cb854 [Makefile.am] Delete intermediates
Clean up after calling 'gcc -save-temps'.
2008-08-17 11:39:56 +01:00
Chris Wilson
e3665bde5d [test/Makefile.am] Match *-out.{pdf,ps,svg}
When cleaning files, limit the glob to only match *-out.{pdf,ps,svg} in
order to distinguish the current practice of naming vector output files
from possible future vector target/reference files.
2008-08-13 22:02:12 +01:00
Chris Wilson
49ea4fbb25 [test/create-from-png-stream] Correct check for png loading error.
The test for failure to load the image surface from the png stream
incorrectly checked for a NULL surface, instead of the error surface.
2008-08-13 22:02:00 +01:00
Chris Wilson
93af67d7fd [test] Pass a 'complete' name to create_surface().
Construct the test name to pass to the boilerplate creation routines such
that it uniquely identifies the test in terms of test, target, content and
pass (similar, offset, thread). This allows the vector targets to create
output different output files for each test, whereas before, later tests
would overwrite existing files making debugging more difficult.
2008-08-13 22:01:51 +01:00
Chris Wilson
517e532fb7 [test] Run fallback-resolution if we have at least one vector surface.
Currently fallback-resolution is included in the test suite if we have all
of the vector surfaces available. This commit enables individual support
for the vector surfaces, so that the test can be run even if one or more
of the surfaces are not available.
2008-08-13 22:01:39 +01:00
Chris Wilson
d56ea9cc87 [test] Set CAIRO_TEST_UNTESTED to 77
77 is the magic exit code used by automake to indicate a skipped test, so
by using it we can get a slightly more informative test log.
2008-08-13 21:55:19 +01:00
Chris Wilson
f85a4aec1f [test] Export a function to check whether a target is enabled.
Allow individuals tests to check whether a test target is enabled -
useful for those tests that circumvent cairo_test() and perform
feature testing.
2008-08-13 21:55:09 +01:00
Chris Wilson
436c0c8be2 [test] Preparatory work for running under memfault.
In order to run under memfault, the framework is first extended to handle
running concurrent tests - i.e. multi-threading. (Not that this is a
requirement for memfault, instead it shares a common goal of storing
per-test data).  To that end all the global data is moved into a per-test
context and the targets are adjusted to avoid overlap on shared, global
resources (such as output files and frame buffers). In order to preserve
the simplicity of the standard draw routines, the context is not passed
explicitly as a parameter to the routines, but is instead attached to the
cairo_t via the user_data.

For the masochist, to enable the tests to be run across multiple threads
simply set the environment variable CAIRO_TEST_NUM_THREADS to the desired
number.

In the long run, we can hope the need for memfault (runtime testing of
error paths) will be mitigated by static analysis. A promising candidate
for this task would appear to be http://hal.cs.berkeley.edu/cil/.
2008-08-13 21:54:59 +01:00
Chris Wilson
5ace0cb17a [cairo-test] Exclude lcd-filter tests for vector targets.
Add text-lcd-filter-* to vector_ignored_tests.
2008-08-11 20:43:14 +01:00
Behdad Esfahbod
b176b5c29d [test/get-xrender-format.c] Don't fail if DISPLAY is not set 2008-08-11 15:06:31 -04:00
Behdad Esfahbod
bbd5f03fd8 [test/xlib-surface-source] Skip test if DISPLAY not set 2008-08-11 14:28:28 -04:00
Behdad Esfahbod
549dd9adb5 [test] Update ref image list 2008-08-11 01:40:27 -04:00
Behdad Esfahbod
e797f6791e [test/Makefil.am] Cosmetic 2008-08-10 23:39:28 -04:00
Chris Wilson
322c3ef7f9 [.gitignore] Update list of tests 2008-08-08 10:09:55 +01:00
Chris Wilson
893b50a980 [test] Update reference image for leaky-dashed-rectangle.
Bah, it seems someone fixed the code and the error lay in discrepancies
with the antialiasing in the reference image.
2008-08-08 10:09:37 +01:00
Behdad Esfahbod
08e8a42ea1 [test/user-font] Fix comments 2008-08-08 03:01:18 -04:00
Behdad Esfahbod
597bfa922a [test/user-font] Document glyph-not-found situation 2008-08-08 03:01:17 -04:00
Behdad Esfahbod
d9408041aa Add cairo_scaled_font_text_to_glyphs()
And update user-font text_to_glyphs() method to match.

Currently disable the win32-font text_to_glyphs(), until that one
is updated.  Or better yet, remove it and implement ucs4_to_index().
It's the toy font API afterall.
2008-08-08 03:01:16 -04:00
Behdad Esfahbod
b01ad0835d [user-font] Add a cairo_t argument to cairo_user_scaled_font_init_func_t
The init func does not actually need to draw anything, but having a cairo_t
similar to that passed to render_glyph is handy for computing font extents.
This is because cairo makes doing some things really hard (if not impossible)
without a cairo_t.

The user-font-proxy test case is a great example of how the added cairo_t
makes life much easier.
2008-08-08 03:01:15 -04:00
Behdad Esfahbod
7e57892983 Add toy font constructor and getters
New public API:

	cairo_toy_font_face_create()
	cairo_toy_font_face_get_family()
	cairo_toy_font_face_get_slant()
	cairo_toy_font_face_get_weight()
2008-08-08 03:01:14 -04:00
Jeff Muizelaar
e8ddbd1a14 Add a test case showing the invariance of push/pop_group
This shows the regressions caused by
1a9809baab
2008-08-07 19:25:40 -04:00
Chris Wilson
ae7bdd7ee0 [valgrind] More suppressions for XrmGetStringDatabase().
Another variation in the callstack needs suppressing.
2008-08-07 08:29:14 +01:00
Behdad Esfahbod
1dc0f3a1ad [test/user-font] Document that Poppler is buggy with glyph 0 2008-08-06 12:00:28 -04:00
Sylvain Pasche
65d017a406 Add tests for the new LCD filter API 2008-08-05 16:30:37 -04:00
Jeff Muizelaar
3074ba02a1 Add a test for scaling a surface with device offset. 2008-07-21 22:08:46 -04:00