Commit graph

5881 commits

Author SHA1 Message Date
Chris Wilson
7357e80054 [clip] Limit traps.
Apply prior knowledge to limit the traps during clipping to avoid
generating extra work.
2008-09-24 11:45:26 +01:00
Chris Wilson
c36a242303 [traps] Replace open-coding of box->rectangle->box
Use the utility functions _cairo_box_from_rectangle and
_cairo_box_round_to_rectangle() instead of open-coding. Simultaneously
tweak the whitespace so that all users of traps look similar.
2008-09-24 11:45:13 +01:00
Chris Wilson
49b9a21e0b [test/any2ppm] Handle filenames with multiple-dots.
Use strrchr() to find the extension, as strchr() is fooled too easily.

As spotted by Carlos Garcia Campos.
2008-09-24 02:03:10 +01:00
Chris Wilson
651c6598c9 [traps] Limit extents to imposed constraints.
When reporting the extents of the traps, constrain them to the imposed
limits. This is relied upon in the analysis-surface which sets the
limits on the traps (based on clip/surface extents) and then reports the
extents of the traps as the region of the operation.
2008-09-24 01:02:48 +01:00
Behdad Esfahbod
0baf12f450 [scaled-font] Another typo fix in the comments
Both this and previous one kindly pointed out by Carl.
2008-09-23 19:18:00 -04:00
Behdad Esfahbod
70207aadfd [mutex] Fix typo in comments 2008-09-23 19:11:31 -04:00
Chris Wilson
0a4a6213e2 [fill] Check for the most common rectilinear case first.
Avoid the iterative search for the extreme points by first checking the
most likely arrangement (as produced by cairo_rectangle() under no
transformation).
2008-09-23 23:55:38 +01:00
Chris Wilson
8f51ea4657 [pattern] Beware unsigned wrap-around with pathological surface patterns.
A surface pattern under an extreme transformation could lie entirely in
the negative quadrant. This would trigger the fixup such that it's lower
left corner was clamped to the origin, but the upper right corner was left
unchecked. This could result in the width,height being negative and
wrapping around to large values instead of being clamped to 0.
2008-09-23 23:35:53 +01:00
Chris Wilson
3c6d3684e9 [test] Add a test case for create_similar(CONTENT_ALPHA)
Application of a pure-alpha similar source is inconsistently handled
across the backends. The PDF/PS backends allow the rgb channels to bleed
through and the SVG backend mixes in pure white.
2008-09-23 23:35:53 +01:00
Chris Wilson
5e54084126 [test-meta] Use real meta-surface snapshot.
The meta-surface workaround an old bug, which is no longer present in the
tree and open-coded the surface snapshot. However, the workaround itself
was buggy (not respecting the surface content). The lesson to take away
from this is not to add workarounds in test code for bugs in the library!
2008-09-23 23:35:53 +01:00
Behdad Esfahbod
03c37f56b2 [build] Use mkdir -p portability macros 2008-09-23 17:15:07 -04:00
Chris Wilson
ae0511fbbe [pdf] Do not modify the dashes in-place.
As PS has different semantics regarding a zero-length dash, we need to
adjust the dash array before emitting. However, we need to modify a copy
of the dash array since the same array may be used by the meta-surface
when replaying to an image fallback.
2008-09-23 20:08:38 +01:00
Chris Wilson
b7ab1fc791 Return the real error status for set_user_data()
Instead of returning a new NO_MEMORY error, return the status from the
error object.
2008-09-23 20:08:30 +01:00
Adrian Johnson
0204d2f4e2 Replace two boolean args with one enum arg
The use of multiple booleans in a function call can make it easy to
mix up the parameters.
2008-09-23 22:38:55 +09:30
Behdad Esfahbod
5a3f03623c [Makefile.win32] Add comments about where to edit for customization 2008-09-23 04:11:48 -04:00
Behdad Esfahbod
afb32c7f07 [src/Makefile.am.analysis] Fix out-of-tree build 2008-09-23 03:58:17 -04:00
Behdad Esfahbod
fba0211ed6 [Makefile.win32] Add makefile rules to generate cairo-features.h 2008-09-22 23:41:07 -04:00
Behdad Esfahbod
0bedbe78fe [Makefile.win32] Misc cleanup 2008-09-22 22:46:05 -04:00
Behdad Esfahbod
ebb5eb57b7 Generate build/Makefile.win32.features 2008-09-22 22:24:38 -04:00
Behdad Esfahbod
fd5cef50a7 [aclocal] Add support for automake-only or win32-only makefiles 2008-09-22 20:48:14 -04:00
Behdad Esfahbod
42e4103015 [aclocal] Don't do automake conditionals for builtin features 2008-09-22 20:33:23 -04:00
Behdad Esfahbod
79bc967a0d [build] Make including Makefile.win32.features files more robust
By using top_srcdir if available.  Make's include is relative to
current dir, not the Makefile being processed.  That makes it hard
to include Makefile's relatively.
2008-09-22 20:20:02 -04:00
Behdad Esfahbod
e686a00da8 [build] Add CAIRO_CONFIG_MAKEFILE_PRIVATE 2008-09-22 20:11:39 -04:00
Behdad Esfahbod
0ac7a242f8 [build] Add Makefile.win32.common 2008-09-22 20:11:38 -04:00
Behdad Esfahbod
984320dff1 [build] Don't define feature variables in Makefile.win32.features
This is not the right place to do that as one also needs to adjust
cairo-features.h.  Working on a proper fix.
2008-09-22 20:11:32 -04:00
Behdad Esfahbod
eb9ce58059 [build] Don't generate Makefile conditionals for default=always features 2008-09-22 19:23:41 -04:00
Behdad Esfahbod
caa3dbd61b [build] Make Makefile.*.features files more readable
By inserting a new line before each feature entry.
2008-09-22 19:15:05 -04:00
Behdad Esfahbod
23b9767bb3 Rename Makefile.*.config to Makefile.*.features as they should not be modified
The .config naming was giving people the impression that they can modify it.
That's not the case.
2008-09-22 17:34:36 -04:00
Kai-Uwe Behrmann
20be3182ef [svg] Counteract application of object matrix to mask.
The expected behaviour for masking in Cairo is to set the mask according
to the current active matrix and apply unchanged to the masked surface.

In SVG, the mask element is bound to the masked object and thus the local
matrix from that image object applies to the nested mask as well.

Attached is a small patch for substracting the matrix of a image
surface from the matrix of the mask to comply to Cairo's behaviour.
I did not test for other stuff like vectors or text and would expect this
part is incomplete.
2008-09-22 12:01:11 +01:00
Chris Wilson
223e7b9ed0 [test] Add an exercise for masking an image using the ctm.
Quote Kai-Uwe Behrmann:
"The expected behaviour for masking in Cairo is to set the mask according
to the current active matrix and apply unchanged to a to be masked
surface.

In SVG the mask element is bound to the masked object and thus the local
matrix from that image object applies to the nested mask as well."

This is a test case to exercise applying a mask to an image under
separate transformations.

Original patch by Kai-Uwe Behrmann, altered to run the test against all
backends (where it causes poppler to crash on my machine <evil grin>).
2008-09-22 09:55:15 +01:00
Behdad Esfahbod
3a45ff0e2f Make checks happy again
Minor syntax changes and improved check regexps.
2008-09-20 18:35:10 -04:00
Behdad Esfahbod
9084f6baf6 [Makefile.win32] Fix various issues reported by Damian Frank
We now compile cairo-system.c twice when building static library, but
that's fine because cairo-systemc. includes no other code.  Indeed
that's why cairo-system.c was born in the first place.
2008-09-20 18:26:27 -04:00
Behdad Esfahbod
45609d8400 Add cairo-system.c for platform system-specific code
This is where DLL initialization/finalization should be done for example.
Moved the one for win32.  For OS/2 just left a comment as the code needs
more work.

This change simplifies building shared and static libraries in the win32
makefiles.
2008-09-20 18:26:27 -04:00
Behdad Esfahbod
9c27323959 [aclocal] In generated Makefile.win32.config, don't overwrite feature vars
When I designed this first I thought people can define make vars on the
command line to override default features.  That works.  However, it's
natural to want to define the list of features in the toplevel Makefile
and not on command line.  So, we don't override user's var now.  They
can set a make feature var to 0 to disable it.
2008-09-20 18:26:19 -04:00
Behdad Esfahbod
6d0d5e7ba0 Define cairo_public correctly for win32
I'm conditioning on _MSC_VER.  Is this accurate?
Note that we never overwrite cairo_public.  So one can define it to
something else.
2008-09-20 17:52:19 -04:00
Behdad Esfahbod
11e96487d8 [Makefile.win32] Remove a few unused macro declarations
An undefined PACKAGE_BUGREPORT is not properly handled where it's used.
The other two were not being used after build system revamp.
2008-09-20 17:51:24 -04:00
Behdad Esfahbod
fee72c26af Make sure feature macros are checked using #if, not #ifdef; add a test for it
This is more robust to cases where people want to assign 0 to those variables.
(win32/alternate build systems, etc)
2008-09-20 17:20:36 -04:00
Behdad Esfahbod
e00565fa3c [src/check-includes.sh] Check that there is no #include <cairo.*.h>
The correct syntax to include cairo headers from other cairo headers and
sources is using "...", not <...>.  Check that.
2008-09-20 15:38:29 -04:00
Behdad Esfahbod
9c36a5f3f1 [src/Makefile.am.analysis] Check that all headers can be compiled standalone
This ensures that each header includes all headers it depends on.
This is now enforced by "make check".
2008-09-19 18:51:03 -04:00
Behdad Esfahbod
2dd90a6c94 [cairo-mutex] Move semicolons out of cairo-mutex-list-private.h
Previously cairo-mutex-list-private.h assumed that every use of the file
will produce a statement for each mutex by including a semicolon after
each.  But some uses (like enumerating all static mutexes  in an array
for example, can't be implemented with the semicolon in place.  So, move
the semicolon out to the users of the header file.
2008-09-19 18:45:44 -04:00
Behdad Esfahbod
8ae8189327 [configure.ac.warnings] Add -Wp,-D_FORTIFY_SOURCE=2 to warning flags
It enables various checks in glibc and gcc preprocessor.
2008-09-19 18:43:43 -04:00
Behdad Esfahbod
54b60dadb9 [Makefile.am.common] Remove gcc precompiled headers in "make clean"
Stale gcc precompiled headers can cause bugs very tricky to pin down.
2008-09-19 18:42:54 -04:00
Behdad Esfahbod
d84752605a Make sure (and check) that all private headers include some cairo header first
The macros CAIRO_BEGIN_DECLS and CAIRO_END_DECLS are declared in two
places: config.h and cairo.h.  On Win32 build there is no config.h.  So,
we can't rely on pulling CAIRO_BEGIN_DECLS from there.  Hence, we now:

  * Not add those declarations to config.h anymore,

  * Test that every cairo private header includes some other cairo
    header before any other includes.

These two are fairly enough to ensure that cairo.h is seen from all
private headers.  There's still the case of headers not including
any header file at all.  I'll fix that later.
2008-09-19 17:19:10 -04:00
Behdad Esfahbod
eb89bf049a Check for _MSC_VER in mutex implementation code
Previously I made the mutex implementation code to use Windows mutexes
conditional on HAVE_WINDOWS_H.  This was suppposed to be a more wine-friendly
version of checking for a Windows platform.  However, it also meant that
when compiling without config.h, one had to stuff a #define for HAVE_WINDOWS_H
somewhere.  Traditionally it was put in cairo-features-win32.h, and that
practice was carried over even after my build system rewrite.

Somewhere along the road I also decided that the mutex implementation header
does not need to include anything other than config.h.  So the hacked up
HAVE_WINDOWS_H in cairo-features-win32.h was not being seen by its lone
user.

We now condition on any of HAVE_WINDOWS_H and _MSC_VER.  So the hack can be
removed altogether.
2008-09-19 16:57:42 -04:00
Behdad Esfahbod
33b6d2b5eb [src/check-cairoint.sh] Escape dot in regexp
No why, just that it's more robust :).
2008-09-19 16:57:42 -04:00
Behdad Esfahbod
d635c941b2 [image] Check for PACKAGE_BUGREPORT availability
Building using win32, there is no config.h.  So PACKAGE_BUGREPORT may
not be defined.
2008-09-19 16:57:42 -04:00
Chris Wilson
a6c0ebee7a [tessellator] Only run sweep-line validator when debugging
The tessellator is well-proven now. However, the sweep-line validator
consumes around 50% of the total time required to draw the fractal
Pythagoras tree (the leaves are sub-pixel rectangles, so lots of edges
to sweep through). So disable the validator, but keep it available for
debugging.
2008-09-19 16:59:51 +01:00
Chris Wilson
91f0b8b1ea [fill] Construct trap using rectangle directly.
Avoid the overhead in sorting the edges within
_cairo_traps_tessellate_convex_quad() by using our prior knowledge that we
have a simple rectangle and construct the trap from the extreme points.
2008-09-19 16:59:51 +01:00
Chris Wilson
e749b58af8 [test] Add rectilinear-fill
Add a test-case to exercise pixel-aligned fills to verify the optimised
rectilinear filler.
2008-09-19 16:59:50 +01:00
Chris Wilson
d5cd7ee74f [stroke] Optimise rectilinear strokes.
Avoid the overhead of sorting the rectangle in
_cairo_traps_tessellate_convex_quad() by constructing the trap directly
from the line segment. This also has secondary effects in only passing
 the non-degenerate trap to _cairo_traps_add_trap().

For rectilinear Hilbert curves this makes the rectilinear stoker over 4x
faster.
2008-09-19 16:59:25 +01:00