Commit graph

327 commits

Author SHA1 Message Date
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
Behdad Esfahbod
d478d5ed5c [doc] Give a small hint about Twin font
Though, the details are not documented yet.  I'm not sure how much of it
I do want to document.
2009-01-02 06:51:15 -05:00
Chris Wilson
c601f30843 [cairo] Early return if we attempt to set the same colour.
Profiling a silly video renderer that called set-source; rectangle; fill;
for each pixel, we can shave 5% off the cairo overhead by introducing an
early return if we attempt to reset the current colour.
2009-01-02 09:53:27 +00:00
Chris Wilson
1c4ea84b24 [cairo] Early return if we attempt to set the same scaled_font
If the application calls cairo_set_scaled_font() with the current
scaled font, we can return early as it is a no-op.
2009-01-02 09:53:26 +00:00
Chris Wilson
b661f3d27b [cairo] Embed a second gstate.
Experiment with embedding a second gstate into the initial context to
reduce allocations.
2009-01-02 09:53:25 +00:00
Chris Wilson
e10af38799 make "make check" happy again
Add the missing scoping that caused check-plt to complain.
2008-12-29 12:55:10 +00:00
Jeff Muizelaar
1d72e53c3e Add a missing _cairo_error() to a bunch of status returns. 2008-12-17 17:42:18 -05:00
Chris Wilson
af53297a97 [cairo] Use a stack buffer for text path.
First try to allocate glyphs from the stack, similar to cairo_show_text().
2008-12-12 12:00:41 +00:00
Chris Wilson
095a1fd786 [gstate] Remove culled glyphs from clusters.
Sascha Steinbiss reported a bug where the PDF backend was reading beyond
the end of the glyph array:
http://lists.cairographics.org/archives/cairo/2008-December/015976.html.

It transpires that in the early glyph culling in the gstate we were
not updating the clusters to skip culled glyphs.
2008-12-12 10:20:47 +00:00
Chris Wilson
e6963a5bfe Mark allocation failures as unlikely.
Use the gcc likelihood annotation to indicate that allocation failures are
extremely unlikely.
2008-11-29 11:20:34 +00:00
Chris Wilson
d1801c23fa Mark if(status) as being unlikely.
The error paths should be hit very rarely during normal operation, so mark
them as being unlikely so gcc may emit better code.
2008-11-29 11:20:33 +00:00
Chris Wilson
b8991a1c69 [in-fill] Add the implicit close-path during move-to.
When interpreting a fixed-path for a fill operation, any move-to
implicitly closes the current path.
2008-11-25 10:24:58 +00:00
Chris Wilson
59de6fb89e [path] Compute approximate extents.
When computing the bounds of the clip path, we care more for a fast result
than absolute precision as the extents are only used as a guide to trim
the future operations. So computing the extents of the path suffices.
2008-11-25 10:16:32 +00:00
Chris Wilson
b6bf047494 [clip] Check for error surface
The update to use a NULL backend with an error surface broke creating a
context from an error surface.
2008-11-25 10:14:25 +00:00
Chris Wilson
a11442154d [cairo] Allocate glyphs on the stack for show_text().
First try to use a stack buffer for the glyphs and clusters if the user
calls cairo_show_text() - for example, as pango does to draw the unknown hex
box.
2008-11-21 09:40:42 +00:00
Chris Wilson
97edc680c1 [twin] Reduce tolerance.
As the glyphs are rendered to cache, ensure that they are rendered at the
highest quality settings.
2008-11-19 11:59:20 +00:00
Chris Wilson
db9ed77d8a [cairo] FLush surface on cairo_destroy()
When discussing the implications of snapshot cow, one of the questions
that we raised was what happens on cairo_destroy()? The lifetime of the
context implicitly marks the extents of the drawing operations, typically
the expose event (or perhaps one phase of it). Therefore at the end of the
sequence we implicitly wish to flush the graphics events to the surface.
2008-11-16 16:21:24 +00:00
Chris Wilson
b06c50cc54 [cairoint.h] Remove unused PLT entries.
Trim the slim_hidden_proto/def to match the currently used functions.
2008-11-13 11:36:43 +00:00
Chris Wilson
6ed957fc24 [gstate] Use _cairo_pattern_black for the default source.
Avoid allocating a default source pattern by using the static black pattern
object. The one complication is that we need to ensure that the static
pattern does leak to the application, so we replace it with an allocated
solid pattern within _cairo_gstate_get_source().
2008-10-30 17:52:11 +00: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
Behdad Esfahbod
096f9def0f Add slim markers to make check-plt.sh happy 2008-09-26 11:07:10 -04:00
Chris Wilson
06f0cc81d2 Add a macro to determine whether a status is a fatal error.
In a few places we need to check whether we have a fatal error or an
internal return code, so provide a utility macro to centralise the check.
2008-09-26 13:42:28 +01:00
Carl Worth
1d896aa9d8 Actually remove cairo_has_show_text_glyphs
The release notes for 1.7.6 say that we had dropped this
function, but apparently we had only planned to do that
and didn't actually get around to it until now.

Thanks to the RELEASING insctructions which gave a diff
command that pointed out this problem.
2008-09-25 15:56:57 -07:00
Chris Wilson
8c0ff8b585 [cairo] Define min-tolerance in terms of cairo_fixed_t
By using the cairo_fixed_t macros we can compute the correct minimum
tolerance for any configuration.
2008-09-24 17:05:08 +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
Behdad Esfahbod
1fe7088a11 [show_text_glyphs] Replace the bool backward with cairo_text_cluster_flags
Chris rightfully complained that having a boolean function argument is
new in cairo_show_text_glyphs, and indeed avoiding them has been one
of the API design criteria for cairo.  Trying to come up with alternatives,
Owen suggested using a flag type which nicely solves the problem AND
future-proofs such a complex API.

Please welcome _flags_t APIs to cairo.h
2008-09-18 00:26:07 -04:00
Behdad Esfahbod
47b3c9aa3f Move version functions to cairo-misc.c 2008-08-28 17:29:32 -04:00
Behdad Esfahbod
00bc650455 Add new public API cairo_surface_has_show_text_glyphs()
We added cairo_has_show_text_glyphs() before.  Since this is really a
surface property, should have the surface method too.  Like we added
cairo_surface_show_page()...
2008-08-18 14:54:21 -04:00
Behdad Esfahbod
a1e5d40376 [doc] Another typo fix 2008-08-17 00:11:34 -04:00
Behdad Esfahbod
eabe572981 Document all new API
Also validate clusters generated by font backends.
2008-08-08 03:04:38 -04:00
Behdad Esfahbod
d9408041aa Add cairo_scaled_font_text_to_glyphs()
And update user-font text_to_glyphs() method to match.

Currently disable the win32-font text_to_glyphs(), until that one
is updated.  Or better yet, remove it and implement ucs4_to_index().
It's the toy font API afterall.
2008-08-08 03:01:16 -04:00
Behdad Esfahbod
d6ae23478a Check for NULL pointer in cairo_set_scaled_font 2008-08-08 03:01:15 -04:00
Behdad Esfahbod
7e57892983 Add toy font constructor and getters
New public API:

	cairo_toy_font_face_create()
	cairo_toy_font_face_get_family()
	cairo_toy_font_face_get_slant()
	cairo_toy_font_face_get_weight()
2008-08-08 03:01:14 -04:00
Jeff Muizelaar
16939e1a86 Center the group pattern transform around the device_transformed origin
When popping a group, transform it by the ctm centered at the origin
specified by the device_transform so that it ends up in the right place
when we try to paint. This fixes the regressions caused by
1a9809baab as shown by the pdf backend.
2008-08-07 19:25:40 -04:00
Behdad Esfahbod
17a5f10f53 [show_text_glyphs] Allow clusters with zero text
As Adrian points out, PDF can handle it, and it doesn't harm allowing.
2008-06-29 15:00:10 -04:00
Behdad Esfahbod
4ffea75d90 Change cairo_text_cluster_t members signed
Also reject clusters with no text.
2008-06-27 11:18:22 -04:00
Behdad Esfahbod
047566fd52 Add cairo_show_text_glyphs API
New public API:

	cairo_text_cluster_t
	cairo_has_show_text_glyphs()
	cairo_show_text_glyphs()

Add accompanying gstate and surface functions, and surface backend methods.
No backends implement them just yet.
2008-06-26 16:20:59 -04:00
Behdad Esfahbod
425846dedb Oops. Fix thinko in previous commit. 2008-06-24 15:09:33 -04:00
Behdad Esfahbod
74789a702b Cleanup _set_error functions a bit 2008-06-24 15:07:07 -04:00
Behdad Esfahbod
f32090fb34 Return CAIRO_STATUS_NEGATIVE_COUNT if num_glyphs is negative 2008-06-23 17:56:28 -04:00
Behdad Esfahbod
676b221326 Protect against NULL glyphs array in text API
We still don't do anything if num_glyphs is negative.  Why isn't
that argument unsigned int...
2008-06-23 17:42:29 -04:00
Behdad Esfahbod
52cf67a8f2 Rename cairo_* global vars to _cairo_* 2008-06-19 17:44:43 -04:00
Chris Wilson
ad9a334e2c Allocate the correct pattern type on the stack.
Instead of allocating the union of all possible pattern types, just
allocate the specific pattern as used by the function in order to trim
the stack space consumption and flag potential misuse.
2008-06-13 21:37:58 +01:00
Chris Wilson
b2eadb94f8 [cairo] Cache freed gstates.
Reduce the malloc pressure from frequent cairo_save()/cairo_restore() by
caching the freed gstates in a list on the context.
2008-06-13 21:34:41 +01:00
Behdad Esfahbod
3f5051fab1 Fix now-detected doc formatting issues 2008-06-01 19:14:13 -04:00
Behdad Esfahbod
3f02e0d74b Fix newly detected doc syntax issues 2008-06-01 18:46:45 -04:00
Behdad Esfahbod
4dd4d96fb1 [cairo-surface] Add cairo_surface_get_fallback_resolution() 2008-05-15 17:20:30 -04:00
Behdad Esfahbod
08334be905 [cairo-meta-surface] Add _cairo_meta_surface_get_path()
Which generates the path for each cairo operation.  If there's any paint,
mask, or intersect-clip-path operations in the meta-surface, UNSUPPORTED
is returned.

Strokes are currently tesselated to traps, then traps converted to path.
Should be made to use stroke_to_path() when we implement that.
2008-05-09 15:54:13 +02:00
Chris Wilson
f6834dacef [cairo] Return defaults when the context is in error.
Return the default values instead of zero for an error context. This
helps to prevent application logic faults when using the values from
the error context (for an example, see _cairo_arc_in_direction()).
2008-04-11 15:39:10 +01:00