Commit graph

6819 commits

Author SHA1 Message Date
Chris Wilson
dc176d88ac [test] Trivial leak on error in show-glyphs-many.
Free the allocated glyph array after failure.
2009-03-18 09:44:33 +00:00
Chris Wilson
a4b44ca89e [pattern] Report the true error status from getters.
As the getters actually return an error status, use it to report any
pre-existing error status on the pattern.
2009-03-18 09:44:33 +00:00
Behdad Esfahbod
496bbcf582 Make CAIRO_STATUS_LAST_STATUS public 2009-03-17 19:46:25 -04:00
Behdad Esfahbod
922c108365 [twin] Reorganize matching code to better reflect the code in Pango
Makes it easier to update later.
2009-03-17 19:22:31 -04:00
Behdad Esfahbod
2b4044a36f [twin] Update parsed weights and stretches from Pango 2009-03-17 18:52:16 -04:00
Behdad Esfahbod
3ec94f9b59 Support compiling without fontconfig
Adds a new, fake, fontconfig font backend.  Fontconfig can be disabled
using --disable-fc, in which case the toy text API wont find fonts and
the internal font will always be used.

Also defines the feature macro CAIRO_HAS_FC_FONT.  The two fontconfig-specific
functions in cairo-ft.h depend on that macro now.
2009-03-17 00:58:40 -04:00
Chris Wilson
0e7bcb5e37 [scaled-font] Improve comments.
Grr. I thought I had merged this in with the previous commit...
2009-03-16 21:32:44 +00:00
Chris Wilson
9c80392ac4 [scaled-font] Lean and mean global glyph cache.
Jeff Muizelaar pointed out that the severe overallocation implicit in the
current version of the glyph cache is obnoxious and prevents him from
accepting the trunk into Mozilla. Jeff captured a trace of scaled font
and glyph usage during a tp run and presented his analysis in
http://lists.cairographics.org/archives/cairo/2009-March/016706.html

Using that data, the design was changed to allocate pages of glyphs from a
capped global pool but with per-font hash tables. This should allow the
glyph cache to have tight memory bounds with fair allocation according to
usage. Note that both the old design and the 1.8 glyph cache had
essentially unbounded memory constraints, since each scaled font could
cache up to 256 glyphs (1.8) or had a reserved page (old), with no limit
on the number of active fonts. Currently the eviction policy is a simple
random strategy, this gives a 'fair' allotment of the cache, but a LRU
variant might perform better.

On a sample run of firefox-3.0.7 perusing BBC news in 32 languages:
1.8:  cache allocation 8190x, ~1.2 MiB; elapsed 88.2s
old:  cache allocation 771x, ~13.8 MiB; elapsed 81.7s
lean: cache allocation 433x,  ~1.8 MiB; elapsed 82.4s
2009-03-16 20:51:50 +00:00
Chris Wilson
121d4bb656 [scaled-font] Initialise original_font_face
Eek, attempting to use+free an uninitialised pointer!
2009-03-16 19:53:49 +00:00
Chris Wilson
9099c7e730 [trace] Disable mark dirty tracing.
Applications like firefox have a very conservative approach and mark
surfaces dirty before every render. As we record the image data every
time, firefox traces can grow very large with redundant data - so allow
the user to disable mark dirty tracing.
2009-03-04 09:26:17 +00:00
Jeff Muizelaar
addeb32c75 [pdf] Intialize 'interpolate'
Intialize 'interpolate' to prevent a gcc warning. Do this instead of adding a
'default' case to the switch statement so that we still get warnings if new
filter types are added.
2009-03-03 12:20:47 -05:00
Chris Wilson
a8158d443e [truetype] Move the sizeof asserts to compile time.
Eliminate the need for a runtime test on the sizeof the private structures
by performing the check at compile time. This was provoked by Ginn Chenn
noting that the test was including a private header.
2009-03-03 11:21:35 +00:00
Ginn Chen
e4b1f871e9 [configure] Detect mkdir variant with non-gcc compilers.
It doesn't work for non GCC compiler right now, as "-Werror -Wall" is
an error to non GCC compiler.

I swapped the sequence of build/configure.ac.system and build/
configure.ac.warnings, then WARN_CFLAGS can be used.
2009-03-03 10:27:44 +00:00
Chris Wilson
f178f55e47 [test/any2ppm] Update the cairo-script-interpreter callback.
Reflect the current prototype which now specifies the content to use when
creating the surface.
2009-03-03 10:25:05 +00:00
Chris Wilson
694f2eea9f [test/any2ppm] Add feature checks for daemon()
Add the feature checks for the presence of the daemon() function call.
2009-03-03 10:24:25 +00:00
Chris Wilson
9304984f4e [path] Fix regression introduced with 005436
The order of the multiplication of the CTM and device_transform was
reversed.
2009-03-01 10:10:24 +00:00
Chris Wilson
b30de64a8c [test] Add regression test for 005436
Jeff Muizelaar found a regression in commit 005436 and submitted this
little test to exercise it. The essence of the bug appears to be wrt to
the product of the CTM and device transform matrices.
2009-03-01 10:10:13 +00:00
Chris Wilson
e20f1a0c76 [in-fill] Close the path, cf fill()
In order for in-fill treat the path equivalently to a fill, we need to
close the path after interpretation.
2009-02-27 16:37:20 +00:00
Jeff Muizelaar
102ddd37bb [win32] Include $(OPT) flags when linking cairo.dll
This will pass in -Zi which causes the /DEBUG flag to be passed to the
linker keeping the debug information from being discarded during link.
2009-02-26 16:04:49 -05:00
Chris Wilson
eb2a73ba6d [ps] Check the status of _cairo_type3_glyph_surface_create()
Doing so serves two purposes. The first is to do an early error check and
the second is to clearly initialise the status variable.
2009-02-24 20:27:36 +00:00
Chris Wilson
6eb0a9d97f [scaled-font] Hold reference to original font face
As noted by Carl during his LCA talk, caching of toy fonts was broken
because we create the scaled font using the implementation font face and
lose the reference to the containing font face that is cached by the toy
font face create routines. So the toy fonts were not being preserved for
the duration of the holdover scaled fonts and we recreated a new font
face, new scaled font and new glyph caches every time we needed a font.
2009-02-24 20:00:17 +00:00
Jeff Muizelaar
fe7d5323f5 Relanding: Add CAIRO_ENSURE_UNIQUE macro and use it in _cairo_error()
When using MSVC, _cairo_error() can be folded into other identical functions.
If that happens, _cairo_error isn't really useful anymore. Using the
CAIRO_ENSURE_UNIQUE macro makes sure this doesn't happen.

Use __asm to serve as a line delimiter. This allows us to use the
__asm{} block in a macro.
2009-02-19 16:00:17 -05:00
Jeff Muizelaar
78de0e045e Revert "Add CAIRO_ENSURE_UNIQUE macro and use it in _cairo_error()"
This reverts commit 126824f5e6.

It turns out MSVC doesn't handle line continuation characters in __asm{}
blocks very well, so revert for now until I come up with something that
works.
2009-02-19 15:45:11 -05:00
Jeff Muizelaar
126824f5e6 Add CAIRO_ENSURE_UNIQUE macro and use it in _cairo_error()
When using MSVC, _cairo_error() can be folded into other identical functions. If
that happens, _cairo_error isn't really useful anymore. Using the
CAIRO_ENSURE_UNIQUE macro makes sure this doesn't happen.
2009-02-19 13:31:55 -05:00
Jeff Muizelaar
d4227fc912 [test] Fix assert on default font family in toy-font-face
toy-font-face was checking that cairo_toy_font_face_get_family returned ""
which is CAIRO_FONT_FAMILY_DEFAULT when the freetype font backend is the
default. However, when other font backends are the default the returned family
is different. Therefore, instead of checking for "", we check for the appropriate
string depending on the backend.
2009-02-19 11:45:33 -05:00
Jeff Muizelaar
06fa7a8386 Fix a const warning in _cairo_user_data_array_foreach()
_cairo_user_data_array_foreach() was taking a function
with a void *key parameter instead of a const void *key
to match cairo_user_data_slot_t.
2009-02-18 18:43:29 -05:00
Jeff Muizelaar
f7b3c9df58 Add test/Makefile.sources
This lets test/Makefile.am and test/Makefile.win32 share a common list of sources.
It also makes test/Makefile.win32 useful again.
2009-02-16 22:28:32 -05:00
M Joonas Pihlaja
e380beae53 [sdl] Remove new backend.
The SDL backend makes invalid assumptions about SDL_Surface locking
semantics and doesn't deal correctly with the unpremultiplied pixel
format supported by SDL.  Removed as per discussion on the mailing list.

http://lists.cairographics.org/archives/cairo/2009-February/016595.html
2009-02-16 14:01:43 +02:00
Søren Sandmann Pedersen
79a72e6358 Delete _cairo_region_boxes_fini() 2009-02-16 05:44:15 -05:00
Søren Sandmann
f6daa664c1 Delete _cairo_region_get_boxes() in favor of _cairo_region_get_box()
The _cairo_region_get_boxes() interface was difficult to use and often
caused unnecessary memory allocation. With _cairo_region_get_box() it
is possible to access the boxes of a region without allocating a big
temporary array.
2009-02-15 18:57:31 -05:00
Søren Sandmann Pedersen
fcb13d262c Simplify region handling in xlib surface 2009-02-15 15:59:10 -05:00
Jeff Muizelaar
b43e7aee98 [wince] We don't need cairo_win32_tmpfile on Windows CE
_cairo_win32_tmpfile() uses _open_osfhandle() which is not available
on Windows CE. However, Windows CE doesn't have the permisions problems
that necessitated _cairo_win32_tmpfile() in the first place so we can just
use tmpfile() on Windows CE.
2009-02-13 12:15:23 -05:00
Chris Wilson
fa66291c88 [perf] Test non-antialiased fill.
Just because the i915 can special case such fills using a single-pass
tessellation in the stencil buffer.
2009-02-13 14:13:32 +00:00
Chris Wilson
aab9ed3432 [perf] Env variable to ignore similar targets whilst benchmarking.
Use CAIRO_TEST_IGNORE_SIMILAR to skip similar targets.
2009-02-13 14:13:25 +00:00
Chris Wilson
655f698733 [perf] Split can_run? into a separate precondition.
Allow tests to skip unnecessary setup when pruning the list of perf cases.
2009-02-13 13:26:53 +00:00
Chris Wilson
798581a1b5 [perf] Extend range of testing.
Primarily to test longer glyph runs, but also test large upper bounds for
strokes and fills.
2009-02-13 13:26:53 +00:00
Chris Wilson
1522fac5c7 [perf] Fix infinite loop in text
The row would wrap-around with the character index, causing an infinite
loop when trying to fill a window of size 512x512 and above.
2009-02-13 13:26:52 +00:00
Chris Wilson
187e347351 [test] Free ref_name in fallback-resolution.
Trivial leak of a few thousand bytes.
2009-02-13 13:26:52 +00:00
Chris Wilson
005436758c [path] Inline path ops during append_to_context()
By inlining the operations, and most significantly, precomputing the
combined user-to-backend matrix, we can achieve a speed up of over 50%,
which is a noticeable performance boost in swfdec - where append-to-path
accounts for over 35% [inclusive] of the time for a h/w accelerated
backend.
2009-02-13 13:26:52 +00:00
Chris Wilson
d295942b9d Inline _cairo_restrict_value()
This is one instance where the function call overhead dominated the
function call in both time and size.
2009-02-13 13:26:52 +00:00
Chris Wilson
cc8a09567c [surface] Move the meta-data copy-on-snapshot to the generic layer.
As pointed out by Paolo Bonzini, copying the meta data for a snapshot is
common for all backends and so should be handled by the generic layer.
2009-02-13 13:26:52 +00:00
Chris Wilson
adaf70a93f [surface] Separate the mime-data from the user-data.
Move the mime-data into its own array so that it cannot be confused with
user-data and we do not need to hard-code the copy list during
snapshotting. The copy-on-snapshotting code becomes far simpler and will
accommodate all future mime-types.

Keeping mime-data separate from user-data is important due to the
principle of least surprise - the API is different and so it would be
surprising if you queried for user-data and were returned an opaque
mime-data pointer, and vice versa. (Note this should have been prevented
by using interned strings, but conceptually it is cleaner to make the
separation.) Also it aides in trimming the user data arrays which are
linearly searched.

Based on the original patch by Adrian Johnson:
http://cgit.freedesktop.org/~ajohnson/cairo/commit/?h=metadata&id=37e607cc777523ad12a2d214708d79ecbca5b380
2009-02-13 13:08:24 +00:00
Chris Wilson
2280de9d02 Merge branch '1.8' 2009-02-13 10:08:21 +00:00
Chris Wilson
de7270cb1e [cairo] Describe the restrictions upon cairo_set_tolerance()
Truc Troung reported that the behaviour of
cairo_set_tolerance()/cairo_get_tolerance() was inconsistent with the
documentation, i.e. we failed to mention that the tolerance would be
restricted to the smalled fixed-point value.

Add a sentence to the documentation that describes the restriction without
mentioning what that is... Hopefully that is sufficient detail to
accommodate the reporter, without exposing internal implementation details.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=20095
Bug 20095 - The cairo_set_tolerance() function behavior is inconsistency
with the spec
2009-02-13 10:07:37 +00:00
Chris Wilson
17ce8584e7 [NEWS] Add API changes.
Scan the public headers for obvious additions.
2009-02-12 18:27:52 +00:00
Chris Wilson
2df611a381 [script] Expose a normal xlib window for replay
Provide a visible surface for replaying scripts against.
2009-02-12 18:27:51 +00:00
Jeff Muizelaar
8e1f103540 Divert pclose to _pclose for MSVC
Commit bf62798b12 added a diversion for
popen but not for pclose. This is needed for linking the boilerplate
with the test suite.
2009-02-12 12:02:17 -05:00
Chris Wilson
38a1061bbc Merge branch '1.8' 2009-02-12 10:46:29 +00:00
Chris Wilson
e7d4bc3d86 [png] Correct documentation to avoid reference to NULL
As pointed out by Truc Truong,
cairo_image_surface_create_from_png_stream() cannot return NULL and so the
documentation was incorrect.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=20075
Bug 20075 There is a misprint in the spec for
cairo_image_surface_create_from_png_stream() function
2009-02-12 10:42:24 +00:00
Søren Sandmann
b3e2433f1e Correct the reference image for the rotate-image-surface-paint test 2009-02-11 17:55:15 -05:00