Commit graph

33 commits

Author SHA1 Message Date
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
57a1d932f3 [array] Rearrange user_data_fini() to optimize common case.
Micro-optimisation to avoid the _cairo_array_index() for the common case
of 0 elements.
2008-10-30 17:14:27 +00:00
Chris Wilson
1f813ff040 [array] Silence gtk-doc complaints.
gtk-doc fails make check for array as it insists that even the simplest
functions must have a long description and cannot be entirely described by
their arguments and return value.
2008-10-07 01:45:45 +01:00
Behdad Esfahbod
3f02e0d74b Fix newly detected doc syntax issues 2008-06-01 18:46:45 -04:00
Chris Wilson
cfff3c3bd0 [cairo-array] Guard against integer overflow whilst growing the array.
Sanity check the arguments to _cairo_array_grow_by() such that the
array size does not overflow, similar to the defensive checking of
parameters to malloc.
2008-04-03 17:36:50 +01:00
Behdad Esfahbod
52cc603db1 [doc] Stricter syntax check for type names, update test 2008-01-28 22:10:20 -05:00
Behdad Esfahbod
f0633f4449 [doc] Make sure all function names in docs are followed by () 2008-01-28 21:49:57 -05:00
Behdad Esfahbod
0d898f2bad [doc] Make sure all type names in docs are prefixed by # 2008-01-28 20:49:44 -05:00
Behdad Esfahbod
9ecde82d35 [doc] Make sure all macro names in docs are prefixed by % 2008-01-28 20:48:48 -05:00
Chris Wilson
7111b18c27 [cairo-surface] Introduce _cairo_surface_create_in_error().
Unexport all the static error surfaces and use a function to select
the appropriate error surface for the status.
2008-01-16 16:51:32 +00:00
Chris Wilson
bed8239f03 [cairo-error] Clean up all the warnings and missing _cairo_error() calls.
Every time we assign or return a hard-coded error status wrap that value
with a call to _cairo_error(). So the idiom becomes:
    status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
or
    return _cairo_error (CAIRO_STATUS_INVALID_DASH);

This ensures that a breakpoint placed on _cairo_error() will trigger
immediately cairo detects the error.
2007-10-04 13:31:44 +01:00
Chris Wilson
8ad56b308a [malloc/error] Add call to _cairo_error() after a failed malloc.
Blitz all allocations to ensure that they raise a
_cairo_error(CAIRO_STATUS_NO_MEMORY) on failure.
2007-10-04 00:42:30 +01:00
Chris Wilson
e49bcde27f [malloc] Check for integer overflow when realloc'ing.
Perform similar sanity checks to Vlad's _cairo_malloc_ab() but on the
arguments to realloc instead.
2007-10-04 00:42:29 +01:00
Behdad Esfahbod
ded08256ef Spell check the docs 2007-01-07 02:08:15 -05:00
Carl Worth
942cd2e026 Add _cairo_array_size to allow querying the allocated size 2006-09-07 17:33:35 -07:00
Carl Worth
06a9628868 Eliminate conditions checking for unsigned or enum values less than 0. 2006-08-28 19:00:48 -07:00
Carl Worth
eb9caf0833 Add -Wsign-compare compiler flag and fix all warnings 2006-07-28 22:50:06 -07:00
Carl Worth
ef10a0403a Remove initial, final, and duplicate blank lines.
This patch was produced by running git-stripspace on all *.[ch] files
within cairo. Note that this script would have also created all the changes
from the previous commits to remove trailing whitespace.
2006-06-06 15:50:33 -07:00
Carl Worth
4670366ede Remove trailing whitespace from lines that look like comments.
This patch was produced with the following (GNU) sed script:

	sed -i -r -e '/^[ \t]*\/?\*/ s/[ \t]+$//'

run on all *.[ch] files within cairo, (though I manually excluded
src/cairo-atsui-font.c which has a code line that appears as a comment
to this script).
2006-06-06 15:35:48 -07:00
Carl Worth
09dfd6c3c1 PS: Add three new public functions for emitting DSC comments.
This commit adds the following new functions to the cairo-ps API:

	cairo_ps_surface_dsc_comment
	cairo_ps_surface_dsc_begin_setup
	cairo_ps_surface_dsc_begin_page_setup

Many thanks are due to Michael Sweet who provided invaluble guidance
during the design of this API.

It is hoped that with this API in place, basically all printer control
that is likely to be desired to be performed with cairo PostScript
output is now possible.

This commit augments the ps-features test to exercise the new API.
2006-05-03 00:26:22 -07:00
Carl Worth
c786853993 Here is a cleaner implementation of the _cairo_array_t change which was previously committed inadvertently.
Fix buggy implementation of _cairo_array_snapshot by changing array->elements to be a pointer to a pointer. This extra level of indirection allows the snapshot array to point to a pointer which will itself get changed when new storage is needed for a growing array. Previously, the snapshot would be left pointing at stale storage.
Fix to call _cairo_array_index rather than grabbing array->elements directly and casting (which cast is now wrong with the change in implementation of array->index).
2005-12-21 16:35:32 +00:00
Carl Worth
122a83643b Revert inadvertent commit (immediately previous). 2005-12-21 12:20:06 +00:00
Carl Worth
5280c09b7d Fix indentation. 2005-12-21 12:08:57 +00:00
Carl Worth
964c56e72b Note that self-copy now works with the PS backend.
Add _cairo_array_init_snapshot and checks for is_snapshot throughout.
Add a new surface->backend->snapshot function.
Implement _cairo_meta_surface_snapshot and _cairo_meta_surface_acquire/release_source_image. Change _cairo_meta_surface_create to require the width and height in pixels to be used when replaying for purposed of _cairo_meta_surface_aquire_source_image.
Track change in prototype of _cairo_meta_surface_create. Implement _cairo_ps_surface_snapshot by deferring down into _cairo_meta_surface_snapshot.
2005-12-07 12:19:10 +00:00
Carl Worth
632b948c8c Add new _cairo_array_allocate function for growing the array and getting a pointer to the buffer of new data. This is intended to be used in place of the abuse of passing data=NULL to _cairo_array_append_multiple.
Add new function to be used instead of the abuse of pasing data=NULL to cairo_pdf_ft_font_write.
Just return a status now instead of a pointer to the written buffer, since cairo_pdf_ft_font_allocate_write_buffer should now be used instead when a pointer is needed.
Switch to use cairo_pdf_ft_font_allocate_write_buffer.
Fix use of uninitialized status value.
initialization just to keep the compiler quiet about possibly uninitialized variables.
2005-11-07 13:23:31 +00:00
Carl Worth
9341c254a0 Rename old, rarely used _cairo_array_append to _cairo_array_append_multiple. Add much more common _cairo_array_append. Fix both to return a cairo_status_t. Remove undocumented code to allow a non-copying append when elements is NULL, (let's not encourage unintialized data, shall we?)
Cleanup to not rely on undocumented copy-avoidance in _cairo_array_append.
Track change in number of arguments and return value of _cairo_array_append.
2005-11-04 16:13:30 +00:00
Carl Worth
feef096e25 Add documentation for all _cairo_array interface functions. 2005-11-04 15:15:30 +00:00
Carl Worth
2b5d9c8e00 Add CAIRO_STATUS_INVALID_CONTENT, CAIRO_STATUS_INVALID_FORMAT, and CAIRO_STATUS_INVALID_VISUAL.
Change functions to return type of void:
cairo_scaled_font_extents cairo_surface_finish
Add new functions to query object status:
cairo_scaled_font_status cairo_surface_status
Implementation of new error handling scheme for cairo_surface_t and cairo_scaled_font_t.
Track change in return value of cairo_surface_finish.
2005-07-27 15:39:34 +00:00
Carl Worth
756e991b91 Fix name of _cairo_user_data_array_destroy to be _cairo_user_data_array_fini. 2005-06-03 16:16:44 +00:00
Owen Taylor
c803908d95 src/cairo.h src/cairo-font.c src/cairoint.h doc/public/cairo-sections.txt: Add cairo_font_face_set/get_user_data().
src/cairo-array.c src/cairoint.h src/cairo-surface.c: Refactor user data code from cairo-surface.c into cairo_user_data_array_t.
Switch these types to be like cairo_surface_t where the generic code frees the wrapper object.
src/cairo-atsui-font.c src/cairo-ft-font.c src/cairo-win32-font.c: Fix up for the above changes.
Implement a complicated mutual-referencing scheme to make sure that a face from cairo_ft_font_face_create_for_ft_face() is freed only when the FT_Face is no longer needed.
Update the docs to describe how to figure out when the FT_Face can be freed.
Fix refcount leaks when creating fonts.
Remove excess call to _cairo_unscaled_font_reference().
Remove stray initialization of font matrix to the identity.
test/user-data.c: Fix a bug when setting/unsetting a key with a free key slot before it, add that to the test case.
Don't append an element when user_data is NULL.
2005-04-08 13:14:17 +00:00
Kristian Høgsberg
2c6939b7ac Add preliminary text support, including support for truetype font subsetting.
Change type of 'surface' argument in show_glyphs to void * as it is for all other surface virtual functions.
Update accordingly.
Add check for endianess.
Fix bug in array growing loop. (_cairo_array_append): Accept NULL for elements argument, in which case we just allocate space in the array.
2005-01-17 09:40:00 +00:00
Kristian Høgsberg
b1ec8ae13e New PDF backend.
Add PDF surface constructors.
New file - generic array implementation.
Add cairo_array prototypes.
Add cairo_array.c and cairo_pdf_surface.c.
2005-01-05 14:29:31 +00:00