Commit graph

6778 commits

Author SHA1 Message Date
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
Jeff Muizelaar
41cbd935f9 [test] Add cairo_test_NaN and use it in place of strtod
strtod("NaN") returns 0.0 with the MSVC runtime so we
need to generate NaN some other way.
2009-02-11 15:24:24 -05:00
Jeff Muizelaar
70297f257d [test] Add crtdbg.h include
crtdbg.h is required for _CrtSetReportMode() and _CrtSetReportFile().
2009-02-10 17:58:28 -05:00
Jeff Muizelaar
b9f0c4b252 Use _cairo_round() instead of round()
MSVC doesn't have round() and the code probably wants
to round in the same direction regardless of whether
the values are negative or positive.
2009-02-10 17:57:00 -05:00
Jeff Muizelaar
dffdbd8515 Add _cairo_round()
_cairo_round() has the same behaviour as _cairo_lround() except
it returns a double instead of an integer.
2009-02-10 17:53:39 -05:00
Jeff Muizelaar
41e46c7754 [test] Don't embed preprocessor directives inside macros
MSVC can't handle this. GCC will warn with -pedantic, but I'm not
sure we want to enable that.
2009-02-10 11:44:20 -05:00
Jeff Muizelaar
fe40d3bdb0 [test] Allocate glyph array with malloc
Keeping it on the stack causes a stack overflow of Window's
default 1mb stack.
2009-02-09 23:43:04 -05:00
Jeff Muizelaar
50f8c2e4f3 [test] define isnan() on MSVC
Needed for user-font-rescale.c
2009-02-09 23:39:38 -05:00
Jeff Muizelaar
dd9fc47418 Remove zero size data array for compilation with MSVC
MSVC doesn't support zero sized arrays very well. For example, zero
sized arrays in arrays.
2009-02-10 01:58:15 +02:00
Jeff Muizelaar
a6c8f18a39 [test] Avoid C99 designated initializers
MSVC doesn't support these so we shouldn't use them.
2009-02-09 15:59:01 -05:00
Jeff Muizelaar
3d2fcec948 [test] Define INFINITY on MSVC
1./0. produces a compiler error on MSVC so we'll use HUGEVAL instead.
2009-02-09 15:12:41 -05:00
Behdad Esfahbod
c22ca79863 Don't distribute cairo-features.h (#19992)
Second time I fix this bug.  Mabe we should add a test for it!
2009-02-06 12:56:48 -05:00
Behdad Esfahbod
a55655a82d [test] Fix "make dist" 2009-02-06 12:47:51 -05:00
Jeff Muizelaar
af5ca7249f [test] Fix the definition of INFINITY
In my defence, even with INFINITY as 0, I was seeing new asserts on win32.
Caught by Jeremy Lea.
2009-02-05 16:46:50 -05:00
Jeff Muizelaar
83ec4b16b7 Elaborate the meaning of arithmetic rounding as done by _cairo_lround() 2009-02-04 14:04:05 -05:00
Jeff Muizelaar
2676b3bdd6 [test] Define INFINITY if it hasn't been defined.
This lets us use more of invalid-matrix on win32
2009-02-03 14:18:44 -05:00
Chris Wilson
6b0c2c8ba6 [directfb] Don't access the scaled_font->glyphs cache directly
Not only does it no longer exist, but doing so bypassed the locking
mechanisms and sanity checks!

Spotted by Lance Hepler.
2009-02-02 09:14:15 +00:00
Behdad Esfahbod
d63c1ab3ff [util/malloc-stats] Do a single backtrace_symbols() call
I was hoping that this may speed things up, but it didn't.  :(
2009-01-31 22:10:57 -05:00
Behdad Esfahbod
64d1c75870 [util] Fix memset bug in malloc-stats 2009-01-31 21:34:46 -05:00
Behdad Esfahbod
b02aeb367d [util] Don't link backtrace-symbols into malloc-stats
On my rawhide machine, seems like the glibc backgrace-symbols is now as
good as our private backtrace-symbols.
2009-01-31 21:33:42 -05:00
Chris Wilson
7375f4c76b Trivial warning fixes.
Cleanup a few compiler warnings about unused variables and mismatching
pointer types.
2009-01-30 21:54:56 +00:00
Chris Wilson
f10eaadf89 Revert "[png] Complete the idempotent read_png() -> write_png()"
This reverts commit 564d64a132.

In hindsight, and with further discussion with Jeff Muizelaar, this
behaviour of using the stored contents from the mime-data is completely
the opposite of the users' expectations. When the user calls
cairo_surface_write_to_png(), usually in the course of debugging their
rendering code, they expect the precise contents of the surface to be
saved.
2009-01-30 21:50:24 +00:00
Chris Wilson
dd11d905a5 [util] Use a hash-table for malloc-stats.
At Behdad's request, convert the array of allocators into a simple hash
table (large static number of buckets + chaining) in order to speed up
malloc profiling.
2009-01-30 10:18:15 +00:00
Chris Wilson
322fb00066 [test] Compile again without memfault.
Hide the valgrind macro when not using memfault.
2009-01-29 22:15:21 +00:00
Chris Wilson
5e6d25e204 [skiplist] Provide an initial stack allocated pool.
Since we only need to allocate elts for intersection events and edges, the
number of elts in flight at any one time is actually quite small and can
usually be accommodated from an embedded pool.
2009-01-29 16:47:53 +00:00
Chris Wilson
dd4276c661 [stroker] Rectilinear dashing.
Extend the rectilinear stroker to handle dashes, so that for pixel-aligned
dashed strokes we completely avoid tessellation overhead.
2009-01-29 14:55:21 +00:00
Chris Wilson
7f95288c03 [ft] Improve error status propagation.
Propagate the error status from deep within the bowels, in order to reduce
the number of duplicate _cairo_error() and generally clean up the return
values.
2009-01-29 10:10:43 +00:00
Chris Wilson
53bd2ae2ce [ft] Distinguish fatal backend errors whilst constructing scaled fonts.
We now have the ability to distinguish an error case where the backend is
left in an inconsistent state from a transitory error. For the former we
need to report the error condition via the return value, which will be
propagated to the font-face. For the latter we just construct an in-error
scaled font nil-object which is passed back to the user.
2009-01-29 10:10:42 +00:00
Chris Wilson
f17aeedab3 [scaled-font] Differentiate fatal error when creating fonts
We only want to set the error state on the backend when it implies that
the font-face is in an inconsistent state. For example, this may be due to
a locking error in the backend or that we have detected a corrupt font.

In contrast, if we merely fail to allocated the scaled font then we just
wish to return that error to the user, without making the font-face itself
inert.
2009-01-29 10:10:42 +00:00
Chris Wilson
58cab06c4c [scaled-font] Guard against invalid matrices when creating the scaled font.
Check the user input for validity before passing the values on to the
backend. Currently the error is detected by the backend and the error is
propagated onto the font-face.
2009-01-29 10:10:42 +00:00
Chris Wilson
97c88f2af0 [surface] Fix memleak of along set_mime_data() error path
Free the mime_data holder if we fail to attach it to the surface.
2009-01-29 10:10:42 +00:00
Chris Wilson
d20e5fc2d9 [ps] Free images after emitting patterns.
Ensure that the temporary images are freed after we finish with the
pattern.

Note that we are using 3 members of the surface for temporary storage
whilst emitting patterns, this should be reviewed.
2009-01-29 10:10:41 +00:00
Chris Wilson
e6102dbe02 [png] Avoid a double free of the memory stream after error.
_cairo_memory_stream_destroy() finalizes the stream even if the stream was
in error and that error is reported back to the caller - so ensure we
don't try to free the stream again.
2009-01-29 10:10:41 +00:00
Chris Wilson
0f3e366f8b [font-face] Close a race when resurrecting fonts.
Paul Messmer provided a thorough analysis of a race between destroying the
final reference on a font and a concurrent recreation of the font -
demonstrating how it is possible for the create() to return the font that
was in the process of being freed.

To stop the race, we need to recheck the reference count upon taking the
mutex guarding the hash table.
2009-01-29 10:10:41 +00:00
Chris Wilson
312b5680a5 [cff-subset] Free ps_name.
Ensure ps_name is freed along error paths and by the normal destructor.
2009-01-29 10:10:41 +00:00
Chris Wilson
5176507fcb [truetype] Free font name.
Remember to free the font name on destruction.
2009-01-29 10:10:41 +00:00
Chris Wilson
ab0ac1b8a8 [truetype] Initialise font_name
Ensure the font_name is initialized to NULL.
2009-01-29 10:10:41 +00:00
Chris Wilson
8388af1378 [test] Trivial fixes for error paths.
Kill a few leaks along error paths in the test code.
2009-01-29 10:10:41 +00:00
Chris Wilson
3752f690b4 [test] Suppress suppressed memfault report
Check to see if there are any *unsuppressed* memfaults before declaring
unreported faults.
2009-01-29 10:10:40 +00:00
Chris Wilson
8dc4c0da9b [toy-font] Fix unwind behaviour following error during construction.
We failed to cleanup the font face correctly after an allocation failure
during _cairo_toy_font_face_init() leading to memleaks and live entries
being left in the font-face hash tables.
2009-01-29 10:10:40 +00:00
Chris Wilson
1d52fbc8f4 [tessellator] Memleak on error path.
Add a missing _cairo_skip_list_fini() after failure to allocate the
events.
2009-01-29 10:10:40 +00:00
Chris Wilson
6b5d2bf1a7 [trace] Comment out the redundant wrapping of FT_Open_Face()
Remove the left-over debugging spew, but leave a comment to hopefully
clarify the situation with wrapping FT_Open_Face().
2009-01-29 10:10:40 +00:00