Commit graph

6752 commits

Author SHA1 Message Date
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
Carl Worth
faa004033c cairo-trace: Print name of trace file.
It's just a lot easier to use cairo-trace if it tells you
what file it just created.
2009-01-29 10:10:40 +00:00
Daniel Holbert
d108b2777f Spelling corrections: s/it's/its/
As a fun itch to scratch, I've been fixing incorrect uses of the
contraction "it's" in comments within the mozilla source tree (tracked
in https://bugzilla.mozilla.org/show_bug.cgi?id=458167 ), and I ran
across 6 instances of this typo in mozilla's snapshot of cairo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-01-29 10:10:40 +00:00
Paolo Bonzini
6394ec3048 [surface] add CAIRO_STATUS_INVALID_SIZE
Adds an error code replacing CAIRO_STATUS_NO_MEMORY in one case where it
is not really appropriate.  CAIRO_STATUS_INVALID_SIZE is used by several
backends that do not support image sizes beyond 2^15 pixels on each side.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-01-29 10:10:40 +00:00
Paolo Bonzini
46acfd2e85 [glitz] use image fallback if the cairo_content_t is unsupported
The agreement on the mailing list was that returning NULL is the right
thing to do, and indeed the callers of _cairo_glitz_surface_create_similar
are prepared to receive NULL and return CAIRO_STATUS_INT_UNSUPPORTED in
that case.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2009-01-29 10:10:39 +00:00
Chris Wilson
01d20b79da [scaled-font] Fix up syntax in doc comments
The old NULL vs %NULL conflict.
2009-01-29 10:10:39 +00:00
Chris Wilson
aaec63d483 [scaled-font] Global glyph cache
Currently glyphs are cached independently in each font i.e. each font
maintains a cache of up to 256 glyphs, and there can be as many scaled fonts
in use as the application needs and references (we maintain a holdover
cache of 512 scaled fonts as well).

Alternatively, as in this patch, we can maintain a global pool of glyphs
split between all open fonts. This allows a heavily used individual font
to cache more glyphs than we could allow if we used per-font glyph caches,
but at the same time maintains fairness across all fonts (by using random
replacement) and provides a cap on the maximum number of global glyphs.

The glyphs are allocated in pages, which are cached in the global pool.
Using pages means we can exploit spatial locality within the font
(nearby indices are typically used in clusters) to reduce frequency of small
allocations and allow the scaled font to reserve a single MRU page of
glyphs. This caching dramatically reduces the cairo overhead during the
cairo-perf benchmarks, and drastically reduces the number of allocations
made by the application (for example browsing multi-lingual site with
firefox).
2009-01-29 10:10:39 +00:00
Chris Wilson
54f6a49ebb [bounds] Skip spline evaluation based on bounding bbox of control points.
The bounding polygon of the control points, defines the extents of the
spline. Therefore if the control points are entirely contained within the
current path extents, so is the spline and we do not need to evaluate its
tight bounds.
2009-01-29 10:10:39 +00:00
Chris Wilson
e217c4da7b [in-stroke] Check point against extents before computing path.
We can avoid tessellating the path entirely by first checking whether the
query point is inside the path extents.
2009-01-29 10:10:39 +00:00
Chris Wilson
48f9a0e6da [spline] Correct the definition of a cubic Bezier curve.
Add the missing coefficients for p1 and p2 so the derivation of the
derivative and the solution for its inflection points stands correct.
2009-01-29 10:10:39 +00:00
Chris Wilson
ee7ac5681f [path] A degenerate curve_to becomes a line_to.
Be consistent.
2009-01-29 10:10:39 +00:00
Chris Wilson
778ced4879 [path] Rename _cairo_path_fixed_approximate_extents()
Rename approximate_extents() to approximate_clip_extents() so that it is
consistent with the fill and stroke variants and clearer under what
circumstances you may wish to use it.
2009-01-29 10:10:39 +00:00
Chris Wilson
75f7c420b6 [perf] Remove a redundant clear during source init.
After a short wild goose chase to see why
cairo_image_surface_fill_rectangles() was appearing in the profile,
tweak init_and_set_source_surface() to remove the redundant clear and
to propagate any errors in the auxiliary context.
2009-01-29 10:10:38 +00:00
Chris Wilson
706f6de68d [perf] Add another variation on the many-rectangles case
This variation aims to show the difference between calling fill once
per-rectangle, or once for all rectangles.
2009-01-29 10:10:38 +00:00
Chris Wilson
ff5d37a8ad [mutex] Civilise the comment.
Note bene that Behdad does not like people shouting.
2009-01-29 10:10:38 +00:00
Jeff Muizelaar
f4ff6128d7 Avoid "empty body in an if-statement" warning
Use '(void)expr;' instead of 'if (expr) ;' to avoid getting the warning.
'if (expr) {}' is an option, however '(void)expr;' seems like a more common
idiom and getting warnings for __attribute__((warn_unsed_result)) functions is
probably prefered.
2009-01-28 17:16:32 -05:00
Adrian Johnson
41feeedcc1 Use PS font name in PS TrueType fonts 2009-01-22 23:12:14 +11:00
Adrian Johnson
b7a9e1d4ac Embed full font name in PDF TrueType and CFF fonts
if the full font name was available in the font.
2009-01-22 23:12:14 +11:00
Adrian Johnson
6f2db9a4b0 Use PS font name in CFF and TrueType PDF font subsets
James Cloos found that the font name in embedded fonts should be the
PostScript font name (nameID=6 in the name table).

http://lists.cairographics.org/archives/cairo/2008-December/015919.html
2009-01-22 23:12:14 +11:00
Adrian Johnson
2ed08f7801 Factor out duplicate code in truetype and cff subsetting
The code for reading the font name from the name table has been moved
to a new function: _cairo_truetype_read_font_name().
2009-01-22 23:12:14 +11:00
Adrian Johnson
1deb1e4510 PDF: Include subset tag in font name
PDF requires font names of subsetted fonts to be preprended with
"XXXXXX+" where XXXXXX is a sequence of 6 uppercase letters unique the
font and the set of glyphs in the subset.
2009-01-22 23:12:14 +11:00
Carl Worth
c4e54629bb Add details to test/COPYING about license of bundled fonts.
Just the public-doamin 6x13.pcf file for now, but Adrian will
be bundling more soon.
2009-01-22 12:26:55 +11:00
Chris Wilson
6801f28f6d [perf] Add a utility to compare backends.
A minor variation on cairo-perf-diff-files that compares tests with the
same name for multiple backends.
2009-01-14 16:51:09 +00:00
Chris Wilson
4c79cd480d [perf] Tweak dragon to hit fill_rectangles().
Add a second dragon path that is pixel-aligned and uses a solid pattern,
so that it can be drawn using fill-rectangles.
2009-01-14 16:51:09 +00:00
Chris Wilson
de9e6b5a3f [perf] Cover linear gradient with 3 stops.
The i915 is able to special case gradients with just 2 color stops to
avoid creating temporary gradient textures, so add a 3 stop linear
gradient to compare the speed difference.
2009-01-14 16:51:09 +00:00
Chris Wilson
7cbc55f216 [perf] Add scaled similar surface sources.
Cover the similar source with min/mag scale factors as well, so we can
compare the performance impact with scaled image sources. This is useful
to distinguish between transport overhead and transform cost.
2009-01-14 16:51:09 +00:00