Commit graph

6089 commits

Author SHA1 Message Date
Chris Wilson
336eddfdbb [test/get-clip] Check the status on the secondary context.
As we solely use a secondary context, we must manually report NO_MEMORY
errors whilst running under memfault.
2008-10-18 09:55:06 +01:00
Chris Wilson
d48f934051 [test/clip-operator] Propagate error from secondary context.
Use the cairo_get_target() to propagate any errors from the secondary
context.
2008-10-17 22:52:47 +01:00
Chris Wilson
d11014386f Add support for lockdep.
lockdep is a valgrind skin which performs pthread locking correctness
validation. In particular it allows one to write assert(HOLDS_LOCK(mutex))
which both documents the preconditions for a function and enforces them
when the program is run under lockdep.

As an aide to lockdep (as it works by intercepting the pthread functions),
all the mutexes should be initialised and destroyed using
pthread_mutex_init() and pthread_mutex_destroy() rather than using static
initializers and no-ops.
2008-10-17 22:52:47 +01:00
Chris Wilson
bccfdf7d93 [test] Add support for memfault.
Add the core support to cairo-test for running the test-suite under a
malloc fault injector. This commit contains the adjustments to
cairo_test_run() to repeat the test if it detects a failure due to fault
injection and complains if it detects unreported faults or memory leaks.
2008-10-17 22:52:47 +01:00
Chris Wilson
974fabfe05 [ft] Add more comments about FT_Face lifetime issues.
Currently we only have an example of how to call FT_Done after the last
reference to the FT cairo_font_face_t has been dropped, but do not
actually explain why this needs to be done. So add a couple of sentences
to clarify the likely lifetime of the FT_Face once exposed to cairo.
2008-10-17 22:52:47 +01:00
Chris Wilson
5fcfc7ebc9 [test/README] Document all fonts used.
Do a little leg-work to answer a query in a bug report and document the
results.
2008-10-17 10:38:55 +01:00
Chris Wilson
c1164a574d [type1] Add comment to warn about read() as macro.
In case we are ever tempted to simplify the function pointer, warn that it
may alias with a macro.
2008-10-16 17:19:00 +01:00
Adrian Johnson
ff9ee74b37 Revert unintended changes to test/fallback-resolution.c in the previous commit 2008-10-16 17:29:33 +10:30
Adrian Johnson
5911c6966d Use correct inverse ctm for stroke in meta surface replay
This fixes #9189 Dashed strokes too long in fallback images
2008-10-16 17:22:48 +10:30
Chris Wilson
6afcd82118 [test] Add a spline test.
Test the decomposition of 5 different types of spline curve. Useful test
for future experiments in improving the decomposition algorithm.

Note: the vector targets all need separate reference images due to their
lack of support for cairo_set_tolerance(). Also GS strokes the Bezier
curve differently using offset curves and opposed to transcribing the
outline of a pen.
2008-10-15 23:27:11 +01:00
Chris Wilson
91b0dc92c8 [build] Add -fno-common.
Generate a warning if two files define a global variable with the same
name, instead of silently merging them to reference the same location.
2008-10-15 23:12:22 +01:00
Jeff Muizelaar
b94b600b34 [quartz] Completely remove CAIRO_HAS_QUARTZ_IMAGE_SURFACE check
Instead of fixing the check in d36b02dc66, just
remove it. Conditionally compilation will keep cairo-quartz-image-surface.c
from being compiled in when it is not configured to be. Suggested by Behdad.
2008-10-15 13:41:03 -04:00
Jeff Muizelaar
d36b02dc66 [quartz] Rebalance 'CAIRO_HAS_QUARTZ_IMAGE_SURFACE' #ifdef
Fixes compilation by re-adding '#ifdef CAIRO_HAS_QUARTZ_IMAGE_SURFACE' which
was, I assume, unintentionally removed by
2cf4b3161c.
2008-10-15 12:45:11 -04:00
Jeff Muizelaar
83162360a4 Fix quratz_image typo in Makefile.sources. 2008-10-15 10:34:12 -04:00
Chris Wilson
877e77fa3e [glitz] Disable caching of solid surfaces.
glitz currently has no mechanism to release resources upon connection
closure (ala XCloseDisplay) and so will attempt invalid accesses when
evicting old surfaces from the solid pattern cache.
2008-10-15 12:20:00 +01:00
Chris Wilson
fc04a1e0db [boilerplate] Fixup compilation for gliitz.
Convert a few old references to cairo_boilerplate_surface_set_user_data.
2008-10-15 12:13:40 +01:00
Chris Wilson
e17f02add0 [type1] Protect against read macro
POSIX allows for any of its functions to be implemented as a macro,
inflicting damage upon innocent function pointers that happen to share
the same name.

face->stream->read() is one such example.

As it's outside of our control (being a FT_Face) we cannot simply rename
the data member, so we need to explicitly dereference it as a function
pointer in order to disambiguate it for the compiler.
2008-10-15 10:52:33 +01:00
Chris Wilson
bc872a5f5f [xlib] Handle 4,20,24,28 depth XImages
Bug 9102 cairo doesn't support 24 bits per pixel mode on X11
(https://bugs.freedesktop.org/show_bug.cgi?id=9102)
is a reminder that that we need to support many obscure XImage formats.
With Carl's and Behdad's work to support psuedocolor we have a mechanism
in place to handle any format that is not natively handled by pixman. The
only piece we were missing was extending the swapper to handle all-known
formats and putting in defensive checks that pixels were correctly aligned
in accordance with pixman's requirements.
2008-10-15 10:21:05 +01:00
Chris Wilson
1728fa3520 [svg] Add notes about why we shouldn't add DOCTYPE.
Emmanuel Pacaud did some research into adding DOCTYPE after we had a
complaint that our SVG output failed to be validated by batik. The
conclusion he came to was that the validation of SVG was incomplete and
misleading, i.e. our output might generate false negatives leading to more
confusion.
2008-10-15 09:23:01 +01:00
Chris Wilson
e9f5ee6efe [doc] Fix a few gtk-doc errors.
gtk-doc insists on a non-empty long description, even for trivial
functions that are fully described by their input arguments and return
value. Grrr.
2008-10-14 14:42:48 +01:00
Chris Wilson
595414bb78 [test/fallback-resolution] Extend to cover separate ppi x/y.
Adrian Johnson proposed a hack that fixed the current test by simply
scaling the dashed stroke by device_transform.xx. Obviously this exposes a
deficiency in the test case. So add an outer loop to iterate over several
common ppi for both x and y and in doing so reveal more ugly artifacts in
the current fallback code.
2008-10-14 14:24:49 +01:00
Chris Wilson
0d3e152d2f [check-doc-syntax.sh] Allow quoting.
func_regexp was incorrectly complaining that cairo_pure was a function without
parenthesis. The simplest solution appeared to be allow quoting of
'cairo_pure'.
2008-10-14 13:44:47 +01:00
Chris Wilson
02a7ca80f9 [pattern] Correctly optimize away fractional translations.
As is so often the case, reading the commit log gives you fresh insight in
the problem - often called confessional debugging...

We can simplify the problem by ignoring attr->[xy]_offset, for the time
being, and focus on computing the correct matrix. This is comparatively
simple as all we need to do is perform the appropriate rounding on the
translation vector.
2008-10-14 11:08:43 +01:00
Chris Wilson
9886cb3353 [pattern] Only perform non-integer optimization for identity matrices.
A complication I realised after pushing 3eb4bc3 was handling larger
sampled areas.  Extending the test case revealed that the optimization
was broken for anything but the identity transform (after removing the
translation).  Correctness first, leaving the "pixel-exact" solution for
interested reader...
2008-10-14 10:27:21 +01:00
Chris Wilson
8dc3deecb8 Add documentation for function attributes 'pure' and 'const'.
Carl suggested that cairo_pure and cairo_const are pretty opaque, even to
the developer who added them, so it is extremely important that they have
a good description so that they are used correctly and perhaps ported to
other compilers.
2008-10-14 08:17:23 +01:00
Chris Wilson
6aa1143d5a Update documentation to remove references to cairo_has_show_text_glyphs().
With the addition of cairo_show_text_glyphs() came a couple of functions
to query whether the target supported the extended attributes. However,
at Carl's request cairo_has_show_text_glyphs() was removed - but the
documentation was not updated to reflect that.
2008-10-13 23:49:17 +01:00
Chris Wilson
b2053945df [scaled-font] Correct documentation for cairo_scaled_font_create().
Fix the documentation not to suggest that NULL is a legal value for
font_options (as we temporarily made it during the 1.[57] dev cycle).
2008-10-13 23:39:47 +01:00
Chris Wilson
3eb4bc3757 [pattern] Optimize away fractional translation for NEAREST patterns.
As identified in bug 15479,
  Unpredictable performance of cairo-xlib with non-integer translations of a
  source surface pattern
  (https://bugs.freedesktop.org/show_bug.cgi?id=15479),
source surfaces with a fractional translation hit slow paths for some
drivers, causing seemingly random performance variations. As a work-around
Owen Taylor proposed that cairo could convert non-integer translations on
NEAREST sources patterns to their integer equivalents.

The messy detail involved here is replicating the rounding mode used by
pixman for the sample offset, but otherwise the conversion is fairly
trivial.
2008-10-13 23:34:51 +01:00
Chris Wilson
ceab32e2c3 [win32] win32 also uses font subsets.
Include win32 in the list of font subset users, fixes build when
cross-compiling.
2008-10-12 12:11:12 +01:00
Chris Wilson
1d3453eee5 [pattern] Rescale the linear pattern matrix to avoid overflow.
As proof-of-principle, compute a scale factor to avoid overflow when
converting a linear pattern to pixman_fixed_t. Fixes test/huge-pattern,
but the principle should be extended to handle more cases of overflow.
2008-10-12 11:38:42 +01:00
Chris Wilson
ab1d106cba [xlib] Use the cached xrender formats.
Use the cached formats for consistency and simplify several double pointer
dereferences.
2008-10-11 19:52:28 +01:00
Chris Wilson
6736faba3e [test/any2ppm] Do not attempt to compile PS without spectre
Since CAN_TEST_PS_SURFACE does not currently require spectre, we were
attempting to compile in spectre support for any2ppm even on systems
without libspectre installed. Fix that by adding a separate flag for
CAIRO_HAS_SPECTRE.
2008-10-11 19:01:43 +01:00
Benjamin Otte
b358711162 [test] Add huge pattern.
Add a test case to exercise range overflow during gradient construction.
2008-10-11 18:12:29 +01:00
Chris Wilson
7707027081 [test] Use _POSIX_C_SOURCE for flockfile.
From bug 18010 (https://bugs.freedesktop.org/show_bug.cgi?id=18010),
in order to make flockfile() available we need to set _POSIX_C_SOURCE and
according to the man page, the appropriate feature check is
_POSIX_THREAD_SAFE_FUNCTIONS.
2008-10-11 18:12:28 +01:00
Adrian Johnson
34ff7e4ac4 Check that reads in truetype_reverse_cmap are within valid data
Bulia Byak reported a bug where cairo was crashing with a particular
font. The font had an incorrect entry in the cmap table that caused
cairo to read from outside of the buffer allocated for the cmap.
2008-10-11 23:44:37 +10:30
Chris Wilson
a16ef6ead2 [INSTALL] Mention pkg-config requirement
Mention that building the configure script requires at least version 0.16
of pkg-config.

See the old bug:
  Bug 4702 PKG_PROG_PKG_CONFIG: command not found
  (https://bugs.freedesktop.org/show_bug.cgi?id=4702)
2008-10-10 18:03:49 +01:00
Chris Wilson
eba9d87d54 [image] Warn about a potential NULL return after finish().
Improve the wording as suggested by
  https://bugs.freedesktop.org/show_bug.cgi?id=12659
to warn about the possibility of returning NULL even if the passed in
surface was an image surface.
2008-10-10 16:51:07 +01:00
Chris Wilson
ac3e4b4bea [xlib] Disable XRender support if the surface has no xrender_format
Bug 11734:
  XRender crashes due to NULL pointer from Cairo on SGI O2
  (https://bugs.freedesktop.org/show_bug.cgi?id=1173)
is an example of a case where we try to perform an XRender operation on a
surface with a format that was not supported by the XRender extension. By
marking the extension version as -1 on those surfaces, the current checks
for SURFACE_RENDER_HAS_* always correctly return false and prevent us try
to create a Picture with a NULL xrender_format.
2008-10-10 15:42:09 +01:00
Carlos Garcia Campos
8ac8e8c523 [test] Add ps2png check program using libspectre
Add a simple program to compliment pdf2png and svg2png.
2008-10-09 12:25:08 +01:00
Carlos Garcia Campos
3e6afb353d [test/any2ppm] Enable PS conversion using libspectre.
Complete the vector trilogy using libspectre to provide a similar
interface (to poppler and librsvg) around GhostScript.
2008-10-09 12:25:08 +01:00
Chris Wilson
ddd1615a17 [pattern] Remove incorrect assert.
It's possible to reach that point without setting the filter to NEAREST,
for example if using FAST or GAUSSIAN.
2008-10-09 12:25:07 +01:00
Benjamin Otte
c647c0bbca [TEST] make imagediff work again
It seems to have bitrotten
2008-10-09 13:22:01 +02:00
Björn Lindqvist
f644d78dc1 [perf] Add composite performance test.
Add a new test case to Cairo for checking the performance of Cairo's
equivalent to GDK's gdk_pixbuf_composite_color() operation. That is an
operation that happens to be extremely useful when viewing or editing
transparent images so I think it is important that it is as fast as
possible.
2008-10-08 20:10:27 +01:00
Chris Wilson
96b083d3f0 [test] Exercise degenerate dashes.
Add a test case to capture the current behaviour when a segment ends on
an off/on dash transition.

Originally filed as bug:
  Miter artifacts for dashed strokes
  https://bugs.freedesktop.org/show_bug.cgi?id=17973
2008-10-08 19:04:42 +01:00
Chris Wilson
6487a147a2 [cairo.h] Be defensive when checking for _MSC_VER
Since cairo.h is a public header file, we need to be careful so that it
can be compiled by random compilers and even users specifying "-Werror
-Wundef" (mentioning no names, Company). So replace the bare (and legal)
  #if _MSC_VER
with
  #if defined (_MSC_VER)
just in case.
2008-10-08 15:26:03 +01:00
Chris Wilson
59141e56a7 [win32] Restore fine-grained fallback support for printing.
Missed updating win32 when implementing the new paginated API to query
support for the fine-grained fallbacks.

(Thanks to Adrian for spotting this oversight.)
2008-10-08 13:51:43 +01:00
Chris Wilson
565c02a37e [svg] Use finer-grained fallbacks for SVG 1.2
The use of fine-grained fallbacks requires the native support of the
SOURCE operator applied to an image on the target surface. SVG 1.2
introduces the "comp-op:src" mode fulfilling this criteria - so we can
enable fine-grained fallbacks for 1.2+.

Update test/fine-grained-fallbacks to exercise this pathway in SVG 1.2 -
as SVG natively supported all the current operations within that test.
This reveals yet another librsvg bug in handling SVG 1.2.
2008-10-08 12:43:35 +01:00
Vladimir Vukicevic
0c777a3e0d [win32] Use wide-char versions of some API functions, for compat with Windows Mobile 2008-10-07 15:20:33 -07:00
Chris Wilson
cf572b58e1 [tessellator] Compile fixes for !HAVE_INT64_T
Fixup a couple of instances of implicit down-casting to 32bits from a
64bit wide integer and add a new is_zero() predicate.
2008-10-07 22:16:26 +01:00
Chris Wilson
6b8c055962 [tessellator] Avoid implicit promotion to 64bit integer.
Avoid passing a 32bit integer as a cairo_int64_t in case we do not have a
64bit native integral type. As a side-effect this means we can also use a
narrower multiply.
2008-10-07 22:16:07 +01:00