Const-ify where appropriate and make all index and element counts
unsigned int.
This is needed to enable accessing const cairo_array_t's without
having to manually remove the const qualifier (which happens in the
to-be-merged mesh pattern code, for example).
It is sometimes useful to read the elements of a const cairo_array_t,
but it is currently only possible by ignoring the const qualifier.
The _cairo_array_index_const function allows read-only access to the
array elements.
This is needed to enable accessing const cairo_array_t's without
having to manually remove the const qualifier (which happens in the
to-be-merged mesh pattern code, for example).
Array snapshots are not used anymore and just bloat the implementation
of cairo_array_t.
In particular, double indirection was needed to implement array
snapshots, as explained in c786853993.
I updated the Free Software Foundation address using the following script.
for i in $(git grep Temple | cut -d: -f1 )
do
sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i"
done
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
The number of mime-types attached to a surface is usually small,
typically zero. Therefore it is quicker to do a strcmp() against
each key in the private mime-data array than it is to intern the
string (i.e. compute a hash, search the hash table, and do a final
strcmp).
Ensure that no assumptions are made that a small allocation will succeed
by manually injecting faults when we may be simply allocating from an
embedded memory pool.
The main advantage in manual fault injection is improved code coverage -
from within the test suite most allocations are handled by the embedded
memory pools.
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
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.
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.
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.
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.
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).
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.
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).
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.
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.
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.
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.
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.
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.