diff options
author | Loïc Minier <lool@dooz.org> | 2009-04-14 23:42:01 +0200 |
---|---|---|
committer | Loïc Minier <lool@dooz.org> | 2009-04-14 23:42:01 +0200 |
commit | c229d1b285e22de4e9815b4a360baa6e8288f7d2 (patch) | |
tree | 6a716d2570c4216bca956d709860839dc463d990 | |
parent | ca1b557e8866801a5f43fd265be7421f60f54a70 (diff) |
Imported Upstream version 0.9.2
159 files changed, 28575 insertions, 4860 deletions
@@ -1,3 +1,1077 @@ +2005-08-13 Carl Worth <cworth@cworth.org> + + * NEWS: Added notes for release 0.9.2. + + * configure.in: Increment CAIRO_VERSION to 0.9.2 and libtool + versioning to 3:1:1. + + * RELEASING: Remove some more 'snapshot' language. Make it more + clear that the libtool versioning numbers need to be updated. + +2005-08-13 Carl Worth <cworth@cworth.org> + + * src/cairo-pattern.c: Fix unterminated comment that eliminated + cairo_pattern_add_color_stop_rgba. + +2005-08-13 Carl Worth <cworth@cworth.org> + + * NEWS: Add missing notes on soname and user-space locking for + cairo_set_source() to the 0.9.0 release notes. + + * src/cairo-pattern.c: Document cairo_pattern_add_color_stop_rgb, + cairo_pattern_add_color_stop_rgba, cairo_pattern_set_matrix, and + cairo_pattern_get_matrix. + + * src/cairo.c: Add note on user-space locking to the documentation + for cairo_set_source(). + +2005-08-13 Carl Worth <cworth@cworth.org> + + * src/cairoint.h: Turn the mutex code back on. It looks like the + deadlocks have disappeared as of the cairo_scaled_font_map patch + from two days ago. + + * configure.in: Setup an automake conditional for the HAVE_PTHREAD + case. + + * test/Makefile.am: Link all tests with -lpthread if available, so + that we can get some testing of cairo with mutexes turned on. + +2005-08-13 Carl Worth <cworth@cworth.org> + + Minor, cosmetic changes: + + * src/cairo-ft-font.c: (_cairo_ft_unscaled_font_lock_face): Reowrd + comment to be more clear. + + * src/cairo-ft-font.c: (_cairo_ft_scaled_font_create): Prefer + return of address of base field rather than cast. + + * src/cairo-ft-font.c: (_cairo_ft_font_face_destroy): Whitespace + fix. + +2005-08-13 Carl Worth <cworth@cworth.org> + + * src/cairo-ft-font.c: (_cairo_ft_unscaled_font_map_create), + (_cairo_ft_unscaled_font_init_key), (_cairo_ft_unscaled_font_init), + (_cairo_unscaled_font_is_ft), (_cairo_ft_unscaled_font_fini), + (_cairo_ft_unscaled_font_keys_equal), + (_cairo_ft_unscaled_font_create_from_face), + (_cairo_ft_unscaled_font_destroy): Shuffle functions around to put + them in a sane order within the file. There should be no + functional change here. + +2005-08-11 Carl Worth <cworth@cworth.org> + + Reviewed by: keithp + + * src/cairoint.h: Add hash_entry field to cairo_scaled_font_t so + that it can be hashed. + + * src/cairo-font.c: (_cairo_scaled_font_map_lock), + (_cairo_scaled_font_map_unlock), (_cairo_scaled_font_map_destroy), + (_cairo_scaled_font_init_key), (_cairo_scaled_font_keys_equal), + (_cairo_scaled_font_init), (_cairo_scaled_font_fini), + (cairo_scaled_font_create), (cairo_scaled_font_reference), + (cairo_scaled_font_destroy), (_cairo_font_reset_static_data): + Convert the font_face/matrix/ctm/options => cairo_scaled_font_t + mapping from a two-layer cairo-cache.c implementation to a single + cairo-hash.c implementation backed by a simple array for the + secondary cache. + +2005-08-13 Behdad Esfahbod <behdad@behdad.org> + + * src/cairo-path-data.c (_cairo_path_data_append_to_context): + Move checks for invalid number of points before the calls that + use the points. + +2005-08-13 Behdad Esfahbod <behdad@behdad.org> + + * src/cairo-color.c: Fix conversion to short, to get a uniform + range even for 0xffff. In other words, a color component of + of (1.0 - epsilon) would convert to 0xffff, not 0xfffe. + +2005-08-13 Behdad Esfahbod <behdad@behdad.org> + + * RELEASING: + * Makefile.am: Generate sh1sum instead of md5sum. Use gpg to + sign it. You need gpg set up. + +2005-08-12 Carl Worth <cworth@cworth.org> + + * RELEASING: + * Makefile.am: Move tagging from an instruction in RELEASING to + an automated step at the end of release-publish. + +2005-08-13 Behdad Esfahbod <behdad@behdad.org> + + * Makefile.am (release-publish): Check that the micro component + of the version number is even. + + * RELEASING: Fixed the pattern to find all public header files. + +2005-08-11 Carl Worth <cworth@cworth.org> + + * src/cairo-font.c (_cairo_toy_font_face_fini): Fix inverted sense + of assert statement which led to lots of unpleasant crashes. + +2005-08-08 Carl Worth <cworth@cworth.org> + + Reviewed by: keithp + + * src/cairoint.h: Add hash_entry field to cairo_font_face_t so + that it can (optionally) be hashed. + + * src/cairo-font.c: (_cairo_toy_font_face_hash_table_lock), + (_cairo_toy_font_face_hash_table_unlock), + (_cairo_toy_font_face_init_key), (_cairo_toy_font_face_init), + (_cairo_toy_font_face_fini), (_cairo_toy_font_face_keys_equal), + (_cairo_toy_font_face_create), (_cairo_toy_font_face_destroy), + (_cairo_toy_font_face_scaled_font_create), + (_cairo_font_reset_static_data): Complete the remainder of the + simple -> toy renaming. Convert the family/slant/weight -> + cairo_toy_font_face_t mapping to use cairo-hash.c rather + than cairo-cache.c. + +2005-08-11 Carl Worth <cworth@cworth.org> + + Reviewed by: keithp + + * src/cairo-ft-font.c: (_cairo_ft_unscaled_font_init), + (_cairo_ft_unscaled_font_init_key), + (_cairo_ft_unscaled_font_keys_equal), + (_cairo_ft_unscaled_font_fini), + (_cairo_ft_unscaled_font_map_destroy), + (_cairo_ft_unscaled_font_map_lock), + (_cairo_ft_unscaled_font_map_unlock), + (_cairo_ft_unscaled_font_map_create), + (_cairo_ft_unscaled_font_create_for_pattern), (_has_unlocked_face), + (_cairo_ft_unscaled_font_lock_face), + (_cairo_ft_unscaled_font_destroy), + (_cairo_ft_scaled_font_create_toy), + (cairo_ft_font_face_create_for_pattern), + (_cairo_ft_font_reset_static_data): + Move implementation of filename/id => cairo_ft_unscaled_font_t + from cairo-cache.c to cairo-hash.c, with new + cairo_ft_unscaled_font_map. + + * src/cairoint.h: Add cairo_unscaled_font->hash_entry so that + unscaled fonts can live in hash tables. + +2005-08-08 Carl Worth <cworth@cworth.org> + + Reviewed by: otaylor + + * src/cairoint.h: Re-order cairo_scaled_font->font_face parameter + to maintain the font_face,font_matrix,ctm,options order that + prevails throughout the implementation. Add font_face parameter to + _cairo_scaled_font_init. + + * src/cairoint.h: + * src/cairo-atsui-font.c: (_cairo_atsui_font_create_toy): + * src/cairo-win32-font.c: (_cairo_win32_scaled_font_create_toy): + * src/cairo-ft-font.c: (_cairo_ft_scaled_font_create_toy): + Remove const qualifier from toy_face parameter to creat_toy, as + these functions may reference the font face. Track addition of + font_face parameter to _cairo_scaled_font_init. + + * src/cairo-font.c: (_cairo_inner_font_cache_create_entry), + (_cairo_scaled_font_init): Implement font_face parameter to + _cairo_scaled_font_init, moving the reference of the font_face + from _cairo_inner_font_cache_create_entry. + + * src/cairo-ft-font.c: (_cairo_ft_scaled_font_create): Add a + font_face parameter in addition to the unscaled_font parameter. + + * src/cairo-ft-font.c: (_cairo_ft_font_face_scaled_font_create): + Track new font_face parameter to _cairo_ft_scaled_font_create. + + * src/cairo-ft-font.c: (_cairo_ft_font_face_create), + (cairo_ft_scaled_font_lock_face): Whitespace touchup. + +2005-08-10 Billy Biggs <vektor@dumbterm.net> + + * test/clip-operator-ref.png: Update to match the output from + libpixman. + +2005-08-10 Carl Worth <cworth@cworth.org> + + Thanks to Olivier Andrieu: + + * NEWS: Add mention of cairo_get_antialias. Fix to mention + cairo_surface_flush by its correct name, (rather than the + non-existent cairo_flush). + +2005-08-10 Carl Worth <cworth@cworth.org> + + * doc/public/cairo-docs.xml: Fix id to be cairo rather than + libglade. (Thanks to Christian Biesinger). + +2005-08-10 Carl Worth <cworth@cworth.org> + + * src/cairo.h: + * src/cairo.c: (cairo_version), (cairo_version_string): + Augment existing CAIRO_VERSION_MAJOR/MINOR/MICRO and + CAIRO_VERSION_STRING with CAIRO_VERSION_ENCODE and CAIRO_VERSION. + Add functions for run-time access: + + cairo_version + cairo_version_string + +2005-08-10 Carl Worth <cworth@cworth.org> + + From Travis Spencer <tspencer@cs.pdx.edu>: + + * src/cairo-xcb-surface.c: + (_cairo_xcb_surface_composite_trapezoids): Fix typo causing a + syntax error. + +2005-08-10 Keith Packard <keithp@keithp.com> + + * test/Makefile.am: + Place private include directives before CAIRO_CFLAGS in case + pixman remains installed in the system. + +2005-08-10 Carl Worth <cworth@cworth.org> + + From Keith Packard <keithp@keithp.com>, + + Build pixman internally as a private part of cairo, with suitable + name changes to avoid any visible pixman symbols in the cairo + library: + + * Makefile.am: Descend into pixman. + + * cairo.pc.in: Drop libpixman from Requires. + + * configure.in: Don't check for libpixman. Check version of + pkg-config and use Requires.private instead of Requires in + cairo.pc if possible. Generate pixman Makefiles. + + * pixman/Makefile.am: Rip out release-publish target and + installation of libpixman.pc. + + * pixman/src/Makefile.am: Add pixman-remap.h. Drop libpixman.la + target. + + * pixman/src/icint.h: Fix to include "config.h" rather than + "../config.h" + + * pixman/src/pixman-remap.h: This is the cpp magic to rename all + pixman functions from the various fb, Fb, INT_pixman, pixman, + Render, _Render, or no prefix to _cairo_pixman_ prefixes. + + * pixman/src/pixman.h: Include pixman-remap.h to get all the + cairo-internalized names. + + * src/Makefile.am: + * test/Makefile.am: Add -I$(top_srcdir)pixman/src to get at + pixman-remap.h. + +2005-08-10 Vladimir Vukicevic <vladimir@pobox.com> + + * src/cairo-glitz-surface.c: Additional fix for 0-width/0-height + glyphs. + +2005-08-10 Carl Worth <cworth@cworth.org> + + * Makefile.am: + * RELEASING: Change release instructions to indicate new odd-micro + version for in-progress development, and even-micro for released + versions. Do a bit of snapshot->release renaming. + +2005-08-10 Carl Worth <cworth@cworth.org> + + * configure.in: Change CAIRO_VERSION from 0.9.0-head to 0.9.1. + + Patch from Behdad Esfahbod <behdad@behdad.org>: + + * configure.in: Update to use AC_INIT and AM_INIT_AUTOMAKE in + recommended ways. Add support for substituting + CAIRO_VERSION_MAJOR/MINOR/MICRO into generated headers. + + * src/cairo-features.h.in: Add CAIRO_VERSION_MAJOR/MINOR/MICRO and + CAIRO_VERSION_STRING which are generated by configure. + +2005-08-10 Carl Worth <cworth@cworth.org> + + * src/cairo-path-data-private.h: + * src/cairoint.h: Add cairo_private to the few pieces of data that + were missing it. + +2005-08-09 Vladimir Vukicevic <vladimir@pobox.com> + + * src/cairo-glitz-surface.c: Don't crash on 0-width or 0-height + glyphs; also correctly initialize entry->key.base.memory with the + image cache image. + + * src/cairo-xlib-surface.c (_xlib_glyphset_cache_create_entry): + Free allocated entry in case of error to avoid leaking memory. + +2005-08-09 Carl Worth <cworth@cworth.org> + + * src/cairo-arc-private.h: + * src/cairo-ft-private.h: + * src/cairo-meta-surface-private.h: + * src/cairoint.h: Add cairo_private to several function prototypes + that were missing it. + +2005-08-09 Carl Worth <cworth@cworth.org> + + * ROADMAP: Note that sane clipping is done now. Add release + versions for previously completed items. + + * test/.cvsignore: Ignore unantialiased-shapes. + +2005-07-29 T Rowley <tim.rowley@gmail.com> + + * src/cairo-atsui-font.c (_cairo_atsui_font_create_toy): + Get cairo_toy_font_face_t type right. + +2005-08-09 Carl Worth <cworth@cworth.org> + + * configure.in: Add -head to CAIRO_VERSION after tagging with + RELEASE_0_9_0. + +2005-08-08 Carl Worth <cworth@cworth.org> + + * NEWS: Added notes for release 0.9.0. + + * configure.in: Increment CAIRO_VERSION to 0.9.0. Increment + LT_CURRENT to 2 to mark the beginning of proper soname management. + +2005-08-08 Carl Worth <cworth@cworth.org> + + * src/Makefile.am (libcairo_la_SOURCES): Add missing cairo-debug.h + which was hold up make distcheck. + +2005-08-08 Carl Worth <cworth@cworth.org> + + * test/Makefile.am (EXTRA_DIST): Fix typo that was holding up make + distcheck from working. + +2005-08-08 Billy Biggs <vektor@dumbterm.net> + + * src/cairo-path-data-private.h: Declare _cairo_path_nil as extern. + +2005-08-08 Billy Biggs <vektor@dumbterm.net> + + reviewed by: cworth, otaylor + + * src/cairo.c: (cairo_set_antialias), (cairo_get_antialias): + * src/cairo.h: Add a new API for disabling antialiasing of shapes + drawn by cairo. This is a hint and is not supported by all backends. + + * src/cairoint.h: + * src/cairo-gstate-private.h: + * src/cairo-gstate.c: (_cairo_gstate_init), + (_composite_traps_draw_func), + (_cairo_surface_clip_and_composite_trapezoids), + (_cairo_gstate_clip_and_composite_trapezoids), + (_cairo_gstate_clip), (_cairo_gstate_set_antialias), + (_cairo_gstate_get_antialias): Store the antialiasing mode in the + gstate and pass it to the backend for trapezoid rendering and for + clipping. + + * src/cairo-clip-private.h: + * src/cairo-clip.c: (_cairo_clip_intersect_path), + (_cairo_clip_intersect_mask), (_cairo_clip_clip): Pass the + antialiasing parameter down to the backend where appropriate. + + * src/cairo-surface.c: (_fallback_composite_trapezoids), + (_cairo_surface_composite_trapezoids), (_cairo_surface_reset_clip), + (_cairo_surface_intersect_clip_path), + (_cairo_surface_set_clip_path_recursive), + (_cairo_surface_set_clip_path): Pass the antialiasing parameter down + to the backend where appropriate. + + * src/cairo-image-surface.c: + (_cairo_image_surface_composite_trapezoids): Add support for A1 format + trapezoid rendering, and remove the _create_mask_image function, + creating a temporary image from memory we allocate and clear. + + * src/cairo-xcb-surface.c: + (_cairo_xcb_surface_composite_trapezoids): Support A1 masks to disable + antialiasing using the RENDER extension when requested. + + * src/cairo-xlib-surface.c: (_create_trapezoid_mask), + (_cairo_xlib_surface_composite_trapezoids): Support A1 masks to disable + antialiasing using the RENDER extension when requested. + + * src/cairo-meta-surface-private.h: + * src/cairo-meta-surface.c: + (_cairo_meta_surface_composite_trapezoids), + (_cairo_meta_surface_intersect_clip_path), + (_cairo_meta_surface_replay): Blindly pass through the antialising + parameter. + + * src/cairo-glitz-surface.c: + (_cairo_glitz_surface_composite_trapezoids): + * src/cairo-pdf-surface.c: + (_cairo_pdf_surface_composite_trapezoids), + (_cairo_pdf_surface_intersect_clip_path): + * src/cairo-ps-surface.c: (_cairo_ps_surface_composite_trapezoids), + (_cairo_ps_surface_intersect_clip_path), + (_ps_output_composite_trapezoids), + (_ps_output_intersect_clip_path): Add the antialiasing parameter but + don't support it. + + * test/Makefile.am: + * test/unantialiased-shapes-ref.png: + * test/unantialiased-shapes.c: (big_star_path), (draw), (main): + Add a test case and a reference image from the latest libpixman. + + * doc/public/tmpl/cairo-font.sgml: + * doc/public/tmpl/cairo.sgml: + * doc/public/cairo-sections.txt: Add the new antialiasing disabling API to + the docs. + + * TODO: Update progress on a parameter to disable antialiasing. + +2005-08-08 Carl Worth <cworth@cworth.org> + + * test/.cvsignore: Ignore clip-operator and unbounded-operator. + +2005-08-08 Carl Worth <cworth@cworth.org> + + * RELEASING: Fix gnome-announce-list address. + +2005-08-08 Owen Taylor <otaylor@redhat.com> + + * src/cairo-xlib-surface.c (_xlib_glyphset_cache_destroy_entry): + Don't free the glyph if the entry doesn't have a glyph. + (Maybe #3909, Carlos Garnacho Parro) + +2005-08-08 Carl Worth <cworth@cworth.org> + + * src/cairo-gstate.c: (_cairo_operator_bounded): Add a return + value after ASSERT_NOT_REACHED to quiet an anxious compiler. + +2005-08-08 Owen Taylor <otaylor@redhat.com> + + * src/cairo-gstate.c: (_cairo_surface_clip_and_composite_trapezoids): + Fix accidentally committed line. + +2005-08-08 Kristian Høgsberg <krh@redhat.com> + + * src/cairo-surface.c (_cairo_surface_set_clip_path): Update doc + comment. + +2005-08-08 Owen Taylor <otaylor@redhat.com> + + * src/cairo-gstate.c (_cairo_operator_bounded): Add a function to test + whether a cairo_operator_t is bounded (does nothing for 0 src/mask) + + * src/cairo-surface.c (_cairo_surface_composite_fixup_unbounded) cairoint.h: + Add a helper function to take clearing areas that are outside the source/mask + but are cleared by unbounded operations. + + * src/cairo-image-surface.c (_cairo_image_surface_composite) + src/cairo-xlib-surface.c (_cairo_xlib_surface_composite): Use + _cairo_surface_composite_fixup_unbounded() as needed. + + * src/cairo-image-surface.c src/cairint.h: Keep track of whether the surface + has a clip or not ... we need this for determining when we can bypass + an intermediate mask for composite_trapezoids(). + + * src/cairo-image-surface.c (_cairo_image_surface_composite_trapezoids): + Create an intermediate mask of the right size with pixman_add_trapezoids() + and composite that. + + * src/cairo-xlib-surface.c (_cairo_xlib_surface_composite_trapezoids): + When rendering with an unbounded operator, create the intermediate mask + ourselves and render with ADD to that, then composite the result. + + * src/cairo-ft-font.c (_cairo_ft_scaled_font_show_glyphs): Create an + intermediate surface the size of the extents, render the glyphs to that + then composite the results. + + * src/cairo-xlib-surface.c (glyphset_cache_entry_t): Add the size of the glyph + + * src/cairo-xlib-surface.c (_show_glyphs_fixup_unbounded): Compute the size + of the glyph mask, then use _cairo_surface_composite_fixup_unbounded(). + + * src/cairo-xlib-surface.c (_cairo_xlib_surface_show_glyphs32): Use the right + mask format. (Unrelated bugfix) + + * src/cairo-gstate.c (_cairo_gstate_clip_and_composite): New function taking + a drawing function as a parameter to encapsulate shared logic between + compositing trapezoid, glyphs, and masks. + + * src/cairo-gstate.c (_cairo_gstate_mask, + _cairo_surface_clip_and_composite_trapezoids, _cairo_gstate_show_glyphs): + Use _cairo_gstate_clip_and_composite(). Also fix extents computations for + unbounded operators. + + * src/cairo-clip.c src/cairo-clip-private.h (_cairo_clip_combine_to_surface): + Add the destination as an extra parameter to allow combining to an intermediate + surface. + + * tests/unbounded-operator.c tests/Makefile.am: Add a test for the + operation of the 6 unbounded operators against different shapes. + + * tests/clip-operator.c tests/Makefile.am: Add a test that tests + surface clipping with different shapes against all the operators. + + * test/composite-integer-translate-over-repeat.c (draw): Make use OVER + like the name and description. With fixed semantics, SOURCE does something + different. + +2005-08-06 Carl Worth <cworth@cworth.org> + + * BUGS: Remove several bugs that have been fixed. + + * ROADMAP: Slip group support off of the 1.0 roadmap. Update + status of clipping work which otaylor is working on. + + * TODO: Update for progress on cairo_surface_mark_dirty + (committed), non-antialiased rendering (patch), cairo_arc_to + (patch), consistent error handling (committed), cairo_content_t + (committed). Remove details for some completed items. + + * src/cairo-gstate.c (_cairo_gstate_set_font_face): Don't crash if + font_face is NULL, (this is a documented mechanism for returning + to the default font_face). + +2005-08-06 Carl Worth <cworth@cworth.org> + + * src/cairo.c (cairo_get_font_face): Fix to return + &_cairo_font_face_nil instead of NULL on error. + +2005-08-06 Jeff Muizelaar <jeff@infidigm.net> + + * test/a8-mask.c: (main): Give reason for failure. + +2005-08-06 Owen Taylor <otaylor@redhat.com> + + * src/cairo-win32-font.c (_cairo_win32_scaled_font_show_glyphs): + Remove a non-sensical XXX that crept in at some point; for + a solid color, there is no difference between premultiplied + and non-premultiplied colors. + +2005-08-06 Carl Worth <cworth@cworth.org> + + * src/cairoint.h: Add a hash_entry as the first member of + cairo_unscaled_font_t so that in can live in a hash table. + + * src/cairo-ft-font.c: (_cairo_ft_unscaled_font_init), + (_cairo_ft_unscaled_font_init_key), + (_cairo_ft_unscaled_font_keys_equal), + (_cairo_ft_unscaled_font_fini), + (_cairo_ft_unscaled_font_map_destroy), + (_cairo_ft_unscaled_font_map_lock), + (_cairo_ft_unscaled_font_map_unlock), + (_cairo_ft_unscaled_font_map_create), + (_cairo_ft_unscaled_font_create_for_pattern), (_has_unlocked_face), + (_cairo_ft_unscaled_font_lock_face), + (_cairo_ft_unscaled_font_destroy), + (_cairo_ft_scaled_font_create_toy), + (cairo_ft_font_face_create_for_pattern), + (_cairo_ft_font_reset_static_data): Rewrite the mapping from + filename/id -> cairo_ft_unscaled_font. The new version uses the + more appropriate cairo_hash_table_t rather than the awkward + cairo_cache_backend_t. + +2005-08-06 Carl Worth <cworth@cworth.org> + + * src/cairo-ft-font.c: (_cairo_ft_scaled_font_create), + (_cairo_ft_scaled_font_create_toy), + (_cairo_ft_scaled_font_glyph_extents), + (_cairo_ft_font_face_scaled_font_create): Fix up some stale + comments. Rename _cairo_ft_scaled_font_create_for_unscaled to its + proper name of _cairo_ft_scaled_font_create (which is available + now that _cairo_ft_scaled_font_create_toy has its correct + name). Also prefer 'scaled_font' over 'f' as an identifier. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * src/cairo-ft-font.c: (_cairo_ft_unscaled_font_init), + (_cairo_ft_unscaled_font_create_from_face), + (_cairo_ft_unscaled_font_create_from_filename): Unify + initialization for _cairo_ft_unscaled_font_create_from_face and + _cairo_ft_unscaled_font_create_from_filename through new + _cairo_ft_unscaled_font_init. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * src/cairo-ft-font.c: (_cairo_ft_font_face_create): Rename + _ft_font_face_backend to be preoperly namespaced as + _cairo_ft_font_face_backend. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * src/cairo-ft-font.c: (_cairo_ft_font_face_destroy), + (_cairo_ft_font_face_create): Rename cairo_ft_font_face->next_face + to next. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * src/cairoint.h: Include cairo-hash-private.h. + + * src/Makefile.am (libcairo_la_SOURCES): Add cairo-hash.c and + cairo-hash-private.h since we're actually going to start using + them now. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * src/cairo-gstate.c: (_cairo_gstate_set_font_face): Simplify the + implementation by taking advantage of the fact that destroy and + reference are safe for NULL, and that reference returns its + argument. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * src/cairo-gstate.c: (_cairo_gstate_translate), + (_cairo_gstate_scale), (_cairo_gstate_rotate), + (_cairo_gstate_transform), (_cairo_gstate_set_matrix), + (_cairo_gstate_identity_matrix), (_cairo_gstate_unset_scaled_font), + (_cairo_gstate_set_font_size), (_cairo_gstate_set_font_matrix), + (_cairo_gstate_set_font_options), + (_cairo_gstate_ensure_scaled_font), + (_cairo_gstate_get_font_extents), (_cairo_gstate_text_to_glyphs), + (_cairo_gstate_set_font_face), (_cairo_gstate_glyph_extents), + (_cairo_gstate_show_glyphs), (_cairo_gstate_glyph_path): + Rename two functions: + + _cairo_gstate_unset_font -> _cairo_gstate_unset_scaled_font + _cairo_gstate_ensure_font -> _cairo_gstate_ensure_scaled_font + +2005-08-05 Carl Worth <cworth@cworth.org> + + * src/cairoint.h: Entagle the cairo_unscaled_font_t typedef. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * src/cairoint.h: Rename font_face_backend->create_font to + scaled_font_create. Group the scaled_font prototypes together. A + little more simple -> toy renaming. + + * src/cairo-font.c: (_cairo_toy_font_face_create_from_cache_key), + (_cairo_toy_font_face_destroy), + (_cairo_toy_font_face_create): + * src/cairo-gstate.c: (_cairo_gstate_select_font_face), + (_cairo_gstate_ensure_font_face): + A little more simple -> toy renaming. + + * src/cairo-font.c: (_cairo_toy_font_face_scaled_font_create), + (_cairo_inner_font_cache_create_entry): + * src/cairo-ft-font.c: (_cairo_ft_font_face_scaled_font_create): + * src/cairo-win32-font.c: (_cairo_win32_font_face_scaled_font_create): + Track rename of font_face_backend->scaled_font_create. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * src/cairoint.h: Rather gratuitous (though mostly harmless) + whitespace changes for font backend tables. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * src/cairo.c: Document the implicit closing of sub-paths for + cairo_fill and cairo_fill_preserve. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * src/cairoint.h: Rename parameters to scalend_font_backend from + font to scaled_font. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * src/cairoint.h: Rename scaled_font_backend->destroy to the more + accurate fini, (since it frees only the dependent data within the + scaled_font and not the scaled_font itself). + + * src/cairo-atsui-font.c: (_cairo_atsui_font_fini): + * src/cairo-font.c: (cairo_scaled_font_destroy): + * src/cairo-ft-font.c: (_cairo_ft_scaled_font_fini): + * src/cairo-win32-font.c: (_cairo_win32_scaled_font_fini): + Track rename of scaled_font_backend->fini. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * src/cairoint.h: Rename scaled_font_backend->create to + create_toy. Move declaration of cairo_simple_font_face_t from + cairo_font.c to cairoint.h and rename it + cairo_toy_font_face_t. Rework create_toy to accept a + cairo_toy_font_face_t rather than separate family, slant, and + weight. + + * src/cairo-atsui-font.c: (_cairo_atsui_font_create_toy): + * src/cairo-ft-font.c: (_cairo_ft_scaled_font_create_toy): + * src/cairo-win32-font.c: (_cairo_win32_scaled_font_create_toy): + Track change in create_toy interface. + + * src/cairo-font.c: (_cairo_toy_font_face_create_from_cache_key), + (_cairo_simple_font_cache_create_entry), + (_cairo_simple_font_face_destroy), + (_cairo_simple_font_face_create_font): + Partial rename of simple->toy. It's not complete as this is a step + in the process of merging in a large patch of mine which actually + removes most of the affected code. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * test/.cvsignore: ignore a8-mask + +2005-08-05 Carl Worth <cworth@cworth.org> + + * test/a8-mask.c (draw): Patch memory leaks. + +2005-08-05 Jeff Muizelaar <jeff@infidigm.net> + + * test/Makefile.am: + * test/a8-mask-ref.png: + * test/a8-mask.c: (draw), (main): + Add a test case for CAIRO_FORMAT_A8 masks that fails with + libpixman. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * autogen.sh (automake_min_vers): Bump automake_min_vers up to 1.7 + since we clearly don't work with 1.4 anymore. + +2005-08-05 Jeff Muizelaar <jeff@infidigm.net> + + * test/xlib-surface.c: (do_test): use the newly added + buffer_diff_noalpha for comparing buffers of + CAIRO_FORMAT_RGB24. + +2005-08-05 Jeff Muizelaar <jeff@infidigm.net> + + * test/buffer-diff.c: (buffer_diff_core), (buffer_diff), + (buffer_diff_noalpha): + * test/buffer-diff.h: rewrite buffer_diff to be endian safe + and add a new fuction buffer_diff_noalpha + +2005-08-05 Carl Worth <cworth@cworth.org> + + * doc/public/cairo-sections.txt: Remove CAIRO_BEGIN_DECLS and + CAIRO_END_DECLS which don't belong here. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * test/surface-finish-twice.c (draw): Remove unused variable. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * doc/public/Makefile.am: Ignore cairo-clip-private.h. + + * doc/public/cairo-docs.xml: Drop non-existent cairo-atsui.xml. + + * src/cairo-font.c: Fix misnamed parameters in comment blocks. + + * test/cairo-test.c: Include config.h so HAVE_UNISTD_H gets + picked up as necessary. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * doc/public/Makefile.am (IGNORE_HFILES): Ignore + cairo-clip-private.h. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * doc/public/cairo-sections.txt: Add some missing declarations to + the appropriate sections. + + * doc/public/tmpl/cairo-font.sgml: + * doc/public/tmpl/cairo-surface.sgml: + * doc/public/tmpl/cairo-xlib.sgml: + * doc/public/tmpl/cairo.sgml: churn + + * src/cairo-path-data-private.h: Rename cairo_path_nil to + _cairo_path_nil since it may be exported, and tag it cairo_private + to try to avoid exporting it. Qualify it as const well. + + * src/cairo-path-data.c: (_cairo_path_data_create_real): + * src/cairo.c: (cairo_copy_path), (cairo_copy_path_flat): + Track new name of _cairo_path_nil and cast away the const as + required. + +2005-08-05 Carl Worth <cworth@cworth.org> + + * src/cairo-arc.c: + * src/cairo-matrix.c: Remove include of math.h since cairoint.h + does it more carefully, (for annoying platforms for which just + including math.h without extra defines is not enough). + + * src/cairo.c: Replace Cairo with cairo. + + * test/buffer-diff.c: Include config.h so HAVE_UNISTD_H gets + picked up as necessary. + + * test/cairo-test.c: Fix non-UTF-8 copyright symbol. + +2005-08-05 Carl Worth <cworth@cworth.org> + + Patch from John Ehresman <jpe@wingide.com> to aid win32 + compilation: + + * src/cairo-output-stream.c: Define snprintf as _snprintf when + under the influence of _MSC_VER. + + * test/read-png.c: (read_png_argb32): + * src/cairo-wideint.h: Define int32_t and friends as __int32 and + friends when under the influence of _MSC_VER. + + * test/buffer-diff.c: + * test/cairo-test.c: Make include of unistd.h conditional on + HAVE_UNISTD_H. + +2005-08-05 Kristian Høgsberg <krh@redhat.com> + + Patch from Adrian Johnson <ajohnson@redneon.com> + + * src/cairo-font-subset.c (cairo_pdf_ft_font_write_glyf_table) + (cairo_pdf_ft_font_remap_composite_glyph): Remap composite glyps + to use subset font glyph indices. + +2005-08-05 Kristian Høgsberg <krh@redhat.com> + + Reviewed by: otaylor + + * src/Makefile.am: + * src/cairo-clip-private.h: + * src/cairo-clip.c: New files. Move code for manipulating + cairo_clip_t out into cairo_clip_* functions and put them in + cairo-clip.c. + + * src/cairo-gstate-private.h: + * src/cairo-gstate.c: Rewrite to use new cairo_clip_t functions + for manipulating the clip state, change the + clip_and_composite_trapezoids call tree to use cairo_clip_t + instead of cairo_gstate_t. + + * src/cairo-meta-surface.c: Use new cairo_clip_t function to + maintain clip state while replaying. + + * src/cairo-path-fill.c: (_cairo_filler_init), + (_cairo_filler_curve_to), (_cairo_path_fixed_fill_to_traps): Pass + fill rule and tolerance directly, to break gstate dependency. + + * src/cairo-surface.c: (_cairo_surface_set_clip): New function. + Set the clip for a surface as specified by the cairo_clip_t. + + * src/cairo-traps.c: (_cairo_traps_translate): Move + translate_traps() from cairo-gstate.c to here and rename it. + +2005-08-04 Kristian Høgsberg <krh@redhat.com> + + * src/cairo-font.c: (cairo_font_face_reference), + (_cairo_unscaled_font_reference), (cairo_scaled_font_reference): + * src/cairo-gstate.c: (_cairo_clip_path_reference): + * src/cairo-pattern.c: (cairo_pattern_reference): + * src/cairo-pdf-surface.c: (_cairo_pdf_document_reference): + * src/cairo-surface.c: (cairo_surface_reference): + * src/cairo.c: (cairo_reference): + * src/cairo.h: + * src/cairoint.h: + Change *_reference() functions to return the object being + referenced. + +2005-07-29 T Rowley <tim.rowley@gmail.com> + + Reviewed by: otaylor + + * src/cairo-xlib-surface.c ( _categorize_composite_operation): + Check for render bug involving repeated patterns with a general + transform matrix. + +2005-08-04 Carl Worth <cworth@cworth.org> + + Originally 2005-07-13 Carl Worth <cworth@cworth.org> + + Reviewed by: otaylor + + * src/cairo-ft-private.h: Export opaque cairo_ft_unscaled_font_t + and change _cairo_ft_unscaled_font_[un]lock_face to accept + cairo_ft_unscaled_font_t rather than cairo_unscaled_font_t. + + * src/cairo-font-subset.c: (_cairo_font_subset_create), + (cairo_pdf_ft_font_generate): Cast explicitly to + cairo_ft_unscaled_font_t to track change in prototype of + _cairo_ft_unscaled_font_[un]lock_face. + + * src/cairo-ft-font.c: Lots of renaming to use consistent + namespacing: + + ft_font_transform_t -> cairo_ft_font_transform_t + ft_font_face_t -> cairo_ft_font_face_t + ft_unscaled_font_t -> cairo_ft_unscaled_font_t + + Add missing _cairo prefix to many functions. + + Disambiguate _ft_scaled_font_create and + _cairo_ft_scaled_font_create by renaming the former to + _cairo_ft_scaled_font_create_for_unscaled. + +2005-08-03 Carl Worth <cworth@cworth.org> + + Fix for bug #3951: + + * configure.in: Add new _CHECK_FUNCS_WITH_FLAGS to abstract out + the pain of temporarily setting flags for AC_CHECK_FUNCS. Use this + to check for the existence of FcFini. + + * test/cairo-test.c: (cairo_test_expecting): Make call to FcFini + conditional on HAVE_FCFINI. + + * test/text-cache-crash.c: (main): Remove stale comment about + cleaning up memory which is now handled by cairo-test.c. + +2005-08-01 Owen Taylor <otaylor@redhat.com> + + reviewed by: cworth + + * src/cairo-gstate.c src/cairo-gstate-private.h: Store the + inverse CTM at the time of cairo_gstate_set_source() to + "lock" the user space matrix. + + * src/cairo-gstate.c: Move the source pattern transformation + to the outside of _cairo_gstate_clip_and_composite_trapezoids() + instead of doing it at the leaves. + + * test/source-surface-scale-paint.c: Change size of output + surface for aesthetics. + + * test/source-surface-scale-paint-ref.png: Updated to correspond + to the current definition. + + * test/Makefile.am (XFAIL_TESTS): + Remove source-surface-scale-paint. + +2005-08-01 Carl Worth <cworth@cworth.org> + + * src/cairo-debug.h: New public header file. + + * src/cairo-debug.c: (cairo_debug_reset_static_data): New function + to reset all static data (eg. caches) to their initial state. + + * Makefile.am: Fix check-valgrind target to depend on the 'all' + target. + + * configure.in: Add check for a new, proposed, XrmFinalize + function. + + * src/Makefile.am: Add cairo-debug.c. + + * src/cairo.h: + * src/cairo-features.h.in: Move the definition of + CAIRO_BEGIN_DECLS to cairo-features.h so that it can be shared + between public header files, and so that it doesn't clutter + cairo.h + + * src/cairoint.h: + * src/cairo-font.c: (_get_global_simple_cache), + (_get_outer_font_cache), (_get_inner_font_cache), + (_cairo_unlock_global_image_glyph_cache), + (_cairo_font_reset_static_data): + * src/cairo-ft-font.c: (_cairo_ft_font_reset_static_data): + * src/cairo-xlib-screen.c: (_cairo_xlib_close_display), + (_cairo_xlib_screen_info_reset), + (_cairo_xlib_screen_reset_static_data): + * src/cairo-xlib-surface.c: (_unlock_xlib_glyphset_caches), + (_destroy_glyphset_cache_recurse), + (_cairo_xlib_surface_reset_static_data): Implement + reset_static_data in all modules as required. + + * test/xlib-surface.c: (main): + * test/cairo-test.h: + * test/cairo-test.c: (cairo_test_for_target), + (cairo_test_expecting): Call cairo_debug_reset_static_data and + FcFini so that we can have all tests be valgrind-clean with + respect to memory leaks and still-reachable data. + +2005-08-01 Owen Taylor <otaylor@redhat.com> + + * src/cairo.h src/cairoint.h src/cairo-surface.c: + Add cairo_mark_dirty[_rectangle]() and cairo_flush() for + + * src/cairo-win32-surface.c: Implement a cairo_flush() + that restores the original clip. Also restore the original + flush when a surface is finished. + + * ROADMAP: Check off the item. + +2005-07-31 Billy Biggs <vektor@dumbterm.net> + + reviewed by: keithp + + * src/cairo-ft-font.c: (_ft_unscaled_font_set_scale): Support + versions of freetype without exact FT_Bitmap_Size.x/y_ppem + values by using the pixel width and height values instead. + + * configure.in: Add a check for FT_Bitmap_Size.y_ppem. + +2005-07-31 Billy Biggs <vektor@dumbterm.net> + + * src/cairo-quartz-surface.c: (cairo_quartz_surface_create): + Cast away the const on the nil surface to avoid a compiler warning. + +2005-07-31 Billy Biggs <vektor@dumbterm.net> + + * src/cairo-atsui-font.c: (_cairo_atsui_font_create): Pass the + options down to the scaled font object to keep things compiling. + +2005-07-30 Keith Packard <keithp@keithp.com> + + * src/cairo-wideint.c: (_cairo_int32x32_64_mul), + (_cairo_uint64_divrem), (_cairo_uint128_divrem): + * src/cairo-wideint.h: + + Replace wide integer divide algorithms with + trivial bit-at-a-time code. Original code was + of unclear provenance, this new code is + completely different. + +2005-07-29 Carl Worth <cworth@cworth.org> + + * ROADMAP: Remove completed 0.6 tasks. Add cairo_surface_flush to + the cairo_surface_mark_dirty task. + +2005-07-29 T Rowley <tim.rowley@gmail.com> + + * src/cairo-atsui-font.c ( _cairo_atsui_font_create): + src/cairo-quartz-surface.c (_cairo_quartz_surface_acquire_dest_image): + Minor updates to keep quartz backend limping along. + +2005-07-29 Owen Taylor <otaylor@redhat.com> + + * src/cairo-font.c src/cairo-ft-font.c src/cairo-win32-font.c + src/cairoint.h: Move the font options into the base + cairo_scaled_font_t object so that we have them available + to use when we are removing a scaled font from the cache. + (http://bugzilla.gnome.org/show_bug.cgi?id=311299, + Ali Akcaagac, Behdad Esfahbod) + +2005-07-28 Carl Worth <cworth@cworth.org> + + * src/cairo-gstate.c: (_cairo_gstate_mask): Run the mask pattern + through the CTM in the same way as the source pattern. This fixes + the bug demonstrated by the mask-ctm and mask-surface-ctm tests so + they should no longer fail. + +2005-07-28 Carl Worth <cworth@cworth.org> + + * test/.cvsignore: + * test/Makefile.am: + * test/mask-ctm-ref.png: + * test/mask-ctm.c: (draw), (main): + * test/mask-surface-ctm-ref.png: + * test/mask-surface-ctm.c: (draw), (main): Add two new tests: + mask-ctm + mask-surface-ctm + demonstrating that masks are not currently being modified by the + CTM. + +2005-07-28 Carl Worth <cworth@cworth.org> + + * RELEASING: CC gnome-announce-list@gnome.org on cairo release + announcements. + +2005-07-28 Carl Worth <cworth@cworth.org> + + * configure.in: Add -head to CAIRO_VERSION after tagging with + SNAPSHOT_0_6_0. + 2005-07-28 Carl Worth <cworth@cworth.org> * NEWS: Added notes for snapshot 0.6.0 @@ -550,6 +1624,19 @@ 2005-07-18 Carl Worth <cworth@cworth.org> + * test/.valgrind-suppressions: Add valgrind suppressions for + libpng/libz use of uninitialized data. There are clearly bugs here + that are not cairo's fault as zeroing the buffer before writing + the png image actually causes more errors(!). And, notably, + setting all the data to random bytes usually makes the errors go + away. + + * test/Makefile.am: Change the check-valgrind target to include + the .valgrind-suppresions file and to tee output into + valgrind.log. + +2005-07-18 Carl Worth <cworth@cworth.org> + * configure.in: Add -head to CAIRO_VERSION after tagging with SNAPSHOT_0_5_2. diff --git a/Makefile.am b/Makefile.am index c2a9965..409900f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ -DIST_SUBDIRS = src test doc -SUBDIRS = src doc +DIST_SUBDIRS = pixman src test doc +SUBDIRS = pixman src doc # libpng is required for our test programs if CAIRO_HAS_PNG_FUNCTIONS @@ -15,6 +15,9 @@ EXTRA_DIST = \ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = cairo.pc +check-valgrind: all + $(MAKE) -C test check-valgrind + DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc # Some custom targets to make it easier to release things. @@ -27,41 +30,69 @@ RELEASE_UPLOAD_DIR = /srv/cairo.freedesktop.org/www/snapshots RELEASE_URL_BASE = http://cairographics.org/snapshots RELEASE_ANNOUNCE_LIST = cairo-announce@cairographics.org +CVS=cvs + tar_file = $(PACKAGE)-$(VERSION).tar.gz -md5_file = $(tar_file).md5 +sha1_file = $(tar_file).sha1 +gpg_file = $(sha1_file).asc + +$(sha1_file): $(tar_file) + sha1sum $^ > $@ -$(md5_file): $(tar_file) - md5sum $^ > $@ +$(gpg_file): $(sha1_file) + @echo "Please enter your GPG password to sign the checksum." + gpg --armor --sign $^ release-remove-old: - rm -f $(tar_file) $(md5_file) + rm -f $(tar_file) $(sha1_file) $(gpg_file) -release-check: release-remove-old distcheck $(md5_file) +release-check: release-verify-even-micro release-verify-newer release-remove-old distcheck + +release-verify-even-micro: + @echo -n "Checking that $(VERSION) has an even micro component..." + @test "$(CAIRO_VERSION_MICRO)" = "`echo $(CAIRO_VERSION_MICRO)/2*2 | bc`" \ + || (echo "Ouch." && echo "The version micro component '$(CAIRO_VERSION_MICRO)' is not an even number." \ + && echo "The version in configure.in must be incremented before a new release." \ + && false) + @echo "Good." release-verify-newer: @echo -n "Checking that no $(VERSION) release already exists..." @ssh $(RELEASE_UPLOAD_HOST) test ! -e $(RELEASE_UPLOAD_DIR)/$(tar_file) \ || (echo "Ouch." && echo "Found: $(RELEASE_UPLOAD_HOST):$(RELEASE_UPLOAD_DIR)/$(tar_file)" \ - && echo "The version in configure.in must be incremented before a new release." \ + && echo "Are you sure you have an updated CVS checkout?" \ + && echo "This should never happen." \ && false) @echo "Good." -release-publish: release-verify-newer release-check +release-upload: release-check $(tar_file) $(sha1_file) $(gpg_file) mkdir -p releases - scp $(tar_file) $(md5_file) $(RELEASE_UPLOAD_HOST):$(RELEASE_UPLOAD_DIR) - mv $(tar_file) $(md5_file) releases - ssh $(RELEASE_UPLOAD_HOST) "rm -f $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-[0-9]* && touch $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-$(VERSION)" + scp $(tar_file) $(sha1_file) $(gpg_file) $(RELEASE_UPLOAD_HOST):$(RELEASE_UPLOAD_DIR) + mv $(tar_file) $(sha1_file) $(gpg_file) releases + ssh $(RELEASE_UPLOAD_HOST) "rm -f $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-[0-9]* && ln -s $(tar_file) $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-$(VERSION)" + $(CVS) tag RELEASE_$(CAIRO_VERSION_MAJOR)_$(CAIRO_VERSION_MINOR)_$(CAIRO_VERSION_MICRO) + +release-publish: release-upload releases/$(sha1_file) @echo "" @echo "Please send an announcement to $(RELEASE_ANNOUNCE_LIST)" @echo "including the following:" @echo "" - @echo "Subject: $(PACKAGE) snapshot $(VERSION) now available" + @echo "Subject: $(PACKAGE) release $(VERSION) now available" @echo "" - @echo "A new $(PACKAGE) snapshot $(VERSION) is now available from:" + @echo "============================== CUT HERE ==============================" + @echo "A new $(PACKAGE) release $(VERSION) is now available from:" @echo "" @echo " $(RELEASE_URL_BASE)/$(tar_file)" - @echo " $(RELEASE_URL_BASE)/$(md5_file)" + @echo " $(RELEASE_URL_BASE)/$(sha1_file)" @echo -n " " - @cat releases/$(md5_file) + @cat releases/$(sha1_file) + @echo " $(RELEASE_URL_BASE)/$(gpg_file)" + @echo " (signed by `getent passwd "$$USER" | cut -d: -f 5 | cut -d, -f 1`)" @echo "" + @echo "============================== CUT HERE ==============================" @echo "Also, please include the new entries from the NEWS file." + @echo "" + @echo "Last but not least, do not forget to bump up the micro" + @echo "version component to the next (odd) number and commit." + +.PHONY: release-check release-remove-old release-verify-even-micro release-verify-newer release-check release-publish release-upload diff --git a/Makefile.in b/Makefile.in index 74f0333..7101da3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -119,6 +119,10 @@ CAIRO_HAS_XCB_SURFACE_TRUE = @CAIRO_HAS_XCB_SURFACE_TRUE@ CAIRO_HAS_XLIB_SURFACE_FALSE = @CAIRO_HAS_XLIB_SURFACE_FALSE@ CAIRO_HAS_XLIB_SURFACE_TRUE = @CAIRO_HAS_XLIB_SURFACE_TRUE@ CAIRO_LIBS = @CAIRO_LIBS@ +CAIRO_VERSION_MAJOR = @CAIRO_VERSION_MAJOR@ +CAIRO_VERSION_MICRO = @CAIRO_VERSION_MICRO@ +CAIRO_VERSION_MINOR = @CAIRO_VERSION_MINOR@ +CAIRO_VERSION_OTHER = @CAIRO_VERSION_OTHER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -154,6 +158,8 @@ GLITZ_REQUIRES = @GLITZ_REQUIRES@ GLITZ_SURFACE_FEATURE = @GLITZ_SURFACE_FEATURE@ GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@ GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ +HAVE_PTHREAD_FALSE = @HAVE_PTHREAD_FALSE@ +HAVE_PTHREAD_TRUE = @HAVE_PTHREAD_TRUE@ HTML_DIR = @HTML_DIR@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -179,8 +185,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PDF_LIBS = @PDF_LIBS@ PDF_SURFACE_FEATURE = @PDF_SURFACE_FEATURE@ -PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ -PIXMAN_LIBS = @PIXMAN_LIBS@ +PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PNG_CFLAGS = @PNG_CFLAGS@ PNG_FUNCTIONS_FEATURE = @PNG_FUNCTIONS_FEATURE@ @@ -251,8 +256,8 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -DIST_SUBDIRS = src test doc -SUBDIRS = src doc $(am__append_1) +DIST_SUBDIRS = pixman src test doc +SUBDIRS = pixman src doc $(am__append_1) EXTRA_DIST = \ COPYING \ COPYING-LGPL-2.1 \ @@ -271,8 +276,10 @@ RELEASE_UPLOAD_HOST = cairographics.org RELEASE_UPLOAD_DIR = /srv/cairo.freedesktop.org/www/snapshots RELEASE_URL_BASE = http://cairographics.org/snapshots RELEASE_ANNOUNCE_LIST = cairo-announce@cairographics.org +CVS = cvs tar_file = $(PACKAGE)-$(VERSION).tar.gz -md5_file = $(tar_file).md5 +sha1_file = $(tar_file).sha1 +gpg_file = $(sha1_file).asc all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -733,41 +740,69 @@ uninstall-info: uninstall-info-recursive uninstall-pkgconfigDATA -$(md5_file): $(tar_file) - md5sum $^ > $@ +check-valgrind: all + $(MAKE) -C test check-valgrind + +$(sha1_file): $(tar_file) + sha1sum $^ > $@ + +$(gpg_file): $(sha1_file) + @echo "Please enter your GPG password to sign the checksum." + gpg --armor --sign $^ release-remove-old: - rm -f $(tar_file) $(md5_file) + rm -f $(tar_file) $(sha1_file) $(gpg_file) + +release-check: release-verify-even-micro release-verify-newer release-remove-old distcheck -release-check: release-remove-old distcheck $(md5_file) +release-verify-even-micro: + @echo -n "Checking that $(VERSION) has an even micro component..." + @test "$(CAIRO_VERSION_MICRO)" = "`echo $(CAIRO_VERSION_MICRO)/2*2 | bc`" \ + || (echo "Ouch." && echo "The version micro component '$(CAIRO_VERSION_MICRO)' is not an even number." \ + && echo "The version in configure.in must be incremented before a new release." \ + && false) + @echo "Good." release-verify-newer: @echo -n "Checking that no $(VERSION) release already exists..." @ssh $(RELEASE_UPLOAD_HOST) test ! -e $(RELEASE_UPLOAD_DIR)/$(tar_file) \ || (echo "Ouch." && echo "Found: $(RELEASE_UPLOAD_HOST):$(RELEASE_UPLOAD_DIR)/$(tar_file)" \ - && echo "The version in configure.in must be incremented before a new release." \ + && echo "Are you sure you have an updated CVS checkout?" \ + && echo "This should never happen." \ && false) @echo "Good." -release-publish: release-verify-newer release-check +release-upload: release-check $(tar_file) $(sha1_file) $(gpg_file) mkdir -p releases - scp $(tar_file) $(md5_file) $(RELEASE_UPLOAD_HOST):$(RELEASE_UPLOAD_DIR) - mv $(tar_file) $(md5_file) releases - ssh $(RELEASE_UPLOAD_HOST) "rm -f $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-[0-9]* && touch $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-$(VERSION)" + scp $(tar_file) $(sha1_file) $(gpg_file) $(RELEASE_UPLOAD_HOST):$(RELEASE_UPLOAD_DIR) + mv $(tar_file) $(sha1_file) $(gpg_file) releases + ssh $(RELEASE_UPLOAD_HOST) "rm -f $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-[0-9]* && ln -s $(tar_file) $(RELEASE_UPLOAD_DIR)/LATEST-$(PACKAGE)-$(VERSION)" + $(CVS) tag RELEASE_$(CAIRO_VERSION_MAJOR)_$(CAIRO_VERSION_MINOR)_$(CAIRO_VERSION_MICRO) + +release-publish: release-upload releases/$(sha1_file) @echo "" @echo "Please send an announcement to $(RELEASE_ANNOUNCE_LIST)" @echo "including the following:" @echo "" - @echo "Subject: $(PACKAGE) snapshot $(VERSION) now available" + @echo "Subject: $(PACKAGE) release $(VERSION) now available" @echo "" - @echo "A new $(PACKAGE) snapshot $(VERSION) is now available from:" + @echo "============================== CUT HERE ==============================" + @echo "A new $(PACKAGE) release $(VERSION) is now available from:" @echo "" @echo " $(RELEASE_URL_BASE)/$(tar_file)" - @echo " $(RELEASE_URL_BASE)/$(md5_file)" + @echo " $(RELEASE_URL_BASE)/$(sha1_file)" @echo -n " " - @cat releases/$(md5_file) + @cat releases/$(sha1_file) + @echo " $(RELEASE_URL_BASE)/$(gpg_file)" + @echo " (signed by `getent passwd "$$USER" | cut -d: -f 5 | cut -d, -f 1`)" @echo "" + @echo "============================== CUT HERE ==============================" @echo "Also, please include the new entries from the NEWS file." + @echo "" + @echo "Last but not least, do not forget to bump up the micro" + @echo "version component to the next (odd) number and commit." + +.PHONY: release-check release-remove-old release-verify-even-micro release-verify-newer release-check release-publish release-upload # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: @@ -1,3 +1,189 @@ +Release 0.9.2 (2005-08-13 Carl Worth <cworth@cworth.org>) +========================================================= +Release numbering +----------------- + * You will notice that this release jumped from 0.9.0 to 0.9.2. We've + decided to use an odd micro version number (eg. 0.9.1) to indicate + in-progress development between releases. As soon as 0.9.2 is + tagged, the version will be incremented in CVS to 0.9.3 where it + will stay until just before 0.9.4 is built, uploaded, and tagged. + + So, even-micro == a released version, odd-micro == something in-between. + +Libpixman dependency dropped +---------------------------- + * As of this release, the dependency on an internal libpixman has + been dropped. Instead, the code from libpixman needed for cairo has + been incorporated into the cairo source tree. The motivation for + this change is that while cairo's API is stable and ready to be + maintained after the 1.0 release, libpixman's API is not, so we do + not want to expose it at this time. + + Also, the incorporation of libpixman into cairo also renames all + previously-public libpixman symbols in order to avoid any conflict + with a future release of libpixman + +API additions +------------- + * Macros and functions have been added so that the version of cairo + can be queried at either compile-time or at run-time. The version + is made available as both a human-readable string and as a single + integer: + + CAIRO_VERSION_STRING eg. "0.9.2" + CAIRO_VERSION eg. 000902 + + const char* + cairo_version_string (void); /* eg. "0.9.2" */ + + int + cairo_version (void); /* eg. 000902 */ + + A macro is provided to convert a three-part component version into + the encoded single-integer form: + + CAIRO_VERSION_ENCODE(X,Y,Z) + + For example, the CAIRO_VERSION value of 000902 is obtained as + CAIRO_VERSION_ENCODE(0,9,2). The intent is to make version + comparisons easy, either at compile-time: + + #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(0,9,2) + ... + #endif + + Or at run-time: + + if (cairo_version() >= CAIRO_VERSION_ENCODE(0,9,2)) { /* ... */ } + +Thread safety +------------- + * This release adds pthread-based locking (when available) to make + the caches used by cairo safe for threaded programs. Some may + remember a failed experiment with this locking between the 0.5.1 + and 0.5.2 snapshots, (where even single-threaded programs that + linked with -lpthread would deadlock). We believe that that problem + has been fixed, so we are looking forward to testing and reports + from users with threaded applications. + +Bug fixes +--------- + * The XCB and Quartz backends failed to compiled in the 0.9.0 release + due to minor syntax errors. These have now been fixed. + + * Various crashes in glitz and pixman due to size 0 glyphs have been + fixed. + +Release 0.9.0 (2005-08-08 Carl Worth <cworth@cworth.org>) +========================================================= +Soname change +------------- + * In all prior snapshots, the libtool library versioning was set to + 1:0:0. As this release is intended to mark the beginning of + backwards-compatible releases, the versioning has been incremented + to 2:0:0. You will notice that the numeric extension on the + installed library filename will change similarly. + + This change will also require all cairo-using applications to be + recompiled. We recognize that this may cause some frustration since + this release is backwards-compatible with 0.6.0 and in that sense + "shouldn't" require re-compilation. However, since all historical + snapshots have used the same 1:0:0 version in spite of incompatible + API changes between them, it was essential that the upcoming 1.0 + release series have distinct library versioning. + + All future releases will use the library versioning to properly + indicate compatibility between releases. So, any application + re-compiled now to work with the 0.9.0 will not need to be + recompiled when a compatible 1.0 release of cairo is made in the + future. + +API additions +------------- + * Add new function calls to set/get the current antialiasing mode in + the graphics state: + + cairo_set_antialias + cairo_get_antialias + + This call accepts the same modes recently added for font options + (NONE or GRAY) but affects the rendering of geometry other than + text. The intent of this call is to enable more precise control of + which pixels are affected by each operation, for example to allow + for full-scene antialiasing for seam-free rendering. It is not + expected that non-antialiased rendering will perform better than + anti-aliased rendering. + + * Three new functions were added to provide support for mixed cairo- + and non-cairo drawing to the same surface: + + cairo_surface_mark_dirty + cairo_surface_mark_dirty_rectangle + cairo_surface_flush + + * The return type of the several "reference" functions was change, + (API compatibly), from void to the same type as the argument. The + affected functions are: + + cairo_font_face_reference + cairo_scaled_font_reference + cairo_pattern_reference + cairo_surface_reference + cairo_reference + + This allows a convenient way to assign and reference in a single + statement. + +Semantic changes +---------------- + * The behavior of cairo_set_source with a pattern with a non-identity + matrix was previously not well-defined. The new behavior is as + follows: + + The pattern's transformation matrix will be locked to the + user space in effect at the time of cairo_set_source(). This means + that further modifications of the CTM will not affect the source + pattern. + +cairo-win32 +----------- + * Some portability improvements, (eg. workaround for missing stdint.h). + +cairo-ft +-------- + * Updated to allow compilation with older versions of freetype. + +Bug fixes +--------- + * Fix the unbounded operators to actually produce a correct result, + (previously the results were artificially restricted to the + bounding box of whatever shape was being drawn rather than + extending out infinitely). The fixed operators are: + + CAIRO_OPERATOR_CLEAR + CAIRO_OPERATOR_SOURCE + CAIRO_OPERATOR_OUT + CAIRO_OPERATOR_IN + CAIRO_OPERATOR_DEST_IN + CAIRO_OPERATOR_DEST_ATOP + + * Fix cairo_mask and cairo_mask_surface to transform the mask by the + current transformation matrix (CTM). + + * Fix cairo_set_source to lock the CTM used to transform the pattern. + + * Workaround for X server Render bug involving repeating patterns + with a general transformation matrix. + + * cairo_get_font_face fixed to return a "nil" font face object rather + than NULL on error. + + * cairo_set_font_face fixed to not crash if given a NULL font face, + (which is the documented interface for restoring the default font + face). + + * Fix xlib glyphset caching to not try to free a NULL glyph. + Snapshot 0.6.0 (2005-07-28 Carl Worth <cworth@cworth.org>) ========================================================== API changes @@ -125,7 +311,7 @@ API additions cairo_xlib_surface_set_drawable - which allos the target drawable for an xlib cairo_surface_t to be + which allows the target drawable for an xlib cairo_surface_t to be changed to another with the same format, screen, and display. This is necessary in certain double-buffering techniques. @@ -190,7 +376,7 @@ Bug fixes * Fix glyph caches to not eject entries that might be immediately needed, (fixing intermittent crashes when rendering text). -* Fix all memory leaks found by running "make check-valigrind". +* Fix all memory leaks found by running "make check-valgrind". ATSUI backend changes --------------------- @@ -1132,7 +1318,7 @@ close_path). The cairo_current_path_flat function does not accept a curve_to callback. Instead, all curved portions of the path will be converted to line segments, (within the current tolerance value). This can be handy for doing things like text-on-path without having to -manually interpolate bezier splines. +manually interpolate Bézier splines. New XCB backend --------------- @@ -10,12 +10,12 @@ Changes that are expected to impact the public API Backwards compatible (API additions only) ----------------------------------------- cairo_begin_group, cairo_end_group, cairo_get_group - cairo_surface_mark_dirty (see below for details) - Add support for non-antialiased rendering. API ? +PDR C cairo_surface_mark_dirty (see below for details) +PDRTC Add support for non-antialiased rendering + API Add CAIRO_FILL_RULE_INVERSE_WINDING and CAIRO_FILL_RULE_INVERSE_EVEN_ODD Add cairo_text_glyphs (see below for details) Add support for programmatic patterns, (ie. arbitrary gradients) - Add cairo_arc_to. +P Add cairo_arc_to. Add support for custom caps (see below for details) Add support for getting at image data from image surface Add CAIRO_STATUS_DESTROYED @@ -25,29 +25,12 @@ Backwards incompatible (API deletions or changes) ------------------------------------------------- PDR C cairo_surface_finish, cairo_surface_flush PDR C A hidden offset for the xlib backend -P Consistent error handling for all objects - Split cairo_format_t (see below for details) +PDR C Consistent error handling for all objects +PDRTC Split cairo_format_t (see below for details) P---C Remove cairo_status_string in favor of cairo_status_to_string Details on some of the above changes ------------------------------------ -* cairo_surface_mark_dirty - - One question is what the function should accept. A single - device-space rectangle seems like a consistent approach. That would - allow us to avoid needing backend-specific functions with - backend-specific region datatypes, (cf. clipping support) - - In order to get the intended efficiency benefits, we'll need to make - two changes: - - 1) In the fallback code, never fetch any data from the clean - region. - - 2) Mark clean any region drawn with device-pixel aligned - rectangles, (cairo_paint with no clip is the most iportant - one here). - * cairo_text_glyphs: It would function as a sort of bridge between the toy and the @@ -78,51 +61,13 @@ Details on some of the above changes current path. We may also need to provide the coordinates of the faces of every dash as well. -* split cairo_format_t into two things: - - - An enumeration that determines the "capabilities" of a surface - - A vs. ARGB. vs. RGB - - An enumeration that determines a specific in-memory representation - of data. (A1/A8/ARGB32/etc.. Could be extensible to things like - RGBA32_BYTES_NONPREMULTIPLIED. Some consistent naming convention would - be be good.) - - One issue here is that some interfaces, like cairo_surface_create_similar() - might be useful with either one. We might want to create an A1 surface - compatible with the backend (are there examples other than A1? Should - bilevel just be another "capability"?), or we might want to just create - an alpha surface without caring about the depth. - - If we want to support this, we could do something like: - - typedef enum cairo_pixel_format_t { - CAIRO_PIXEL_FORMAT_A8 = CAIRO_FORMAT_ALPHA, - CAIRO_PIXEL_FORMAT_RGB24 = CAIRO_FORMAT_RGB, - CAIRO_PIXEL_FORMAT_A1, - }; - - To allow passing either in. - - (I don't particularly like this idea for create_similar() because then you - aren't really saying ALPHA-dont-care, you are saying ALPHA-8. I think it - would be better to have a separate path for create_similar_with_pixel_format() - if we need that. But it might be useful for cairo_image_surface_create() ... - people are going to screw up and pass CAIRO_FORMAT_RGB into that, and if it - "just worked" that would save people trouble....) - Changes that do not affect the public API ========================================= -* Clean up the cache code a bit, (there is at least one redundant - level of cacheing, and there are some minor style issues). - * Fix clipping to work for all operators. The equation we have come up with is: ((src Op dest) In clip) Add (dest Out clip) -* Make a more interesting PS backend, (other than the current - "giant-image for every page" approach). - * Change stroke code to go through one giant polygon. This will fix problems with stroking self-intersecting paths. @@ -6563,18 +6563,6 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 8 - -# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. -AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) - # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 diff --git a/cairo.pc.in b/cairo.pc.in index 2cd0ff1..d9af8b2 100644 --- a/cairo.pc.in +++ b/cairo.pc.in @@ -7,6 +7,6 @@ Name: cairo Description: Multi-platform 2D graphics library Version: @VERSION@ -Requires: @FREETYPE_REQUIRES@ libpixman @XRENDER_REQUIRES@ @PNG_REQUIRES@ @GLITZ_REQUIRES@ +@PKGCONFIG_REQUIRES@: @FREETYPE_REQUIRES@ @XRENDER_REQUIRES@ @PNG_REQUIRES@ @GLITZ_REQUIRES@ Libs: @FREETYPE_LIBS@ -L${libdir} -lcairo Cflags: @FREETYPE_CFLAGS@ -I${includedir}/cairo diff --git a/config.h.in b/config.h.in index cedbee9..91a2f9f 100644 --- a/config.h.in +++ b/config.h.in @@ -3,6 +3,12 @@ /* Define to 1 if you have the <dlfcn.h> header file. */ #undef HAVE_DLFCN_H +/* Define to 1 if you have the `FcFini' function. */ +#undef HAVE_FCFINI + +/* FT_Bitmap_Size structure includes y_ppem field */ +#undef HAVE_FT_BITMAP_SIZE_Y_PPEM + /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H @@ -48,6 +54,9 @@ /* Define to 1 if you have the `vasnprintf' function. */ #undef HAVE_VASNPRINTF +/* Define to 1 if you have the `XrmFinalize' function. */ +#undef HAVE_XRMFINALIZE + /* Name of package */ #undef PACKAGE @@ -1,6 +1,8 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59. +# Generated by GNU Autoconf 2.59 for cairo 0.9.2. +# +# Report bugs to <http://bugs.freedesktop.org/enter_bug.cgi?product=cairo>. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation @@ -419,11 +421,11 @@ SHELL=${CONFIG_SHELL-/bin/sh} : ${ac_max_here_lines=38} # Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= +PACKAGE_NAME='cairo' +PACKAGE_TARNAME='cairo' +PACKAGE_VERSION='0.9.2' +PACKAGE_STRING='cairo 0.9.2' +PACKAGE_BUGREPORT='http://bugs.freedesktop.org/enter_bug.cgi?product=cairo' ac_unique_file="src/cairo.h" # Factoring default headers for most tests. @@ -463,7 +465,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION_INFO INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG XRENDER_CFLAGS XRENDER_LIBS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS CAIRO_HAS_XLIB_SURFACE_TRUE CAIRO_HAS_XLIB_SURFACE_FALSE XLIB_SURFACE_FEATURE XRENDER_REQUIRES CAIRO_HAS_QUARTZ_SURFACE_TRUE CAIRO_HAS_QUARTZ_SURFACE_FALSE QUARTZ_SURFACE_FEATURE XCB_CFLAGS XCB_LIBS CAIRO_HAS_XCB_SURFACE_TRUE CAIRO_HAS_XCB_SURFACE_FALSE XCB_SURFACE_FEATURE CAIRO_HAS_WIN32_SURFACE_TRUE CAIRO_HAS_WIN32_SURFACE_FALSE WIN32_SURFACE_FEATURE CAIRO_HAS_WIN32_FONT_TRUE CAIRO_HAS_WIN32_FONT_FALSE WIN32_FONT_FEATURE PNG_CFLAGS PNG_LIBS CAIRO_HAS_PNG_FUNCTIONS_TRUE CAIRO_HAS_PNG_FUNCTIONS_FALSE PNG_FUNCTIONS_FEATURE PNG_REQUIRES GLITZ_CFLAGS GLITZ_LIBS CAIRO_HAS_GLITZ_SURFACE_TRUE CAIRO_HAS_GLITZ_SURFACE_FALSE GLITZ_SURFACE_FEATURE GLITZ_REQUIRES PIXMAN_CFLAGS PIXMAN_LIBS FONTCONFIG_CFLAGS FONTCONFIG_LIBS FREETYPE_CONFIG FREETYPE_CFLAGS FREETYPE_LIBS FREETYPE_REQUIRES CAIRO_HAS_FT_FONT_TRUE CAIRO_HAS_FT_FONT_FALSE FT_FONT_FEATURE CAIRO_HAS_PS_SURFACE_TRUE CAIRO_HAS_PS_SURFACE_FALSE PS_SURFACE_FEATURE PS_LIBS CAIRO_HAS_PDF_SURFACE_TRUE CAIRO_HAS_PDF_SURFACE_FALSE PDF_SURFACE_FEATURE PDF_LIBS CAIRO_HAS_ATSUI_FONT_TRUE CAIRO_HAS_ATSUI_FONT_FALSE ATSUI_FONT_FEATURE CAIRO_CFLAGS CAIRO_LIBS HTML_DIR ENABLE_GTK_DOC_TRUE ENABLE_GTK_DOC_FALSE GTK_DOC_USE_LIBTOOL_TRUE GTK_DOC_USE_LIBTOOL_FALSE LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar VERSION_INFO CAIRO_VERSION_MAJOR CAIRO_VERSION_MINOR CAIRO_VERSION_MICRO CAIRO_VERSION_OTHER MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL PKG_CONFIG XRENDER_CFLAGS XRENDER_LIBS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS CAIRO_HAS_XLIB_SURFACE_TRUE CAIRO_HAS_XLIB_SURFACE_FALSE XLIB_SURFACE_FEATURE XRENDER_REQUIRES CAIRO_HAS_QUARTZ_SURFACE_TRUE CAIRO_HAS_QUARTZ_SURFACE_FALSE QUARTZ_SURFACE_FEATURE XCB_CFLAGS XCB_LIBS CAIRO_HAS_XCB_SURFACE_TRUE CAIRO_HAS_XCB_SURFACE_FALSE XCB_SURFACE_FEATURE CAIRO_HAS_WIN32_SURFACE_TRUE CAIRO_HAS_WIN32_SURFACE_FALSE WIN32_SURFACE_FEATURE CAIRO_HAS_WIN32_FONT_TRUE CAIRO_HAS_WIN32_FONT_FALSE WIN32_FONT_FEATURE PNG_CFLAGS PNG_LIBS CAIRO_HAS_PNG_FUNCTIONS_TRUE CAIRO_HAS_PNG_FUNCTIONS_FALSE PNG_FUNCTIONS_FEATURE PNG_REQUIRES GLITZ_CFLAGS GLITZ_LIBS CAIRO_HAS_GLITZ_SURFACE_TRUE CAIRO_HAS_GLITZ_SURFACE_FALSE GLITZ_SURFACE_FEATURE GLITZ_REQUIRES FONTCONFIG_CFLAGS FONTCONFIG_LIBS FREETYPE_CONFIG FREETYPE_CFLAGS FREETYPE_LIBS FREETYPE_REQUIRES CAIRO_HAS_FT_FONT_TRUE CAIRO_HAS_FT_FONT_FALSE FT_FONT_FEATURE HAVE_PTHREAD_TRUE HAVE_PTHREAD_FALSE CAIRO_HAS_PS_SURFACE_TRUE CAIRO_HAS_PS_SURFACE_FALSE PS_SURFACE_FEATURE PS_LIBS CAIRO_HAS_PDF_SURFACE_TRUE CAIRO_HAS_PDF_SURFACE_FALSE PDF_SURFACE_FEATURE PDF_LIBS CAIRO_HAS_ATSUI_FONT_TRUE CAIRO_HAS_ATSUI_FONT_FALSE ATSUI_FONT_FEATURE CAIRO_CFLAGS CAIRO_LIBS HTML_DIR ENABLE_GTK_DOC_TRUE ENABLE_GTK_DOC_FALSE GTK_DOC_USE_LIBTOOL_TRUE GTK_DOC_USE_LIBTOOL_FALSE PKGCONFIG_REQUIRES LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -952,7 +954,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. +\`configure' configures cairo 0.9.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1021,7 +1023,9 @@ _ACEOF fi if test -n "$ac_init_help"; then - + case $ac_init_help in + short | recursive ) echo "Configuration of cairo 0.9.2:";; + esac cat <<\_ACEOF Optional Features: @@ -1078,6 +1082,7 @@ Some influential environment variables: Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. +Report bugs to <http://bugs.freedesktop.org/enter_bug.cgi?product=cairo>. _ACEOF fi @@ -1173,6 +1178,8 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF +cairo configure 0.9.2 +generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation @@ -1185,7 +1192,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by $as_me, which was +It was created by cairo $as_me 0.9.2, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1515,26 +1522,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -# Package version number, (as distinct from shared library version) -CAIRO_VERSION=0.6.0 -# libtool shared library version -# Increment if the interface has additions, changes, removals. -LT_CURRENT=1 -# Increment any time the source changes; set to -# 0 if you increment CURRENT -LT_REVISION=0 -# Increment if any interfaces have been added; set to 0 -# if any interfaces have been removed. removal has -# precedence over adding, so set to 0 if both happened. -LT_AGE=0 -VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE" + ac_config_headers="$ac_config_headers config.h" am__api_version="1.9" ac_aux_dir= @@ -1842,8 +1837,8 @@ fi # Define the identity of the package. - PACKAGE=cairo - VERSION=$CAIRO_VERSION + PACKAGE='cairo' + VERSION='0.9.2' cat >>confdefs.h <<_ACEOF @@ -1973,7 +1968,31 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' - ac_config_headers="$ac_config_headers config.h" + + +# libtool shared library version + +# Increment if the interface has additions, changes, removals. +LT_CURRENT=3 + +# Increment any time the source changes; set to +# 0 if you increment CURRENT +LT_REVISION=1 + +# Increment if any interfaces have been added; set to 0 +# if any interfaces have been removed. removal has +# precedence over adding, so set to 0 if both happened. +LT_AGE=1 + + +VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE" + +CAIRO_VERSION_MAJOR=0 +CAIRO_VERSION_MINOR=9 +CAIRO_VERSION_MICRO=2 + + + echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 @@ -3945,7 +3964,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3948 "configure"' > conftest.$ac_ext + echo '#line 3967 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -4468,9 +4487,9 @@ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >& echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## +## ---------------------------------------------------------------------- ## +## Report this to http://bugs.freedesktop.org/enter_bug.cgi?product=cairo ## +## ---------------------------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -5290,7 +5309,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5293:" \ +echo "$as_me:5312:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 @@ -6388,11 +6407,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6391: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6410: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6395: \$? = $ac_status" >&5 + echo "$as_me:6414: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -6650,11 +6669,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6653: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6672: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6657: \$? = $ac_status" >&5 + echo "$as_me:6676: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -6712,11 +6731,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6715: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6734: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6719: \$? = $ac_status" >&5 + echo "$as_me:6738: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8098,7 +8117,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 8101 "configure"' > conftest.$ac_ext + echo '#line 8120 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -8973,7 +8992,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 8976 "configure" +#line 8995 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -9071,7 +9090,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 9074 "configure" +#line 9093 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11319,11 +11338,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11322: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11341: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11326: \$? = $ac_status" >&5 + echo "$as_me:11345: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -11381,11 +11400,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11384: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11403: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11388: \$? = $ac_status" >&5 + echo "$as_me:11407: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11896,7 +11915,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 11899 "configure"' > conftest.$ac_ext + echo '#line 11918 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -12771,7 +12790,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 12774 "configure" +#line 12793 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12869,7 +12888,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 12872 "configure" +#line 12891 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13754,11 +13773,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13757: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13776: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13761: \$? = $ac_status" >&5 + echo "$as_me:13780: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13816,11 +13835,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13819: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13838: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13823: \$? = $ac_status" >&5 + echo "$as_me:13842: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15182,7 +15201,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 15185 "configure"' > conftest.$ac_ext + echo '#line 15204 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -15959,11 +15978,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15962: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15981: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15966: \$? = $ac_status" >&5 + echo "$as_me:15985: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16221,11 +16240,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16224: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16243: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:16228: \$? = $ac_status" >&5 + echo "$as_me:16247: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -16283,11 +16302,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:16286: $lt_compile\"" >&5) + (eval echo "\"\$as_me:16305: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:16290: \$? = $ac_status" >&5 + echo "$as_me:16309: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17669,7 +17688,7 @@ linux*) libsuff= case "$host_cpu" in x86_64*|s390x*|powerpc64*) - echo '#line 17672 "configure"' > conftest.$ac_ext + echo '#line 17691 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -18544,7 +18563,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 18547 "configure" +#line 18566 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -18642,7 +18661,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 18645 "configure" +#line 18664 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -20090,6 +20109,14 @@ esac +# _CHECK_FUNCS_WITH_FLAGS(FUNCTION..., CFLAGS, LIBS +# [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +# Like AC_CHECK_FUNCS but with additional CFLAGS and LIBS +# -------------------------------------------------------------------- + + + + for ac_func in vasnprintf do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` @@ -20971,9 +20998,9 @@ echo "$as_me: WARNING: X11/extensions/Xrender.h: proceeding with the preprocesso echo "$as_me: WARNING: X11/extensions/Xrender.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## +## ---------------------------------------------------------------------- ## +## Report this to http://bugs.freedesktop.org/enter_bug.cgi?product=cairo ## +## ---------------------------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -22156,6 +22183,116 @@ fi fi + + save_cflags="$CFLAGS" + save_libs="$LIBS" + CFLAGS="$CFLAGS $XRENDER_CFLAGS" + LIBS="$LIBS $XRENDER_LIBS" + +for ac_func in XrmFinalize +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + CFLAGS="$save_cflags" + LIBS="$save_libs" + fi @@ -22305,9 +22442,9 @@ echo "$as_me: WARNING: Carbon/Carbon.h: proceeding with the preprocessor's resul echo "$as_me: WARNING: Carbon/Carbon.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## +## ---------------------------------------------------------------------- ## +## Report this to http://bugs.freedesktop.org/enter_bug.cgi?product=cairo ## +## ---------------------------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -22818,108 +22955,6 @@ CAIRO_LIBS="$CAIRO_LIBS $GLITZ_LIBS" - - succeeded=no - - if test -z "$PKG_CONFIG"; then - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_PKG_CONFIG+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG - -if test -n "$PKG_CONFIG"; then - echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 -echo "${ECHO_T}$PKG_CONFIG" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - fi - - if test "$PKG_CONFIG" = "no" ; then - echo "*** The pkg-config script could not be found. Make sure it is" - echo "*** in your path, or set the PKG_CONFIG environment variable" - echo "*** to the full path to pkg-config." - echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." - else - PKG_CONFIG_MIN_VERSION=0.9.0 - if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then - echo "$as_me:$LINENO: checking for libpixman >= 0.1.5" >&5 -echo $ECHO_N "checking for libpixman >= 0.1.5... $ECHO_C" >&6 - - if $PKG_CONFIG --exists "libpixman >= 0.1.5" ; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - succeeded=yes - - echo "$as_me:$LINENO: checking PIXMAN_CFLAGS" >&5 -echo $ECHO_N "checking PIXMAN_CFLAGS... $ECHO_C" >&6 - PIXMAN_CFLAGS=`$PKG_CONFIG --cflags "libpixman >= 0.1.5"` - echo "$as_me:$LINENO: result: $PIXMAN_CFLAGS" >&5 -echo "${ECHO_T}$PIXMAN_CFLAGS" >&6 - - echo "$as_me:$LINENO: checking PIXMAN_LIBS" >&5 -echo $ECHO_N "checking PIXMAN_LIBS... $ECHO_C" >&6 - PIXMAN_LIBS=`$PKG_CONFIG --libs "libpixman >= 0.1.5"` - echo "$as_me:$LINENO: result: $PIXMAN_LIBS" >&5 -echo "${ECHO_T}$PIXMAN_LIBS" >&6 - else - PIXMAN_CFLAGS="" - PIXMAN_LIBS="" - ## If we have a custom action on failure, don't print errors, but - ## do set a variable so people can do so. - PIXMAN_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libpixman >= 0.1.5"` - echo $PIXMAN_PKG_ERRORS - fi - - - - else - echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." - echo "*** See http://www.freedesktop.org/software/pkgconfig" - fi - fi - - if test $succeeded = yes; then - : - else - { { echo "$as_me:$LINENO: error: Library requirements (libpixman >= 0.1.5) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5 -echo "$as_me: error: Library requirements (libpixman >= 0.1.5) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;} - { (exit 1); exit 1; }; } - fi - -CAIRO_CFLAGS="$CAIRO_CFLAGS $PIXMAN_CFLAGS" -CAIRO_LIBS="$CAIRO_LIBS $PIXMAN_LIBS" - - # Check whether --enable-freetype or --disable-freetype was given. if test "${enable_freetype+set}" = set; then enableval="$enable_freetype" @@ -23025,6 +23060,116 @@ echo "${ECHO_T}$FONTCONFIG_LIBS" >&6 use_freetype=no fi + + save_cflags="$CFLAGS" + save_libs="$LIBS" + CFLAGS="$CFLAGS $FONTCONFIG_CFLAGS" + LIBS="$LIBS $FONTCONFIG_LIBS" + +for ac_func in FcFini +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + CFLAGS="$save_cflags" + LIBS="$save_libs" + fi CAIRO_CFLAGS="$CAIRO_CFLAGS $FONTCONFIG_CFLAGS" @@ -23118,6 +23263,129 @@ echo "${ECHO_T}$FREETYPE_VERSION - OK" >&6 + + temp_save_libs="$LIBS" + temp_save_cflags="$CFLAGS" + LIBS="$LIBS $FREETYPE_LIBS" + CFLAGS="$CFLAGS $FREETYPE_CFLAGS" + echo "$as_me:$LINENO: checking for FT_Bitmap_Size.y_ppem" >&5 +echo $ECHO_N "checking for FT_Bitmap_Size.y_ppem... $ECHO_C" >&6 +if test "${ac_cv_member_FT_Bitmap_Size_y_ppem+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include<ft2build.h> + #include FT_FREETYPE_H + +int +main () +{ +static FT_Bitmap_Size ac_aggr; +if (ac_aggr.y_ppem) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_member_FT_Bitmap_Size_y_ppem=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include<ft2build.h> + #include FT_FREETYPE_H + +int +main () +{ +static FT_Bitmap_Size ac_aggr; +if (sizeof ac_aggr.y_ppem) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_member_FT_Bitmap_Size_y_ppem=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_member_FT_Bitmap_Size_y_ppem=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_member_FT_Bitmap_Size_y_ppem" >&5 +echo "${ECHO_T}$ac_cv_member_FT_Bitmap_Size_y_ppem" >&6 +if test $ac_cv_member_FT_Bitmap_Size_y_ppem = yes; then + HAVE_FT_BITMAP_SIZE_Y_PPEM=1 +else + HAVE_FT_BITMAP_SIZE_Y_PPEM=0 +fi + + +cat >>confdefs.h <<_ACEOF +#define HAVE_FT_BITMAP_SIZE_Y_PPEM $HAVE_FT_BITMAP_SIZE_Y_PPEM +_ACEOF + + LIBS="$temp_save_libs" + CFLAGS="$temp_save_cflags" fi CAIRO_CFLAGS="$CAIRO_CFLAGS $FREETYPE_CFLAGS" @@ -23139,10 +23407,6 @@ fi -# -# The FreeType backend uses pthread locking when avaialble -# - for ac_header in pthread.h do @@ -23265,9 +23529,9 @@ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >& echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## +## ---------------------------------------------------------------------- ## +## Report this to http://bugs.freedesktop.org/enter_bug.cgi?product=cairo ## +## ---------------------------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -23288,13 +23552,25 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF - + have_pthread=yes +else + have_pthread=no fi done +if test "x$have_pthread" = "xyes"; then + HAVE_PTHREAD_TRUE= + HAVE_PTHREAD_FALSE='#' +else + HAVE_PTHREAD_TRUE='#' + HAVE_PTHREAD_FALSE= +fi + + + # Check whether --enable-ps or --disable-ps was given. if test "${enable_ps+set}" = set; then enableval="$enable_ps" @@ -23493,9 +23769,9 @@ echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;} echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## +## ---------------------------------------------------------------------- ## +## Report this to http://bugs.freedesktop.org/enter_bug.cgi?product=cairo ## +## ---------------------------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -23708,9 +23984,9 @@ echo "$as_me: WARNING: Carbon/Carbon.h: proceeding with the preprocessor's resul echo "$as_me: WARNING: Carbon/Carbon.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## +## ---------------------------------------------------------------------- ## +## Report this to http://bugs.freedesktop.org/enter_bug.cgi?product=cairo ## +## ---------------------------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -23875,9 +24151,9 @@ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >& echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------------ ## -## Report this to the AC_PACKAGE_NAME lists. ## -## ------------------------------------------ ## +## ---------------------------------------------------------------------- ## +## Report this to http://bugs.freedesktop.org/enter_bug.cgi?product=cairo ## +## ---------------------------------------------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -24158,7 +24434,15 @@ fi - ac_config_files="$ac_config_files cairo.pc Makefile src/Makefile src/cairo-features.h test/Makefile doc/Makefile doc/public/Makefile" + +case `$PKG_CONFIG --version` in +0.?|0.10-7) PKGCONFIG_REQUIRES="Requires"; ;; +*) PKGCONFIG_REQUIRES="Requires.private"; ;; +esac + + + + ac_config_files="$ac_config_files cairo.pc Makefile pixman/Makefile pixman/src/Makefile src/Makefile src/cairo-features.h test/Makefile doc/Makefile doc/public/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -24334,6 +24618,13 @@ echo "$as_me: error: conditional \"CAIRO_HAS_FT_FONT\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${HAVE_PTHREAD_TRUE}" && test -z "${HAVE_PTHREAD_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"HAVE_PTHREAD\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"HAVE_PTHREAD\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi if test -z "${CAIRO_HAS_PS_SURFACE_TRUE}" && test -z "${CAIRO_HAS_PS_SURFACE_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"CAIRO_HAS_PS_SURFACE\" was never defined. Usually this means the macro was only invoked conditionally." >&5 @@ -24640,7 +24931,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by $as_me, which was +This file was extended by cairo $as_me 0.9.2, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -24703,7 +24994,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -config.status +cairo config.status 0.9.2 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -24815,6 +25106,8 @@ do # Handling of arguments. "cairo.pc" ) CONFIG_FILES="$CONFIG_FILES cairo.pc" ;; "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "pixman/Makefile" ) CONFIG_FILES="$CONFIG_FILES pixman/Makefile" ;; + "pixman/src/Makefile" ) CONFIG_FILES="$CONFIG_FILES pixman/src/Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/cairo-features.h" ) CONFIG_FILES="$CONFIG_FILES src/cairo-features.h" ;; "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; @@ -24907,7 +25200,6 @@ s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t -s,@VERSION_INFO@,$VERSION_INFO,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t @@ -24930,6 +25222,11 @@ s,@am__leading_dot@,$am__leading_dot,;t t s,@AMTAR@,$AMTAR,;t t s,@am__tar@,$am__tar,;t t s,@am__untar@,$am__untar,;t t +s,@VERSION_INFO@,$VERSION_INFO,;t t +s,@CAIRO_VERSION_MAJOR@,$CAIRO_VERSION_MAJOR,;t t +s,@CAIRO_VERSION_MINOR@,$CAIRO_VERSION_MINOR,;t t +s,@CAIRO_VERSION_MICRO@,$CAIRO_VERSION_MICRO,;t t +s,@CAIRO_VERSION_OTHER@,$CAIRO_VERSION_OTHER,;t t s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t s,@MAINT@,$MAINT,;t t @@ -25013,8 +25310,6 @@ s,@CAIRO_HAS_GLITZ_SURFACE_TRUE@,$CAIRO_HAS_GLITZ_SURFACE_TRUE,;t t s,@CAIRO_HAS_GLITZ_SURFACE_FALSE@,$CAIRO_HAS_GLITZ_SURFACE_FALSE,;t t s,@GLITZ_SURFACE_FEATURE@,$GLITZ_SURFACE_FEATURE,;t t s,@GLITZ_REQUIRES@,$GLITZ_REQUIRES,;t t -s,@PIXMAN_CFLAGS@,$PIXMAN_CFLAGS,;t t -s,@PIXMAN_LIBS@,$PIXMAN_LIBS,;t t s,@FONTCONFIG_CFLAGS@,$FONTCONFIG_CFLAGS,;t t s,@FONTCONFIG_LIBS@,$FONTCONFIG_LIBS,;t t s,@FREETYPE_CONFIG@,$FREETYPE_CONFIG,;t t @@ -25024,6 +25319,8 @@ s,@FREETYPE_REQUIRES@,$FREETYPE_REQUIRES,;t t s,@CAIRO_HAS_FT_FONT_TRUE@,$CAIRO_HAS_FT_FONT_TRUE,;t t s,@CAIRO_HAS_FT_FONT_FALSE@,$CAIRO_HAS_FT_FONT_FALSE,;t t s,@FT_FONT_FEATURE@,$FT_FONT_FEATURE,;t t +s,@HAVE_PTHREAD_TRUE@,$HAVE_PTHREAD_TRUE,;t t +s,@HAVE_PTHREAD_FALSE@,$HAVE_PTHREAD_FALSE,;t t s,@CAIRO_HAS_PS_SURFACE_TRUE@,$CAIRO_HAS_PS_SURFACE_TRUE,;t t s,@CAIRO_HAS_PS_SURFACE_FALSE@,$CAIRO_HAS_PS_SURFACE_FALSE,;t t s,@PS_SURFACE_FEATURE@,$PS_SURFACE_FEATURE,;t t @@ -25042,6 +25339,7 @@ s,@ENABLE_GTK_DOC_TRUE@,$ENABLE_GTK_DOC_TRUE,;t t s,@ENABLE_GTK_DOC_FALSE@,$ENABLE_GTK_DOC_FALSE,;t t s,@GTK_DOC_USE_LIBTOOL_TRUE@,$GTK_DOC_USE_LIBTOOL_TRUE,;t t s,@GTK_DOC_USE_LIBTOOL_FALSE@,$GTK_DOC_USE_LIBTOOL_FALSE,;t t +s,@PKGCONFIG_REQUIRES@,$PKGCONFIG_REQUIRES,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF diff --git a/configure.in b/configure.in index 27fe96f..a56da7e 100644 --- a/configure.in +++ b/configure.in @@ -1,33 +1,46 @@ AC_PREREQ(2.54) -AC_INIT(src/cairo.h) +# cairo package version number, (as distinct from shared library version) +# An odd micro number indicates in-progress development, (eg. from CVS) +# An even micro number indicates a released version. +m4_define(cairo_version_major, 0) +m4_define(cairo_version_minor, 9) +m4_define(cairo_version_micro, 2) + +AC_INIT([cairo], + cairo_version_major.cairo_version_minor.cairo_version_micro, + [http://bugs.freedesktop.org/enter_bug.cgi?product=cairo]) +AC_CONFIG_SRCDIR(src/cairo.h) +AC_CONFIG_HEADERS(config.h) +AM_INIT_AUTOMAKE([1.7]) dnl =========================================================================== -# Package version number, (as distinct from shared library version) -CAIRO_VERSION=0.6.0 - # libtool shared library version # Increment if the interface has additions, changes, removals. -LT_CURRENT=1 +LT_CURRENT=3 # Increment any time the source changes; set to # 0 if you increment CURRENT -LT_REVISION=0 +LT_REVISION=1 # Increment if any interfaces have been added; set to 0 # if any interfaces have been removed. removal has # precedence over adding, so set to 0 if both happened. -LT_AGE=0 - -VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE" -AC_SUBST(VERSION_INFO) +LT_AGE=1 dnl =========================================================================== -AM_INIT_AUTOMAKE(cairo, $CAIRO_VERSION) -AM_CONFIG_HEADER(config.h) +VERSION_INFO="$LT_CURRENT:$LT_REVISION:$LT_AGE" +AC_SUBST(VERSION_INFO) +CAIRO_VERSION_MAJOR=cairo_version_major() +CAIRO_VERSION_MINOR=cairo_version_minor() +CAIRO_VERSION_MICRO=cairo_version_micro() +AC_SUBST(CAIRO_VERSION_MAJOR) +AC_SUBST(CAIRO_VERSION_MINOR) +AC_SUBST(CAIRO_VERSION_MICRO) +AC_SUBST(CAIRO_VERSION_OTHER) AM_MAINTAINER_MODE @@ -37,6 +50,27 @@ AM_PROG_LIBTOOL AC_STDC_HEADERS AC_C_BIGENDIAN +dnl =========================================================================== +dnl === Local macros +dnl =========================================================================== + +# _CHECK_FUNCS_WITH_FLAGS(FUNCTION..., CFLAGS, LIBS +# [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +# Like AC_CHECK_FUNCS but with additional CFLAGS and LIBS +# -------------------------------------------------------------------- +AC_DEFUN([_CHECK_FUNCS_WITH_FLAGS], +[ + save_cflags="$CFLAGS" + save_libs="$LIBS" + CFLAGS="$CFLAGS $2" + LIBS="$LIBS $3" + AC_CHECK_FUNCS($1, $4, $5) + CFLAGS="$save_cflags" + LIBS="$save_libs" +]) + +dnl =========================================================================== + AC_CHECK_FUNCS(vasnprintf) AC_CHECK_LIBM @@ -61,6 +95,7 @@ if test "x$use_xlib" = "xyes"; then XRENDER_LIBS="$X_LIBS -lXrender -lXext -lX11 $X_EXTRA_LIBS" use_xlib=yes], [ use_xlib="no (requires Xrender http://freedesktop.org/Software/xlibs)"])]) + _CHECK_FUNCS_WITH_FLAGS(XrmFinalize, $XRENDER_CFLAGS, $XRENDER_LIBS) fi AM_CONDITIONAL(CAIRO_HAS_XLIB_SURFACE, test "x$use_xlib" = "xyes") @@ -212,12 +247,6 @@ AC_SUBST(GLITZ_REQUIRES) dnl =========================================================================== -PKG_CHECK_MODULES(PIXMAN, libpixman >= 0.1.5) -CAIRO_CFLAGS="$CAIRO_CFLAGS $PIXMAN_CFLAGS" -CAIRO_LIBS="$CAIRO_LIBS $PIXMAN_LIBS" - -dnl =========================================================================== - AC_ARG_ENABLE(freetype, [ --disable-freetype Disable cairo's freetype font backend], [use_freetype=$enableval], [use_freetype=yes]) @@ -225,6 +254,7 @@ AC_ARG_ENABLE(freetype, if test "x$use_freetype" = "xyes"; then PKG_CHECK_MODULES(FONTCONFIG, fontconfig, [use_freetype=yes], [use_freetype=no]) + _CHECK_FUNCS_WITH_FLAGS(FcFini, $FONTCONFIG_CFLAGS, $FONTCONFIG_LIBS) fi CAIRO_CFLAGS="$CAIRO_CFLAGS $FONTCONFIG_CFLAGS" @@ -273,6 +303,20 @@ if test "x$use_freetype" = "xyes"; then AC_SUBST(FREETYPE_CFLAGS) AC_SUBST(FREETYPE_LIBS) AC_SUBST(FREETYPE_REQUIRES) + + temp_save_libs="$LIBS" + temp_save_cflags="$CFLAGS" + LIBS="$LIBS $FREETYPE_LIBS" + CFLAGS="$CFLAGS $FREETYPE_CFLAGS" + AC_CHECK_MEMBER(FT_Bitmap_Size.y_ppem, + HAVE_FT_BITMAP_SIZE_Y_PPEM=1, + HAVE_FT_BITMAP_SIZE_Y_PPEM=0, + [#include<ft2build.h> + #include FT_FREETYPE_H]) + AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,$HAVE_FT_BITMAP_SIZE_Y_PPEM, + [FT_Bitmap_Size structure includes y_ppem field]) + LIBS="$temp_save_libs" + CFLAGS="$temp_save_cflags" fi CAIRO_CFLAGS="$CAIRO_CFLAGS $FREETYPE_CFLAGS" @@ -286,11 +330,8 @@ AC_SUBST(FT_FONT_FEATURE) dnl =========================================================================== -# -# The FreeType backend uses pthread locking when avaialble -# - -AC_CHECK_HEADERS([pthread.h]) +AC_CHECK_HEADERS([pthread.h], have_pthread=yes, have_pthread=no) +AM_CONDITIONAL(HAVE_PTHREAD, test "x$have_pthread" = "xyes") dnl =========================================================================== @@ -388,9 +429,21 @@ dnl Check for gtk-doc and docbook GTK_DOC_CHECK([1.3]) +dnl =========================================================================== +dnl Check for recent pkg-config which supports Requires.private + +case `$PKG_CONFIG --version` in +0.?|0.1[0-7]) PKGCONFIG_REQUIRES="Requires"; ;; +*) PKGCONFIG_REQUIRES="Requires.private"; ;; +esac + +AC_SUBST(PKGCONFIG_REQUIRES) + AC_OUTPUT([ cairo.pc Makefile +pixman/Makefile +pixman/src/Makefile src/Makefile src/cairo-features.h test/Makefile diff --git a/doc/Makefile.in b/doc/Makefile.in index f45f736..513af2b 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -91,6 +91,10 @@ CAIRO_HAS_XCB_SURFACE_TRUE = @CAIRO_HAS_XCB_SURFACE_TRUE@ CAIRO_HAS_XLIB_SURFACE_FALSE = @CAIRO_HAS_XLIB_SURFACE_FALSE@ CAIRO_HAS_XLIB_SURFACE_TRUE = @CAIRO_HAS_XLIB_SURFACE_TRUE@ CAIRO_LIBS = @CAIRO_LIBS@ +CAIRO_VERSION_MAJOR = @CAIRO_VERSION_MAJOR@ +CAIRO_VERSION_MICRO = @CAIRO_VERSION_MICRO@ +CAIRO_VERSION_MINOR = @CAIRO_VERSION_MINOR@ +CAIRO_VERSION_OTHER = @CAIRO_VERSION_OTHER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -126,6 +130,8 @@ GLITZ_REQUIRES = @GLITZ_REQUIRES@ GLITZ_SURFACE_FEATURE = @GLITZ_SURFACE_FEATURE@ GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@ GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ +HAVE_PTHREAD_FALSE = @HAVE_PTHREAD_FALSE@ +HAVE_PTHREAD_TRUE = @HAVE_PTHREAD_TRUE@ HTML_DIR = @HTML_DIR@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -151,8 +157,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PDF_LIBS = @PDF_LIBS@ PDF_SURFACE_FEATURE = @PDF_SURFACE_FEATURE@ -PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ -PIXMAN_LIBS = @PIXMAN_LIBS@ +PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PNG_CFLAGS = @PNG_CFLAGS@ PNG_FUNCTIONS_FEATURE = @PNG_FUNCTIONS_FEATURE@ diff --git a/doc/public/Makefile.am b/doc/public/Makefile.am index a9faef8..fdd421c 100644 --- a/doc/public/Makefile.am +++ b/doc/public/Makefile.am @@ -20,6 +20,7 @@ CFILE_GLOB=$(top_srcdir)/src/*.c $(top_srcdir)/src/*.h # Headers to ignore IGNORE_HFILES= \ + cairo-clip-private.h \ cairo-features.h \ cairo-font-subset-private.h \ cairo-ft-private.h \ diff --git a/doc/public/Makefile.in b/doc/public/Makefile.in index 58292d8..8309e49 100644 --- a/doc/public/Makefile.in +++ b/doc/public/Makefile.in @@ -89,6 +89,10 @@ CAIRO_HAS_XCB_SURFACE_TRUE = @CAIRO_HAS_XCB_SURFACE_TRUE@ CAIRO_HAS_XLIB_SURFACE_FALSE = @CAIRO_HAS_XLIB_SURFACE_FALSE@ CAIRO_HAS_XLIB_SURFACE_TRUE = @CAIRO_HAS_XLIB_SURFACE_TRUE@ CAIRO_LIBS = @CAIRO_LIBS@ +CAIRO_VERSION_MAJOR = @CAIRO_VERSION_MAJOR@ +CAIRO_VERSION_MICRO = @CAIRO_VERSION_MICRO@ +CAIRO_VERSION_MINOR = @CAIRO_VERSION_MINOR@ +CAIRO_VERSION_OTHER = @CAIRO_VERSION_OTHER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -124,6 +128,8 @@ GLITZ_REQUIRES = @GLITZ_REQUIRES@ GLITZ_SURFACE_FEATURE = @GLITZ_SURFACE_FEATURE@ GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@ GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ +HAVE_PTHREAD_FALSE = @HAVE_PTHREAD_FALSE@ +HAVE_PTHREAD_TRUE = @HAVE_PTHREAD_TRUE@ HTML_DIR = @HTML_DIR@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -149,8 +155,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PDF_LIBS = @PDF_LIBS@ PDF_SURFACE_FEATURE = @PDF_SURFACE_FEATURE@ -PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ -PIXMAN_LIBS = @PIXMAN_LIBS@ +PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PNG_CFLAGS = @PNG_CFLAGS@ PNG_FUNCTIONS_FEATURE = @PNG_FUNCTIONS_FEATURE@ @@ -241,6 +246,7 @@ CFILE_GLOB = $(top_srcdir)/src/*.c $(top_srcdir)/src/*.h # Headers to ignore IGNORE_HFILES = \ + cairo-clip-private.h \ cairo-features.h \ cairo-font-subset-private.h \ cairo-ft-private.h \ diff --git a/doc/public/cairo-docs.xml b/doc/public/cairo-docs.xml index 729738a..3c894b5 100644 --- a/doc/public/cairo-docs.xml +++ b/doc/public/cairo-docs.xml @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> -<book lang="en" id="libglade" xmlns:xi="http://www.w3.org/2003/XInclude"> +<book lang="en" id="cairo" xmlns:xi="http://www.w3.org/2003/XInclude"> <title>Cairo: A Vector Graphics Library</title> <part> <title>Tutorial</title> @@ -13,7 +13,6 @@ <xi:include href="xml/cairo-pattern.xml"/> <xi:include href="xml/cairo-matrix.xml"/> <xi:include href="xml/cairo-font.xml"/> - <xi:include href="xml/cairo-atsui.xml"/> <xi:include href="xml/cairo-ft.xml"/> <xi:include href="xml/cairo-glitz.xml"/> <xi:include href="xml/cairo-pdf.xml"/> diff --git a/doc/public/cairo-sections.txt b/doc/public/cairo-sections.txt index 2e237b0..0c2fe4e 100644 --- a/doc/public/cairo-sections.txt +++ b/doc/public/cairo-sections.txt @@ -75,6 +75,7 @@ cairo_xcb_surface_create_with_xrender_format cairo_xlib_surface_create cairo_xlib_surface_create_for_bitmap cairo_xlib_surface_set_size +cairo_xlib_surface_set_drawable </SECTION> <SECTION> @@ -90,10 +91,14 @@ cairo_surface_t cairo_surface_create_similar cairo_surface_reference cairo_surface_destroy +cairo_surface_status cairo_surface_finish cairo_surface_get_font_options cairo_surface_set_user_data cairo_surface_get_user_data +cairo_surface_flush +cairo_surface_mark_dirty +cairo_surface_mark_dirty_rectangle cairo_surface_set_device_offset </SECTION> @@ -145,11 +150,13 @@ cairo_font_face_t cairo_scaled_font_t cairo_font_face_reference cairo_font_face_destroy +cairo_font_face_status cairo_font_face_get_user_data cairo_font_face_set_user_data cairo_scaled_font_create cairo_scaled_font_reference cairo_scaled_font_destroy +cairo_scaled_font_status cairo_font_extents_t cairo_scaled_font_extents cairo_text_extents_t @@ -162,7 +169,6 @@ cairo_font_options_status cairo_font_options_merge cairo_font_options_hash cairo_font_options_equal -cairo_antialias_t cairo_font_options_set_antialias cairo_font_options_get_antialias cairo_subpixel_order_t @@ -196,6 +202,8 @@ cairo_set_source_rgba cairo_set_source cairo_set_source_surface cairo_set_tolerance +cairo_antialias_t +cairo_set_antialias cairo_fill_rule_t cairo_set_fill_rule cairo_set_line_width @@ -265,6 +273,7 @@ cairo_glyph_path cairo_get_operator cairo_get_source cairo_get_tolerance +cairo_get_antialias cairo_get_current_point cairo_get_fill_rule cairo_get_line_width @@ -293,9 +302,8 @@ cairo_destroy_func_t cairo_user_data_key_t cairo_read_func_t cairo_write_func_t +cairo_debug_reset_static_data <SUBSECTION Private> -CAIRO_BEGIN_DECLS -CAIRO_END_DECLS cairo_current_font_extents cairo_get_font_extents cairo_current_operator @@ -358,4 +366,9 @@ cairo_set_target_quartz cairo_set_target_win32 cairo_set_target_xcb cairo_set_target_drawable +CAIRO_VERSION +CAIRO_VERSION_STRING +CAIRO_VERSION_ENCODE +cairo_version +cairo_version_string </SECTION> diff --git a/doc/public/html/bindings-patterns.html b/doc/public/html/bindings-patterns.html index 154fc79..3e7cc30 100644 --- a/doc/public/html/bindings-patterns.html +++ b/doc/public/html/bindings-patterns.html @@ -28,7 +28,9 @@ <p> The cairo C API allows for creating a number of different types of patterns. All of these different types of patterns map to - <a href="cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> + <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-t" +><span class="type">cairo_pattern_t</span></a> in C, but in an object oriented language, there should instead be a hierarchy of types. (The functions that should map to constructors for the various types are listed after the type, @@ -36,19 +38,41 @@ </p> <pre class="programlisting"> cairo_pattern_t - <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-matrix"><code class="function">cairo_pattern_set_matrix()</code></a> - <a href="cairo-cairo-pattern-t.html#cairo-pattern-get-matrix"><code class="function">cairo_pattern_get_matrix()</code></a> + <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-set-matrix" +><code class="function">cairo_pattern_set_matrix()</code></a> + <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-get-matrix" +><code class="function">cairo_pattern_get_matrix()</code></a> cairo_solid_pattern_t - cairo_surface_pattern_t (<a href="cairo-cairo-pattern-t.html#cairo-pattern-create-for-surface"><code class="function">cairo_pattern_create_for_surface()</code></a>) - <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-extend"><code class="function">cairo_pattern_set_extend()</code></a> - <a href="cairo-cairo-pattern-t.html#cairo-pattern-get-extend"><code class="function">cairo_pattern_get_extend()</code></a> - <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-filter"><code class="function">cairo_pattern_set_filter()</code></a> - <a href="cairo-cairo-pattern-t.html#cairo-pattern-get-filter"><code class="function">cairo_pattern_get_filter()</code></a> + cairo_surface_pattern_t (<a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-create-for-surface" +><code class="function">cairo_pattern_create_for_surface()</code></a>) + <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-set-extend" +><code class="function">cairo_pattern_set_extend()</code></a> + <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-get-extend" +><code class="function">cairo_pattern_get_extend()</code></a> + <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-set-filter" +><code class="function">cairo_pattern_set_filter()</code></a> + <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-get-filter" +><code class="function">cairo_pattern_get_filter()</code></a> cairo_gradient_t - <a href="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgb"><code class="function">cairo_pattern_add_color_stop_rgb()</code></a> - <a href="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgba"><code class="function">cairo_pattern_add_color_stop_rgba()</code></a> - cairo_linear_gradient_t (<a href="cairo-cairo-pattern-t.html#cairo-pattern-create-linear"><code class="function">cairo_pattern_create_linear()</code></a>) - cairo_radial_gradient_t (<a href="cairo-cairo-pattern-t.html#cairo-pattern-create-radial"><code class="function">cairo_pattern_create_radial()</code></a>) + <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgb" +><code class="function">cairo_pattern_add_color_stop_rgb()</code></a> + <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgba" +><code class="function">cairo_pattern_add_color_stop_rgba()</code></a> + cairo_linear_gradient_t (<a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-create-linear" +><code class="function">cairo_pattern_create_linear()</code></a>) + cairo_radial_gradient_t (<a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-create-radial" +><code class="function">cairo_pattern_create_radial()</code></a>) </pre> <p> </p> diff --git a/doc/public/html/cairo-Fonts.html b/doc/public/html/cairo-Fonts.html index b17c96c..471dd29 100644 --- a/doc/public/html/cairo-Fonts.html +++ b/doc/public/html/cairo-Fonts.html @@ -39,8 +39,10 @@ typedef <a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>; typedef <a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a>; -void <a href="cairo-Fonts.html#cairo-font-face-reference">cairo_font_face_reference</a> (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face); +<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* <a href="cairo-Fonts.html#cairo-font-face-reference">cairo_font_face_reference</a> + (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face); void <a href="cairo-Fonts.html#cairo-font-face-destroy">cairo_font_face_destroy</a> (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face); +<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-Fonts.html#cairo-font-face-status">cairo_font_face_status</a> (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face); void* <a href="cairo-Fonts.html#cairo-font-face-get-user-data">cairo_font_face_get_user_data</a> (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face, const <a href="cairo-cairo-t.html#cairo-user-data-key-t">cairo_user_data_key_t</a> *key); <a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-Fonts.html#cairo-font-face-set-user-data">cairo_font_face_set_user_data</a> @@ -53,8 +55,10 @@ void* <a href="cairo-Fonts.html#cairo-font-face-get-user-data">cairo_font_ const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *font_matrix, const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *ctm, const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options); -void <a href="cairo-Fonts.html#cairo-scaled-font-reference">cairo_scaled_font_reference</a> (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font); +<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a>* <a href="cairo-Fonts.html#cairo-scaled-font-reference">cairo_scaled_font_reference</a> + (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font); void <a href="cairo-Fonts.html#cairo-scaled-font-destroy">cairo_scaled_font_destroy</a> (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font); +<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-Fonts.html#cairo-scaled-font-status">cairo_scaled_font_status</a> (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font); <a href="cairo-Fonts.html#cairo-font-extents-t">cairo_font_extents_t</a>; void <a href="cairo-Fonts.html#cairo-scaled-font-extents">cairo_scaled_font_extents</a> (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font, <a href="cairo-Fonts.html#cairo-font-extents-t">cairo_font_extents_t</a> *extents); @@ -75,11 +79,10 @@ void <a href="cairo-Fonts.html#cairo-font-options-merge">cairo_font_optio unsigned long <a href="cairo-Fonts.html#cairo-font-options-hash">cairo_font_options_hash</a> (const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options); <a href="cairo-cairo-t.html#cairo-bool-t">cairo_bool_t</a> <a href="cairo-Fonts.html#cairo-font-options-equal">cairo_font_options_equal</a> (const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options, const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *other); -enum <a href="cairo-Fonts.html#cairo-antialias-t">cairo_antialias_t</a>; void <a href="cairo-Fonts.html#cairo-font-options-set-antialias">cairo_font_options_set_antialias</a> (<a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options, - <a href="cairo-Fonts.html#cairo-antialias-t">cairo_antialias_t</a> antialias); -<a href="cairo-Fonts.html#cairo-antialias-t">cairo_antialias_t</a> <a href="cairo-Fonts.html#cairo-font-options-get-antialias">cairo_font_options_get_antialias</a> + <a href="cairo-cairo-t.html#cairo-antialias-t">cairo_antialias_t</a> antialias); +<a href="cairo-cairo-t.html#cairo-antialias-t">cairo_antialias_t</a> <a href="cairo-Fonts.html#cairo-font-options-get-antialias">cairo_font_options_get_antialias</a> (const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options); enum <a href="cairo-Fonts.html#cairo-subpixel-order-t">cairo_subpixel_order_t</a>; void <a href="cairo-Fonts.html#cairo-font-options-set-subpixel-order">cairo_font_options_set_subpixel_order</a> @@ -102,17 +105,17 @@ void <a href="cairo-Fonts.html#cairo-font-options-set-hint-metrics">cairo </pre> </div> <div class="refsect1" lang="en"> -<a name="id2657406"></a><h2>Description</h2> +<a name="id2909546"></a><h2>Description</h2> <p> </p> </div> <div class="refsect1" lang="en"> -<a name="id2657418"></a><h2>Details</h2> +<a name="id2909557"></a><h2>Details</h2> <div class="refsect2" lang="en"> -<a name="id2657424"></a><h3> +<a name="id2909563"></a><h3> <a name="cairo-font-face-t"></a>cairo_font_face_t</h3> -<a class="indexterm" name="id2657434"></a><pre class="programlisting">typedef struct _cairo_font_face cairo_font_face_t; +<a class="indexterm" name="id2909574"></a><pre class="programlisting">typedef struct _cairo_font_face cairo_font_face_t; </pre> <p> A <a href="cairo-Fonts.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a> specifies all aspects of a font other @@ -127,9 +130,9 @@ directions) . A font face can be set on a <a href="cairo-cairo-t.html#cairo-t">< </div> <hr> <div class="refsect2" lang="en"> -<a name="id2657499"></a><h3> +<a name="id2909638"></a><h3> <a name="cairo-scaled-font-t"></a>cairo_scaled_font_t</h3> -<a class="indexterm" name="id2657509"></a><pre class="programlisting">typedef struct _cairo_scaled_font cairo_scaled_font_t; +<a class="indexterm" name="id2909648"></a><pre class="programlisting">typedef struct _cairo_scaled_font cairo_scaled_font_t; </pre> <p> A <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a> is a font scaled to a particular size and device @@ -142,9 +145,10 @@ to a scaled font to speed up the computation of metrics.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2657540"></a><h3> +<a name="id2909680"></a><h3> <a name="cairo-font-face-reference"></a>cairo_font_face_reference ()</h3> -<a class="indexterm" name="id2657550"></a><pre class="programlisting">void cairo_font_face_reference (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face);</pre> +<a class="indexterm" name="id2909689"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* cairo_font_face_reference + (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face);</pre> <p> Increases the reference count on <em class="parameter"><code>font_face</code></em> by one. This prevents <em class="parameter"><code>font_face</code></em> from being destroyed until a matching call to @@ -154,20 +158,28 @@ Increases the reference count on <em class="parameter"><code>font_face</code></e </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> -<tbody><tr> +<tbody> +<tr> <td> <span class="term"><em class="parameter"><code>font_face</code></em> :</span></td> <td> a <a href="cairo-Fonts.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a>, (may be NULL in which case this function does nothing). </td> -</tr></tbody> +</tr> +<tr> +<td> +<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> +<td> the referenced <a href="cairo-Fonts.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a>. +</td> +</tr> +</tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2657629"></a><h3> +<a name="id2907782"></a><h3> <a name="cairo-font-face-destroy"></a>cairo_font_face_destroy ()</h3> -<a class="indexterm" name="id2657638"></a><pre class="programlisting">void cairo_font_face_destroy (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face);</pre> +<a class="indexterm" name="id2907791"></a><pre class="programlisting">void cairo_font_face_destroy (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face);</pre> <p> Decreases the reference count on <em class="parameter"><code>font_face</code></em> by one. If the result is zero, then <em class="parameter"><code>font_face</code></em> and all associated resources are freed. @@ -187,9 +199,39 @@ See <a href="cairo-Fonts.html#cairo-font-face-reference"><code class="function"> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2607753"></a><h3> +<a name="id2907870"></a><h3> +<a name="cairo-font-face-status"></a>cairo_font_face_status ()</h3> +<a class="indexterm" name="id2907878"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_font_face_status (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face);</pre> +<p> +Checks whether an error has previously occurred for this +font face</p> +<p> + +</p> +<div class="variablelist"><table border="0"> +<col align="left" valign="top"> +<tbody> +<tr> +<td> +<span class="term"><em class="parameter"><code>font_face</code></em> :</span></td> +<td> a <a href="cairo-Fonts.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a> +</td> +</tr> +<tr> +<td> +<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> +<td> <code class="literal">CAIRO_STATUS_SUCCESS</code> or another error such as + <code class="literal">CAIRO_STATUS_NO_MEMORY</code>. +</td> +</tr> +</tbody> +</table></div> +</div> +<hr> +<div class="refsect2" lang="en"> +<a name="id2907959"></a><h3> <a name="cairo-font-face-get-user-data"></a>cairo_font_face_get_user_data ()</h3> -<a class="indexterm" name="id2607764"></a><pre class="programlisting">void* cairo_font_face_get_user_data (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face, +<a class="indexterm" name="id2907970"></a><pre class="programlisting">void* cairo_font_face_get_user_data (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face, const <a href="cairo-cairo-t.html#cairo-user-data-key-t">cairo_user_data_key_t</a> *key);</pre> <p> Return user data previously attached to <em class="parameter"><code>font_face</code></em> using the specified @@ -225,9 +267,9 @@ attached to </div> <hr> <div class="refsect2" lang="en"> -<a name="id2607880"></a><h3> +<a name="id2908086"></a><h3> <a name="cairo-font-face-set-user-data"></a>cairo_font_face_set_user_data ()</h3> -<a class="indexterm" name="id2607891"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_font_face_set_user_data +<a class="indexterm" name="id2908097"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_font_face_set_user_data (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face, const <a href="cairo-cairo-t.html#cairo-user-data-key-t">cairo_user_data_key_t</a> *key, void *user_data, @@ -280,9 +322,9 @@ slot could not be allocated for the user data. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2608070"></a><h3> +<a name="id2908276"></a><h3> <a name="cairo-scaled-font-create"></a>cairo_scaled_font_create ()</h3> -<a class="indexterm" name="id2608079"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a>* cairo_scaled_font_create +<a class="indexterm" name="id2908285"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a>* cairo_scaled_font_create (<a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face, const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *font_matrix, const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *ctm, @@ -339,9 +381,10 @@ be used.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2608252"></a><h3> +<a name="id2857706"></a><h3> <a name="cairo-scaled-font-reference"></a>cairo_scaled_font_reference ()</h3> -<a class="indexterm" name="id2608261"></a><pre class="programlisting">void cairo_scaled_font_reference (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre> +<a class="indexterm" name="id2857715"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a>* cairo_scaled_font_reference + (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre> <p> Increases the reference count on <em class="parameter"><code>scaled_font</code></em> by one. This prevents <em class="parameter"><code>scaled_font</code></em> from being destroyed until a matching call to @@ -351,20 +394,30 @@ Increases the reference count on <em class="parameter"><code>scaled_font</code>< </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> -<tbody><tr> +<tbody> +<tr> <td> <span class="term"><em class="parameter"><code>scaled_font</code></em> :</span></td> <td> a <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a>, (may be NULL in which case this function does nothing) </td> -</tr></tbody> +</tr> +<tr> +<td> +<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> +<td> + + +</td> +</tr> +</tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2608340"></a><h3> +<a name="id2857806"></a><h3> <a name="cairo-scaled-font-destroy"></a>cairo_scaled_font_destroy ()</h3> -<a class="indexterm" name="id2608350"></a><pre class="programlisting">void cairo_scaled_font_destroy (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre> +<a class="indexterm" name="id2857816"></a><pre class="programlisting">void cairo_scaled_font_destroy (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre> <p> Decreases the reference count on <em class="parameter"><code>font</code></em> by one. If the result is zero, then <em class="parameter"><code>font</code></em> and all associated resources are freed. @@ -384,9 +437,39 @@ See <a href="cairo-Fonts.html#cairo-scaled-font-reference"><code class="function </div> <hr> <div class="refsect2" lang="en"> -<a name="id2608430"></a><h3> +<a name="id2857895"></a><h3> +<a name="cairo-scaled-font-status"></a>cairo_scaled_font_status ()</h3> +<a class="indexterm" name="id2857904"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_scaled_font_status (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre> +<p> +Checks whether an error has previously occurred for this +scaled_font.</p> +<p> + +</p> +<div class="variablelist"><table border="0"> +<col align="left" valign="top"> +<tbody> +<tr> +<td> +<span class="term"><em class="parameter"><code>scaled_font</code></em> :</span></td> +<td> a <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a> +</td> +</tr> +<tr> +<td> +<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> +<td> <code class="literal">CAIRO_STATUS_SUCCESS</code> or another error such as + <code class="literal">CAIRO_STATUS_NO_MEMORY</code>. +</td> +</tr> +</tbody> +</table></div> +</div> +<hr> +<div class="refsect2" lang="en"> +<a name="id2857985"></a><h3> <a name="cairo-font-extents-t"></a>cairo_font_extents_t</h3> -<a class="indexterm" name="id2608439"></a><pre class="programlisting">typedef struct { +<a class="indexterm" name="id2857994"></a><pre class="programlisting">typedef struct { double ascent; double descent; double height; @@ -469,9 +552,9 @@ matrix), but otherwise will remain unchanged.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2608647"></a><h3> +<a name="id2858202"></a><h3> <a name="cairo-scaled-font-extents"></a>cairo_scaled_font_extents ()</h3> -<a class="indexterm" name="id2608657"></a><pre class="programlisting">void cairo_scaled_font_extents (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font, +<a class="indexterm" name="id2858211"></a><pre class="programlisting">void cairo_scaled_font_extents (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font, <a href="cairo-Fonts.html#cairo-font-extents-t">cairo_font_extents_t</a> *extents);</pre> <p> Gets the metrics for a <a href="cairo-Fonts.html#cairo-scaled-font-t"><span class="type">cairo_scaled_font_t</span></a>.</p> @@ -498,9 +581,9 @@ Gets the metrics for a <a href="cairo-Fonts.html#cairo-scaled-font-t"><span clas </div> <hr> <div class="refsect2" lang="en"> -<a name="id2608748"></a><h3> +<a name="id2858303"></a><h3> <a name="cairo-text-extents-t"></a>cairo_text_extents_t</h3> -<a class="indexterm" name="id2608757"></a><pre class="programlisting">typedef struct { +<a class="indexterm" name="id2858312"></a><pre class="programlisting">typedef struct { double x_bearing; double y_bearing; double width; @@ -574,9 +657,9 @@ but otherwise will remain unchanged.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2608937"></a><h3> +<a name="id2858492"></a><h3> <a name="cairo-scaled-font-glyph-extents"></a>cairo_scaled_font_glyph_extents ()</h3> -<a class="indexterm" name="id2608948"></a><pre class="programlisting">void cairo_scaled_font_glyph_extents (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font, +<a class="indexterm" name="id2858503"></a><pre class="programlisting">void cairo_scaled_font_glyph_extents (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font, <a href="cairo-cairo-t.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs, int num_glyphs, <a href="cairo-Fonts.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);</pre> @@ -617,9 +700,9 @@ but otherwise will remain unchanged.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2609058"></a><h3> +<a name="id2858612"></a><h3> <a name="cairo-font-options-t"></a>cairo_font_options_t</h3> -<a class="indexterm" name="id2609067"></a><pre class="programlisting">typedef struct _cairo_font_options cairo_font_options_t; +<a class="indexterm" name="id2858621"></a><pre class="programlisting">typedef struct _cairo_font_options cairo_font_options_t; </pre> <p> @@ -627,9 +710,9 @@ but otherwise will remain unchanged.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2609083"></a><h3> +<a name="id2858637"></a><h3> <a name="cairo-font-options-create"></a>cairo_font_options_create ()</h3> -<a class="indexterm" name="id2609092"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a>* cairo_font_options_create +<a class="indexterm" name="id2858647"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a>* cairo_font_options_create (void);</pre> <p> Allocates a new font options object with all options initialized @@ -653,9 +736,9 @@ Allocates a new font options object with all options initialized </div> <hr> <div class="refsect2" lang="en"> -<a name="id2609162"></a><h3> +<a name="id2858716"></a><h3> <a name="cairo-font-options-copy"></a>cairo_font_options_copy ()</h3> -<a class="indexterm" name="id2609171"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a>* cairo_font_options_copy +<a class="indexterm" name="id2858725"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a>* cairo_font_options_copy (const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *original);</pre> <p> Allocates a new font options object copying the option values from @@ -687,9 +770,9 @@ Allocates a new font options object copying the option values from </div> <hr> <div class="refsect2" lang="en"> -<a name="id2609272"></a><h3> +<a name="id2858827"></a><h3> <a name="cairo-font-options-destroy"></a>cairo_font_options_destroy ()</h3> -<a class="indexterm" name="id2609282"></a><pre class="programlisting">void cairo_font_options_destroy (<a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options);</pre> +<a class="indexterm" name="id2858836"></a><pre class="programlisting">void cairo_font_options_destroy (<a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options);</pre> <p> Destroys a <a href="cairo-Fonts.html#cairo-font-options-t"><span class="type">cairo_font_options_t</span></a> object created with with <a href="cairo-Fonts.html#cairo-font-options-create"><code class="function">cairo_font_options_create()</code></a> or <a href="cairo-Fonts.html#cairo-font-options-copy"><code class="function">cairo_font_options_copy()</code></a>.</p> @@ -708,9 +791,9 @@ Destroys a <a href="cairo-Fonts.html#cairo-font-options-t"><span class="type">ca </div> <hr> <div class="refsect2" lang="en"> -<a name="id2609361"></a><h3> +<a name="id2858916"></a><h3> <a name="cairo-font-options-status"></a>cairo_font_options_status ()</h3> -<a class="indexterm" name="id2609371"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_font_options_status (<a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options);</pre> +<a class="indexterm" name="id2858925"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_font_options_status (<a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options);</pre> <p> Checks whether an error has previously occurred for this font options object</p> @@ -737,9 +820,9 @@ font options object</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2609449"></a><h3> +<a name="id2859004"></a><h3> <a name="cairo-font-options-merge"></a>cairo_font_options_merge ()</h3> -<a class="indexterm" name="id2609458"></a><pre class="programlisting">void cairo_font_options_merge (<a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options, +<a class="indexterm" name="id2859013"></a><pre class="programlisting">void cairo_font_options_merge (<a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options, const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *other);</pre> <p> Merges non-default options from <em class="parameter"><code>other</code></em> into <em class="parameter"><code>options</code></em>, replacing @@ -769,9 +852,9 @@ of <code class="literal">CAIRO_OPERATION_OVER</code>.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2609572"></a><h3> +<a name="id2859126"></a><h3> <a name="cairo-font-options-hash"></a>cairo_font_options_hash ()</h3> -<a class="indexterm" name="id2609581"></a><pre class="programlisting">unsigned long cairo_font_options_hash (const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options);</pre> +<a class="indexterm" name="id2859135"></a><pre class="programlisting">unsigned long cairo_font_options_hash (const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options);</pre> <p> Compute a hash for the font options object; this value will be useful when storing an object containing a cairo_font_options_t @@ -801,9 +884,9 @@ in a hash table.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2609652"></a><h3> +<a name="id2859207"></a><h3> <a name="cairo-font-options-equal"></a>cairo_font_options_equal ()</h3> -<a class="indexterm" name="id2609661"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-bool-t">cairo_bool_t</a> cairo_font_options_equal (const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options, +<a class="indexterm" name="id2859216"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-bool-t">cairo_bool_t</a> cairo_font_options_equal (const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options, const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *other);</pre> <p> Compares two font options objects for equality.</p> @@ -836,61 +919,11 @@ Compares two font options objects for equality.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2609762"></a><h3> -<a name="cairo-antialias-t"></a>enum cairo_antialias_t</h3> -<a class="indexterm" name="id2609772"></a><pre class="programlisting">typedef enum _cairo_antialias { - CAIRO_ANTIALIAS_DEFAULT, - CAIRO_ANTIALIAS_NONE, - CAIRO_ANTIALIAS_GRAY, - CAIRO_ANTIALIAS_SUBPIXEL -} cairo_antialias_t; -</pre> -<p> -Specifies the type of antialiasing to do when rendering text.</p> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td> -<span class="term"><code class="literal">CAIRO_ANTIALIAS_DEFAULT</code></span></td> -<td> Use the default antialiasing for - the font subsystem and target device -</td> -</tr> -<tr> -<td> -<span class="term"><code class="literal">CAIRO_ANTIALIAS_NONE</code></span></td> -<td> Do no antialiasing of fonts; use bilevel text -</td> -</tr> -<tr> -<td> -<span class="term"><code class="literal">CAIRO_ANTIALIAS_GRAY</code></span></td> -<td> Perform single-color antialiasing (using - shades of gray for black text on a white background, for example). -</td> -</tr> -<tr> -<td> -<span class="term"><code class="literal">CAIRO_ANTIALIAS_SUBPIXEL</code></span></td> -<td> Perform antialiasing by taking - advantage of the order of subpixel elements on devices - such as LCD panels -</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2609866"></a><h3> +<a name="id2859317"></a><h3> <a name="cairo-font-options-set-antialias"></a>cairo_font_options_set_antialias ()</h3> -<a class="indexterm" name="id2609877"></a><pre class="programlisting">void cairo_font_options_set_antialias +<a class="indexterm" name="id2859328"></a><pre class="programlisting">void cairo_font_options_set_antialias (<a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options, - <a href="cairo-Fonts.html#cairo-antialias-t">cairo_antialias_t</a> antialias);</pre> + <a href="cairo-cairo-t.html#cairo-antialias-t">cairo_antialias_t</a> antialias);</pre> <p> Sets the antiliasing mode for the font options object. This specifies the type of antialiasing to do when rendering text.</p> @@ -917,9 +950,9 @@ specifies the type of antialiasing to do when rendering text.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2609957"></a><h3> +<a name="id2859407"></a><h3> <a name="cairo-font-options-get-antialias"></a>cairo_font_options_get_antialias ()</h3> -<a class="indexterm" name="id2609968"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-antialias-t">cairo_antialias_t</a> cairo_font_options_get_antialias +<a class="indexterm" name="id2859418"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-antialias-t">cairo_antialias_t</a> cairo_font_options_get_antialias (const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options);</pre> <p> Gets the antialising mode for the font options object.</p> @@ -946,9 +979,9 @@ Gets the antialising mode for the font options object.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2610036"></a><h3> +<a name="id2859486"></a><h3> <a name="cairo-subpixel-order-t"></a>enum cairo_subpixel_order_t</h3> -<a class="indexterm" name="id2610045"></a><pre class="programlisting">typedef enum _cairo_subpixel_order { +<a class="indexterm" name="id2859495"></a><pre class="programlisting">typedef enum _cairo_subpixel_order { CAIRO_SUBPIXEL_ORDER_DEFAULT, CAIRO_SUBPIXEL_ORDER_RGB, CAIRO_SUBPIXEL_ORDER_BGR, @@ -1006,9 +1039,9 @@ antialiasing mode of <code class="literal">CAIRO_ANTIALIAS_SUBPIXEL</code>.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2610162"></a><h3> +<a name="id2859613"></a><h3> <a name="cairo-font-options-set-subpixel-order"></a>cairo_font_options_set_subpixel_order ()</h3> -<a class="indexterm" name="id2610173"></a><pre class="programlisting">void cairo_font_options_set_subpixel_order +<a class="indexterm" name="id2859624"></a><pre class="programlisting">void cairo_font_options_set_subpixel_order (<a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options, <a href="cairo-Fonts.html#cairo-subpixel-order-t">cairo_subpixel_order_t</a> subpixel_order);</pre> <p> @@ -1040,9 +1073,9 @@ the display device when rendering with an antialiasing mode of </div> <hr> <div class="refsect2" lang="en"> -<a name="id2610267"></a><h3> +<a name="id2859717"></a><h3> <a name="cairo-font-options-get-subpixel-order"></a>cairo_font_options_get_subpixel_order ()</h3> -<a class="indexterm" name="id2610278"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-subpixel-order-t">cairo_subpixel_order_t</a> cairo_font_options_get_subpixel_order +<a class="indexterm" name="id2859729"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-subpixel-order-t">cairo_subpixel_order_t</a> cairo_font_options_get_subpixel_order (const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options);</pre> <p> Gets the subpixel order for the font options object. @@ -1070,9 +1103,9 @@ See the documentation for <a href="cairo-Fonts.html#cairo-subpixel-order-t"><spa </div> <hr> <div class="refsect2" lang="en"> -<a name="id2610353"></a><h3> +<a name="id2859804"></a><h3> <a name="cairo-hint-style-t"></a>enum cairo_hint_style_t</h3> -<a class="indexterm" name="id2610364"></a><pre class="programlisting">typedef enum _cairo_hint_style { +<a class="indexterm" name="id2859814"></a><pre class="programlisting">typedef enum _cairo_hint_style { CAIRO_HINT_STYLE_DEFAULT, CAIRO_HINT_STYLE_NONE, CAIRO_HINT_STYLE_SLIGHT, @@ -1133,9 +1166,9 @@ styles are supported by all font backends.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2610478"></a><h3> +<a name="id2859928"></a><h3> <a name="cairo-font-options-set-hint-style"></a>cairo_font_options_set_hint_style ()</h3> -<a class="indexterm" name="id2610489"></a><pre class="programlisting">void cairo_font_options_set_hint_style +<a class="indexterm" name="id2859940"></a><pre class="programlisting">void cairo_font_options_set_hint_style (<a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options, <a href="cairo-Fonts.html#cairo-hint-style-t">cairo_hint_style_t</a> hint_style);</pre> <p> @@ -1166,9 +1199,9 @@ See the documentation for <a href="cairo-Fonts.html#cairo-hint-style-t"><span cl </div> <hr> <div class="refsect2" lang="en"> -<a name="id2610577"></a><h3> +<a name="id2860028"></a><h3> <a name="cairo-font-options-get-hint-style"></a>cairo_font_options_get_hint_style ()</h3> -<a class="indexterm" name="id2610589"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-hint-style-t">cairo_hint_style_t</a> cairo_font_options_get_hint_style +<a class="indexterm" name="id2860040"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-hint-style-t">cairo_hint_style_t</a> cairo_font_options_get_hint_style (const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options);</pre> <p> Gets the hint style for font outlines for the font options object. @@ -1196,9 +1229,9 @@ See the documentation for <a href="cairo-Fonts.html#cairo-hint-style-t"><span cl </div> <hr> <div class="refsect2" lang="en"> -<a name="id2610666"></a><h3> +<a name="id2860116"></a><h3> <a name="cairo-hint-metrics-t"></a>enum cairo_hint_metrics_t</h3> -<a class="indexterm" name="id2610675"></a><pre class="programlisting">typedef enum _cairo_hint_metrics { +<a class="indexterm" name="id2860125"></a><pre class="programlisting">typedef enum _cairo_hint_metrics { CAIRO_HINT_METRICS_DEFAULT, CAIRO_HINT_METRICS_OFF, CAIRO_HINT_METRICS_ON @@ -1240,9 +1273,9 @@ will be laid out differently at different zoom factors.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2610752"></a><h3> +<a name="id2860203"></a><h3> <a name="cairo-font-options-set-hint-metrics"></a>cairo_font_options_set_hint_metrics ()</h3> -<a class="indexterm" name="id2610764"></a><pre class="programlisting">void cairo_font_options_set_hint_metrics +<a class="indexterm" name="id2860215"></a><pre class="programlisting">void cairo_font_options_set_hint_metrics (<a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options, <a href="cairo-Fonts.html#cairo-hint-metrics-t">cairo_hint_metrics_t</a> hint_metrics);</pre> <p> @@ -1273,9 +1306,9 @@ See the documentation for <a href="cairo-Fonts.html#cairo-hint-metrics-t"><span </div> <hr> <div class="refsect2" lang="en"> -<a name="id2610851"></a><h3> +<a name="id2860301"></a><h3> <a name="cairo-font-options-get-hint-metrics"></a>cairo_font_options_get_hint_metrics ()</h3> -<a class="indexterm" name="id2610862"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-hint-metrics-t">cairo_hint_metrics_t</a> cairo_font_options_get_hint_metrics +<a class="indexterm" name="id2860313"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-hint-metrics-t">cairo_hint_metrics_t</a> cairo_font_options_get_hint_metrics (const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options);</pre> <p> Gets the metrics hinting mode for the font options object. diff --git a/doc/public/html/cairo-FreeType-Fonts.html b/doc/public/html/cairo-FreeType-Fonts.html index f55f2bc..b8b0ff0 100644 --- a/doc/public/html/cairo-FreeType-Fonts.html +++ b/doc/public/html/cairo-FreeType-Fonts.html @@ -51,17 +51,17 @@ void <a href="cairo-FreeType-Fonts.html#cairo-ft-scaled-font-unlock-face" </pre> </div> <div class="refsect1" lang="en"> -<a name="id2625924"></a><h2>Description</h2> +<a name="id2902931"></a><h2>Description</h2> <p> </p> </div> <div class="refsect1" lang="en"> -<a name="id2625935"></a><h2>Details</h2> +<a name="id2902942"></a><h2>Details</h2> <div class="refsect2" lang="en"> -<a name="id2625942"></a><h3> +<a name="id2902948"></a><h3> <a name="cairo-ft-font-options-substitute"></a>cairo_ft_font_options_substitute ()</h3> -<a class="indexterm" name="id2625950"></a><pre class="programlisting">void cairo_ft_font_options_substitute +<a class="indexterm" name="id2902957"></a><pre class="programlisting">void cairo_ft_font_options_substitute (const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options, FcPattern *pattern);</pre> <p> @@ -93,9 +93,9 @@ before calling <code class="function">FcDefaultSubstitute()</code>.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2606983"></a><h3> +<a name="id2911623"></a><h3> <a name="cairo-ft-font-face-create-for-pattern"></a>cairo_ft_font_face_create_for_pattern ()</h3> -<a class="indexterm" name="id2606994"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* cairo_ft_font_face_create_for_pattern +<a class="indexterm" name="id2911634"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* cairo_ft_font_face_create_for_pattern (FcPattern *pattern);</pre> <p> Creates a new font face for the FreeType font backend based on a @@ -140,9 +140,9 @@ appropriately to reflect the options in a <a href="cairo-Fonts.html#cairo-font-o </div> <hr> <div class="refsect2" lang="en"> -<a name="id2611005"></a><h3> +<a name="id2866506"></a><h3> <a name="cairo-ft-font-face-create-for-ft-face"></a>cairo_ft_font_face_create_for_ft_face ()</h3> -<a class="indexterm" name="id2611016"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* cairo_ft_font_face_create_for_ft_face +<a class="indexterm" name="id2866517"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* cairo_ft_font_face_create_for_ft_face (FT_Face face, int load_flags);</pre> <p> @@ -192,9 +192,9 @@ and can be used with functions such as <code class="function">cairo_ft_font_lock </div> <hr> <div class="refsect2" lang="en"> -<a name="id2611220"></a><h3> +<a name="id2910607"></a><h3> <a name="cairo-ft-scaled-font-lock-face"></a>cairo_ft_scaled_font_lock_face ()</h3> -<a class="indexterm" name="id2611231"></a><pre class="programlisting">FT_Face cairo_ft_scaled_font_lock_face (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre> +<a class="indexterm" name="id2910618"></a><pre class="programlisting">FT_Face cairo_ft_scaled_font_lock_face (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre> <p> <code class="function">cairo_ft_font_lock_face()</code> gets the <span class="type">FT_Face</span> object from a FreeType backend font and scales it appropriately for the font. You must @@ -234,7 +234,7 @@ threaded application.)</p> <span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> <td> The <span class="type">FT_Face</span> object for <em class="parameter"><code>font</code></em>, scaled appropriately, or <code class="literal">NULL</code> if <em class="parameter"><code>scaled_font</code></em> is in an error state (see -<code class="function">cairo_scaled_font_status()</code>) or there is insufficient memory. +<a href="cairo-Fonts.html#cairo-scaled-font-status"><code class="function">cairo_scaled_font_status()</code></a>) or there is insufficient memory. </td> </tr> </tbody> @@ -242,9 +242,9 @@ or <code class="literal">NULL</code> if <em class="parameter"><code>scaled_font< </div> <hr> <div class="refsect2" lang="en"> -<a name="id2649899"></a><h3> +<a name="id2910849"></a><h3> <a name="cairo-ft-scaled-font-unlock-face"></a>cairo_ft_scaled_font_unlock_face ()</h3> -<a class="indexterm" name="id2649910"></a><pre class="programlisting">void cairo_ft_scaled_font_unlock_face +<a class="indexterm" name="id2910860"></a><pre class="programlisting">void cairo_ft_scaled_font_unlock_face (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre> <p> Releases a face obtained with <code class="function">cairo_ft_font_lock_face()</code>. See the diff --git a/doc/public/html/cairo-Glitz-backend.html b/doc/public/html/cairo-Glitz-backend.html index 60249db..7f89ac3 100644 --- a/doc/public/html/cairo-Glitz-backend.html +++ b/doc/public/html/cairo-Glitz-backend.html @@ -41,17 +41,17 @@ </pre> </div> <div class="refsect1" lang="en"> -<a name="id2622399"></a><h2>Description</h2> +<a name="id2882820"></a><h2>Description</h2> <p> </p> </div> <div class="refsect1" lang="en"> -<a name="id2652671"></a><h2>Details</h2> +<a name="id2912769"></a><h2>Details</h2> <div class="refsect2" lang="en"> -<a name="id2645347"></a><h3> +<a name="id2880302"></a><h3> <a name="cairo-glitz-surface-create"></a>cairo_glitz_surface_create ()</h3> -<a class="indexterm" name="id2613686"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_glitz_surface_create (glitz_surface_t *surface);</pre> +<a class="indexterm" name="id2868310"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_glitz_surface_create (glitz_surface_t *surface);</pre> <p> </p> diff --git a/doc/public/html/cairo-Microsoft-Windows-Backend.html b/doc/public/html/cairo-Microsoft-Windows-Backend.html index 54f1e9d..a7973a7 100644 --- a/doc/public/html/cairo-Microsoft-Windows-Backend.html +++ b/doc/public/html/cairo-Microsoft-Windows-Backend.html @@ -50,17 +50,17 @@ double <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-fon </pre> </div> <div class="refsect1" lang="en"> -<a name="id2651457"></a><h2>Description</h2> +<a name="id2877075"></a><h2>Description</h2> <p> </p> </div> <div class="refsect1" lang="en"> -<a name="id2651468"></a><h2>Details</h2> +<a name="id2877086"></a><h2>Details</h2> <div class="refsect2" lang="en"> -<a name="id2651474"></a><h3> +<a name="id2877092"></a><h3> <a name="cairo-win32-surface-create"></a>cairo_win32_surface_create ()</h3> -<a class="indexterm" name="id2651483"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_win32_surface_create (HDC hdc);</pre> +<a class="indexterm" name="id2877101"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_win32_surface_create (HDC hdc);</pre> <p> </p> @@ -86,9 +86,9 @@ double <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-fon </div> <hr> <div class="refsect2" lang="en"> -<a name="id2651539"></a><h3> +<a name="id2910998"></a><h3> <a name="cairo-win32-font-face-create-for-logfontw"></a>cairo_win32_font_face_create_for_logfontw ()</h3> -<a class="indexterm" name="id2651549"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* cairo_win32_font_face_create_for_logfontw +<a class="indexterm" name="id2911008"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* cairo_win32_font_face_create_for_logfontw (LOGFONTW *logfont);</pre> <p> Creates a new font for the Win32 font backend based on a @@ -122,9 +122,9 @@ and can be used with functions such as <a href="cairo-Microsoft-Windows-Backend. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2658006"></a><h3> +<a name="id2906602"></a><h3> <a name="cairo-win32-scaled-font-select-font"></a>cairo_win32_scaled_font_select_font ()</h3> -<a class="indexterm" name="id2658015"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_win32_scaled_font_select_font +<a class="indexterm" name="id2906611"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_win32_scaled_font_select_font (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font, HDC hdc);</pre> <p> @@ -175,9 +175,9 @@ the use of this function to preserve the original graphics state.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2658183"></a><h3> +<a name="id2906778"></a><h3> <a name="cairo-win32-scaled-font-done-font"></a>cairo_win32_scaled_font_done_font ()</h3> -<a class="indexterm" name="id2658195"></a><pre class="programlisting">void cairo_win32_scaled_font_done_font +<a class="indexterm" name="id2906790"></a><pre class="programlisting">void cairo_win32_scaled_font_done_font (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre> <p> Releases any resources allocated by <a href="cairo-Microsoft-Windows-Backend.html#cairo-win32-scaled-font-select-font"><code class="function">cairo_win32_scaled_font_select_font()</code></a></p> @@ -196,9 +196,9 @@ Releases any resources allocated by <a href="cairo-Microsoft-Windows-Backend.htm </div> <hr> <div class="refsect2" lang="en"> -<a name="id2607369"></a><h3> +<a name="id2907267"></a><h3> <a name="cairo-win32-scaled-font-get-metrics-factor"></a>cairo_win32_scaled_font_get_metrics_factor ()</h3> -<a class="indexterm" name="id2607381"></a><pre class="programlisting">double cairo_win32_scaled_font_get_metrics_factor +<a class="indexterm" name="id2907279"></a><pre class="programlisting">double cairo_win32_scaled_font_get_metrics_factor (<a href="cairo-Fonts.html#cairo-scaled-font-t">cairo_scaled_font_t</a> *scaled_font);</pre> <p> Gets a scale factor between logical coordinates in the coordinate diff --git a/doc/public/html/cairo-PDF-Backend.html b/doc/public/html/cairo-PDF-Backend.html index 626f5ee..1d514ee 100644 --- a/doc/public/html/cairo-PDF-Backend.html +++ b/doc/public/html/cairo-PDF-Backend.html @@ -51,17 +51,17 @@ void <a href="cairo-PDF-Backend.html#cairo-pdf-surface-set-dpi">cairo_pdf </pre> </div> <div class="refsect1" lang="en"> -<a name="id2653211"></a><h2>Description</h2> +<a name="id2877412"></a><h2>Description</h2> <p> </p> </div> <div class="refsect1" lang="en"> -<a name="id2653222"></a><h2>Details</h2> +<a name="id2877423"></a><h2>Details</h2> <div class="refsect2" lang="en"> -<a name="id2653228"></a><h3> +<a name="id2877429"></a><h3> <a name="cairo-pdf-surface-create"></a>cairo_pdf_surface_create ()</h3> -<a class="indexterm" name="id2653237"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_pdf_surface_create (const char *filename, +<a class="indexterm" name="id2911708"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_pdf_surface_create (const char *filename, double width_in_points, double height_in_points);</pre> <p> @@ -101,9 +101,9 @@ void <a href="cairo-PDF-Backend.html#cairo-pdf-surface-set-dpi">cairo_pdf </div> <hr> <div class="refsect2" lang="en"> -<a name="id2636330"></a><h3> +<a name="id2911806"></a><h3> <a name="cairo-pdf-surface-create-for-stream"></a>cairo_pdf_surface_create_for_stream ()</h3> -<a class="indexterm" name="id2636339"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_pdf_surface_create_for_stream +<a class="indexterm" name="id2911815"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_pdf_surface_create_for_stream (<a href="cairo-cairo-t.html#cairo-write-func-t">cairo_write_func_t</a> write_func, void *closure, double width_in_points, @@ -151,9 +151,9 @@ void <a href="cairo-PDF-Backend.html#cairo-pdf-surface-set-dpi">cairo_pdf </div> <hr> <div class="refsect2" lang="en"> -<a name="id2650115"></a><h3> +<a name="id2904532"></a><h3> <a name="cairo-pdf-surface-set-dpi"></a>cairo_pdf_surface_set_dpi ()</h3> -<a class="indexterm" name="id2650124"></a><pre class="programlisting">void cairo_pdf_surface_set_dpi (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, +<a class="indexterm" name="id2904541"></a><pre class="programlisting">void cairo_pdf_surface_set_dpi (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, double x_dpi, double y_dpi);</pre> <p> diff --git a/doc/public/html/cairo-PNG-Backend.html b/doc/public/html/cairo-PNG-Backend.html index 79cb417..4400730 100644 --- a/doc/public/html/cairo-PNG-Backend.html +++ b/doc/public/html/cairo-PNG-Backend.html @@ -51,17 +51,17 @@ </pre> </div> <div class="refsect1" lang="en"> -<a name="id2649260"></a><h2>Description</h2> +<a name="id2870476"></a><h2>Description</h2> <p> </p> </div> <div class="refsect1" lang="en"> -<a name="id2649271"></a><h2>Details</h2> +<a name="id2870487"></a><h2>Details</h2> <div class="refsect2" lang="en"> -<a name="id2649277"></a><h3> +<a name="id2870493"></a><h3> <a name="cairo-image-surface-create-from-png"></a>cairo_image_surface_create_from_png ()</h3> -<a class="indexterm" name="id2649286"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_image_surface_create_from_png +<a class="indexterm" name="id2870502"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_image_surface_create_from_png (const char *filename);</pre> <p> Creates a new image surface and initializes the contents to the @@ -96,9 +96,9 @@ CAIRO_STATUS_READ_ERROR </div> <hr> <div class="refsect2" lang="en"> -<a name="id2652067"></a><h3> +<a name="id2909364"></a><h3> <a name="cairo-image-surface-create-from-png-stream"></a>cairo_image_surface_create_from_png_stream ()</h3> -<a class="indexterm" name="id2652077"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_image_surface_create_from_png_stream +<a class="indexterm" name="id2909375"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_image_surface_create_from_png_stream (<a href="cairo-cairo-t.html#cairo-read-func-t">cairo_read_func_t</a> read_func, void *closure);</pre> <p> @@ -135,9 +135,9 @@ memory could not be allocated for the operation. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2652188"></a><h3> +<a name="id2907570"></a><h3> <a name="cairo-surface-write-to-png"></a>cairo_surface_write_to_png ()</h3> -<a class="indexterm" name="id2652197"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_surface_write_to_png (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, +<a class="indexterm" name="id2907578"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_surface_write_to_png (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, const char *filename);</pre> <p> Writes the contents of <em class="parameter"><code>surface</code></em> to a new file <em class="parameter"><code>filename</code></em> as a PNG @@ -176,9 +176,9 @@ while attempting to write the file. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2651723"></a><h3> +<a name="id2907682"></a><h3> <a name="cairo-surface-write-to-png-stream"></a>cairo_surface_write_to_png_stream ()</h3> -<a class="indexterm" name="id2651732"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_surface_write_to_png_stream +<a class="indexterm" name="id2907692"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_surface_write_to_png_stream (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, <a href="cairo-cairo-t.html#cairo-write-func-t">cairo_write_func_t</a> write_func, void *closure);</pre> diff --git a/doc/public/html/cairo-PS-Backend.html b/doc/public/html/cairo-PS-Backend.html index c2af444..af276b4 100644 --- a/doc/public/html/cairo-PS-Backend.html +++ b/doc/public/html/cairo-PS-Backend.html @@ -51,17 +51,17 @@ void <a href="cairo-PS-Backend.html#cairo-ps-surface-set-dpi">cairo_ps_su </pre> </div> <div class="refsect1" lang="en"> -<a name="id2625761"></a><h2>Description</h2> +<a name="id2908406"></a><h2>Description</h2> <p> </p> </div> <div class="refsect1" lang="en"> -<a name="id2625772"></a><h2>Details</h2> +<a name="id2908417"></a><h2>Details</h2> <div class="refsect2" lang="en"> -<a name="id2625778"></a><h3> +<a name="id2908423"></a><h3> <a name="cairo-ps-surface-create"></a>cairo_ps_surface_create ()</h3> -<a class="indexterm" name="id2625787"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_ps_surface_create (const char *filename, +<a class="indexterm" name="id2908432"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_ps_surface_create (const char *filename, double width_in_points, double height_in_points);</pre> <p> @@ -101,9 +101,9 @@ void <a href="cairo-PS-Backend.html#cairo-ps-surface-set-dpi">cairo_ps_su </div> <hr> <div class="refsect2" lang="en"> -<a name="id2651919"></a><h3> +<a name="id2907019"></a><h3> <a name="cairo-ps-surface-create-for-stream"></a>cairo_ps_surface_create_for_stream ()</h3> -<a class="indexterm" name="id2651928"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_ps_surface_create_for_stream +<a class="indexterm" name="id2907028"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_ps_surface_create_for_stream (<a href="cairo-cairo-t.html#cairo-write-func-t">cairo_write_func_t</a> write_func, void *closure, double width_in_points, @@ -151,9 +151,9 @@ void <a href="cairo-PS-Backend.html#cairo-ps-surface-set-dpi">cairo_ps_su </div> <hr> <div class="refsect2" lang="en"> -<a name="id2655418"></a><h3> +<a name="id2907149"></a><h3> <a name="cairo-ps-surface-set-dpi"></a>cairo_ps_surface_set_dpi ()</h3> -<a class="indexterm" name="id2655427"></a><pre class="programlisting">void cairo_ps_surface_set_dpi (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, +<a class="indexterm" name="id2907158"></a><pre class="programlisting">void cairo_ps_surface_set_dpi (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, double x_dpi, double y_dpi);</pre> <p> diff --git a/doc/public/html/cairo-Quartz-Backend.html b/doc/public/html/cairo-Quartz-Backend.html index b5c2026..4b15e18 100644 --- a/doc/public/html/cairo-Quartz-Backend.html +++ b/doc/public/html/cairo-Quartz-Backend.html @@ -44,17 +44,17 @@ </pre> </div> <div class="refsect1" lang="en"> -<a name="id2616820"></a><h2>Description</h2> +<a name="id2869511"></a><h2>Description</h2> <p> </p> </div> <div class="refsect1" lang="en"> -<a name="id2656568"></a><h2>Details</h2> +<a name="id2911225"></a><h2>Details</h2> <div class="refsect2" lang="en"> -<a name="id2606583"></a><h3> +<a name="id2911231"></a><h3> <a name="cairo-quartz-surface-create"></a>cairo_quartz_surface_create ()</h3> -<a class="indexterm" name="id2606591"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_quartz_surface_create +<a class="indexterm" name="id2870620"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_quartz_surface_create (CGContextRef context, int width, int height);</pre> diff --git a/doc/public/html/cairo-XCB-Backend.html b/doc/public/html/cairo-XCB-Backend.html index ae58877..0c0ab07 100644 --- a/doc/public/html/cairo-XCB-Backend.html +++ b/doc/public/html/cairo-XCB-Backend.html @@ -53,17 +53,17 @@ void <a href="cairo-XCB-Backend.html#cairo-xcb-surface-set-size">cairo_xc </pre> </div> <div class="refsect1" lang="en"> -<a name="id2607541"></a><h2>Description</h2> +<a name="id2906897"></a><h2>Description</h2> <p> </p> </div> <div class="refsect1" lang="en"> -<a name="id2607552"></a><h2>Details</h2> +<a name="id2906908"></a><h2>Details</h2> <div class="refsect2" lang="en"> -<a name="id2607558"></a><h3> +<a name="id2906914"></a><h3> <a name="cairo-xcb-surface-create"></a>cairo_xcb_surface_create ()</h3> -<a class="indexterm" name="id2607567"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_xcb_surface_create (XCBConnection *c, +<a class="indexterm" name="id2906923"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_xcb_surface_create (XCBConnection *c, XCBDRAWABLE drawable, XCBVISUALTYPE *visual, int width, @@ -126,9 +126,9 @@ window changes.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2655812"></a><h3> +<a name="id2903715"></a><h3> <a name="cairo-xcb-surface-create-for-bitmap"></a>cairo_xcb_surface_create_for_bitmap ()</h3> -<a class="indexterm" name="id2655821"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_xcb_surface_create_for_bitmap +<a class="indexterm" name="id2903724"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_xcb_surface_create_for_bitmap (XCBConnection *c, XCBPIXMAP bitmap, int width, @@ -177,9 +177,9 @@ This will be drawn to as a CAIRO_FORMAT_A1 object.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2655958"></a><h3> +<a name="id2906187"></a><h3> <a name="cairo-xcb-surface-set-size"></a>cairo_xcb_surface_set_size ()</h3> -<a class="indexterm" name="id2655967"></a><pre class="programlisting">void cairo_xcb_surface_set_size (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, +<a class="indexterm" name="id2906196"></a><pre class="programlisting">void cairo_xcb_surface_set_size (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, int width, int height);</pre> <p> diff --git a/doc/public/html/cairo-XLib-Backend.html b/doc/public/html/cairo-XLib-Backend.html index 0b023c5..b659b6d 100644 --- a/doc/public/html/cairo-XLib-Backend.html +++ b/doc/public/html/cairo-XLib-Backend.html @@ -51,20 +51,24 @@ void <a href="cairo-XLib-Backend.html#cairo-xlib-surface-set-size">cairo_xlib_surface_set_size</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, int width, int height); +void <a href="cairo-XLib-Backend.html#cairo-xlib-surface-set-drawable">cairo_xlib_surface_set_drawable</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, + Drawable drawable, + int width, + int height); </pre> </div> <div class="refsect1" lang="en"> -<a name="id2677769"></a><h2>Description</h2> +<a name="id2903948"></a><h2>Description</h2> <p> </p> </div> <div class="refsect1" lang="en"> -<a name="id2677780"></a><h2>Details</h2> +<a name="id2903959"></a><h2>Details</h2> <div class="refsect2" lang="en"> -<a name="id2677786"></a><h3> +<a name="id2903965"></a><h3> <a name="cairo-xlib-surface-create"></a>cairo_xlib_surface_create ()</h3> -<a class="indexterm" name="id2656047"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_xlib_surface_create (Display *dpy, +<a class="indexterm" name="id2861558"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_xlib_surface_create (Display *dpy, Drawable drawable, Visual *visual, int width, @@ -127,9 +131,9 @@ window changes.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2656290"></a><h3> +<a name="id2861735"></a><h3> <a name="cairo-xlib-surface-create-for-bitmap"></a>cairo_xlib_surface_create_for_bitmap ()</h3> -<a class="indexterm" name="id2656301"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_xlib_surface_create_for_bitmap +<a class="indexterm" name="id2861744"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_xlib_surface_create_for_bitmap (Display *dpy, Pixmap bitmap, Screen *screen, @@ -185,9 +189,9 @@ This will be drawn to as a CAIRO_FORMAT_A1 object.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2678712"></a><h3> +<a name="id2903266"></a><h3> <a name="cairo-xlib-surface-set-size"></a>cairo_xlib_surface_set_size ()</h3> -<a class="indexterm" name="id2678721"></a><pre class="programlisting">void cairo_xlib_surface_set_size (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, +<a class="indexterm" name="id2903275"></a><pre class="programlisting">void cairo_xlib_surface_set_size (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, int width, int height);</pre> <p> @@ -228,6 +232,56 @@ this function on a surface created for a Pixmap.</p> </tbody> </table></div> </div> +<hr> +<div class="refsect2" lang="en"> +<a name="id2903385"></a><h3> +<a name="cairo-xlib-surface-set-drawable"></a>cairo_xlib_surface_set_drawable ()</h3> +<a class="indexterm" name="id2903394"></a><pre class="programlisting">void cairo_xlib_surface_set_drawable (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, + Drawable drawable, + int width, + int height);</pre> +<p> +Informs cairo of a new X Drawable underlying the +surface. The drawable must match the display, screen +and format of the existing drawable or the application +will get X protocol errors and will probably terminate. +No checks are done by this function to ensure this +compatibility.</p> +<p> + +</p> +<div class="variablelist"><table border="0"> +<col align="left" valign="top"> +<tbody> +<tr> +<td> +<span class="term"><em class="parameter"><code>surface</code></em> :</span></td> +<td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> for the XLib backend +</td> +</tr> +<tr> +<td> +<span class="term"><em class="parameter"><code>drawable</code></em> :</span></td> +<td> the new drawable for the surface +</td> +</tr> +<tr> +<td> +<span class="term"><em class="parameter"><code>width</code></em> :</span></td> +<td> +</td> +</tr> +<tr> +<td> +<span class="term"><em class="parameter"><code>height</code></em> :</span></td> +<td> + + +</td> +</tr> +</tbody> +</table></div> +</div> </div> </div> <table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"> diff --git a/doc/public/html/cairo-cairo-matrix-t.html b/doc/public/html/cairo-cairo-matrix-t.html index 0a65d18..b58db0b 100644 --- a/doc/public/html/cairo-cairo-matrix-t.html +++ b/doc/public/html/cairo-cairo-matrix-t.html @@ -5,7 +5,7 @@ <meta name="generator" content="DocBook XSL Stylesheets V1.68.1"> <link rel="start" href="index.html" title="Cairo: A Vector Graphics Library"> <link rel="up" href="pt02.html" title="Part II. Reference"> -<link rel="prev" href="cairo-cairo-pattern-t.html" title="cairo_pattern_t"> +<link rel="prev" href="cairo-cairo-surface-t.html" title="cairo_surface_t"> <link rel="next" href="cairo-Fonts.html" title="Fonts"> <meta name="generator" content="GTK-Doc V1.4 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> @@ -16,7 +16,7 @@ </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"> -<td><a accesskey="p" href="cairo-cairo-pattern-t.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td> +<td><a accesskey="p" href="cairo-cairo-surface-t.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td> <td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> <th width="100%" align="center">Cairo: A Vector Graphics Library</th> @@ -76,8 +76,8 @@ void <a href="cairo-cairo-matrix-t.html#cairo-matrix-transform-point">cai </pre> </div> <div class="refsect1" lang="en"> -<a name="id2614976"></a><h2>Description</h2> -<p><a class="indexterm" name="id2614983"></a><a class="indexterm" name="id2614991"></a> +<a name="id2876757"></a><h2>Description</h2> +<p><a class="indexterm" name="id2876765"></a><a class="indexterm" name="id2876773"></a> <span class="structname">cairo_matrix_t</span> is used throughout Cairo to represents between different coordinates spaces. A <span class="structname">cairo_matrix</span> holds an affine @@ -104,11 +104,11 @@ void <a href="cairo-cairo-matrix-t.html#cairo-matrix-transform-point">cai </p> </div> <div class="refsect1" lang="en"> -<a name="id2615119"></a><h2>Details</h2> +<a name="id2876901"></a><h2>Details</h2> <div class="refsect2" lang="en"> -<a name="id2615125"></a><h3> +<a name="id2876907"></a><h3> <a name="cairo-matrix-t"></a>cairo_matrix_t</h3> -<a class="indexterm" name="id2615135"></a><pre class="programlisting">typedef struct { +<a class="indexterm" name="id2876917"></a><pre class="programlisting">typedef struct { double xx; double yx; double xy; double yy; double x0; double y0; @@ -170,9 +170,9 @@ by: </div> <hr> <div class="refsect2" lang="en"> -<a name="id2650593"></a><h3> +<a name="id2863573"></a><h3> <a name="cairo-matrix-init"></a>cairo_matrix_init ()</h3> -<a class="indexterm" name="id2650604"></a><pre class="programlisting">void cairo_matrix_init (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, +<a class="indexterm" name="id2863583"></a><pre class="programlisting">void cairo_matrix_init (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double xx, double yx, double xy, @@ -241,9 +241,9 @@ by: </div> <hr> <div class="refsect2" lang="en"> -<a name="id2611854"></a><h3> +<a name="id2870868"></a><h3> <a name="cairo-matrix-init-identity"></a>cairo_matrix_init_identity ()</h3> -<a class="indexterm" name="id2611862"></a><pre class="programlisting">void cairo_matrix_init_identity (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre> +<a class="indexterm" name="id2870877"></a><pre class="programlisting">void cairo_matrix_init_identity (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre> <p> Modifies <em class="parameter"><code>matrix</code></em> to be an identity transformation.</p> <p> @@ -261,9 +261,9 @@ Modifies <em class="parameter"><code>matrix</code></em> to be an identity transf </div> <hr> <div class="refsect2" lang="en"> -<a name="id2611925"></a><h3> +<a name="id2870940"></a><h3> <a name="cairo-matrix-init-translate"></a>cairo_matrix_init_translate ()</h3> -<a class="indexterm" name="id2611934"></a><pre class="programlisting">void cairo_matrix_init_translate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, +<a class="indexterm" name="id2870948"></a><pre class="programlisting">void cairo_matrix_init_translate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double tx, double ty);</pre> <p> @@ -298,9 +298,9 @@ Initializes <em class="parameter"><code>matrix</code></em> to a transformation t </div> <hr> <div class="refsect2" lang="en"> -<a name="id2612045"></a><h3> +<a name="id2871060"></a><h3> <a name="cairo-matrix-init-scale"></a>cairo_matrix_init_scale ()</h3> -<a class="indexterm" name="id2612054"></a><pre class="programlisting">void cairo_matrix_init_scale (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, +<a class="indexterm" name="id2871069"></a><pre class="programlisting">void cairo_matrix_init_scale (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double sx, double sy);</pre> <p> @@ -335,9 +335,9 @@ in the X and Y dimensions, respectively.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2612165"></a><h3> +<a name="id2871180"></a><h3> <a name="cairo-matrix-init-rotate"></a>cairo_matrix_init_rotate ()</h3> -<a class="indexterm" name="id2612174"></a><pre class="programlisting">void cairo_matrix_init_rotate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, +<a class="indexterm" name="id2871188"></a><pre class="programlisting">void cairo_matrix_init_rotate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double radians);</pre> <p> Initialized <em class="parameter"><code>matrix</code></em> to a transformation that rotates by <em class="parameter"><code>radians</code></em>.</p> @@ -368,9 +368,9 @@ direction. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2612262"></a><h3> +<a name="id2871276"></a><h3> <a name="cairo-matrix-translate"></a>cairo_matrix_translate ()</h3> -<a class="indexterm" name="id2612271"></a><pre class="programlisting">void cairo_matrix_translate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, +<a class="indexterm" name="id2871285"></a><pre class="programlisting">void cairo_matrix_translate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double tx, double ty);</pre> <p> @@ -407,9 +407,9 @@ to the coordinates.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2612395"></a><h3> +<a name="id2871409"></a><h3> <a name="cairo-matrix-scale"></a>cairo_matrix_scale ()</h3> -<a class="indexterm" name="id2612405"></a><pre class="programlisting">void cairo_matrix_scale (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, +<a class="indexterm" name="id2871419"></a><pre class="programlisting">void cairo_matrix_scale (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double sx, double sy);</pre> <p> @@ -445,9 +445,9 @@ by <em class="parameter"><code>sx</code></em> and <em class="parameter"><code>sy </div> <hr> <div class="refsect2" lang="en"> -<a name="id2612536"></a><h3> +<a name="id2900989"></a><h3> <a name="cairo-matrix-rotate"></a>cairo_matrix_rotate ()</h3> -<a class="indexterm" name="id2612546"></a><pre class="programlisting">void cairo_matrix_rotate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, +<a class="indexterm" name="id2900999"></a><pre class="programlisting">void cairo_matrix_rotate (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double radians);</pre> <p> Applies rotation by <em class="parameter"><code>radians</code></em> to the transformation in @@ -481,9 +481,9 @@ direction. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2612647"></a><h3> +<a name="id2901099"></a><h3> <a name="cairo-matrix-invert"></a>cairo_matrix_invert ()</h3> -<a class="indexterm" name="id2612657"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_matrix_invert (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre> +<a class="indexterm" name="id2901109"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_matrix_invert (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre> <p> Changes <em class="parameter"><code>matrix</code></em> to be the inverse of it's original value. Not all transformation matrices have inverses; if the matrix @@ -517,9 +517,9 @@ Returns: If <em class="parameter"><code>matrix</code></em> has an inverse, modif </div> <hr> <div class="refsect2" lang="en"> -<a name="id2612763"></a><h3> +<a name="id2901214"></a><h3> <a name="cairo-matrix-multiply"></a>cairo_matrix_multiply ()</h3> -<a class="indexterm" name="id2612772"></a><pre class="programlisting">void cairo_matrix_multiply (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *result, +<a class="indexterm" name="id2901223"></a><pre class="programlisting">void cairo_matrix_multiply (<a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *result, const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *a, const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *b);</pre> <p> @@ -560,9 +560,9 @@ It is allowable for <em class="parameter"><code>result</code></em> to be identic </div> <hr> <div class="refsect2" lang="en"> -<a name="id2612937"></a><h3> +<a name="id2901388"></a><h3> <a name="cairo-matrix-transform-distance"></a>cairo_matrix_transform_distance ()</h3> -<a class="indexterm" name="id2612948"></a><pre class="programlisting">void cairo_matrix_transform_distance (const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, +<a class="indexterm" name="id2901398"></a><pre class="programlisting">void cairo_matrix_transform_distance (const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double *dx, double *dy);</pre> <p> @@ -613,9 +613,9 @@ to (<em class="parameter"><code>x2</code></em>,<em class="parameter"><code>y2</c </div> <hr> <div class="refsect2" lang="en"> -<a name="id2654347"></a><h3> +<a name="id2901627"></a><h3> <a name="cairo-matrix-transform-point"></a>cairo_matrix_transform_point ()</h3> -<a class="indexterm" name="id2654358"></a><pre class="programlisting">void cairo_matrix_transform_point (const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, +<a class="indexterm" name="id2901638"></a><pre class="programlisting">void cairo_matrix_transform_point (const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix, double *x, double *y);</pre> <p> @@ -650,7 +650,7 @@ Transforms the point (<em class="parameter"><code>x</code></em>, <em class="para </div> </div> <table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"> -<td align="left"><a accesskey="p" href="cairo-cairo-pattern-t.html"><b><< cairo_pattern_t</b></a></td> +<td align="left"><a accesskey="p" href="cairo-cairo-surface-t.html"><b><< cairo_surface_t</b></a></td> <td align="right"><a accesskey="n" href="cairo-Fonts.html"><b>Fonts >></b></a></td> </tr></table> </body> diff --git a/doc/public/html/cairo-cairo-pattern-t.html b/doc/public/html/cairo-cairo-pattern-t.html deleted file mode 100644 index 25f9034..0000000 --- a/doc/public/html/cairo-cairo-pattern-t.html +++ /dev/null @@ -1,764 +0,0 @@ -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> -<title>cairo_pattern_t</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.68.1"> -<link rel="start" href="index.html" title="Cairo: A Vector Graphics Library"> -<link rel="up" href="pt02.html" title="Part II. Reference"> -<link rel="prev" href="cairo-cairo-surface-t.html" title="cairo_surface_t"> -<link rel="next" href="cairo-cairo-matrix-t.html" title="cairo_matrix_t"> -<meta name="generator" content="GTK-Doc V1.4 (XML mode)"> -<link rel="stylesheet" href="style.css" type="text/css"> -<link rel="part" href="pt01.html" title="Part I. Tutorial"> -<link rel="part" href="pt02.html" title="Part II. Reference"> -<link rel="index" href="ix01.html" title="Index"> -<link rel="appendix" href="language-bindings.html" title="Appendix A. Creating a language binding for cairo"> -</head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> -<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"> -<td><a accesskey="p" href="cairo-cairo-surface-t.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td> -<td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> -<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> -<th width="100%" align="center">Cairo: A Vector Graphics Library</th> -<td><a accesskey="n" href="cairo-cairo-matrix-t.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> -</tr></table> -<div class="refentry" lang="en"> -<a name="cairo-cairo-pattern-t"></a><div class="titlepage"></div> -<div class="refnamediv"><table width="100%"><tr> -<td valign="top"> -<h2><span class="refentrytitle">cairo_pattern_t</span></h2> -<p>cairo_pattern_t — </p> -</td> -<td valign="top" align="right"></td> -</tr></table></div> -<div class="refsynopsisdiv"> -<h2>Synopsis</h2> -<pre class="synopsis"> - - - -typedef <a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>; -<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-cairo-pattern-t.html#cairo-pattern-create-rgb">cairo_pattern_create_rgb</a> (double red, - double green, - double blue); -<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-cairo-pattern-t.html#cairo-pattern-create-rgba">cairo_pattern_create_rgba</a> (double red, - double green, - double blue, - double alpha); -<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-cairo-pattern-t.html#cairo-pattern-create-for-surface">cairo_pattern_create_for_surface</a> - (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface); -<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-cairo-pattern-t.html#cairo-pattern-create-linear">cairo_pattern_create_linear</a> - (double x0, - double y0, - double x1, - double y1); -<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-cairo-pattern-t.html#cairo-pattern-create-radial">cairo_pattern_create_radial</a> - (double cx0, - double cy0, - double radius0, - double cx1, - double cy1, - double radius1); -void <a href="cairo-cairo-pattern-t.html#cairo-pattern-reference">cairo_pattern_reference</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern); -void <a href="cairo-cairo-pattern-t.html#cairo-pattern-destroy">cairo_pattern_destroy</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern); -<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-pattern-t.html#cairo-pattern-status">cairo_pattern_status</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern); -void <a href="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgb">cairo_pattern_add_color_stop_rgb</a> - (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern, - double offset, - double red, - double green, - double blue); -void <a href="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgba">cairo_pattern_add_color_stop_rgba</a> - (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern, - double offset, - double red, - double green, - double blue, - double alpha); -void <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-matrix">cairo_pattern_set_matrix</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern, - const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix); -void <a href="cairo-cairo-pattern-t.html#cairo-pattern-get-matrix">cairo_pattern_get_matrix</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern, - <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix); -enum <a href="cairo-cairo-pattern-t.html#cairo-extend-t">cairo_extend_t</a>; -void <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-extend">cairo_pattern_set_extend</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern, - <a href="cairo-cairo-pattern-t.html#cairo-extend-t">cairo_extend_t</a> extend); -<a href="cairo-cairo-pattern-t.html#cairo-extend-t">cairo_extend_t</a> <a href="cairo-cairo-pattern-t.html#cairo-pattern-get-extend">cairo_pattern_get_extend</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern); -void <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-filter">cairo_pattern_set_filter</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern, - <a href="cairo-cairo-t.html#cairo-filter-t">cairo_filter_t</a> filter); -<a href="cairo-cairo-t.html#cairo-filter-t">cairo_filter_t</a> <a href="cairo-cairo-pattern-t.html#cairo-pattern-get-filter">cairo_pattern_get_filter</a> (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern); -</pre> -</div> -<div class="refsect1" lang="en"> -<a name="id2652410"></a><h2>Description</h2> -<p> - -</p> -</div> -<div class="refsect1" lang="en"> -<a name="id2652421"></a><h2>Details</h2> -<div class="refsect2" lang="en"> -<a name="id2652427"></a><h3> -<a name="cairo-pattern-t"></a>cairo_pattern_t</h3> -<a class="indexterm" name="id2652437"></a><pre class="programlisting">typedef struct _cairo_pattern cairo_pattern_t; -</pre> -<p> - -</p> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2652454"></a><h3> -<a name="cairo-pattern-create-rgb"></a>cairo_pattern_create_rgb ()</h3> -<a class="indexterm" name="id2652462"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_rgb (double red, - double green, - double blue);</pre> -<p> -Create a new cairo_pattern_t corresponding to a opaque color. The -color components are floating point numbers in the range 0 to 1. -If the values passed in are outside that range, they will be -clamped.</p> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td> -<span class="term"><em class="parameter"><code>red</code></em> :</span></td> -<td> red component of the color -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>green</code></em> :</span></td> -<td> green component of the color -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>blue</code></em> :</span></td> -<td> blue component of the color -</td> -</tr> -<tr> -<td> -<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> -<td> the newly created <a href="cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> if succesful, or -an error pattern in case of no memory. The caller owns the -returned object and should call <a href="cairo-cairo-pattern-t.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> when -finished with it. - -This function will always return a valid pointer, but if an error -occurred the pattern status will be set to an error. To inspect -the status of a pattern use <a href="cairo-cairo-pattern-t.html#cairo-pattern-status"><code class="function">cairo_pattern_status()</code></a>. -</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2613872"></a><h3> -<a name="cairo-pattern-create-rgba"></a>cairo_pattern_create_rgba ()</h3> -<a class="indexterm" name="id2613882"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_rgba (double red, - double green, - double blue, - double alpha);</pre> -<p> -Create a new cairo_pattern_t corresponding to a translucent color. -The color components are floating point numbers in the range 0 to -1. If the values passed in are outside that range, they will be -clamped.</p> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td> -<span class="term"><em class="parameter"><code>red</code></em> :</span></td> -<td> red component of the color -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>green</code></em> :</span></td> -<td> green component of the color -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>blue</code></em> :</span></td> -<td> blue component of the color -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>alpha</code></em> :</span></td> -<td> alpha component of the color -</td> -</tr> -<tr> -<td> -<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> -<td> the newly created <a href="cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> if succesful, or -an error pattern in case of no memory. The caller owns the -returned object and should call <a href="cairo-cairo-pattern-t.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> when -finished with it. - -This function will always return a valid pointer, but if an error -occurred the pattern status will be set to an error. To inspect -the status of a pattern use <a href="cairo-cairo-pattern-t.html#cairo-pattern-status"><code class="function">cairo_pattern_status()</code></a>. -</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2650221"></a><h3> -<a name="cairo-pattern-create-for-surface"></a>cairo_pattern_create_for_surface ()</h3> -<a class="indexterm" name="id2650231"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_for_surface - (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre> -<p> -Create a new cairo_pattern_t for the given surface.</p> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td> -<span class="term"><em class="parameter"><code>surface</code></em> :</span></td> -<td> the surface -</td> -</tr> -<tr> -<td> -<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> -<td> the newly created <a href="cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> if succesful, or -an error pattern in case of no memory. The caller owns the -returned object and should call <a href="cairo-cairo-pattern-t.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> when -finished with it. - -This function will always return a valid pointer, but if an error -occurred the pattern status will be set to an error. To inspect -the status of a pattern use <a href="cairo-cairo-pattern-t.html#cairo-pattern-status"><code class="function">cairo_pattern_status()</code></a>. -</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2650323"></a><h3> -<a name="cairo-pattern-create-linear"></a>cairo_pattern_create_linear ()</h3> -<a class="indexterm" name="id2650333"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_linear - (double x0, - double y0, - double x1, - double y1);</pre> -<p> -Create a new linear gradient cairo_pattern_t along the line defined -by (x0, y0) and (x1, y1). Before using the gradient pattern, a -number of color stops should be defined using -<a href="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgb"><code class="function">cairo_pattern_add_color_stop_rgb()</code></a> or -<a href="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgba"><code class="function">cairo_pattern_add_color_stop_rgba()</code></a>.</p> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td> -<span class="term"><em class="parameter"><code>x0</code></em> :</span></td> -<td> x coordinate of the start point -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>y0</code></em> :</span></td> -<td> y coordinate of the start point -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>x1</code></em> :</span></td> -<td> x coordinate of the end point -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>y1</code></em> :</span></td> -<td> y coordinate of the end point -</td> -</tr> -<tr> -<td> -<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> -<td> the newly created <a href="cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> if succesful, or -an error pattern in case of no memory. The caller owns the -returned object and should call <a href="cairo-cairo-pattern-t.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> when -finished with it. - -This function will always return a valid pointer, but if an error -occurred the pattern status will be set to an error. To inspect -the status of a pattern use <a href="cairo-cairo-pattern-t.html#cairo-pattern-status"><code class="function">cairo_pattern_status()</code></a>. -</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2619005"></a><h3> -<a name="cairo-pattern-create-radial"></a>cairo_pattern_create_radial ()</h3> -<a class="indexterm" name="id2619014"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_pattern_create_radial - (double cx0, - double cy0, - double radius0, - double cx1, - double cy1, - double radius1);</pre> -<p> -Create a new radial gradient cairo_pattern_t between the two -circles defined by (x0, y0, c0) and (x1, y1, c0). Before using the -gradient pattern, a number of color stops should be defined using -<a href="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgb"><code class="function">cairo_pattern_add_color_stop_rgb()</code></a> or -<a href="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgba"><code class="function">cairo_pattern_add_color_stop_rgba()</code></a>.</p> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td> -<span class="term"><em class="parameter"><code>cx0</code></em> :</span></td> -<td> x coordinate for the center of the start circle -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>cy0</code></em> :</span></td> -<td> y coordinate for the center of the start circle -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>radius0</code></em> :</span></td> -<td> radius of the start cirle -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>cx1</code></em> :</span></td> -<td> x coordinate for the center of the end circle -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>cy1</code></em> :</span></td> -<td> y coordinate for the center of the end circle -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>radius1</code></em> :</span></td> -<td> radius of the end cirle -</td> -</tr> -<tr> -<td> -<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> -<td> the newly created <a href="cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> if succesful, or -an error pattern in case of no memory. The caller owns the -returned object and should call <a href="cairo-cairo-pattern-t.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> when -finished with it. - -This function will always return a valid pointer, but if an error -occurred the pattern status will be set to an error. To inspect -the status of a pattern use <a href="cairo-cairo-pattern-t.html#cairo-pattern-status"><code class="function">cairo_pattern_status()</code></a>. -</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2619235"></a><h3> -<a name="cairo-pattern-reference"></a>cairo_pattern_reference ()</h3> -<a class="indexterm" name="id2619244"></a><pre class="programlisting">void cairo_pattern_reference (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre> -<p> -Increases the reference count on <em class="parameter"><code>pattern</code></em> by one. This prevents -<em class="parameter"><code>pattern</code></em> from being destroyed until a matching call to -<a href="cairo-cairo-pattern-t.html#cairo-pattern-destroy"><code class="function">cairo_pattern_destroy()</code></a> is made.</p> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody><tr> -<td> -<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td> -<td> a <a href="cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> -</td> -</tr></tbody> -</table></div> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2619322"></a><h3> -<a name="cairo-pattern-destroy"></a>cairo_pattern_destroy ()</h3> -<a class="indexterm" name="id2619331"></a><pre class="programlisting">void cairo_pattern_destroy (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre> -<p> -Decreases the reference count on <em class="parameter"><code>pattern</code></em> by one. If the result is -zero, then <em class="parameter"><code>pattern</code></em> and all associated resources are freed. See -<a href="cairo-cairo-pattern-t.html#cairo-pattern-reference"><code class="function">cairo_pattern_reference()</code></a>.</p> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody><tr> -<td> -<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td> -<td> a <a href="cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> -</td> -</tr></tbody> -</table></div> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2619408"></a><h3> -<a name="cairo-pattern-status"></a>cairo_pattern_status ()</h3> -<a class="indexterm" name="id2619417"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_pattern_status (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre> -<p> -Checks whether an error has previously occurred for this -pattern.</p> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td> -<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td> -<td> a <a href="cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> -</td> -</tr> -<tr> -<td> -<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> -<td> <code class="literal">CAIRO_STATUS_SUCCESS</code> or <code class="literal">CAIRO_STATUS_NO_MEMORY</code> -</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2619496"></a><h3> -<a name="cairo-pattern-add-color-stop-rgb"></a>cairo_pattern_add_color_stop_rgb ()</h3> -<a class="indexterm" name="id2619507"></a><pre class="programlisting">void cairo_pattern_add_color_stop_rgb - (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern, - double offset, - double red, - double green, - double blue);</pre> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td> -<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td> -<td> -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>offset</code></em> :</span></td> -<td> -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>red</code></em> :</span></td> -<td> -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>green</code></em> :</span></td> -<td> -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>blue</code></em> :</span></td> -<td> - - -</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2619638"></a><h3> -<a name="cairo-pattern-add-color-stop-rgba"></a>cairo_pattern_add_color_stop_rgba ()</h3> -<a class="indexterm" name="id2619650"></a><pre class="programlisting">void cairo_pattern_add_color_stop_rgba - (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern, - double offset, - double red, - double green, - double blue, - double alpha);</pre> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td> -<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td> -<td> -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>offset</code></em> :</span></td> -<td> -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>red</code></em> :</span></td> -<td> -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>green</code></em> :</span></td> -<td> -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>blue</code></em> :</span></td> -<td> -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>alpha</code></em> :</span></td> -<td> - - -</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2619802"></a><h3> -<a name="cairo-pattern-set-matrix"></a>cairo_pattern_set_matrix ()</h3> -<a class="indexterm" name="id2619811"></a><pre class="programlisting">void cairo_pattern_set_matrix (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern, - const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td> -<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td> -<td> -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>matrix</code></em> :</span></td> -<td> - - -</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2619878"></a><h3> -<a name="cairo-pattern-get-matrix"></a>cairo_pattern_get_matrix ()</h3> -<a class="indexterm" name="id2619887"></a><pre class="programlisting">void cairo_pattern_get_matrix (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern, - <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td> -<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td> -<td> -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>matrix</code></em> :</span></td> -<td> -</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2619954"></a><h3> -<a name="cairo-extend-t"></a>enum cairo_extend_t</h3> -<a class="indexterm" name="id2619964"></a><pre class="programlisting">typedef enum _cairo_extend { - CAIRO_EXTEND_NONE, - CAIRO_EXTEND_REPEAT, - CAIRO_EXTEND_REFLECT -} cairo_extend_t; -</pre> -<p> - -</p> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2619982"></a><h3> -<a name="cairo-pattern-set-extend"></a>cairo_pattern_set_extend ()</h3> -<a class="indexterm" name="id2619991"></a><pre class="programlisting">void cairo_pattern_set_extend (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern, - <a href="cairo-cairo-pattern-t.html#cairo-extend-t">cairo_extend_t</a> extend);</pre> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td> -<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td> -<td> -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>extend</code></em> :</span></td> -<td> - - -</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2620058"></a><h3> -<a name="cairo-pattern-get-extend"></a>cairo_pattern_get_extend ()</h3> -<a class="indexterm" name="id2620067"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-extend-t">cairo_extend_t</a> cairo_pattern_get_extend (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td> -<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td> -<td> -</td> -</tr> -<tr> -<td> -<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> -<td> - - -</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2656635"></a><h3> -<a name="cairo-pattern-set-filter"></a>cairo_pattern_set_filter ()</h3> -<a class="indexterm" name="id2656644"></a><pre class="programlisting">void cairo_pattern_set_filter (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern, - <a href="cairo-cairo-t.html#cairo-filter-t">cairo_filter_t</a> filter);</pre> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td> -<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td> -<td> -</td> -</tr> -<tr> -<td> -<span class="term"><em class="parameter"><code>filter</code></em> :</span></td> -<td> - - -</td> -</tr> -</tbody> -</table></div> -</div> -<hr> -<div class="refsect2" lang="en"> -<a name="id2656711"></a><h3> -<a name="cairo-pattern-get-filter"></a>cairo_pattern_get_filter ()</h3> -<a class="indexterm" name="id2656720"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-filter-t">cairo_filter_t</a> cairo_pattern_get_filter (<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre> -<p> - -</p> -<div class="variablelist"><table border="0"> -<col align="left" valign="top"> -<tbody> -<tr> -<td> -<span class="term"><em class="parameter"><code>pattern</code></em> :</span></td> -<td> -</td> -</tr> -<tr> -<td> -<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> -<td> - - -</td> -</tr> -</tbody> -</table></div> -</div> -</div> -</div> -<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"> -<td align="left"><a accesskey="p" href="cairo-cairo-surface-t.html"><b><< cairo_surface_t</b></a></td> -<td align="right"><a accesskey="n" href="cairo-cairo-matrix-t.html"><b>cairo_matrix_t >></b></a></td> -</tr></table> -</body> -</html> diff --git a/doc/public/html/cairo-cairo-surface-t.html b/doc/public/html/cairo-cairo-surface-t.html index 37a0a75..d5d6718 100644 --- a/doc/public/html/cairo-cairo-surface-t.html +++ b/doc/public/html/cairo-cairo-surface-t.html @@ -6,7 +6,7 @@ <link rel="start" href="index.html" title="Cairo: A Vector Graphics Library"> <link rel="up" href="pt02.html" title="Part II. Reference"> <link rel="prev" href="cairo-cairo-t.html" title="cairo_t"> -<link rel="next" href="cairo-cairo-pattern-t.html" title="cairo_pattern_t"> +<link rel="next" href="cairo-cairo-matrix-t.html" title="cairo_matrix_t"> <meta name="generator" content="GTK-Doc V1.4 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> <link rel="part" href="pt01.html" title="Part I. Tutorial"> @@ -20,7 +20,7 @@ <td><a accesskey="u" href="pt02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> <th width="100%" align="center">Cairo: A Vector Graphics Library</th> -<td><a accesskey="n" href="cairo-cairo-pattern-t.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> +<td><a accesskey="n" href="cairo-cairo-matrix-t.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> </tr></table> <div class="refentry" lang="en"> <a name="cairo-cairo-surface-t"></a><div class="titlepage"></div> @@ -43,8 +43,9 @@ typedef <a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t <a href="cairo-cairo-t.html#cairo-content-t">cairo_content_t</a> content, int width, int height); -void <a href="cairo-cairo-surface-t.html#cairo-surface-reference">cairo_surface_reference</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface); +<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* <a href="cairo-cairo-surface-t.html#cairo-surface-reference">cairo_surface_reference</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface); void <a href="cairo-cairo-surface-t.html#cairo-surface-destroy">cairo_surface_destroy</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface); +<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> <a href="cairo-cairo-surface-t.html#cairo-surface-status">cairo_surface_status</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface); void <a href="cairo-cairo-surface-t.html#cairo-surface-finish">cairo_surface_finish</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface); void <a href="cairo-cairo-surface-t.html#cairo-surface-get-font-options">cairo_surface_get_font_options</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options); @@ -54,23 +55,31 @@ void <a href="cairo-cairo-surface-t.html#cairo-surface-get-font-options"> <a href="cairo-cairo-t.html#cairo-destroy-func-t">cairo_destroy_func_t</a> destroy); void* <a href="cairo-cairo-surface-t.html#cairo-surface-get-user-data">cairo_surface_get_user_data</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, const <a href="cairo-cairo-t.html#cairo-user-data-key-t">cairo_user_data_key_t</a> *key); +void <a href="cairo-cairo-surface-t.html#cairo-surface-flush">cairo_surface_flush</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface); +void <a href="cairo-cairo-surface-t.html#cairo-surface-mark-dirty">cairo_surface_mark_dirty</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface); +void <a href="cairo-cairo-surface-t.html#cairo-surface-mark-dirty-rectangle">cairo_surface_mark_dirty_rectangle</a> + (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, + int x, + int y, + int width, + int height); void <a href="cairo-cairo-surface-t.html#cairo-surface-set-device-offset">cairo_surface_set_device_offset</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, double x_offset, double y_offset); </pre> </div> <div class="refsect1" lang="en"> -<a name="id2614291"></a><h2>Description</h2> +<a name="id2865741"></a><h2>Description</h2> <p> </p> </div> <div class="refsect1" lang="en"> -<a name="id2614302"></a><h2>Details</h2> +<a name="id2865752"></a><h2>Details</h2> <div class="refsect2" lang="en"> -<a name="id2614308"></a><h3> +<a name="id2865758"></a><h3> <a name="cairo-surface-t"></a>cairo_surface_t</h3> -<a class="indexterm" name="id2614318"></a><pre class="programlisting">typedef struct _cairo_surface cairo_surface_t; +<a class="indexterm" name="id2865768"></a><pre class="programlisting">typedef struct _cairo_surface cairo_surface_t; </pre> <p> A <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> represents an image, either as the destination @@ -88,9 +97,9 @@ Memory management of <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span </div> <hr> <div class="refsect2" lang="en"> -<a name="id2614386"></a><h3> +<a name="id2865836"></a><h3> <a name="cairo-surface-create-similar"></a>cairo_surface_create_similar ()</h3> -<a class="indexterm" name="id2614395"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_surface_create_similar +<a class="indexterm" name="id2913257"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_surface_create_similar (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *other, <a href="cairo-cairo-t.html#cairo-content-t">cairo_content_t</a> content, int width, @@ -146,29 +155,43 @@ or any other error occurs. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2661524"></a><h3> +<a name="id2913404"></a><h3> <a name="cairo-surface-reference"></a>cairo_surface_reference ()</h3> -<a class="indexterm" name="id2661533"></a><pre class="programlisting">void cairo_surface_reference (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre> +<a class="indexterm" name="id2913413"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_surface_reference (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre> +<p> +Increases the reference count on <em class="parameter"><code>surface</code></em> by one. This prevents +<em class="parameter"><code>surface</code></em> from being destroyed until a matching call to +<a href="cairo-cairo-surface-t.html#cairo-surface-destroy"><code class="function">cairo_surface_destroy()</code></a> is made.</p> <p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> -<tbody><tr> +<tbody> +<tr> <td> <span class="term"><em class="parameter"><code>surface</code></em> :</span></td> +<td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> +</td> +</tr> +<tr> <td> - - +<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> +<td> the referenced <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a>. </td> -</tr></tbody> +</tr> +</tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2661578"></a><h3> +<a name="id2902022"></a><h3> <a name="cairo-surface-destroy"></a>cairo_surface_destroy ()</h3> -<a class="indexterm" name="id2661587"></a><pre class="programlisting">void cairo_surface_destroy (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre> +<a class="indexterm" name="id2902031"></a><pre class="programlisting">void cairo_surface_destroy (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre> +<p> +Decreases the reference count on <em class="parameter"><code>surface</code></em> by one. If the result is +zero, then <em class="parameter"><code>surface</code></em> and all associated resources are freed. See +<a href="cairo-cairo-surface-t.html#cairo-surface-reference"><code class="function">cairo_surface_reference()</code></a>.</p> <p> </p> @@ -177,18 +200,48 @@ or any other error occurs. <tbody><tr> <td> <span class="term"><em class="parameter"><code>surface</code></em> :</span></td> -<td> - - +<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> </td> </tr></tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2661632"></a><h3> +<a name="id2902108"></a><h3> +<a name="cairo-surface-status"></a>cairo_surface_status ()</h3> +<a class="indexterm" name="id2902117"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_surface_status (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre> +<p> +Checks whether an error has previously occurred for this +surface.</p> +<p> + +</p> +<div class="variablelist"><table border="0"> +<col align="left" valign="top"> +<tbody> +<tr> +<td> +<span class="term"><em class="parameter"><code>surface</code></em> :</span></td> +<td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> +</td> +</tr> +<tr> +<td> +<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> +<td> <code class="literal">CAIRO_STATUS_SUCCESS</code>, <code class="literal">CAIRO_STATUS_NULL_POINTER</code>, +<code class="literal">CAIRO_STATUS_NO_MEMORY</code>, <code class="literal">CAIRO_STATUS_READ_ERROR</code>, +<code class="literal">CAIRO_STATUS_INVALID_CONTENT</code>, <code class="literal">CAIRO_STATUS_INVALUE_FORMAT</code>, or +<code class="literal">CAIRO_STATUS_INVALID_VISUAL</code>. +</td> +</tr> +</tbody> +</table></div> +</div> +<hr> +<div class="refsect2" lang="en"> +<a name="id2902227"></a><h3> <a name="cairo-surface-finish"></a>cairo_surface_finish ()</h3> -<a class="indexterm" name="id2661641"></a><pre class="programlisting">void cairo_surface_finish (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre> +<a class="indexterm" name="id2902236"></a><pre class="programlisting">void cairo_surface_finish (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre> <p> This function finishes the surface and drops all references to external resources. For example, for the Xlib backend it means @@ -219,9 +272,9 @@ associated with the surface.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2616377"></a><h3> +<a name="id2911874"></a><h3> <a name="cairo-surface-get-font-options"></a>cairo_surface_get_font_options ()</h3> -<a class="indexterm" name="id2616387"></a><pre class="programlisting">void cairo_surface_get_font_options (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, +<a class="indexterm" name="id2911884"></a><pre class="programlisting">void cairo_surface_get_font_options (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options);</pre> <p> Retrieves the default font rendering options for the surface. @@ -253,9 +306,9 @@ metrics and so forth. The result can then be used with </div> <hr> <div class="refsect2" lang="en"> -<a name="id2616485"></a><h3> +<a name="id2911982"></a><h3> <a name="cairo-surface-set-user-data"></a>cairo_surface_set_user_data ()</h3> -<a class="indexterm" name="id2616494"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_surface_set_user_data (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, +<a class="indexterm" name="id2911992"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_surface_set_user_data (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, const <a href="cairo-cairo-t.html#cairo-user-data-key-t">cairo_user_data_key_t</a> *key, void *user_data, <a href="cairo-cairo-t.html#cairo-destroy-func-t">cairo_destroy_func_t</a> destroy);</pre> @@ -307,9 +360,9 @@ slot could not be allocated for the user data. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2660085"></a><h3> +<a name="id2912168"></a><h3> <a name="cairo-surface-get-user-data"></a>cairo_surface_get_user_data ()</h3> -<a class="indexterm" name="id2660095"></a><pre class="programlisting">void* cairo_surface_get_user_data (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, +<a class="indexterm" name="id2912178"></a><pre class="programlisting">void* cairo_surface_get_user_data (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, const <a href="cairo-cairo-t.html#cairo-user-data-key-t">cairo_user_data_key_t</a> *key);</pre> <p> Return user data previously attached to <em class="parameter"><code>surface</code></em> using the specified @@ -345,9 +398,109 @@ attached to </div> <hr> <div class="refsect2" lang="en"> -<a name="id2660208"></a><h3> +<a name="id2912291"></a><h3> +<a name="cairo-surface-flush"></a>cairo_surface_flush ()</h3> +<a class="indexterm" name="id2912301"></a><pre class="programlisting">void cairo_surface_flush (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre> +<p> +Do any pending drawing for the surface and also restore any +temporary modification's cairo has made to the surface's +state. This function must be called before switching from +drawing on the surface with cairo to drawing on it directly +with native APIs. If the surface doesn't support direct access, +then this function does nothing.</p> +<p> + +</p> +<div class="variablelist"><table border="0"> +<col align="left" valign="top"> +<tbody><tr> +<td> +<span class="term"><em class="parameter"><code>surface</code></em> :</span></td> +<td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> +</td> +</tr></tbody> +</table></div> +</div> +<hr> +<div class="refsect2" lang="en"> +<a name="id2912362"></a><h3> +<a name="cairo-surface-mark-dirty"></a>cairo_surface_mark_dirty ()</h3> +<a class="indexterm" name="id2912371"></a><pre class="programlisting">void cairo_surface_mark_dirty (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre> +<p> +Tells cairo that drawing has been done to surface using means other +than cairo, and that cairo should reread any cached areas. Note +that you must call <a href="cairo-cairo-surface-t.html#cairo-surface-flush"><code class="function">cairo_surface_flush()</code></a> before doing such drawing.</p> +<p> + +</p> +<div class="variablelist"><table border="0"> +<col align="left" valign="top"> +<tbody><tr> +<td> +<span class="term"><em class="parameter"><code>surface</code></em> :</span></td> +<td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> +</td> +</tr></tbody> +</table></div> +</div> +<hr> +<div class="refsect2" lang="en"> +<a name="id2912438"></a><h3> +<a name="cairo-surface-mark-dirty-rectangle"></a>cairo_surface_mark_dirty_rectangle ()</h3> +<a class="indexterm" name="id2912449"></a><pre class="programlisting">void cairo_surface_mark_dirty_rectangle + (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, + int x, + int y, + int width, + int height);</pre> +<p> +Like <a href="cairo-cairo-surface-t.html#cairo-surface-mark-dirty"><code class="function">cairo_surface_mark_dirty()</code></a>, but drawing has been done only to +the specified rectangle, so that cairo can retain cached contents +for other parts of the surface.</p> +<p> + +</p> +<div class="variablelist"><table border="0"> +<col align="left" valign="top"> +<tbody> +<tr> +<td> +<span class="term"><em class="parameter"><code>surface</code></em> :</span></td> +<td> a <a href="cairo-cairo-surface-t.html#cairo-surface-t"><span class="type">cairo_surface_t</span></a> +</td> +</tr> +<tr> +<td> +<span class="term"><em class="parameter"><code>x</code></em> :</span></td> +<td> X coordinate of dirty rectangle +</td> +</tr> +<tr> +<td> +<span class="term"><em class="parameter"><code>y</code></em> :</span></td> +<td> Y coordinate of dirty rectangle +</td> +</tr> +<tr> +<td> +<span class="term"><em class="parameter"><code>width</code></em> :</span></td> +<td> width of dirty rectangle +</td> +</tr> +<tr> +<td> +<span class="term"><em class="parameter"><code>height</code></em> :</span></td> +<td> height of dirty rectangle +</td> +</tr> +</tbody> +</table></div> +</div> +<hr> +<div class="refsect2" lang="en"> +<a name="id2912602"></a><h3> <a name="cairo-surface-set-device-offset"></a>cairo_surface_set_device_offset ()</h3> -<a class="indexterm" name="id2660219"></a><pre class="programlisting">void cairo_surface_set_device_offset (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, +<a class="indexterm" name="id2912613"></a><pre class="programlisting">void cairo_surface_set_device_offset (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, double x_offset, double y_offset);</pre> <p> @@ -394,7 +547,7 @@ the surface in a surface pattern.</p> </div> <table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"> <td align="left"><a accesskey="p" href="cairo-cairo-t.html"><b><< cairo_t</b></a></td> -<td align="right"><a accesskey="n" href="cairo-cairo-pattern-t.html"><b>cairo_pattern_t >></b></a></td> +<td align="right"><a accesskey="n" href="cairo-cairo-matrix-t.html"><b>cairo_matrix_t >></b></a></td> </tr></table> </body> </html> diff --git a/doc/public/html/cairo-cairo-t.html b/doc/public/html/cairo-cairo-t.html index 8ea8215..8231f7d 100644 --- a/doc/public/html/cairo-cairo-t.html +++ b/doc/public/html/cairo-cairo-t.html @@ -39,7 +39,7 @@ typedef <a href="cairo-cairo-t.html#cairo-t">cairo_t</a>; <a href="cairo-cairo-t.html#cairo-t">cairo_t</a>* <a href="cairo-cairo-t.html#cairo-create">cairo_create</a> (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *target); -void <a href="cairo-cairo-t.html#cairo-reference">cairo_reference</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr); +<a href="cairo-cairo-t.html#cairo-t">cairo_t</a>* <a href="cairo-cairo-t.html#cairo-reference">cairo_reference</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr); void <a href="cairo-cairo-t.html#cairo-destroy">cairo_destroy</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr); void <a href="cairo-cairo-t.html#cairo-save">cairo_save</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr); void <a href="cairo-cairo-t.html#cairo-restore">cairo_restore</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr); @@ -60,13 +60,18 @@ void <a href="cairo-cairo-t.html#cairo-set-source-rgba">cairo_set_source_ double blue, double alpha); void <a href="cairo-cairo-t.html#cairo-set-source">cairo_set_source</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, - <a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *source); + <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-t" +>cairo_pattern_t</a> *source); void <a href="cairo-cairo-t.html#cairo-set-source-surface">cairo_set_source_surface</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, double x, double y); void <a href="cairo-cairo-t.html#cairo-set-tolerance">cairo_set_tolerance</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double tolerance); +enum <a href="cairo-cairo-t.html#cairo-antialias-t">cairo_antialias_t</a>; +void <a href="cairo-cairo-t.html#cairo-set-antialias">cairo_set_antialias</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, + <a href="cairo-cairo-t.html#cairo-antialias-t">cairo_antialias_t</a> antialias); enum <a href="cairo-cairo-t.html#cairo-fill-rule-t">cairo_fill_rule_t</a>; void <a href="cairo-cairo-t.html#cairo-set-fill-rule">cairo_set_fill_rule</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-cairo-t.html#cairo-fill-rule-t">cairo_fill_rule_t</a> fill_rule); @@ -158,7 +163,9 @@ void <a href="cairo-cairo-t.html#cairo-paint">cairo_paint</a> void <a href="cairo-cairo-t.html#cairo-paint-with-alpha">cairo_paint_with_alpha</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double alpha); void <a href="cairo-cairo-t.html#cairo-mask">cairo_mask</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, - <a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern); + <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-t" +>cairo_pattern_t</a> *pattern); void <a href="cairo-cairo-t.html#cairo-mask-surface">cairo_mask_surface</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, double surface_x, @@ -229,8 +236,11 @@ void <a href="cairo-cairo-t.html#cairo-glyph-path">cairo_glyph_path</a> <a href="cairo-cairo-t.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs, int num_glyphs); <a href="cairo-cairo-t.html#cairo-operator-t">cairo_operator_t</a> <a href="cairo-cairo-t.html#cairo-get-operator">cairo_get_operator</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr); -<a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* <a href="cairo-cairo-t.html#cairo-get-source">cairo_get_source</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr); +<a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-t" +>cairo_pattern_t</a>* <a href="cairo-cairo-t.html#cairo-get-source">cairo_get_source</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr); double <a href="cairo-cairo-t.html#cairo-get-tolerance">cairo_get_tolerance</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr); +<a href="cairo-cairo-t.html#cairo-antialias-t">cairo_antialias_t</a> <a href="cairo-cairo-t.html#cairo-get-antialias">cairo_get_antialias</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr); void <a href="cairo-cairo-t.html#cairo-get-current-point">cairo_get_current_point</a> (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double *x, double *y); @@ -273,11 +283,12 @@ void (<a href="cairo-cairo-t.html#cairo-destroy-func-t">*cairo_destroy_fu <a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> (<a href="cairo-cairo-t.html#cairo-write-func-t">*cairo_write_func_t</a>) (void *closure, unsigned char *data, unsigned int length); +void <a href="cairo-cairo-t.html#cairo-debug-reset-static-data">cairo_debug_reset_static_data</a> (void); </pre> </div> <div class="refsect1" lang="en"> -<a name="id2664931"></a><h2>Description</h2> +<a name="id2916903"></a><h2>Description</h2> <p> <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> is the main object used when drawing with Cairo. To draw with Cairo, you create a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>, set the target surface, @@ -292,11 +303,11 @@ void (<a href="cairo-cairo-t.html#cairo-destroy-func-t">*cairo_destroy_fu </p> </div> <div class="refsect1" lang="en"> -<a name="id2665038"></a><h2>Details</h2> +<a name="id2917010"></a><h2>Details</h2> <div class="refsect2" lang="en"> -<a name="id2665044"></a><h3> +<a name="id2917016"></a><h3> <a name="cairo-t"></a>cairo_t</h3> -<a class="indexterm" name="id2665054"></a><pre class="programlisting">typedef struct _cairo cairo_t; +<a class="indexterm" name="id2917026"></a><pre class="programlisting">typedef struct _cairo cairo_t; </pre> <p> A <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> contains the current state of the rendering device, @@ -307,9 +318,9 @@ including coordinates of yet to be drawn shapes.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2665083"></a><h3> +<a name="id2917055"></a><h3> <a name="cairo-create"></a>cairo_create ()</h3> -<a class="indexterm" name="id2665093"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-t">cairo_t</a>* cairo_create (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *target);</pre> +<a class="indexterm" name="id2917066"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-t">cairo_t</a>* cairo_create (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *target);</pre> <p> Creates a new <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> with all graphics state parameters set to default values and with <em class="parameter"><code>target</code></em> as a target surface. The target @@ -362,9 +373,9 @@ provide a way to achieve this explicitly). See also the </div> <hr> <div class="refsect2" lang="en"> -<a name="id2665327"></a><h3> +<a name="id2917299"></a><h3> <a name="cairo-reference"></a>cairo_reference ()</h3> -<a class="indexterm" name="id2665337"></a><pre class="programlisting">void cairo_reference (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2917310"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-t">cairo_t</a>* cairo_reference (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Increases the reference count on <em class="parameter"><code>cr</code></em> by one. This prevents <em class="parameter"><code>cr</code></em> from being destroyed until a matching call to <a href="cairo-cairo-t.html#cairo-destroy"><code class="function">cairo_destroy()</code></a> @@ -374,19 +385,27 @@ is made.</p> </p> <div class="variablelist"><table border="0"> <col align="left" valign="top"> -<tbody><tr> +<tbody> +<tr> <td> <span class="term"><em class="parameter"><code>cr</code></em> :</span></td> <td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> </td> -</tr></tbody> +</tr> +<tr> +<td> +<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> +<td> the referenced <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>. +</td> +</tr> +</tbody> </table></div> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2665417"></a><h3> +<a name="id2917407"></a><h3> <a name="cairo-destroy"></a>cairo_destroy ()</h3> -<a class="indexterm" name="id2665428"></a><pre class="programlisting">void cairo_destroy (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2917418"></a><pre class="programlisting">void cairo_destroy (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Decreases the reference count on <em class="parameter"><code>cr</code></em> by one. If the result is zero, then <em class="parameter"><code>cr</code></em> and all associated resources are freed. @@ -406,9 +425,9 @@ See <a href="cairo-cairo-t.html#cairo-reference"><code class="function">cairo_re </div> <hr> <div class="refsect2" lang="en"> -<a name="id2665507"></a><h3> +<a name="id2917498"></a><h3> <a name="cairo-save"></a>cairo_save ()</h3> -<a class="indexterm" name="id2665518"></a><pre class="programlisting">void cairo_save (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2917508"></a><pre class="programlisting">void cairo_save (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Makes a copy of the current state of <em class="parameter"><code>cr</code></em> and saves it on an internal stack of saved states for <em class="parameter"><code>cr</code></em>. When @@ -437,9 +456,9 @@ any saved states will be freed along with the <a href="cairo-cairo-t.html#cairo- </div> <hr> <div class="refsect2" lang="en"> -<a name="id2665680"></a><h3> +<a name="id2917671"></a><h3> <a name="cairo-restore"></a>cairo_restore ()</h3> -<a class="indexterm" name="id2665691"></a><pre class="programlisting">void cairo_restore (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2917681"></a><pre class="programlisting">void cairo_restore (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Restores <em class="parameter"><code>cr</code></em> to the state saved by a preceding call to <a href="cairo-cairo-t.html#cairo-save"><code class="function">cairo_save()</code></a> and removes that state from the stack of @@ -459,9 +478,9 @@ saved states.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2665765"></a><h3> +<a name="id2917755"></a><h3> <a name="cairo-content-t"></a>enum cairo_content_t</h3> -<a class="indexterm" name="id2665776"></a><pre class="programlisting">typedef enum _cairo_content { +<a class="indexterm" name="id2917766"></a><pre class="programlisting">typedef enum _cairo_content { CAIRO_CONTENT_COLOR = 0x1000, CAIRO_CONTENT_ALPHA = 0x2000, CAIRO_CONTENT_COLOR_ALPHA = 0x3000 @@ -505,9 +524,9 @@ implementation can detect the error if users confuse the two types.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2665866"></a><h3> +<a name="id2917856"></a><h3> <a name="CAIRO-CONTENT-VALID:CAPS"></a>CAIRO_CONTENT_VALID()</h3> -<a class="indexterm" name="id2665878"></a><pre class="programlisting">#define CAIRO_CONTENT_VALID(content)</pre> +<a class="indexterm" name="id2917868"></a><pre class="programlisting">#define CAIRO_CONTENT_VALID(content)</pre> <p> </p> @@ -525,9 +544,9 @@ implementation can detect the error if users confuse the two types.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2665913"></a><h3> +<a name="id2917903"></a><h3> <a name="cairo-format-t"></a>enum cairo_format_t</h3> -<a class="indexterm" name="id2665924"></a><pre class="programlisting">typedef enum _cairo_format { +<a class="indexterm" name="id2917914"></a><pre class="programlisting">typedef enum _cairo_format { CAIRO_FORMAT_ARGB32, CAIRO_FORMAT_RGB24, CAIRO_FORMAT_A8, @@ -584,9 +603,9 @@ image data.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2666033"></a><h3> +<a name="id2918024"></a><h3> <a name="CAIRO-FORMAT-VALID:CAPS"></a>CAIRO_FORMAT_VALID()</h3> -<a class="indexterm" name="id2666044"></a><pre class="programlisting">#define CAIRO_FORMAT_VALID(format)</pre> +<a class="indexterm" name="id2918035"></a><pre class="programlisting">#define CAIRO_FORMAT_VALID(format)</pre> <p> </p> @@ -604,9 +623,9 @@ image data.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2666080"></a><h3> +<a name="id2918070"></a><h3> <a name="cairo-operator-t"></a>enum cairo_operator_t</h3> -<a class="indexterm" name="id2666091"></a><pre class="programlisting">typedef enum _cairo_operator { +<a class="indexterm" name="id2918081"></a><pre class="programlisting">typedef enum _cairo_operator { CAIRO_OPERATOR_CLEAR, CAIRO_OPERATOR_SOURCE, @@ -632,9 +651,9 @@ image data.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2666113"></a><h3> +<a name="id2918103"></a><h3> <a name="cairo-set-operator"></a>cairo_set_operator ()</h3> -<a class="indexterm" name="id2666125"></a><pre class="programlisting">void cairo_set_operator (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2918115"></a><pre class="programlisting">void cairo_set_operator (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-cairo-t.html#cairo-operator-t">cairo_operator_t</a> op);</pre> <p> Sets the compositing operator to be used for all drawing @@ -668,9 +687,9 @@ that if such a section existed? (cworth).</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2666226"></a><h3> +<a name="id2918216"></a><h3> <a name="cairo-set-source-rgb"></a>cairo_set_source_rgb ()</h3> -<a class="indexterm" name="id2666238"></a><pre class="programlisting">void cairo_set_source_rgb (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2918228"></a><pre class="programlisting">void cairo_set_source_rgb (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double red, double green, double blue);</pre> @@ -718,9 +737,9 @@ clamped.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2666365"></a><h3> +<a name="id2918356"></a><h3> <a name="cairo-set-source-rgba"></a>cairo_set_source_rgba ()</h3> -<a class="indexterm" name="id2666376"></a><pre class="programlisting">void cairo_set_source_rgba (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2918367"></a><pre class="programlisting">void cairo_set_source_rgba (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double red, double green, double blue, @@ -775,16 +794,26 @@ will be clamped.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2666526"></a><h3> +<a name="id2918516"></a><h3> <a name="cairo-set-source"></a>cairo_set_source ()</h3> -<a class="indexterm" name="id2666537"></a><pre class="programlisting">void cairo_set_source (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, - <a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *source);</pre> +<a class="indexterm" name="id2918527"></a><pre class="programlisting">void cairo_set_source (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, + <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-t" +>cairo_pattern_t</a> *source);</pre> <p> Sets the source pattern within <em class="parameter"><code>cr</code></em> to <em class="parameter"><code>source</code></em>. This pattern will then be used for any subsequent drawing operation until a new source pattern is set. </p> <p> +Note: The pattern's transformation matrix will be locked to the +user space in effect at the time of <a href="cairo-cairo-t.html#cairo-set-source"><code class="function">cairo_set_source()</code></a>. This means +that further modifications of the CTM will not affect the source +pattern. See <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-set-matrix" +><code class="function">cairo_pattern_set_matrix()</code></a>. +</p> +<p> XXX: I'd also like to direct the reader's attention to some (not-yet-written) section on cairo's imaging model. How would I do that if such a section existed? (cworth).</p> @@ -803,7 +832,9 @@ that if such a section existed? (cworth).</p> <tr> <td> <span class="term"><em class="parameter"><code>source</code></em> :</span></td> -<td> a <a href="cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> to be used as the source for +<td> a <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-t" +><span class="type">cairo_pattern_t</span></a> to be used as the source for subsequent drawing operations. </td> </tr> @@ -812,9 +843,9 @@ subsequent drawing operations. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2666636"></a><h3> +<a name="id2918652"></a><h3> <a name="cairo-set-source-surface"></a>cairo_set_source_surface ()</h3> -<a class="indexterm" name="id2666647"></a><pre class="programlisting">void cairo_set_source_surface (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2918664"></a><pre class="programlisting">void cairo_set_source_surface (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, double x, double y);</pre> @@ -835,7 +866,9 @@ above, all other pattern attributes, (such as its extend mode), are set to the default values as in cairo_pattern_create_for_surface. The resulting pattern can be queried with <a href="cairo-cairo-t.html#cairo-get-source"><code class="function">cairo_get_source()</code></a> so that these attributes can be modified if desired, (eg. to create a -repeating pattern with <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-extend"><code class="function">cairo_pattern_set_extend()</code></a>).</p> +repeating pattern with <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-set-extend" +><code class="function">cairo_pattern_set_extend()</code></a>).</p> <p> </p> @@ -871,9 +904,9 @@ repeating pattern with <a href="cairo-cairo-pattern-t.html#cairo-pattern-set-ext </div> <hr> <div class="refsect2" lang="en"> -<a name="id2666846"></a><h3> +<a name="id2918862"></a><h3> <a name="cairo-set-tolerance"></a>cairo_set_tolerance ()</h3> -<a class="indexterm" name="id2666857"></a><pre class="programlisting">void cairo_set_tolerance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2918873"></a><pre class="programlisting">void cairo_set_tolerance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double tolerance);</pre> <p> Sets the tolerance used when converting paths into trapezoids. @@ -906,9 +939,95 @@ is unlikely to improve appearance significantly.)</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2666948"></a><h3> +<a name="id2918964"></a><h3> +<a name="cairo-antialias-t"></a>enum cairo_antialias_t</h3> +<a class="indexterm" name="id2918975"></a><pre class="programlisting">typedef enum _cairo_antialias { + CAIRO_ANTIALIAS_DEFAULT, + CAIRO_ANTIALIAS_NONE, + CAIRO_ANTIALIAS_GRAY, + CAIRO_ANTIALIAS_SUBPIXEL +} cairo_antialias_t; +</pre> +<p> +Specifies the type of antialiasing to do when rendering text or shapes.</p> +<p> + +</p> +<div class="variablelist"><table border="0"> +<col align="left" valign="top"> +<tbody> +<tr> +<td> +<span class="term"><code class="literal">CAIRO_ANTIALIAS_DEFAULT</code></span></td> +<td> Use the default antialiasing for + the subsystem and target device +</td> +</tr> +<tr> +<td> +<span class="term"><code class="literal">CAIRO_ANTIALIAS_NONE</code></span></td> +<td> Use a bilevel alpha mask +</td> +</tr> +<tr> +<td> +<span class="term"><code class="literal">CAIRO_ANTIALIAS_GRAY</code></span></td> +<td> Perform single-color antialiasing (using + shades of gray for black text on a white background, for example). +</td> +</tr> +<tr> +<td> +<span class="term"><code class="literal">CAIRO_ANTIALIAS_SUBPIXEL</code></span></td> +<td> Perform antialiasing by taking + advantage of the order of subpixel elements on devices + such as LCD panels +</td> +</tr> +</tbody> +</table></div> +</div> +<hr> +<div class="refsect2" lang="en"> +<a name="id2919071"></a><h3> +<a name="cairo-set-antialias"></a>cairo_set_antialias ()</h3> +<a class="indexterm" name="id2919082"></a><pre class="programlisting">void cairo_set_antialias (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, + <a href="cairo-cairo-t.html#cairo-antialias-t">cairo_antialias_t</a> antialias);</pre> +<p> +Set the antialiasing mode of the rasterizer used for drawing shapes. +This value is a hint, and a particular backend may or may not support +a particular value. At the current time, no backend supports +<code class="literal">CAIRO_ANTIALIAS_SUBPIXEL</code> when drawing shapes. +</p> +<p> +Note that this option does not affect text rendering, instead see +<a href="cairo-Fonts.html#cairo-font-options-set-antialias"><code class="function">cairo_font_options_set_antialias()</code></a>.</p> +<p> + +</p> +<div class="variablelist"><table border="0"> +<col align="left" valign="top"> +<tbody> +<tr> +<td> +<span class="term"><em class="parameter"><code>cr</code></em> :</span></td> +<td> a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> +</td> +</tr> +<tr> +<td> +<span class="term"><em class="parameter"><code>antialias</code></em> :</span></td> +<td> the new antialiasing mode +</td> +</tr> +</tbody> +</table></div> +</div> +<hr> +<div class="refsect2" lang="en"> +<a name="id2919184"></a><h3> <a name="cairo-fill-rule-t"></a>enum cairo_fill_rule_t</h3> -<a class="indexterm" name="id2666959"></a><pre class="programlisting">typedef enum _cairo_fill_rule { +<a class="indexterm" name="id2919195"></a><pre class="programlisting">typedef enum _cairo_fill_rule { CAIRO_FILL_RULE_WINDING, CAIRO_FILL_RULE_EVEN_ODD } cairo_fill_rule_t; @@ -952,9 +1071,9 @@ filled. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2667039"></a><h3> +<a name="id2919275"></a><h3> <a name="cairo-set-fill-rule"></a>cairo_set_fill_rule ()</h3> -<a class="indexterm" name="id2667050"></a><pre class="programlisting">void cairo_set_fill_rule (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2919286"></a><pre class="programlisting">void cairo_set_fill_rule (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-cairo-t.html#cairo-fill-rule-t">cairo_fill_rule_t</a> fill_rule);</pre> <p> Set the current fill rule within the cairo context. The fill rule @@ -985,9 +1104,9 @@ on the semantics of each available fill rule.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2667147"></a><h3> +<a name="id2919384"></a><h3> <a name="cairo-set-line-width"></a>cairo_set_line_width ()</h3> -<a class="indexterm" name="id2667158"></a><pre class="programlisting">void cairo_set_line_width (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2919395"></a><pre class="programlisting">void cairo_set_line_width (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double width);</pre> <p> Sets the current line width within the cairo context. The line @@ -1022,9 +1141,9 @@ construction.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2667274"></a><h3> +<a name="id2919510"></a><h3> <a name="cairo-line-cap-t"></a>enum cairo_line_cap_t</h3> -<a class="indexterm" name="id2667285"></a><pre class="programlisting">typedef enum _cairo_line_cap { +<a class="indexterm" name="id2919522"></a><pre class="programlisting">typedef enum _cairo_line_cap { CAIRO_LINE_CAP_BUTT, CAIRO_LINE_CAP_ROUND, CAIRO_LINE_CAP_SQUARE @@ -1061,9 +1180,9 @@ enumeration for style of line-endings</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2667361"></a><h3> +<a name="id2919598"></a><h3> <a name="cairo-set-line-cap"></a>cairo_set_line_cap ()</h3> -<a class="indexterm" name="id2667372"></a><pre class="programlisting">void cairo_set_line_cap (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2919609"></a><pre class="programlisting">void cairo_set_line_cap (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-cairo-t.html#cairo-line-cap-t">cairo_line_cap_t</a> line_cap);</pre> <p> Sets the current line cap style within the cairo context. See @@ -1098,9 +1217,9 @@ construction.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2667502"></a><h3> +<a name="id2919739"></a><h3> <a name="cairo-line-join-t"></a>enum cairo_line_join_t</h3> -<a class="indexterm" name="id2667513"></a><pre class="programlisting">typedef enum _cairo_line_join { +<a class="indexterm" name="id2919750"></a><pre class="programlisting">typedef enum _cairo_line_join { CAIRO_LINE_JOIN_MITER, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_JOIN_BEVEL @@ -1112,9 +1231,9 @@ construction.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2667531"></a><h3> +<a name="id2919767"></a><h3> <a name="cairo-set-line-join"></a>cairo_set_line_join ()</h3> -<a class="indexterm" name="id2667542"></a><pre class="programlisting">void cairo_set_line_join (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2919779"></a><pre class="programlisting">void cairo_set_line_join (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-cairo-t.html#cairo-line-join-t">cairo_line_join_t</a> line_join);</pre> <p> Sets the current line join style within the cairo context. See @@ -1149,9 +1268,9 @@ construction.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2667672"></a><h3> +<a name="id2919909"></a><h3> <a name="cairo-set-dash"></a>cairo_set_dash ()</h3> -<a class="indexterm" name="id2667683"></a><pre class="programlisting">void cairo_set_dash (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2919920"></a><pre class="programlisting">void cairo_set_dash (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double *dashes, int ndash, double offset);</pre> @@ -1192,9 +1311,9 @@ construction.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2667792"></a><h3> +<a name="id2920029"></a><h3> <a name="cairo-set-miter-limit"></a>cairo_set_miter_limit ()</h3> -<a class="indexterm" name="id2667803"></a><pre class="programlisting">void cairo_set_miter_limit (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2920040"></a><pre class="programlisting">void cairo_set_miter_limit (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double limit);</pre> <p> @@ -1221,9 +1340,9 @@ construction.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2667870"></a><h3> +<a name="id2920107"></a><h3> <a name="cairo-translate"></a>cairo_translate ()</h3> -<a class="indexterm" name="id2667881"></a><pre class="programlisting">void cairo_translate (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2920118"></a><pre class="programlisting">void cairo_translate (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double tx, double ty);</pre> <p> @@ -1261,9 +1380,9 @@ user-space origin takes place after any existing transformation.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2667991"></a><h3> +<a name="id2920227"></a><h3> <a name="cairo-scale"></a>cairo_scale ()</h3> -<a class="indexterm" name="id2668001"></a><pre class="programlisting">void cairo_scale (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2920238"></a><pre class="programlisting">void cairo_scale (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double sx, double sy);</pre> <p> @@ -1300,9 +1419,9 @@ space.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2668108"></a><h3> +<a name="id2920345"></a><h3> <a name="cairo-rotate"></a>cairo_rotate ()</h3> -<a class="indexterm" name="id2668120"></a><pre class="programlisting">void cairo_rotate (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2920356"></a><pre class="programlisting">void cairo_rotate (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double angle);</pre> <p> Modifies the current transformation matrix (CTM) by rotating the @@ -1334,9 +1453,9 @@ rotated </div> <hr> <div class="refsect2" lang="en"> -<a name="id2668202"></a><h3> +<a name="id2920438"></a><h3> <a name="cairo-transform"></a>cairo_transform ()</h3> -<a class="indexterm" name="id2668212"></a><pre class="programlisting">void cairo_transform (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2920449"></a><pre class="programlisting">void cairo_transform (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre> <p> Modifies the current transformation matrix (CTM) by applying @@ -1365,9 +1484,9 @@ user space takes place after any existing transformation.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2668293"></a><h3> +<a name="id2920530"></a><h3> <a name="cairo-set-matrix"></a>cairo_set_matrix ()</h3> -<a class="indexterm" name="id2668304"></a><pre class="programlisting">void cairo_set_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2920541"></a><pre class="programlisting">void cairo_set_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre> <p> Modifies the current transformation matrix (CTM) by setting it @@ -1395,9 +1514,9 @@ equal to <em class="parameter"><code>matrix</code></em>.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2668383"></a><h3> +<a name="id2920620"></a><h3> <a name="cairo-identity-matrix"></a>cairo_identity_matrix ()</h3> -<a class="indexterm" name="id2668394"></a><pre class="programlisting">void cairo_identity_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2920631"></a><pre class="programlisting">void cairo_identity_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Resets the current transformation matrix (CTM) by setting it equal to the identity matrix. That is, the user-space and device-space @@ -1418,9 +1537,9 @@ device-space unit.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2668447"></a><h3> +<a name="id2920684"></a><h3> <a name="cairo-user-to-device"></a>cairo_user_to_device ()</h3> -<a class="indexterm" name="id2668458"></a><pre class="programlisting">void cairo_user_to_device (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2920695"></a><pre class="programlisting">void cairo_user_to_device (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double *x, double *y);</pre> <p> @@ -1456,9 +1575,9 @@ multiplying the given point by the current transformation matrix </div> <hr> <div class="refsect2" lang="en"> -<a name="id2668553"></a><h3> +<a name="id2920790"></a><h3> <a name="cairo-user-to-device-distance"></a>cairo_user_to_device_distance ()</h3> -<a class="indexterm" name="id2668565"></a><pre class="programlisting">void cairo_user_to_device_distance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2920802"></a><pre class="programlisting">void cairo_user_to_device_distance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double *dx, double *dy);</pre> <p> @@ -1495,9 +1614,9 @@ translation components of the CTM will be ignored when transforming </div> <hr> <div class="refsect2" lang="en"> -<a name="id2668683"></a><h3> +<a name="id2920920"></a><h3> <a name="cairo-device-to-user"></a>cairo_device_to_user ()</h3> -<a class="indexterm" name="id2668694"></a><pre class="programlisting">void cairo_device_to_user (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2920931"></a><pre class="programlisting">void cairo_device_to_user (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double *x, double *y);</pre> <p> @@ -1533,9 +1652,9 @@ transformation matrix (CTM).</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2668789"></a><h3> +<a name="id2921026"></a><h3> <a name="cairo-device-to-user-distance"></a>cairo_device_to_user_distance ()</h3> -<a class="indexterm" name="id2668801"></a><pre class="programlisting">void cairo_device_to_user_distance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2921037"></a><pre class="programlisting">void cairo_device_to_user_distance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double *dx, double *dy);</pre> <p> @@ -1572,9 +1691,9 @@ transforming (<em class="parameter"><code>dx</code></em>,<em class="parameter">< </div> <hr> <div class="refsect2" lang="en"> -<a name="id2668919"></a><h3> +<a name="id2921156"></a><h3> <a name="cairo-new-path"></a>cairo_new_path ()</h3> -<a class="indexterm" name="id2668930"></a><pre class="programlisting">void cairo_new_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2921166"></a><pre class="programlisting">void cairo_new_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> </p> @@ -1592,9 +1711,9 @@ transforming (<em class="parameter"><code>dx</code></em>,<em class="parameter">< </div> <hr> <div class="refsect2" lang="en"> -<a name="id2668975"></a><h3> +<a name="id2921212"></a><h3> <a name="cairo-move-to"></a>cairo_move_to ()</h3> -<a class="indexterm" name="id2668986"></a><pre class="programlisting">void cairo_move_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2921223"></a><pre class="programlisting">void cairo_move_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double x, double y);</pre> <p> @@ -1628,9 +1747,9 @@ transforming (<em class="parameter"><code>dx</code></em>,<em class="parameter">< </div> <hr> <div class="refsect2" lang="en"> -<a name="id2669074"></a><h3> +<a name="id2921310"></a><h3> <a name="cairo-line-to"></a>cairo_line_to ()</h3> -<a class="indexterm" name="id2669084"></a><pre class="programlisting">void cairo_line_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2921321"></a><pre class="programlisting">void cairo_line_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double x, double y);</pre> <p> @@ -1664,9 +1783,9 @@ transforming (<em class="parameter"><code>dx</code></em>,<em class="parameter">< </div> <hr> <div class="refsect2" lang="en"> -<a name="id2669172"></a><h3> +<a name="id2921409"></a><h3> <a name="cairo-curve-to"></a>cairo_curve_to ()</h3> -<a class="indexterm" name="id2669183"></a><pre class="programlisting">void cairo_curve_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2921420"></a><pre class="programlisting">void cairo_curve_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double x1, double y1, double x2, @@ -1728,9 +1847,9 @@ transforming (<em class="parameter"><code>dx</code></em>,<em class="parameter">< </div> <hr> <div class="refsect2" lang="en"> -<a name="id2669354"></a><h3> +<a name="id2921591"></a><h3> <a name="cairo-arc"></a>cairo_arc ()</h3> -<a class="indexterm" name="id2669365"></a><pre class="programlisting">void cairo_arc (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2921601"></a><pre class="programlisting">void cairo_arc (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double xc, double yc, double radius, @@ -1809,9 +1928,9 @@ cairo_restore (cr); </div> <hr> <div class="refsect2" lang="en"> -<a name="id2669603"></a><h3> +<a name="id2921840"></a><h3> <a name="cairo-arc-negative"></a>cairo_arc_negative ()</h3> -<a class="indexterm" name="id2669614"></a><pre class="programlisting">void cairo_arc_negative (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2921851"></a><pre class="programlisting">void cairo_arc_negative (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double xc, double yc, double radius, @@ -1869,9 +1988,9 @@ the arc in the direction of decreasing angle.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2669795"></a><h3> +<a name="id2922031"></a><h3> <a name="cairo-rel-move-to"></a>cairo_rel_move_to ()</h3> -<a class="indexterm" name="id2669806"></a><pre class="programlisting">void cairo_rel_move_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2922042"></a><pre class="programlisting">void cairo_rel_move_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double dx, double dy);</pre> <p> @@ -1905,9 +2024,9 @@ the arc in the direction of decreasing angle.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2669893"></a><h3> +<a name="id2922130"></a><h3> <a name="cairo-rel-line-to"></a>cairo_rel_line_to ()</h3> -<a class="indexterm" name="id2669904"></a><pre class="programlisting">void cairo_rel_line_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2922141"></a><pre class="programlisting">void cairo_rel_line_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double dx, double dy);</pre> <p> @@ -1941,9 +2060,9 @@ the arc in the direction of decreasing angle.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2669992"></a><h3> +<a name="id2922228"></a><h3> <a name="cairo-rel-curve-to"></a>cairo_rel_curve_to ()</h3> -<a class="indexterm" name="id2670003"></a><pre class="programlisting">void cairo_rel_curve_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2922240"></a><pre class="programlisting">void cairo_rel_curve_to (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double dx1, double dy1, double dx2, @@ -2005,9 +2124,9 @@ the arc in the direction of decreasing angle.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2670174"></a><h3> +<a name="id2922411"></a><h3> <a name="cairo-rectangle"></a>cairo_rectangle ()</h3> -<a class="indexterm" name="id2670185"></a><pre class="programlisting">void cairo_rectangle (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2922421"></a><pre class="programlisting">void cairo_rectangle (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double x, double y, double width, @@ -2055,9 +2174,9 @@ the arc in the direction of decreasing angle.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2670314"></a><h3> +<a name="id2922551"></a><h3> <a name="cairo-close-path"></a>cairo_close_path ()</h3> -<a class="indexterm" name="id2670326"></a><pre class="programlisting">void cairo_close_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2922562"></a><pre class="programlisting">void cairo_close_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> </p> @@ -2075,9 +2194,9 @@ the arc in the direction of decreasing angle.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2670371"></a><h3> +<a name="id2922608"></a><h3> <a name="cairo-paint"></a>cairo_paint ()</h3> -<a class="indexterm" name="id2670382"></a><pre class="programlisting">void cairo_paint (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2922618"></a><pre class="programlisting">void cairo_paint (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> A drawing operator that paints the current source everywhere within the current clip region.</p> @@ -2096,9 +2215,9 @@ the current clip region.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2670433"></a><h3> +<a name="id2922670"></a><h3> <a name="cairo-paint-with-alpha"></a>cairo_paint_with_alpha ()</h3> -<a class="indexterm" name="id2670444"></a><pre class="programlisting">void cairo_paint_with_alpha (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2922681"></a><pre class="programlisting">void cairo_paint_with_alpha (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double alpha);</pre> <p> A drawing operator that paints the current source everywhere within @@ -2128,10 +2247,12 @@ is faded out using the alpha value.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2670534"></a><h3> +<a name="id2922771"></a><h3> <a name="cairo-mask"></a>cairo_mask ()</h3> -<a class="indexterm" name="id2670544"></a><pre class="programlisting">void cairo_mask (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, - <a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a> *pattern);</pre> +<a class="indexterm" name="id2922781"></a><pre class="programlisting">void cairo_mask (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, + <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-t" +>cairo_pattern_t</a> *pattern);</pre> <p> A drawing operator that paints the current source using the alpha channel of <em class="parameter"><code>pattern</code></em> as a mask. (Opaque @@ -2152,7 +2273,9 @@ areas are not painted.)</p> <tr> <td> <span class="term"><em class="parameter"><code>pattern</code></em> :</span></td> -<td> a <a href="cairo-cairo-pattern-t.html#cairo-pattern-t"><span class="type">cairo_pattern_t</span></a> +<td> a <a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-t" +><span class="type">cairo_pattern_t</span></a> </td> </tr> </tbody> @@ -2160,9 +2283,9 @@ areas are not painted.)</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2670637"></a><h3> +<a name="id2922874"></a><h3> <a name="cairo-mask-surface"></a>cairo_mask_surface ()</h3> -<a class="indexterm" name="id2670649"></a><pre class="programlisting">void cairo_mask_surface (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2922886"></a><pre class="programlisting">void cairo_mask_surface (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface, double surface_x, double surface_y);</pre> @@ -2206,9 +2329,9 @@ areas are not painted.)</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2670797"></a><h3> +<a name="id2923034"></a><h3> <a name="cairo-stroke"></a>cairo_stroke ()</h3> -<a class="indexterm" name="id2670808"></a><pre class="programlisting">void cairo_stroke (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2923044"></a><pre class="programlisting">void cairo_stroke (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> A drawing operator that strokes the current path according to the current line width, line join, line cap, and dash settings. After @@ -2231,9 +2354,9 @@ context. See <a href="cairo-cairo-t.html#cairo-set-line-width"><code class="func </div> <hr> <div class="refsect2" lang="en"> -<a name="id2670909"></a><h3> +<a name="id2923146"></a><h3> <a name="cairo-stroke-preserve"></a>cairo_stroke_preserve ()</h3> -<a class="indexterm" name="id2670920"></a><pre class="programlisting">void cairo_stroke_preserve (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2923157"></a><pre class="programlisting">void cairo_stroke_preserve (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> A drawing operator that strokes the current path according to the current line width, line join, line cap, and dash settings. Unlike @@ -2259,13 +2382,14 @@ See <a href="cairo-cairo-t.html#cairo-set-line-width"><code class="function">cai </div> <hr> <div class="refsect2" lang="en"> -<a name="id2671036"></a><h3> +<a name="id2923272"></a><h3> <a name="cairo-fill"></a>cairo_fill ()</h3> -<a class="indexterm" name="id2671046"></a><pre class="programlisting">void cairo_fill (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2923283"></a><pre class="programlisting">void cairo_fill (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> A drawing operator that fills the current path according to the -current fill rule. After cairo_fill, the current path will be -cleared from the cairo context. See <a href="cairo-cairo-t.html#cairo-set-fill-rule"><code class="function">cairo_set_fill_rule()</code></a> and +current fill rule, (each sub-path is implicitly closed before being +filled). After cairo_fill, the current path will be cleared from +the cairo context. See <a href="cairo-cairo-t.html#cairo-set-fill-rule"><code class="function">cairo_set_fill_rule()</code></a> and <a href="cairo-cairo-t.html#cairo-fill-preserve"><code class="function">cairo_fill_preserve()</code></a>.</p> <p> @@ -2282,13 +2406,14 @@ cleared from the cairo context. See <a href="cairo-cairo-t.html#cairo-set-fill-r </div> <hr> <div class="refsect2" lang="en"> -<a name="id2671118"></a><h3> +<a name="id2923355"></a><h3> <a name="cairo-fill-preserve"></a>cairo_fill_preserve ()</h3> -<a class="indexterm" name="id2671129"></a><pre class="programlisting">void cairo_fill_preserve (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2923367"></a><pre class="programlisting">void cairo_fill_preserve (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> A drawing operator that fills the current path according to the -current fill rule. Unlike <a href="cairo-cairo-t.html#cairo-fill"><code class="function">cairo_fill()</code></a>, cairo_fill_preserve -preserves the path within the cairo context. +current fill rule, (each sub-path is implicitly closed before being +filled). Unlike <a href="cairo-cairo-t.html#cairo-fill"><code class="function">cairo_fill()</code></a>, cairo_fill_preserve preserves the +path within the cairo context. </p> <p> See <a href="cairo-cairo-t.html#cairo-set-fill-rule"><code class="function">cairo_set_fill_rule()</code></a> and <a href="cairo-cairo-t.html#cairo-fill"><code class="function">cairo_fill()</code></a>.</p> @@ -2307,9 +2432,9 @@ See <a href="cairo-cairo-t.html#cairo-set-fill-rule"><code class="function">cair </div> <hr> <div class="refsect2" lang="en"> -<a name="id2671213"></a><h3> +<a name="id2923452"></a><h3> <a name="cairo-copy-page"></a>cairo_copy_page ()</h3> -<a class="indexterm" name="id2671224"></a><pre class="programlisting">void cairo_copy_page (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2923462"></a><pre class="programlisting">void cairo_copy_page (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> </p> @@ -2327,9 +2452,9 @@ See <a href="cairo-cairo-t.html#cairo-set-fill-rule"><code class="function">cair </div> <hr> <div class="refsect2" lang="en"> -<a name="id2671269"></a><h3> +<a name="id2923508"></a><h3> <a name="cairo-show-page"></a>cairo_show_page ()</h3> -<a class="indexterm" name="id2671280"></a><pre class="programlisting">void cairo_show_page (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2923519"></a><pre class="programlisting">void cairo_show_page (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> </p> @@ -2347,9 +2472,9 @@ See <a href="cairo-cairo-t.html#cairo-set-fill-rule"><code class="function">cair </div> <hr> <div class="refsect2" lang="en"> -<a name="id2671326"></a><h3> +<a name="id2923565"></a><h3> <a name="cairo-in-stroke"></a>cairo_in_stroke ()</h3> -<a class="indexterm" name="id2671337"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-bool-t">cairo_bool_t</a> cairo_in_stroke (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2923575"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-bool-t">cairo_bool_t</a> cairo_in_stroke (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double x, double y);</pre> <p> @@ -2389,9 +2514,9 @@ See <a href="cairo-cairo-t.html#cairo-set-fill-rule"><code class="function">cair </div> <hr> <div class="refsect2" lang="en"> -<a name="id2671435"></a><h3> +<a name="id2923674"></a><h3> <a name="cairo-in-fill"></a>cairo_in_fill ()</h3> -<a class="indexterm" name="id2671446"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-bool-t">cairo_bool_t</a> cairo_in_fill (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2923685"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-bool-t">cairo_bool_t</a> cairo_in_fill (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double x, double y);</pre> <p> @@ -2431,9 +2556,9 @@ See <a href="cairo-cairo-t.html#cairo-set-fill-rule"><code class="function">cair </div> <hr> <div class="refsect2" lang="en"> -<a name="id2671544"></a><h3> +<a name="id2923783"></a><h3> <a name="cairo-bool-t"></a>cairo_bool_t</h3> -<a class="indexterm" name="id2671555"></a><pre class="programlisting">typedef int cairo_bool_t; +<a class="indexterm" name="id2923794"></a><pre class="programlisting">typedef int cairo_bool_t; </pre> <p> <a href="cairo-cairo-t.html#cairo-bool-t"><span class="type">cairo_bool_t</span></a> is used for boolean values. Returns of type @@ -2454,9 +2579,9 @@ value as a boolean condition. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2671608"></a><h3> +<a name="id2923847"></a><h3> <a name="cairo-stroke-extents"></a>cairo_stroke_extents ()</h3> -<a class="indexterm" name="id2671619"></a><pre class="programlisting">void cairo_stroke_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2923858"></a><pre class="programlisting">void cairo_stroke_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double *x1, double *y1, double *x2, @@ -2504,9 +2629,9 @@ value as a boolean condition. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2671749"></a><h3> +<a name="id2923987"></a><h3> <a name="cairo-fill-extents"></a>cairo_fill_extents ()</h3> -<a class="indexterm" name="id2671760"></a><pre class="programlisting">void cairo_fill_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2923999"></a><pre class="programlisting">void cairo_fill_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double *x1, double *y1, double *x2, @@ -2554,9 +2679,9 @@ value as a boolean condition. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2671889"></a><h3> +<a name="id2924128"></a><h3> <a name="cairo-clip"></a>cairo_clip ()</h3> -<a class="indexterm" name="id2671899"></a><pre class="programlisting">void cairo_clip (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2924138"></a><pre class="programlisting">void cairo_clip (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Establishes a new clip region by intersecting the current clip region with the current path as it would be filled by <a href="cairo-cairo-t.html#cairo-fill"><code class="function">cairo_fill()</code></a> @@ -2593,9 +2718,9 @@ region is <a href="cairo-cairo-t.html#cairo-reset-clip"><code class="function">c </div> <hr> <div class="refsect2" lang="en"> -<a name="id2672037"></a><h3> +<a name="id2924276"></a><h3> <a name="cairo-clip-preserve"></a>cairo_clip_preserve ()</h3> -<a class="indexterm" name="id2672048"></a><pre class="programlisting">void cairo_clip_preserve (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2924287"></a><pre class="programlisting">void cairo_clip_preserve (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Establishes a new clip region by intersecting the current clip region with the current path as it would be filled by <a href="cairo-cairo-t.html#cairo-fill"><code class="function">cairo_fill()</code></a> @@ -2632,9 +2757,9 @@ region is <a href="cairo-cairo-t.html#cairo-reset-clip"><code class="function">c </div> <hr> <div class="refsect2" lang="en"> -<a name="id2672195"></a><h3> +<a name="id2924434"></a><h3> <a name="cairo-reset-clip"></a>cairo_reset_clip ()</h3> -<a class="indexterm" name="id2672205"></a><pre class="programlisting">void cairo_reset_clip (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2924444"></a><pre class="programlisting">void cairo_reset_clip (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Reset the current clip region to its original, unrestricted state. That is, set the clip region to an infinitely large shape @@ -2663,9 +2788,9 @@ robust means of temporarily restricting the clip region.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2672314"></a><h3> +<a name="id2924553"></a><h3> <a name="cairo-glyph-t"></a>cairo_glyph_t</h3> -<a class="indexterm" name="id2672325"></a><pre class="programlisting">typedef struct { +<a class="indexterm" name="id2924564"></a><pre class="programlisting">typedef struct { unsigned long index; double x; double y; @@ -2719,9 +2844,9 @@ with respect to the overall origin</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2672459"></a><h3> +<a name="id2924697"></a><h3> <a name="cairo-font-slant-t"></a>enum cairo_font_slant_t</h3> -<a class="indexterm" name="id2672470"></a><pre class="programlisting">typedef enum _cairo_font_slant { +<a class="indexterm" name="id2924709"></a><pre class="programlisting">typedef enum _cairo_font_slant { CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_SLANT_OBLIQUE @@ -2733,9 +2858,9 @@ with respect to the overall origin</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2672487"></a><h3> +<a name="id2924726"></a><h3> <a name="cairo-font-weight-t"></a>enum cairo_font_weight_t</h3> -<a class="indexterm" name="id2672498"></a><pre class="programlisting">typedef enum _cairo_font_weight { +<a class="indexterm" name="id2924737"></a><pre class="programlisting">typedef enum _cairo_font_weight { CAIRO_FONT_WEIGHT_NORMAL, CAIRO_FONT_WEIGHT_BOLD } cairo_font_weight_t; @@ -2746,9 +2871,9 @@ with respect to the overall origin</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2672516"></a><h3> +<a name="id2924754"></a><h3> <a name="cairo-select-font-face"></a>cairo_select_font_face ()</h3> -<a class="indexterm" name="id2672527"></a><pre class="programlisting">void cairo_select_font_face (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2924765"></a><pre class="programlisting">void cairo_select_font_face (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, const char *family, <a href="cairo-cairo-t.html#cairo-font-slant-t">cairo_font_slant_t</a> slant, <a href="cairo-cairo-t.html#cairo-font-weight-t">cairo_font_weight_t</a> weight);</pre> @@ -2759,7 +2884,7 @@ only for applications with simple font needs: Cairo doesn't provide for operations such as listing all available fonts on the system, and it is expected that most applications will need to use a more comprehensive font handling and text layout library in addition to -Cairo.</p> +cairo.</p> <p> </p> @@ -2795,9 +2920,9 @@ Cairo.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2672655"></a><h3> +<a name="id2924894"></a><h3> <a name="cairo-set-font-size"></a>cairo_set_font_size ()</h3> -<a class="indexterm" name="id2672667"></a><pre class="programlisting">void cairo_set_font_size (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2924905"></a><pre class="programlisting">void cairo_set_font_size (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double size);</pre> <p> Sets the current font matrix to a scale by a factor of <em class="parameter"><code>size</code></em>, replacing @@ -2828,9 +2953,9 @@ em-square being a <em class="parameter"><code>size</code></em> by <em class="par </div> <hr> <div class="refsect2" lang="en"> -<a name="id2672792"></a><h3> +<a name="id2925030"></a><h3> <a name="cairo-set-font-matrix"></a>cairo_set_font_matrix ()</h3> -<a class="indexterm" name="id2672803"></a><pre class="programlisting">void cairo_set_font_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2925042"></a><pre class="programlisting">void cairo_set_font_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, const <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre> <p> Sets the current font matrix to <em class="parameter"><code>matrix</code></em>. The font matrix gives a @@ -2863,9 +2988,9 @@ the current font. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2672910"></a><h3> +<a name="id2925149"></a><h3> <a name="cairo-get-font-matrix"></a>cairo_get_font_matrix ()</h3> -<a class="indexterm" name="id2672921"></a><pre class="programlisting">void cairo_get_font_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2925160"></a><pre class="programlisting">void cairo_get_font_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre> <p> Stores the current font matrix into <em class="parameter"><code>matrix</code></em>. See @@ -2893,9 +3018,9 @@ Stores the current font matrix into <em class="parameter"><code>matrix</code></e </div> <hr> <div class="refsect2" lang="en"> -<a name="id2673016"></a><h3> +<a name="id2925255"></a><h3> <a name="cairo-set-font-options"></a>cairo_set_font_options ()</h3> -<a class="indexterm" name="id2673027"></a><pre class="programlisting">void cairo_set_font_options (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2925266"></a><pre class="programlisting">void cairo_set_font_options (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, const <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options);</pre> <p> Sets a set of custom font rendering options for the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>. @@ -2926,9 +3051,9 @@ from the surface is used.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2673129"></a><h3> +<a name="id2925368"></a><h3> <a name="cairo-get-font-options"></a>cairo_get_font_options ()</h3> -<a class="indexterm" name="id2673140"></a><pre class="programlisting">void cairo_get_font_options (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2925379"></a><pre class="programlisting">void cairo_get_font_options (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-Fonts.html#cairo-font-options-t">cairo_font_options_t</a> *options);</pre> <p> Retrieves font rendering options set via <a href="cairo-cairo-t.html#cairo-set-font-options"><span class="type">cairo_set_font_options</span></a>. @@ -2959,9 +3084,9 @@ passed to <a href="cairo-cairo-t.html#cairo-set-font-options"><code class="funct </div> <hr> <div class="refsect2" lang="en"> -<a name="id2673248"></a><h3> +<a name="id2925487"></a><h3> <a name="cairo-show-text"></a>cairo_show_text ()</h3> -<a class="indexterm" name="id2673258"></a><pre class="programlisting">void cairo_show_text (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2925497"></a><pre class="programlisting">void cairo_show_text (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, const char *utf8);</pre> <p> @@ -2988,9 +3113,9 @@ passed to <a href="cairo-cairo-t.html#cairo-set-font-options"><code class="funct </div> <hr> <div class="refsect2" lang="en"> -<a name="id2673325"></a><h3> +<a name="id2925564"></a><h3> <a name="cairo-show-glyphs"></a>cairo_show_glyphs ()</h3> -<a class="indexterm" name="id2673337"></a><pre class="programlisting">void cairo_show_glyphs (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2925575"></a><pre class="programlisting">void cairo_show_glyphs (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-cairo-t.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs, int num_glyphs);</pre> <p> @@ -3024,9 +3149,9 @@ passed to <a href="cairo-cairo-t.html#cairo-set-font-options"><code class="funct </div> <hr> <div class="refsect2" lang="en"> -<a name="id2673424"></a><h3> +<a name="id2925663"></a><h3> <a name="cairo-get-font-face"></a>cairo_get_font_face ()</h3> -<a class="indexterm" name="id2673436"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* cairo_get_font_face (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2925674"></a><pre class="programlisting"><a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a>* cairo_get_font_face (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Gets the current font face for a <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a>.</p> <p> @@ -3055,9 +3180,9 @@ Gets the current font face for a <a href="cairo-cairo-t.html#cairo-t"><span clas </div> <hr> <div class="refsect2" lang="en"> -<a name="id2673529"></a><h3> +<a name="id2925768"></a><h3> <a name="cairo-font-extents"></a>cairo_font_extents ()</h3> -<a class="indexterm" name="id2673540"></a><pre class="programlisting">void cairo_font_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2925779"></a><pre class="programlisting">void cairo_font_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-Fonts.html#cairo-font-extents-t">cairo_font_extents_t</a> *extents);</pre> <p> Gets the font extents for the currently selected font.</p> @@ -3085,9 +3210,9 @@ will be stored. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2673627"></a><h3> +<a name="id2925866"></a><h3> <a name="cairo-set-font-face"></a>cairo_set_font_face ()</h3> -<a class="indexterm" name="id2673639"></a><pre class="programlisting">void cairo_set_font_face (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2925877"></a><pre class="programlisting">void cairo_set_font_face (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-Fonts.html#cairo-font-face-t">cairo_font_face_t</a> *font_face);</pre> <p> Replaces the current <a href="cairo-Fonts.html#cairo-font-face-t"><span class="type">cairo_font_face_t</span></a> object in the <a href="cairo-cairo-t.html#cairo-t"><span class="type">cairo_t</span></a> with @@ -3116,9 +3241,9 @@ destroyed if there are no other references to it.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2673759"></a><h3> +<a name="id2925998"></a><h3> <a name="cairo-text-extents"></a>cairo_text_extents ()</h3> -<a class="indexterm" name="id2673770"></a><pre class="programlisting">void cairo_text_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2926009"></a><pre class="programlisting">void cairo_text_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, const char *utf8, <a href="cairo-Fonts.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);</pre> <p> @@ -3165,9 +3290,9 @@ will be stored. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2673893"></a><h3> +<a name="id2926132"></a><h3> <a name="cairo-glyph-extents"></a>cairo_glyph_extents ()</h3> -<a class="indexterm" name="id2673904"></a><pre class="programlisting">void cairo_glyph_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2926143"></a><pre class="programlisting">void cairo_glyph_extents (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-cairo-t.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs, int num_glyphs, <a href="cairo-Fonts.html#cairo-text-extents-t">cairo_text_extents_t</a> *extents);</pre> @@ -3218,9 +3343,9 @@ will be stored </div> <hr> <div class="refsect2" lang="en"> -<a name="id2674057"></a><h3> +<a name="id2926296"></a><h3> <a name="cairo-text-path"></a>cairo_text_path ()</h3> -<a class="indexterm" name="id2674068"></a><pre class="programlisting">void cairo_text_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2926307"></a><pre class="programlisting">void cairo_text_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, const char *utf8);</pre> <p> @@ -3247,9 +3372,9 @@ will be stored </div> <hr> <div class="refsect2" lang="en"> -<a name="id2674135"></a><h3> +<a name="id2926374"></a><h3> <a name="cairo-glyph-path"></a>cairo_glyph_path ()</h3> -<a class="indexterm" name="id2674147"></a><pre class="programlisting">void cairo_glyph_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2926385"></a><pre class="programlisting">void cairo_glyph_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-cairo-t.html#cairo-glyph-t">cairo_glyph_t</a> *glyphs, int num_glyphs);</pre> <p> @@ -3283,9 +3408,9 @@ will be stored </div> <hr> <div class="refsect2" lang="en"> -<a name="id2674235"></a><h3> +<a name="id2926474"></a><h3> <a name="cairo-get-operator"></a>cairo_get_operator ()</h3> -<a class="indexterm" name="id2674246"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-operator-t">cairo_operator_t</a> cairo_get_operator (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2926485"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-operator-t">cairo_operator_t</a> cairo_get_operator (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Gets the current compositing operator for a cairo context.</p> <p> @@ -3311,9 +3436,11 @@ Gets the current compositing operator for a cairo context.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2674307"></a><h3> +<a name="id2926546"></a><h3> <a name="cairo-get-source"></a>cairo_get_source ()</h3> -<a class="indexterm" name="id2674318"></a><pre class="programlisting"><a href="cairo-cairo-pattern-t.html#cairo-pattern-t">cairo_pattern_t</a>* cairo_get_source (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2926557"></a><pre class="programlisting"><a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-t" +>cairo_pattern_t</a>* cairo_get_source (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Gets the current source pattern for <em class="parameter"><code>cr</code></em>.</p> <p> @@ -3333,7 +3460,9 @@ Gets the current source pattern for <em class="parameter"><code>cr</code></em>.< <span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> <td> the current source pattern. This object is owned by cairo. To keep a reference to it, you must call -<a href="cairo-cairo-pattern-t.html#cairo-pattern-reference"><code class="function">cairo_pattern_reference()</code></a>. +<a +href="../cairo/cairo-cairo-pattern-t.html#cairo-pattern-reference" +><code class="function">cairo_pattern_reference()</code></a>. </td> </tr> </tbody> @@ -3341,9 +3470,9 @@ cairo. To keep a reference to it, you must call </div> <hr> <div class="refsect2" lang="en"> -<a name="id2674397"></a><h3> +<a name="id2926635"></a><h3> <a name="cairo-get-tolerance"></a>cairo_get_tolerance ()</h3> -<a class="indexterm" name="id2674408"></a><pre class="programlisting">double cairo_get_tolerance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2926647"></a><pre class="programlisting">double cairo_get_tolerance (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Gets the current tolerance value, as set by <a href="cairo-cairo-t.html#cairo-set-tolerance"><code class="function">cairo_set_tolerance()</code></a>.</p> <p> @@ -3369,9 +3498,37 @@ Gets the current tolerance value, as set by <a href="cairo-cairo-t.html#cairo-se </div> <hr> <div class="refsect2" lang="en"> -<a name="id2674479"></a><h3> +<a name="id2926717"></a><h3> +<a name="cairo-get-antialias"></a>cairo_get_antialias ()</h3> +<a class="indexterm" name="id2926729"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-antialias-t">cairo_antialias_t</a> cairo_get_antialias (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<p> +Gets the current shape antialiasing mode, as set by <code class="function">cairo_set_shape_antialias()</code>.</p> +<p> + +</p> +<div class="variablelist"><table border="0"> +<col align="left" valign="top"> +<tbody> +<tr> +<td> +<span class="term"><em class="parameter"><code>cr</code></em> :</span></td> +<td> a cairo context +</td> +</tr> +<tr> +<td> +<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td> +<td> the current shape antialiasing mode. +</td> +</tr> +</tbody> +</table></div> +</div> +<hr> +<div class="refsect2" lang="en"> +<a name="id2926800"></a><h3> <a name="cairo-get-current-point"></a>cairo_get_current_point ()</h3> -<a class="indexterm" name="id2674490"></a><pre class="programlisting">void cairo_get_current_point (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2926811"></a><pre class="programlisting">void cairo_get_current_point (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, double *x, double *y);</pre> <p> @@ -3421,9 +3578,9 @@ following for details on how they affect the current point: </div> <hr> <div class="refsect2" lang="en"> -<a name="id2674716"></a><h3> +<a name="id2927037"></a><h3> <a name="cairo-get-fill-rule"></a>cairo_get_fill_rule ()</h3> -<a class="indexterm" name="id2674727"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-fill-rule-t">cairo_fill_rule_t</a> cairo_get_fill_rule (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2927049"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-fill-rule-t">cairo_fill_rule_t</a> cairo_get_fill_rule (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Gets the current fill rule, as set by <a href="cairo-cairo-t.html#cairo-set-fill-rule"><code class="function">cairo_set_fill_rule()</code></a>.</p> <p> @@ -3449,9 +3606,9 @@ Gets the current fill rule, as set by <a href="cairo-cairo-t.html#cairo-set-fill </div> <hr> <div class="refsect2" lang="en"> -<a name="id2674798"></a><h3> +<a name="id2927119"></a><h3> <a name="cairo-get-line-width"></a>cairo_get_line_width ()</h3> -<a class="indexterm" name="id2674809"></a><pre class="programlisting">double cairo_get_line_width (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2927130"></a><pre class="programlisting">double cairo_get_line_width (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Gets the current line width, as set by <a href="cairo-cairo-t.html#cairo-set-line-width"><code class="function">cairo_set_line_width()</code></a>.</p> <p> @@ -3477,9 +3634,9 @@ Gets the current line width, as set by <a href="cairo-cairo-t.html#cairo-set-lin </div> <hr> <div class="refsect2" lang="en"> -<a name="id2674881"></a><h3> +<a name="id2927202"></a><h3> <a name="cairo-get-line-cap"></a>cairo_get_line_cap ()</h3> -<a class="indexterm" name="id2674892"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-line-cap-t">cairo_line_cap_t</a> cairo_get_line_cap (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2927213"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-line-cap-t">cairo_line_cap_t</a> cairo_get_line_cap (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Gets the current line cap style, as set by <a href="cairo-cairo-t.html#cairo-set-line-cap"><code class="function">cairo_set_line_cap()</code></a>.</p> <p> @@ -3505,9 +3662,9 @@ Gets the current line cap style, as set by <a href="cairo-cairo-t.html#cairo-set </div> <hr> <div class="refsect2" lang="en"> -<a name="id2674963"></a><h3> +<a name="id2927284"></a><h3> <a name="cairo-get-line-join"></a>cairo_get_line_join ()</h3> -<a class="indexterm" name="id2674974"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-line-join-t">cairo_line_join_t</a> cairo_get_line_join (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2927295"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-line-join-t">cairo_line_join_t</a> cairo_get_line_join (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Gets the current line join style, as set by <a href="cairo-cairo-t.html#cairo-set-line-join"><code class="function">cairo_set_line_join()</code></a>.</p> <p> @@ -3533,9 +3690,9 @@ Gets the current line join style, as set by <a href="cairo-cairo-t.html#cairo-se </div> <hr> <div class="refsect2" lang="en"> -<a name="id2675045"></a><h3> +<a name="id2927366"></a><h3> <a name="cairo-get-miter-limit"></a>cairo_get_miter_limit ()</h3> -<a class="indexterm" name="id2675056"></a><pre class="programlisting">double cairo_get_miter_limit (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2927377"></a><pre class="programlisting">double cairo_get_miter_limit (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Gets the current miter limit, as set by <a href="cairo-cairo-t.html#cairo-set-miter-limit"><code class="function">cairo_set_miter_limit()</code></a>.</p> <p> @@ -3561,9 +3718,9 @@ Gets the current miter limit, as set by <a href="cairo-cairo-t.html#cairo-set-mi </div> <hr> <div class="refsect2" lang="en"> -<a name="id2675127"></a><h3> +<a name="id2927448"></a><h3> <a name="cairo-get-matrix"></a>cairo_get_matrix ()</h3> -<a class="indexterm" name="id2675138"></a><pre class="programlisting">void cairo_get_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2927459"></a><pre class="programlisting">void cairo_get_matrix (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-cairo-matrix-t.html#cairo-matrix-t">cairo_matrix_t</a> *matrix);</pre> <p> Stores the current transformation matrix (CTM) into <em class="parameter"><code>matrix</code></em>.</p> @@ -3590,9 +3747,9 @@ Stores the current transformation matrix (CTM) into <em class="parameter"><code> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2675216"></a><h3> +<a name="id2927537"></a><h3> <a name="cairo-get-target"></a>cairo_get_target ()</h3> -<a class="indexterm" name="id2675227"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_get_target (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2927548"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_get_target (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Gets the target surface for the cairo context as passed to <a href="cairo-cairo-t.html#cairo-create"><code class="function">cairo_create()</code></a>.</p> @@ -3625,9 +3782,9 @@ indicated by cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2675320"></a><h3> +<a name="id2927641"></a><h3> <a name="cairo-copy-path"></a>cairo_copy_path ()</h3> -<a class="indexterm" name="id2675331"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-path-t">cairo_path_t</a>* cairo_copy_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2927652"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-path-t">cairo_path_t</a>* cairo_copy_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Creates a copy of the current path and returns it to the user as a <a href="cairo-cairo-t.html#cairo-path-t"><span class="type">cairo_path_t</span></a>. See <span class="type">cairo_path_data_t</span> for hints on how to iterate @@ -3668,9 +3825,9 @@ In either case, path->status will be set to CAIRO_STATUS_NO_MEMORY, </div> <hr> <div class="refsect2" lang="en"> -<a name="id2675437"></a><h3> +<a name="id2927759"></a><h3> <a name="cairo-copy-path-flat"></a>cairo_copy_path_flat ()</h3> -<a class="indexterm" name="id2675448"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-path-t">cairo_path_t</a>* cairo_copy_path_flat (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2927770"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-path-t">cairo_path_t</a>* cairo_copy_path_flat (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> Gets a flattened copy of the current path and returns it to the user as a <a href="cairo-cairo-t.html#cairo-path-t"><span class="type">cairo_path_t</span></a>. See <span class="type">cairo_path_data_t</span> for hints on @@ -3719,9 +3876,9 @@ following conditions hold: </div> <hr> <div class="refsect2" lang="en"> -<a name="id2675568"></a><h3> +<a name="id2927890"></a><h3> <a name="cairo-append-path"></a>cairo_append_path ()</h3> -<a class="indexterm" name="id2675580"></a><pre class="programlisting">void cairo_append_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, +<a class="indexterm" name="id2927901"></a><pre class="programlisting">void cairo_append_path (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr, <a href="cairo-cairo-t.html#cairo-path-t">cairo_path_t</a> *path);</pre> <p> Append the <em class="parameter"><code>path</code></em> onto the current path. The <em class="parameter"><code>path</code></em> may be either the @@ -3753,9 +3910,9 @@ CAIRO_STATUS_SUCCESS.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2675693"></a><h3> +<a name="id2928014"></a><h3> <a name="cairo-path-data-type-t"></a>enum cairo_path_data_type_t</h3> -<a class="indexterm" name="id2675705"></a><pre class="programlisting">typedef enum _cairo_path_data_type { +<a class="indexterm" name="id2928026"></a><pre class="programlisting">typedef enum _cairo_path_data_type { CAIRO_PATH_MOVE_TO, CAIRO_PATH_LINE_TO, CAIRO_PATH_CURVE_TO, @@ -3768,9 +3925,9 @@ CAIRO_STATUS_SUCCESS.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2675723"></a><h3> +<a name="id2928044"></a><h3> <a name="cairo-path-t"></a>cairo_path_t</h3> -<a class="indexterm" name="id2675734"></a><pre class="programlisting">typedef struct { +<a class="indexterm" name="id2928055"></a><pre class="programlisting">typedef struct { cairo_status_t status; cairo_path_data_t *data; int num_data; @@ -3820,9 +3977,9 @@ includes both headers and coordinates for each portion.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2675874"></a><h3> +<a name="id2928195"></a><h3> <a name="cairo-path-destroy"></a>cairo_path_destroy ()</h3> -<a class="indexterm" name="id2675885"></a><pre class="programlisting">void cairo_path_destroy (<a href="cairo-cairo-t.html#cairo-path-t">cairo_path_t</a> *path);</pre> +<a class="indexterm" name="id2928206"></a><pre class="programlisting">void cairo_path_destroy (<a href="cairo-cairo-t.html#cairo-path-t">cairo_path_t</a> *path);</pre> <p> Immediately releases all memory associated with <em class="parameter"><code>path</code></em>. After a call to <a href="cairo-cairo-t.html#cairo-path-destroy"><code class="function">cairo_path_destroy()</code></a> the <em class="parameter"><code>path</code></em> pointer is no longer valid and @@ -3849,9 +4006,9 @@ cairo_copy_path or cairo_copy_path_flat. </div> <hr> <div class="refsect2" lang="en"> -<a name="id2675974"></a><h3> +<a name="id2928295"></a><h3> <a name="cairo-status-t"></a>enum cairo_status_t</h3> -<a class="indexterm" name="id2675985"></a><pre class="programlisting">typedef enum _cairo_status { +<a class="indexterm" name="id2928306"></a><pre class="programlisting">typedef enum _cairo_status { CAIRO_STATUS_SUCCESS = 0, CAIRO_STATUS_NO_MEMORY, CAIRO_STATUS_INVALID_RESTORE, @@ -4003,9 +4160,9 @@ the context and can be retrieved with <a href="cairo-cairo-t.html#cairo-status"> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2676358"></a><h3> +<a name="id2928679"></a><h3> <a name="cairo-status"></a>cairo_status ()</h3> -<a class="indexterm" name="id2676369"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_status (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> +<a class="indexterm" name="id2928690"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> cairo_status (<a href="cairo-cairo-t.html#cairo-t">cairo_t</a> *cr);</pre> <p> </p> @@ -4031,9 +4188,9 @@ the context and can be retrieved with <a href="cairo-cairo-t.html#cairo-status"> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2676426"></a><h3> +<a name="id2928746"></a><h3> <a name="cairo-status-string"></a>cairo_status_string</h3> -<a class="indexterm" name="id2676437"></a><pre class="programlisting">#define cairo_status_string cairo_status_string_DEPRECATED_BY_cairo_status_AND_cairo_status_to_string +<a class="indexterm" name="id2928758"></a><pre class="programlisting">#define cairo_status_string cairo_status_string_DEPRECATED_BY_cairo_status_AND_cairo_status_to_string </pre> <p> @@ -4041,9 +4198,9 @@ the context and can be retrieved with <a href="cairo-cairo-t.html#cairo-status"> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2676454"></a><h3> +<a name="id2928775"></a><h3> <a name="cairo-status-to-string"></a>cairo_status_to_string ()</h3> -<a class="indexterm" name="id2676465"></a><pre class="programlisting">const char* cairo_status_to_string (<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> status);</pre> +<a class="indexterm" name="id2928786"></a><pre class="programlisting">const char* cairo_status_to_string (<a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> status);</pre> <p> </p> @@ -4069,9 +4226,9 @@ the context and can be retrieved with <a href="cairo-cairo-t.html#cairo-status"> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2676523"></a><h3> +<a name="id2928844"></a><h3> <a name="cairo-filter-t"></a>enum cairo_filter_t</h3> -<a class="indexterm" name="id2676534"></a><pre class="programlisting">typedef enum _cairo_filter { +<a class="indexterm" name="id2928855"></a><pre class="programlisting">typedef enum _cairo_filter { CAIRO_FILTER_FAST, CAIRO_FILTER_GOOD, CAIRO_FILTER_BEST, @@ -4086,9 +4243,9 @@ the context and can be retrieved with <a href="cairo-cairo-t.html#cairo-status"> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2676553"></a><h3> +<a name="id2928874"></a><h3> <a name="cairo-image-surface-create"></a>cairo_image_surface_create ()</h3> -<a class="indexterm" name="id2676565"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_image_surface_create (<a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format, +<a class="indexterm" name="id2928885"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_image_surface_create (<a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format, int width, int height);</pre> <p> @@ -4132,9 +4289,9 @@ must explicitely clear the buffer, using, for example, </div> <hr> <div class="refsect2" lang="en"> -<a name="id2676698"></a><h3> +<a name="id2929019"></a><h3> <a name="cairo-image-surface-create-for-data"></a>cairo_image_surface_create_for_data ()</h3> -<a class="indexterm" name="id2676710"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_image_surface_create_for_data +<a class="indexterm" name="id2929031"></a><pre class="programlisting"><a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a>* cairo_image_surface_create_for_data (unsigned char *data, <a href="cairo-cairo-t.html#cairo-format-t">cairo_format_t</a> format, int width, @@ -4199,9 +4356,9 @@ must explicitely clear the buffer, using, for example, </div> <hr> <div class="refsect2" lang="en"> -<a name="id2676922"></a><h3> +<a name="id2929243"></a><h3> <a name="cairo-image-surface-get-width"></a>cairo_image_surface_get_width ()</h3> -<a class="indexterm" name="id2676933"></a><pre class="programlisting">int cairo_image_surface_get_width (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre> +<a class="indexterm" name="id2929254"></a><pre class="programlisting">int cairo_image_surface_get_width (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre> <p> Get the width of the image surface in pixels.</p> <p> @@ -4227,9 +4384,9 @@ Get the width of the image surface in pixels.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2677003"></a><h3> +<a name="id2929324"></a><h3> <a name="cairo-image-surface-get-height"></a>cairo_image_surface_get_height ()</h3> -<a class="indexterm" name="id2677015"></a><pre class="programlisting">int cairo_image_surface_get_height (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre> +<a class="indexterm" name="id2929336"></a><pre class="programlisting">int cairo_image_surface_get_height (<a href="cairo-cairo-surface-t.html#cairo-surface-t">cairo_surface_t</a> *surface);</pre> <p> Get the height of the image surface in pixels.</p> <p> @@ -4255,9 +4412,9 @@ Get the height of the image surface in pixels.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2677084"></a><h3> +<a name="id2929405"></a><h3> <a name="cairo-destroy-func-t"></a>cairo_destroy_func_t ()</h3> -<a class="indexterm" name="id2677096"></a><pre class="programlisting">void (*cairo_destroy_func_t) (void *data);</pre> +<a class="indexterm" name="id2929417"></a><pre class="programlisting">void (*cairo_destroy_func_t) (void *data);</pre> <p> <a href="cairo-cairo-t.html#cairo-destroy-func-t"><span class="type">cairo_destroy_func_t</span></a> the type of function which is called when a data element is destroyed. It is passed the pointer to the data @@ -4277,9 +4434,9 @@ element and should free any memory and resources allocated for it.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2677157"></a><h3> +<a name="id2929477"></a><h3> <a name="cairo-user-data-key-t"></a>cairo_user_data_key_t</h3> -<a class="indexterm" name="id2677168"></a><pre class="programlisting">typedef struct { +<a class="indexterm" name="id2929488"></a><pre class="programlisting">typedef struct { int unused; } cairo_user_data_key_t; </pre> @@ -4304,9 +4461,9 @@ would just use the address of a static <span class="type">cairo_data_key_t</span </div> <hr> <div class="refsect2" lang="en"> -<a name="id2677240"></a><h3> +<a name="id2929561"></a><h3> <a name="cairo-read-func-t"></a>cairo_read_func_t ()</h3> -<a class="indexterm" name="id2677251"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> (*cairo_read_func_t) (void *closure, +<a class="indexterm" name="id2929572"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> (*cairo_read_func_t) (void *closure, unsigned char *data, unsigned int length);</pre> <p> @@ -4352,9 +4509,9 @@ CAIRO_STATUS_READ_ERROR otherwise.</p> </div> <hr> <div class="refsect2" lang="en"> -<a name="id2677369"></a><h3> +<a name="id2929690"></a><h3> <a name="cairo-write-func-t"></a>cairo_write_func_t ()</h3> -<a class="indexterm" name="id2677380"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> (*cairo_write_func_t) (void *closure, +<a class="indexterm" name="id2929701"></a><pre class="programlisting"><a href="cairo-cairo-t.html#cairo-status-t">cairo_status_t</a> (*cairo_write_func_t) (void *closure, unsigned char *data, unsigned int length);</pre> <p> @@ -4398,6 +4555,35 @@ CAIRO_STATUS_WRITE_ERROR otherwise.</p> </tbody> </table></div> </div> +<hr> +<div class="refsect2" lang="en"> +<a name="id2929819"></a><h3> +<a name="cairo-debug-reset-static-data"></a>cairo_debug_reset_static_data ()</h3> +<a class="indexterm" name="id2929831"></a><pre class="programlisting">void cairo_debug_reset_static_data (void);</pre> +<p> +Resets all static data within cairo to its original state, +(ie. identical to the state at the time of program invocation). For +example, all caches within cairo will be flushed empty. +</p> +<p> +This function is intended to be useful when using memory-checking +tools such as valgrind. When valgrind's memcheck analyzes a +cairo-using program without a call to cairo_debug_reset_static_data, +it will report all data reachable via cairo's static objects as +"still reachable". Calling cairo_debug_reset_static_data just prior +to program termination will make it easier to get squeaky clean +reports from valgrind. +</p> +<p> +WARNING: It is only safe to call this function when there are no +active cairo objects remaining, (ie. the appropriate destroy +functions have been called as necessary). If there are active cairo +objects, this call is likely to cause a crash, (eg. an assertion +failure due to a hash table being destroyed when non-empty).</p> +<p> + +</p> +</div> </div> </div> <table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"> diff --git a/doc/public/html/cairo.devhelp b/doc/public/html/cairo.devhelp index d8845f8..735e416 100644 --- a/doc/public/html/cairo.devhelp +++ b/doc/public/html/cairo.devhelp @@ -5,7 +5,6 @@ <sub name="Reference" link="pt02.html"> <sub name="cairo_t" link="cairo-cairo-t.html"/> <sub name="cairo_surface_t" link="cairo-cairo-surface-t.html"/> - <sub name="cairo_pattern_t" link="cairo-cairo-pattern-t.html"/> <sub name="cairo_matrix_t" link="cairo-cairo-matrix-t.html"/> <sub name="Fonts" link="cairo-Fonts.html"/> <sub name="FreeType Fonts" link="cairo-FreeType-Fonts.html"/> @@ -50,6 +49,8 @@ <function name="cairo_set_source ()" link="cairo-cairo-t.html#cairo-set-source"/> <function name="cairo_set_source_surface ()" link="cairo-cairo-t.html#cairo-set-source-surface"/> <function name="cairo_set_tolerance ()" link="cairo-cairo-t.html#cairo-set-tolerance"/> + <function name="enum cairo_antialias_t" link="cairo-cairo-t.html#cairo-antialias-t"/> + <function name="cairo_set_antialias ()" link="cairo-cairo-t.html#cairo-set-antialias"/> <function name="enum cairo_fill_rule_t" link="cairo-cairo-t.html#cairo-fill-rule-t"/> <function name="cairo_set_fill_rule ()" link="cairo-cairo-t.html#cairo-set-fill-rule"/> <function name="cairo_set_line_width ()" link="cairo-cairo-t.html#cairo-set-line-width"/> @@ -119,6 +120,7 @@ <function name="cairo_get_operator ()" link="cairo-cairo-t.html#cairo-get-operator"/> <function name="cairo_get_source ()" link="cairo-cairo-t.html#cairo-get-source"/> <function name="cairo_get_tolerance ()" link="cairo-cairo-t.html#cairo-get-tolerance"/> + <function name="cairo_get_antialias ()" link="cairo-cairo-t.html#cairo-get-antialias"/> <function name="cairo_get_current_point ()" link="cairo-cairo-t.html#cairo-get-current-point"/> <function name="cairo_get_fill_rule ()" link="cairo-cairo-t.html#cairo-get-fill-rule"/> <function name="cairo_get_line_width ()" link="cairo-cairo-t.html#cairo-get-line-width"/> @@ -146,33 +148,20 @@ <function name="cairo_user_data_key_t" link="cairo-cairo-t.html#cairo-user-data-key-t"/> <function name="cairo_read_func_t ()" link="cairo-cairo-t.html#cairo-read-func-t"/> <function name="cairo_write_func_t ()" link="cairo-cairo-t.html#cairo-write-func-t"/> + <function name="cairo_debug_reset_static_data ()" link="cairo-cairo-t.html#cairo-debug-reset-static-data"/> <function name="cairo_surface_t" link="cairo-cairo-surface-t.html#cairo-surface-t"/> <function name="cairo_surface_create_similar ()" link="cairo-cairo-surface-t.html#cairo-surface-create-similar"/> <function name="cairo_surface_reference ()" link="cairo-cairo-surface-t.html#cairo-surface-reference"/> <function name="cairo_surface_destroy ()" link="cairo-cairo-surface-t.html#cairo-surface-destroy"/> + <function name="cairo_surface_status ()" link="cairo-cairo-surface-t.html#cairo-surface-status"/> <function name="cairo_surface_finish ()" link="cairo-cairo-surface-t.html#cairo-surface-finish"/> <function name="cairo_surface_get_font_options ()" link="cairo-cairo-surface-t.html#cairo-surface-get-font-options"/> <function name="cairo_surface_set_user_data ()" link="cairo-cairo-surface-t.html#cairo-surface-set-user-data"/> <function name="cairo_surface_get_user_data ()" link="cairo-cairo-surface-t.html#cairo-surface-get-user-data"/> + <function name="cairo_surface_flush ()" link="cairo-cairo-surface-t.html#cairo-surface-flush"/> + <function name="cairo_surface_mark_dirty ()" link="cairo-cairo-surface-t.html#cairo-surface-mark-dirty"/> + <function name="cairo_surface_mark_dirty_rectangle ()" link="cairo-cairo-surface-t.html#cairo-surface-mark-dirty-rectangle"/> <function name="cairo_surface_set_device_offset ()" link="cairo-cairo-surface-t.html#cairo-surface-set-device-offset"/> - <function name="cairo_pattern_t" link="cairo-cairo-pattern-t.html#cairo-pattern-t"/> - <function name="cairo_pattern_create_rgb ()" link="cairo-cairo-pattern-t.html#cairo-pattern-create-rgb"/> - <function name="cairo_pattern_create_rgba ()" link="cairo-cairo-pattern-t.html#cairo-pattern-create-rgba"/> - <function name="cairo_pattern_create_for_surface ()" link="cairo-cairo-pattern-t.html#cairo-pattern-create-for-surface"/> - <function name="cairo_pattern_create_linear ()" link="cairo-cairo-pattern-t.html#cairo-pattern-create-linear"/> - <function name="cairo_pattern_create_radial ()" link="cairo-cairo-pattern-t.html#cairo-pattern-create-radial"/> - <function name="cairo_pattern_reference ()" link="cairo-cairo-pattern-t.html#cairo-pattern-reference"/> - <function name="cairo_pattern_destroy ()" link="cairo-cairo-pattern-t.html#cairo-pattern-destroy"/> - <function name="cairo_pattern_status ()" link="cairo-cairo-pattern-t.html#cairo-pattern-status"/> - <function name="cairo_pattern_add_color_stop_rgb ()" link="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgb"/> - <function name="cairo_pattern_add_color_stop_rgba ()" link="cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgba"/> - <function name="cairo_pattern_set_matrix ()" link="cairo-cairo-pattern-t.html#cairo-pattern-set-matrix"/> - <function name="cairo_pattern_get_matrix ()" link="cairo-cairo-pattern-t.html#cairo-pattern-get-matrix"/> - <function name="enum cairo_extend_t" link="cairo-cairo-pattern-t.html#cairo-extend-t"/> - <function name="cairo_pattern_set_extend ()" link="cairo-cairo-pattern-t.html#cairo-pattern-set-extend"/> - <function name="cairo_pattern_get_extend ()" link="cairo-cairo-pattern-t.html#cairo-pattern-get-extend"/> - <function name="cairo_pattern_set_filter ()" link="cairo-cairo-pattern-t.html#cairo-pattern-set-filter"/> - <function name="cairo_pattern_get_filter ()" link="cairo-cairo-pattern-t.html#cairo-pattern-get-filter"/> <function name="cairo_matrix_t" link="cairo-cairo-matrix-t.html#cairo-matrix-t"/> <function name="cairo_matrix_init ()" link="cairo-cairo-matrix-t.html#cairo-matrix-init"/> <function name="cairo_matrix_init_identity ()" link="cairo-cairo-matrix-t.html#cairo-matrix-init-identity"/> @@ -190,11 +179,13 @@ <function name="cairo_scaled_font_t" link="cairo-Fonts.html#cairo-scaled-font-t"/> <function name="cairo_font_face_reference ()" link="cairo-Fonts.html#cairo-font-face-reference"/> <function name="cairo_font_face_destroy ()" link="cairo-Fonts.html#cairo-font-face-destroy"/> + <function name="cairo_font_face_status ()" link="cairo-Fonts.html#cairo-font-face-status"/> <function name="cairo_font_face_get_user_data ()" link="cairo-Fonts.html#cairo-font-face-get-user-data"/> <function name="cairo_font_face_set_user_data ()" link="cairo-Fonts.html#cairo-font-face-set-user-data"/> <function name="cairo_scaled_font_create ()" link="cairo-Fonts.html#cairo-scaled-font-create"/> <function name="cairo_scaled_font_reference ()" link="cairo-Fonts.html#cairo-scaled-font-reference"/> <function name="cairo_scaled_font_destroy ()" link="cairo-Fonts.html#cairo-scaled-font-destroy"/> + <function name="cairo_scaled_font_status ()" link="cairo-Fonts.html#cairo-scaled-font-status"/> <function name="cairo_font_extents_t" link="cairo-Fonts.html#cairo-font-extents-t"/> <function name="cairo_scaled_font_extents ()" link="cairo-Fonts.html#cairo-scaled-font-extents"/> <function name="cairo_text_extents_t" link="cairo-Fonts.html#cairo-text-extents-t"/> @@ -207,7 +198,6 @@ <function name="cairo_font_options_merge ()" link="cairo-Fonts.html#cairo-font-options-merge"/> <function name="cairo_font_options_hash ()" link="cairo-Fonts.html#cairo-font-options-hash"/> <function name="cairo_font_options_equal ()" link="cairo-Fonts.html#cairo-font-options-equal"/> - <function name="enum cairo_antialias_t" link="cairo-Fonts.html#cairo-antialias-t"/> <function name="cairo_font_options_set_antialias ()" link="cairo-Fonts.html#cairo-font-options-set-antialias"/> <function name="cairo_font_options_get_antialias ()" link="cairo-Fonts.html#cairo-font-options-get-antialias"/> <function name="enum cairo_subpixel_order_t" link="cairo-Fonts.html#cairo-subpixel-order-t"/> @@ -247,5 +237,6 @@ <function name="cairo_xlib_surface_create ()" link="cairo-XLib-Backend.html#cairo-xlib-surface-create"/> <function name="cairo_xlib_surface_create_for_bitmap ()" link="cairo-XLib-Backend.html#cairo-xlib-surface-create-for-bitmap"/> <function name="cairo_xlib_surface_set_size ()" link="cairo-XLib-Backend.html#cairo-xlib-surface-set-size"/> + <function name="cairo_xlib_surface_set_drawable ()" link="cairo-XLib-Backend.html#cairo-xlib-surface-set-drawable"/> </functions> </book> diff --git a/doc/public/html/index.html b/doc/public/html/index.html index 3d29d02..b72f8ad 100644 --- a/doc/public/html/index.html +++ b/doc/public/html/index.html @@ -31,9 +31,6 @@ <span class="refentrytitle"><a href="cairo-cairo-surface-t.html">cairo_surface_t</a></span><span class="refpurpose"> - </span> </dt> <dt> -<span class="refentrytitle"><a href="cairo-cairo-pattern-t.html">cairo_pattern_t</a></span><span class="refpurpose"> - </span> -</dt> -<dt> <span class="refentrytitle"><a href="cairo-cairo-matrix-t.html">cairo_matrix_t</a></span><span class="refpurpose"> - Transformation matrices</span> </dt> diff --git a/doc/public/html/index.sgml b/doc/public/html/index.sgml index 888cbcc..a9dcb70 100644 --- a/doc/public/html/index.sgml +++ b/doc/public/html/index.sgml @@ -16,6 +16,8 @@ <ANCHOR id="cairo-set-source" href="cairo/cairo-cairo-t.html#cairo-set-source"> <ANCHOR id="cairo-set-source-surface" href="cairo/cairo-cairo-t.html#cairo-set-source-surface"> <ANCHOR id="cairo-set-tolerance" href="cairo/cairo-cairo-t.html#cairo-set-tolerance"> +<ANCHOR id="cairo-antialias-t" href="cairo/cairo-cairo-t.html#cairo-antialias-t"> +<ANCHOR id="cairo-set-antialias" href="cairo/cairo-cairo-t.html#cairo-set-antialias"> <ANCHOR id="cairo-fill-rule-t" href="cairo/cairo-cairo-t.html#cairo-fill-rule-t"> <ANCHOR id="cairo-set-fill-rule" href="cairo/cairo-cairo-t.html#cairo-set-fill-rule"> <ANCHOR id="cairo-set-line-width" href="cairo/cairo-cairo-t.html#cairo-set-line-width"> @@ -85,6 +87,7 @@ <ANCHOR id="cairo-get-operator" href="cairo/cairo-cairo-t.html#cairo-get-operator"> <ANCHOR id="cairo-get-source" href="cairo/cairo-cairo-t.html#cairo-get-source"> <ANCHOR id="cairo-get-tolerance" href="cairo/cairo-cairo-t.html#cairo-get-tolerance"> +<ANCHOR id="cairo-get-antialias" href="cairo/cairo-cairo-t.html#cairo-get-antialias"> <ANCHOR id="cairo-get-current-point" href="cairo/cairo-cairo-t.html#cairo-get-current-point"> <ANCHOR id="cairo-get-fill-rule" href="cairo/cairo-cairo-t.html#cairo-get-fill-rule"> <ANCHOR id="cairo-get-line-width" href="cairo/cairo-cairo-t.html#cairo-get-line-width"> @@ -112,35 +115,21 @@ <ANCHOR id="cairo-user-data-key-t" href="cairo/cairo-cairo-t.html#cairo-user-data-key-t"> <ANCHOR id="cairo-read-func-t" href="cairo/cairo-cairo-t.html#cairo-read-func-t"> <ANCHOR id="cairo-write-func-t" href="cairo/cairo-cairo-t.html#cairo-write-func-t"> +<ANCHOR id="cairo-debug-reset-static-data" href="cairo/cairo-cairo-t.html#cairo-debug-reset-static-data"> <ANCHOR id="cairo-cairo-surface-t" href="cairo/cairo-cairo-surface-t.html"> <ANCHOR id="cairo-surface-t" href="cairo/cairo-cairo-surface-t.html#cairo-surface-t"> <ANCHOR id="cairo-surface-create-similar" href="cairo/cairo-cairo-surface-t.html#cairo-surface-create-similar"> <ANCHOR id="cairo-surface-reference" href="cairo/cairo-cairo-surface-t.html#cairo-surface-reference"> <ANCHOR id="cairo-surface-destroy" href="cairo/cairo-cairo-surface-t.html#cairo-surface-destroy"> +<ANCHOR id="cairo-surface-status" href="cairo/cairo-cairo-surface-t.html#cairo-surface-status"> <ANCHOR id="cairo-surface-finish" href="cairo/cairo-cairo-surface-t.html#cairo-surface-finish"> <ANCHOR id="cairo-surface-get-font-options" href="cairo/cairo-cairo-surface-t.html#cairo-surface-get-font-options"> <ANCHOR id="cairo-surface-set-user-data" href="cairo/cairo-cairo-surface-t.html#cairo-surface-set-user-data"> <ANCHOR id="cairo-surface-get-user-data" href="cairo/cairo-cairo-surface-t.html#cairo-surface-get-user-data"> +<ANCHOR id="cairo-surface-flush" href="cairo/cairo-cairo-surface-t.html#cairo-surface-flush"> +<ANCHOR id="cairo-surface-mark-dirty" href="cairo/cairo-cairo-surface-t.html#cairo-surface-mark-dirty"> +<ANCHOR id="cairo-surface-mark-dirty-rectangle" href="cairo/cairo-cairo-surface-t.html#cairo-surface-mark-dirty-rectangle"> <ANCHOR id="cairo-surface-set-device-offset" href="cairo/cairo-cairo-surface-t.html#cairo-surface-set-device-offset"> -<ANCHOR id="cairo-cairo-pattern-t" href="cairo/cairo-cairo-pattern-t.html"> -<ANCHOR id="cairo-pattern-t" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-t"> -<ANCHOR id="cairo-pattern-create-rgb" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-create-rgb"> -<ANCHOR id="cairo-pattern-create-rgba" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-create-rgba"> -<ANCHOR id="cairo-pattern-create-for-surface" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-create-for-surface"> -<ANCHOR id="cairo-pattern-create-linear" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-create-linear"> -<ANCHOR id="cairo-pattern-create-radial" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-create-radial"> -<ANCHOR id="cairo-pattern-reference" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-reference"> -<ANCHOR id="cairo-pattern-destroy" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-destroy"> -<ANCHOR id="cairo-pattern-status" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-status"> -<ANCHOR id="cairo-pattern-add-color-stop-rgb" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgb"> -<ANCHOR id="cairo-pattern-add-color-stop-rgba" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-add-color-stop-rgba"> -<ANCHOR id="cairo-pattern-set-matrix" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-set-matrix"> -<ANCHOR id="cairo-pattern-get-matrix" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-get-matrix"> -<ANCHOR id="cairo-extend-t" href="cairo/cairo-cairo-pattern-t.html#cairo-extend-t"> -<ANCHOR id="cairo-pattern-set-extend" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-set-extend"> -<ANCHOR id="cairo-pattern-get-extend" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-get-extend"> -<ANCHOR id="cairo-pattern-set-filter" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-set-filter"> -<ANCHOR id="cairo-pattern-get-filter" href="cairo/cairo-cairo-pattern-t.html#cairo-pattern-get-filter"> <ANCHOR id="cairo-cairo-matrix-t" href="cairo/cairo-cairo-matrix-t.html"> <ANCHOR id="cairo-matrix-t" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-t"> <ANCHOR id="cairo-matrix-init" href="cairo/cairo-cairo-matrix-t.html#cairo-matrix-init"> @@ -160,11 +149,13 @@ <ANCHOR id="cairo-scaled-font-t" href="cairo/cairo-Fonts.html#cairo-scaled-font-t"> <ANCHOR id="cairo-font-face-reference" href="cairo/cairo-Fonts.html#cairo-font-face-reference"> <ANCHOR id="cairo-font-face-destroy" href="cairo/cairo-Fonts.html#cairo-font-face-destroy"> +<ANCHOR id="cairo-font-face-status" href="cairo/cairo-Fonts.html#cairo-font-face-status"> <ANCHOR id="cairo-font-face-get-user-data" href="cairo/cairo-Fonts.html#cairo-font-face-get-user-data"> <ANCHOR id="cairo-font-face-set-user-data" href="cairo/cairo-Fonts.html#cairo-font-face-set-user-data"> <ANCHOR id="cairo-scaled-font-create" href="cairo/cairo-Fonts.html#cairo-scaled-font-create"> <ANCHOR id="cairo-scaled-font-reference" href="cairo/cairo-Fonts.html#cairo-scaled-font-reference"> <ANCHOR id="cairo-scaled-font-destroy" href="cairo/cairo-Fonts.html#cairo-scaled-font-destroy"> +<ANCHOR id="cairo-scaled-font-status" href="cairo/cairo-Fonts.html#cairo-scaled-font-status"> <ANCHOR id="cairo-font-extents-t" href="cairo/cairo-Fonts.html#cairo-font-extents-t"> <ANCHOR id="cairo-scaled-font-extents" href="cairo/cairo-Fonts.html#cairo-scaled-font-extents"> <ANCHOR id="cairo-text-extents-t" href="cairo/cairo-Fonts.html#cairo-text-extents-t"> @@ -177,7 +168,6 @@ <ANCHOR id="cairo-font-options-merge" href="cairo/cairo-Fonts.html#cairo-font-options-merge"> <ANCHOR id="cairo-font-options-hash" href="cairo/cairo-Fonts.html#cairo-font-options-hash"> <ANCHOR id="cairo-font-options-equal" href="cairo/cairo-Fonts.html#cairo-font-options-equal"> -<ANCHOR id="cairo-antialias-t" href="cairo/cairo-Fonts.html#cairo-antialias-t"> <ANCHOR id="cairo-font-options-set-antialias" href="cairo/cairo-Fonts.html#cairo-font-options-set-antialias"> <ANCHOR id="cairo-font-options-get-antialias" href="cairo/cairo-Fonts.html#cairo-font-options-get-antialias"> <ANCHOR id="cairo-subpixel-order-t" href="cairo/cairo-Fonts.html#cairo-subpixel-order-t"> @@ -226,3 +216,4 @@ <ANCHOR id="cairo-xlib-surface-create" href="cairo/cairo-XLib-Backend.html#cairo-xlib-surface-create"> <ANCHOR id="cairo-xlib-surface-create-for-bitmap" href="cairo/cairo-XLib-Backend.html#cairo-xlib-surface-create-for-bitmap"> <ANCHOR id="cairo-xlib-surface-set-size" href="cairo/cairo-XLib-Backend.html#cairo-xlib-surface-set-size"> +<ANCHOR id="cairo-xlib-surface-set-drawable" href="cairo/cairo-XLib-Backend.html#cairo-xlib-surface-set-drawable"> diff --git a/doc/public/html/ix01.html b/doc/public/html/ix01.html index 3da89e3..c3e2139 100644 --- a/doc/public/html/ix01.html +++ b/doc/public/html/ix01.html @@ -23,443 +23,427 @@ </tr></table> <div class="index"> <div class="titlepage"><div><div><h2 class="title"> -<a name="id2560294"></a>Index</h2></div></div></div> +<a name="id2811716"></a>Index</h2></div></div></div> <div class="index"> <div class="indexdiv"> <h3></h3> -<dl><dt>, <a href="cairo-cairo-matrix-t.html#id2614976">Description</a> +<dl><dt>, <a href="cairo-cairo-matrix-t.html#id2876757">Description</a> </dt></dl> </div> <div class="indexdiv"> <h3>C</h3> <dl> -<dt>cairo_antialias_t, <a href="cairo-Fonts.html#id2609762">enum cairo_antialias_t</a> +<dt>cairo_antialias_t, <a href="cairo-cairo-t.html#id2918964">enum cairo_antialias_t</a> </dt> -<dt>cairo_append_path, <a href="cairo-cairo-t.html#id2675568">cairo_append_path ()</a> +<dt>cairo_append_path, <a href="cairo-cairo-t.html#id2927890">cairo_append_path ()</a> </dt> -<dt>cairo_arc, <a href="cairo-cairo-t.html#id2669354">cairo_arc ()</a> +<dt>cairo_arc, <a href="cairo-cairo-t.html#id2921591">cairo_arc ()</a> </dt> -<dt>cairo_arc_negative, <a href="cairo-cairo-t.html#id2669603">cairo_arc_negative ()</a> +<dt>cairo_arc_negative, <a href="cairo-cairo-t.html#id2921840">cairo_arc_negative ()</a> </dt> -<dt>cairo_bool_t, <a href="cairo-cairo-t.html#id2671544">cairo_bool_t</a> +<dt>cairo_bool_t, <a href="cairo-cairo-t.html#id2923783">cairo_bool_t</a> </dt> -<dt>cairo_clip, <a href="cairo-cairo-t.html#id2671889">cairo_clip ()</a> +<dt>cairo_clip, <a href="cairo-cairo-t.html#id2924128">cairo_clip ()</a> </dt> -<dt>cairo_clip_preserve, <a href="cairo-cairo-t.html#id2672037">cairo_clip_preserve ()</a> +<dt>cairo_clip_preserve, <a href="cairo-cairo-t.html#id2924276">cairo_clip_preserve ()</a> </dt> -<dt>cairo_close_path, <a href="cairo-cairo-t.html#id2670314">cairo_close_path ()</a> +<dt>cairo_close_path, <a href="cairo-cairo-t.html#id2922551">cairo_close_path ()</a> </dt> -<dt>cairo_content_t, <a href="cairo-cairo-t.html#id2665765">enum cairo_content_t</a> +<dt>cairo_content_t, <a href="cairo-cairo-t.html#id2917755">enum cairo_content_t</a> </dt> -<dt>CAIRO_CONTENT_VALID, <a href="cairo-cairo-t.html#id2665866">CAIRO_CONTENT_VALID()</a> +<dt>CAIRO_CONTENT_VALID, <a href="cairo-cairo-t.html#id2917856">CAIRO_CONTENT_VALID()</a> </dt> -<dt>cairo_copy_page, <a href="cairo-cairo-t.html#id2671213">cairo_copy_page ()</a> +<dt>cairo_copy_page, <a href="cairo-cairo-t.html#id2923452">cairo_copy_page ()</a> </dt> -<dt>cairo_copy_path, <a href="cairo-cairo-t.html#id2675320">cairo_copy_path ()</a> +<dt>cairo_copy_path, <a href="cairo-cairo-t.html#id2927641">cairo_copy_path ()</a> </dt> -<dt>cairo_copy_path_flat, <a href="cairo-cairo-t.html#id2675437">cairo_copy_path_flat ()</a> +<dt>cairo_copy_path_flat, <a href="cairo-cairo-t.html#id2927759">cairo_copy_path_flat ()</a> </dt> -<dt>cairo_create, <a href="cairo-cairo-t.html#id2665083">cairo_create ()</a> +<dt>cairo_create, <a href="cairo-cairo-t.html#id2917055">cairo_create ()</a> </dt> -<dt>cairo_curve_to, <a href="cairo-cairo-t.html#id2669172">cairo_curve_to ()</a> +<dt>cairo_curve_to, <a href="cairo-cairo-t.html#id2921409">cairo_curve_to ()</a> </dt> -<dt>cairo_destroy, <a href="cairo-cairo-t.html#id2665417">cairo_destroy ()</a> +<dt>cairo_debug_reset_static_data, <a href="cairo-cairo-t.html#id2929819">cairo_debug_reset_static_data ()</a> </dt> -<dt>cairo_destroy_func_t, <a href="cairo-cairo-t.html#id2677084">cairo_destroy_func_t ()</a> +<dt>cairo_destroy, <a href="cairo-cairo-t.html#id2917407">cairo_destroy ()</a> </dt> -<dt>cairo_device_to_user, <a href="cairo-cairo-t.html#id2668683">cairo_device_to_user ()</a> +<dt>cairo_destroy_func_t, <a href="cairo-cairo-t.html#id2929405">cairo_destroy_func_t ()</a> </dt> -<dt>cairo_device_to_user_distance, <a href="cairo-cairo-t.html#id2668789">cairo_device_to_user_distance ()</a> +<dt>cairo_device_to_user, <a href="cairo-cairo-t.html#id2920920">cairo_device_to_user ()</a> </dt> -<dt>cairo_extend_t, <a href="cairo-cairo-pattern-t.html#id2619954">enum cairo_extend_t</a> +<dt>cairo_device_to_user_distance, <a href="cairo-cairo-t.html#id2921026">cairo_device_to_user_distance ()</a> </dt> -<dt>cairo_fill, <a href="cairo-cairo-t.html#id2671036">cairo_fill ()</a> +<dt>cairo_fill, <a href="cairo-cairo-t.html#id2923272">cairo_fill ()</a> </dt> -<dt>cairo_fill_extents, <a href="cairo-cairo-t.html#id2671749">cairo_fill_extents ()</a> +<dt>cairo_fill_extents, <a href="cairo-cairo-t.html#id2923987">cairo_fill_extents ()</a> </dt> -<dt>cairo_fill_preserve, <a href="cairo-cairo-t.html#id2671118">cairo_fill_preserve ()</a> +<dt>cairo_fill_preserve, <a href="cairo-cairo-t.html#id2923355">cairo_fill_preserve ()</a> </dt> -<dt>cairo_fill_rule_t, <a href="cairo-cairo-t.html#id2666948">enum cairo_fill_rule_t</a> +<dt>cairo_fill_rule_t, <a href="cairo-cairo-t.html#id2919184">enum cairo_fill_rule_t</a> </dt> -<dt>cairo_filter_t, <a href="cairo-cairo-t.html#id2676523">enum cairo_filter_t</a> +<dt>cairo_filter_t, <a href="cairo-cairo-t.html#id2928844">enum cairo_filter_t</a> </dt> -<dt>cairo_font_extents, <a href="cairo-cairo-t.html#id2673529">cairo_font_extents ()</a> +<dt>cairo_font_extents, <a href="cairo-cairo-t.html#id2925768">cairo_font_extents ()</a> </dt> -<dt>cairo_font_extents_t, <a href="cairo-Fonts.html#id2608430">cairo_font_extents_t</a> +<dt>cairo_font_extents_t, <a href="cairo-Fonts.html#id2857985">cairo_font_extents_t</a> </dt> -<dt>cairo_font_face_destroy, <a href="cairo-Fonts.html#id2657629">cairo_font_face_destroy ()</a> +<dt>cairo_font_face_destroy, <a href="cairo-Fonts.html#id2907782">cairo_font_face_destroy ()</a> </dt> -<dt>cairo_font_face_get_user_data, <a href="cairo-Fonts.html#id2607753">cairo_font_face_get_user_data ()</a> +<dt>cairo_font_face_get_user_data, <a href="cairo-Fonts.html#id2907959">cairo_font_face_get_user_data ()</a> </dt> -<dt>cairo_font_face_reference, <a href="cairo-Fonts.html#id2657540">cairo_font_face_reference ()</a> +<dt>cairo_font_face_reference, <a href="cairo-Fonts.html#id2909680">cairo_font_face_reference ()</a> </dt> -<dt>cairo_font_face_set_user_data, <a href="cairo-Fonts.html#id2607880">cairo_font_face_set_user_data ()</a> +<dt>cairo_font_face_set_user_data, <a href="cairo-Fonts.html#id2908086">cairo_font_face_set_user_data ()</a> </dt> -<dt>cairo_font_face_t, <a href="cairo-Fonts.html#id2657424">cairo_font_face_t</a> +<dt>cairo_font_face_status, <a href="cairo-Fonts.html#id2907870">cairo_font_face_status ()</a> </dt> -<dt>cairo_font_options_copy, <a href="cairo-Fonts.html#id2609162">cairo_font_options_copy ()</a> +<dt>cairo_font_face_t, <a href="cairo-Fonts.html#id2909563">cairo_font_face_t</a> </dt> -<dt>cairo_font_options_create, <a href="cairo-Fonts.html#id2609083">cairo_font_options_create ()</a> +<dt>cairo_font_options_copy, <a href="cairo-Fonts.html#id2858716">cairo_font_options_copy ()</a> </dt> -<dt>cairo_font_options_destroy, <a href="cairo-Fonts.html#id2609272">cairo_font_options_destroy ()</a> +<dt>cairo_font_options_create, <a href="cairo-Fonts.html#id2858637">cairo_font_options_create ()</a> </dt> -<dt>cairo_font_options_equal, <a href="cairo-Fonts.html#id2609652">cairo_font_options_equal ()</a> +<dt>cairo_font_options_destroy, <a href="cairo-Fonts.html#id2858827">cairo_font_options_destroy ()</a> </dt> -<dt>cairo_font_options_get_antialias, <a href="cairo-Fonts.html#id2609957">cairo_font_options_get_antialias ()</a> +<dt>cairo_font_options_equal, <a href="cairo-Fonts.html#id2859207">cairo_font_options_equal ()</a> </dt> -<dt>cairo_font_options_get_hint_metrics, <a href="cairo-Fonts.html#id2610851">cairo_font_options_get_hint_metrics ()</a> +<dt>cairo_font_options_get_antialias, <a href="cairo-Fonts.html#id2859407">cairo_font_options_get_antialias ()</a> </dt> -<dt>cairo_font_options_get_hint_style, <a href="cairo-Fonts.html#id2610577">cairo_font_options_get_hint_style ()</a> +<dt>cairo_font_options_get_hint_metrics, <a href="cairo-Fonts.html#id2860301">cairo_font_options_get_hint_metrics ()</a> </dt> -<dt>cairo_font_options_get_subpixel_order, <a href="cairo-Fonts.html#id2610267">cairo_font_options_get_subpixel_order ()</a> +<dt>cairo_font_options_get_hint_style, <a href="cairo-Fonts.html#id2860028">cairo_font_options_get_hint_style ()</a> </dt> -<dt>cairo_font_options_hash, <a href="cairo-Fonts.html#id2609572">cairo_font_options_hash ()</a> +<dt>cairo_font_options_get_subpixel_order, <a href="cairo-Fonts.html#id2859717">cairo_font_options_get_subpixel_order ()</a> </dt> -<dt>cairo_font_options_merge, <a href="cairo-Fonts.html#id2609449">cairo_font_options_merge ()</a> +<dt>cairo_font_options_hash, <a href="cairo-Fonts.html#id2859126">cairo_font_options_hash ()</a> </dt> -<dt>cairo_font_options_set_antialias, <a href="cairo-Fonts.html#id2609866">cairo_font_options_set_antialias ()</a> +<dt>cairo_font_options_merge, <a href="cairo-Fonts.html#id2859004">cairo_font_options_merge ()</a> </dt> -<dt>cairo_font_options_set_hint_metrics, <a href="cairo-Fonts.html#id2610752">cairo_font_options_set_hint_metrics ()</a> +<dt>cairo_font_options_set_antialias, <a href="cairo-Fonts.html#id2859317">cairo_font_options_set_antialias ()</a> </dt> -<dt>cairo_font_options_set_hint_style, <a href="cairo-Fonts.html#id2610478">cairo_font_options_set_hint_style ()</a> +<dt>cairo_font_options_set_hint_metrics, <a href="cairo-Fonts.html#id2860203">cairo_font_options_set_hint_metrics ()</a> </dt> -<dt>cairo_font_options_set_subpixel_order, <a href="cairo-Fonts.html#id2610162">cairo_font_options_set_subpixel_order ()</a> +<dt>cairo_font_options_set_hint_style, <a href="cairo-Fonts.html#id2859928">cairo_font_options_set_hint_style ()</a> </dt> -<dt>cairo_font_options_status, <a href="cairo-Fonts.html#id2609361">cairo_font_options_status ()</a> +<dt>cairo_font_options_set_subpixel_order, <a href="cairo-Fonts.html#id2859613">cairo_font_options_set_subpixel_order ()</a> </dt> -<dt>cairo_font_options_t, <a href="cairo-Fonts.html#id2609058">cairo_font_options_t</a> +<dt>cairo_font_options_status, <a href="cairo-Fonts.html#id2858916">cairo_font_options_status ()</a> </dt> -<dt>cairo_font_slant_t, <a href="cairo-cairo-t.html#id2672459">enum cairo_font_slant_t</a> +<dt>cairo_font_options_t, <a href="cairo-Fonts.html#id2858612">cairo_font_options_t</a> </dt> -<dt>cairo_font_weight_t, <a href="cairo-cairo-t.html#id2672487">enum cairo_font_weight_t</a> +<dt>cairo_font_slant_t, <a href="cairo-cairo-t.html#id2924697">enum cairo_font_slant_t</a> </dt> -<dt>cairo_format_t, <a href="cairo-cairo-t.html#id2665913">enum cairo_format_t</a> +<dt>cairo_font_weight_t, <a href="cairo-cairo-t.html#id2924726">enum cairo_font_weight_t</a> </dt> -<dt>CAIRO_FORMAT_VALID, <a href="cairo-cairo-t.html#id2666033">CAIRO_FORMAT_VALID()</a> +<dt>cairo_format_t, <a href="cairo-cairo-t.html#id2917903">enum cairo_format_t</a> </dt> -<dt>cairo_ft_font_face_create_for_ft_face, <a href="cairo-FreeType-Fonts.html#id2611005">cairo_ft_font_face_create_for_ft_face ()</a> +<dt>CAIRO_FORMAT_VALID, <a href="cairo-cairo-t.html#id2918024">CAIRO_FORMAT_VALID()</a> </dt> -<dt>cairo_ft_font_face_create_for_pattern, <a href="cairo-FreeType-Fonts.html#id2606983">cairo_ft_font_face_create_for_pattern ()</a> +<dt>cairo_ft_font_face_create_for_ft_face, <a href="cairo-FreeType-Fonts.html#id2866506">cairo_ft_font_face_create_for_ft_face ()</a> </dt> -<dt>cairo_ft_font_options_substitute, <a href="cairo-FreeType-Fonts.html#id2625942">cairo_ft_font_options_substitute ()</a> +<dt>cairo_ft_font_face_create_for_pattern, <a href="cairo-FreeType-Fonts.html#id2911623">cairo_ft_font_face_create_for_pattern ()</a> </dt> -<dt>cairo_ft_scaled_font_lock_face, <a href="cairo-FreeType-Fonts.html#id2611220">cairo_ft_scaled_font_lock_face ()</a> +<dt>cairo_ft_font_options_substitute, <a href="cairo-FreeType-Fonts.html#id2902948">cairo_ft_font_options_substitute ()</a> </dt> -<dt>cairo_ft_scaled_font_unlock_face, <a href="cairo-FreeType-Fonts.html#id2649899">cairo_ft_scaled_font_unlock_face ()</a> +<dt>cairo_ft_scaled_font_lock_face, <a href="cairo-FreeType-Fonts.html#id2910607">cairo_ft_scaled_font_lock_face ()</a> </dt> -<dt>cairo_get_current_point, <a href="cairo-cairo-t.html#id2674479">cairo_get_current_point ()</a> +<dt>cairo_ft_scaled_font_unlock_face, <a href="cairo-FreeType-Fonts.html#id2910849">cairo_ft_scaled_font_unlock_face ()</a> </dt> -<dt>cairo_get_fill_rule, <a href="cairo-cairo-t.html#id2674716">cairo_get_fill_rule ()</a> +<dt>cairo_get_antialias, <a href="cairo-cairo-t.html#id2926717">cairo_get_antialias ()</a> </dt> -<dt>cairo_get_font_face, <a href="cairo-cairo-t.html#id2673424">cairo_get_font_face ()</a> +<dt>cairo_get_current_point, <a href="cairo-cairo-t.html#id2926800">cairo_get_current_point ()</a> </dt> -<dt>cairo_get_font_matrix, <a href="cairo-cairo-t.html#id2672910">cairo_get_font_matrix ()</a> +<dt>cairo_get_fill_rule, <a href="cairo-cairo-t.html#id2927037">cairo_get_fill_rule ()</a> </dt> -<dt>cairo_get_font_options, <a href="cairo-cairo-t.html#id2673129">cairo_get_font_options ()</a> +<dt>cairo_get_font_face, <a href="cairo-cairo-t.html#id2925663">cairo_get_font_face ()</a> </dt> -<dt>cairo_get_line_cap, <a href="cairo-cairo-t.html#id2674881">cairo_get_line_cap ()</a> +<dt>cairo_get_font_matrix, <a href="cairo-cairo-t.html#id2925149">cairo_get_font_matrix ()</a> </dt> -<dt>cairo_get_line_join, <a href="cairo-cairo-t.html#id2674963">cairo_get_line_join ()</a> +<dt>cairo_get_font_options, <a href="cairo-cairo-t.html#id2925368">cairo_get_font_options ()</a> </dt> -<dt>cairo_get_line_width, <a href="cairo-cairo-t.html#id2674798">cairo_get_line_width ()</a> +<dt>cairo_get_line_cap, <a href="cairo-cairo-t.html#id2927202">cairo_get_line_cap ()</a> </dt> -<dt>cairo_get_matrix, <a href="cairo-cairo-t.html#id2675127">cairo_get_matrix ()</a> +<dt>cairo_get_line_join, <a href="cairo-cairo-t.html#id2927284">cairo_get_line_join ()</a> </dt> -<dt>cairo_get_miter_limit, <a href="cairo-cairo-t.html#id2675045">cairo_get_miter_limit ()</a> +<dt>cairo_get_line_width, <a href="cairo-cairo-t.html#id2927119">cairo_get_line_width ()</a> </dt> -<dt>cairo_get_operator, <a href="cairo-cairo-t.html#id2674235">cairo_get_operator ()</a> +<dt>cairo_get_matrix, <a href="cairo-cairo-t.html#id2927448">cairo_get_matrix ()</a> </dt> -<dt>cairo_get_source, <a href="cairo-cairo-t.html#id2674307">cairo_get_source ()</a> +<dt>cairo_get_miter_limit, <a href="cairo-cairo-t.html#id2927366">cairo_get_miter_limit ()</a> </dt> -<dt>cairo_get_target, <a href="cairo-cairo-t.html#id2675216">cairo_get_target ()</a> +<dt>cairo_get_operator, <a href="cairo-cairo-t.html#id2926474">cairo_get_operator ()</a> </dt> -<dt>cairo_get_tolerance, <a href="cairo-cairo-t.html#id2674397">cairo_get_tolerance ()</a> +<dt>cairo_get_source, <a href="cairo-cairo-t.html#id2926546">cairo_get_source ()</a> </dt> -<dt>cairo_glitz_surface_create, <a href="cairo-Glitz-backend.html#id2645347">cairo_glitz_surface_create ()</a> +<dt>cairo_get_target, <a href="cairo-cairo-t.html#id2927537">cairo_get_target ()</a> </dt> -<dt>cairo_glyph_extents, <a href="cairo-cairo-t.html#id2673893">cairo_glyph_extents ()</a> +<dt>cairo_get_tolerance, <a href="cairo-cairo-t.html#id2926635">cairo_get_tolerance ()</a> </dt> -<dt>cairo_glyph_path, <a href="cairo-cairo-t.html#id2674135">cairo_glyph_path ()</a> +<dt>cairo_glitz_surface_create, <a href="cairo-Glitz-backend.html#id2880302">cairo_glitz_surface_create ()</a> </dt> -<dt>cairo_glyph_t, <a href="cairo-cairo-t.html#id2672314">cairo_glyph_t</a> +<dt>cairo_glyph_extents, <a href="cairo-cairo-t.html#id2926132">cairo_glyph_extents ()</a> </dt> -<dt>cairo_hint_metrics_t, <a href="cairo-Fonts.html#id2610666">enum cairo_hint_metrics_t</a> +<dt>cairo_glyph_path, <a href="cairo-cairo-t.html#id2926374">cairo_glyph_path ()</a> </dt> -<dt>cairo_hint_style_t, <a href="cairo-Fonts.html#id2610353">enum cairo_hint_style_t</a> +<dt>cairo_glyph_t, <a href="cairo-cairo-t.html#id2924553">cairo_glyph_t</a> </dt> -<dt>cairo_identity_matrix, <a href="cairo-cairo-t.html#id2668383">cairo_identity_matrix ()</a> +<dt>cairo_hint_metrics_t, <a href="cairo-Fonts.html#id2860116">enum cairo_hint_metrics_t</a> </dt> -<dt>cairo_image_surface_create, <a href="cairo-cairo-t.html#id2676553">cairo_image_surface_create ()</a> +<dt>cairo_hint_style_t, <a href="cairo-Fonts.html#id2859804">enum cairo_hint_style_t</a> </dt> -<dt>cairo_image_surface_create_for_data, <a href="cairo-cairo-t.html#id2676698">cairo_image_surface_create_for_data ()</a> +<dt>cairo_identity_matrix, <a href="cairo-cairo-t.html#id2920620">cairo_identity_matrix ()</a> </dt> -<dt>cairo_image_surface_create_from_png, <a href="cairo-PNG-Backend.html#id2649277">cairo_image_surface_create_from_png ()</a> +<dt>cairo_image_surface_create, <a href="cairo-cairo-t.html#id2928874">cairo_image_surface_create ()</a> </dt> -<dt>cairo_image_surface_create_from_png_stream, <a href="cairo-PNG-Backend.html#id2652067">cairo_image_surface_create_from_png_stream ()</a> +<dt>cairo_image_surface_create_for_data, <a href="cairo-cairo-t.html#id2929019">cairo_image_surface_create_for_data ()</a> </dt> -<dt>cairo_image_surface_get_height, <a href="cairo-cairo-t.html#id2677003">cairo_image_surface_get_height ()</a> +<dt>cairo_image_surface_create_from_png, <a href="cairo-PNG-Backend.html#id2870493">cairo_image_surface_create_from_png ()</a> </dt> -<dt>cairo_image_surface_get_width, <a href="cairo-cairo-t.html#id2676922">cairo_image_surface_get_width ()</a> +<dt>cairo_image_surface_create_from_png_stream, <a href="cairo-PNG-Backend.html#id2909364">cairo_image_surface_create_from_png_stream ()</a> </dt> -<dt>cairo_in_fill, <a href="cairo-cairo-t.html#id2671435">cairo_in_fill ()</a> +<dt>cairo_image_surface_get_height, <a href="cairo-cairo-t.html#id2929324">cairo_image_surface_get_height ()</a> </dt> -<dt>cairo_in_stroke, <a href="cairo-cairo-t.html#id2671326">cairo_in_stroke ()</a> +<dt>cairo_image_surface_get_width, <a href="cairo-cairo-t.html#id2929243">cairo_image_surface_get_width ()</a> </dt> -<dt>cairo_line_cap_t, <a href="cairo-cairo-t.html#id2667274">enum cairo_line_cap_t</a> +<dt>cairo_in_fill, <a href="cairo-cairo-t.html#id2923674">cairo_in_fill ()</a> </dt> -<dt>cairo_line_join_t, <a href="cairo-cairo-t.html#id2667502">enum cairo_line_join_t</a> +<dt>cairo_in_stroke, <a href="cairo-cairo-t.html#id2923565">cairo_in_stroke ()</a> </dt> -<dt>cairo_line_to, <a href="cairo-cairo-t.html#id2669074">cairo_line_to ()</a> +<dt>cairo_line_cap_t, <a href="cairo-cairo-t.html#id2919510">enum cairo_line_cap_t</a> </dt> -<dt>cairo_mask, <a href="cairo-cairo-t.html#id2670534">cairo_mask ()</a> +<dt>cairo_line_join_t, <a href="cairo-cairo-t.html#id2919739">enum cairo_line_join_t</a> </dt> -<dt>cairo_mask_surface, <a href="cairo-cairo-t.html#id2670637">cairo_mask_surface ()</a> +<dt>cairo_line_to, <a href="cairo-cairo-t.html#id2921310">cairo_line_to ()</a> </dt> -<dt>cairo_matrix_init, <a href="cairo-cairo-matrix-t.html#id2650593">cairo_matrix_init ()</a> +<dt>cairo_mask, <a href="cairo-cairo-t.html#id2922771">cairo_mask ()</a> </dt> -<dt>cairo_matrix_init_identity, <a href="cairo-cairo-matrix-t.html#id2611854">cairo_matrix_init_identity ()</a> +<dt>cairo_mask_surface, <a href="cairo-cairo-t.html#id2922874">cairo_mask_surface ()</a> </dt> -<dt>cairo_matrix_init_rotate, <a href="cairo-cairo-matrix-t.html#id2612165">cairo_matrix_init_rotate ()</a> +<dt>cairo_matrix_init, <a href="cairo-cairo-matrix-t.html#id2863573">cairo_matrix_init ()</a> </dt> -<dt>cairo_matrix_init_scale, <a href="cairo-cairo-matrix-t.html#id2612045">cairo_matrix_init_scale ()</a> +<dt>cairo_matrix_init_identity, <a href="cairo-cairo-matrix-t.html#id2870868">cairo_matrix_init_identity ()</a> </dt> -<dt>cairo_matrix_init_translate, <a href="cairo-cairo-matrix-t.html#id2611925">cairo_matrix_init_translate ()</a> +<dt>cairo_matrix_init_rotate, <a href="cairo-cairo-matrix-t.html#id2871180">cairo_matrix_init_rotate ()</a> </dt> -<dt>cairo_matrix_invert, <a href="cairo-cairo-matrix-t.html#id2612647">cairo_matrix_invert ()</a> +<dt>cairo_matrix_init_scale, <a href="cairo-cairo-matrix-t.html#id2871060">cairo_matrix_init_scale ()</a> </dt> -<dt>cairo_matrix_multiply, <a href="cairo-cairo-matrix-t.html#id2612763">cairo_matrix_multiply ()</a> +<dt>cairo_matrix_init_translate, <a href="cairo-cairo-matrix-t.html#id2870940">cairo_matrix_init_translate ()</a> </dt> -<dt>cairo_matrix_rotate, <a href="cairo-cairo-matrix-t.html#id2612536">cairo_matrix_rotate ()</a> +<dt>cairo_matrix_invert, <a href="cairo-cairo-matrix-t.html#id2901099">cairo_matrix_invert ()</a> </dt> -<dt>cairo_matrix_scale, <a href="cairo-cairo-matrix-t.html#id2612395">cairo_matrix_scale ()</a> +<dt>cairo_matrix_multiply, <a href="cairo-cairo-matrix-t.html#id2901214">cairo_matrix_multiply ()</a> </dt> -<dt>cairo_matrix_t, <a href="cairo-cairo-matrix-t.html#id2615125">cairo_matrix_t</a> +<dt>cairo_matrix_rotate, <a href="cairo-cairo-matrix-t.html#id2900989">cairo_matrix_rotate ()</a> </dt> -<dt>cairo_matrix_transform_distance, <a href="cairo-cairo-matrix-t.html#id2612937">cairo_matrix_transform_distance ()</a> +<dt>cairo_matrix_scale, <a href="cairo-cairo-matrix-t.html#id2871409">cairo_matrix_scale ()</a> </dt> -<dt>cairo_matrix_transform_point, <a href="cairo-cairo-matrix-t.html#id2654347">cairo_matrix_transform_point ()</a> +<dt>cairo_matrix_t, <a href="cairo-cairo-matrix-t.html#id2876907">cairo_matrix_t</a> </dt> -<dt>cairo_matrix_translate, <a href="cairo-cairo-matrix-t.html#id2612262">cairo_matrix_translate ()</a> +<dt>cairo_matrix_transform_distance, <a href="cairo-cairo-matrix-t.html#id2901388">cairo_matrix_transform_distance ()</a> </dt> -<dt>cairo_move_to, <a href="cairo-cairo-t.html#id2668975">cairo_move_to ()</a> +<dt>cairo_matrix_transform_point, <a href="cairo-cairo-matrix-t.html#id2901627">cairo_matrix_transform_point ()</a> </dt> -<dt>cairo_new_path, <a href="cairo-cairo-t.html#id2668919">cairo_new_path ()</a> +<dt>cairo_matrix_translate, <a href="cairo-cairo-matrix-t.html#id2871276">cairo_matrix_translate ()</a> </dt> -<dt>cairo_operator_t, <a href="cairo-cairo-t.html#id2666080">enum cairo_operator_t</a> +<dt>cairo_move_to, <a href="cairo-cairo-t.html#id2921212">cairo_move_to ()</a> </dt> -<dt>cairo_paint, <a href="cairo-cairo-t.html#id2670371">cairo_paint ()</a> +<dt>cairo_new_path, <a href="cairo-cairo-t.html#id2921156">cairo_new_path ()</a> </dt> -<dt>cairo_paint_with_alpha, <a href="cairo-cairo-t.html#id2670433">cairo_paint_with_alpha ()</a> +<dt>cairo_operator_t, <a href="cairo-cairo-t.html#id2918070">enum cairo_operator_t</a> </dt> -<dt>cairo_path_data_type_t, <a href="cairo-cairo-t.html#id2675693">enum cairo_path_data_type_t</a> +<dt>cairo_paint, <a href="cairo-cairo-t.html#id2922608">cairo_paint ()</a> </dt> -<dt>cairo_path_destroy, <a href="cairo-cairo-t.html#id2675874">cairo_path_destroy ()</a> +<dt>cairo_paint_with_alpha, <a href="cairo-cairo-t.html#id2922670">cairo_paint_with_alpha ()</a> </dt> -<dt>cairo_path_t, <a href="cairo-cairo-t.html#id2675723">cairo_path_t</a> +<dt>cairo_path_data_type_t, <a href="cairo-cairo-t.html#id2928014">enum cairo_path_data_type_t</a> </dt> -<dt>cairo_pattern_add_color_stop_rgb, <a href="cairo-cairo-pattern-t.html#id2619496">cairo_pattern_add_color_stop_rgb ()</a> +<dt>cairo_path_destroy, <a href="cairo-cairo-t.html#id2928195">cairo_path_destroy ()</a> </dt> -<dt>cairo_pattern_add_color_stop_rgba, <a href="cairo-cairo-pattern-t.html#id2619638">cairo_pattern_add_color_stop_rgba ()</a> +<dt>cairo_path_t, <a href="cairo-cairo-t.html#id2928044">cairo_path_t</a> </dt> -<dt>cairo_pattern_create_for_surface, <a href="cairo-cairo-pattern-t.html#id2650221">cairo_pattern_create_for_surface ()</a> +<dt>cairo_pdf_surface_create, <a href="cairo-PDF-Backend.html#id2877429">cairo_pdf_surface_create ()</a> </dt> -<dt>cairo_pattern_create_linear, <a href="cairo-cairo-pattern-t.html#id2650323">cairo_pattern_create_linear ()</a> +<dt>cairo_pdf_surface_create_for_stream, <a href="cairo-PDF-Backend.html#id2911806">cairo_pdf_surface_create_for_stream ()</a> </dt> -<dt>cairo_pattern_create_radial, <a href="cairo-cairo-pattern-t.html#id2619005">cairo_pattern_create_radial ()</a> +<dt>cairo_pdf_surface_set_dpi, <a href="cairo-PDF-Backend.html#id2904532">cairo_pdf_surface_set_dpi ()</a> </dt> -<dt>cairo_pattern_create_rgb, <a href="cairo-cairo-pattern-t.html#id2652454">cairo_pattern_create_rgb ()</a> +<dt>cairo_ps_surface_create, <a href="cairo-PS-Backend.html#id2908423">cairo_ps_surface_create ()</a> </dt> -<dt>cairo_pattern_create_rgba, <a href="cairo-cairo-pattern-t.html#id2613872">cairo_pattern_create_rgba ()</a> +<dt>cairo_ps_surface_create_for_stream, <a href="cairo-PS-Backend.html#id2907019">cairo_ps_surface_create_for_stream ()</a> </dt> -<dt>cairo_pattern_destroy, <a href="cairo-cairo-pattern-t.html#id2619322">cairo_pattern_destroy ()</a> +<dt>cairo_ps_surface_set_dpi, <a href="cairo-PS-Backend.html#id2907149">cairo_ps_surface_set_dpi ()</a> </dt> -<dt>cairo_pattern_get_extend, <a href="cairo-cairo-pattern-t.html#id2620058">cairo_pattern_get_extend ()</a> +<dt>cairo_quartz_surface_create, <a href="cairo-Quartz-Backend.html#id2911231">cairo_quartz_surface_create ()</a> </dt> -<dt>cairo_pattern_get_filter, <a href="cairo-cairo-pattern-t.html#id2656711">cairo_pattern_get_filter ()</a> +<dt>cairo_read_func_t, <a href="cairo-cairo-t.html#id2929561">cairo_read_func_t ()</a> </dt> -<dt>cairo_pattern_get_matrix, <a href="cairo-cairo-pattern-t.html#id2619878">cairo_pattern_get_matrix ()</a> +<dt>cairo_rectangle, <a href="cairo-cairo-t.html#id2922411">cairo_rectangle ()</a> </dt> -<dt>cairo_pattern_reference, <a href="cairo-cairo-pattern-t.html#id2619235">cairo_pattern_reference ()</a> +<dt>cairo_reference, <a href="cairo-cairo-t.html#id2917299">cairo_reference ()</a> </dt> -<dt>cairo_pattern_set_extend, <a href="cairo-cairo-pattern-t.html#id2619982">cairo_pattern_set_extend ()</a> +<dt>cairo_rel_curve_to, <a href="cairo-cairo-t.html#id2922228">cairo_rel_curve_to ()</a> </dt> -<dt>cairo_pattern_set_filter, <a href="cairo-cairo-pattern-t.html#id2656635">cairo_pattern_set_filter ()</a> +<dt>cairo_rel_line_to, <a href="cairo-cairo-t.html#id2922130">cairo_rel_line_to ()</a> </dt> -<dt>cairo_pattern_set_matrix, <a href="cairo-cairo-pattern-t.html#id2619802">cairo_pattern_set_matrix ()</a> +<dt>cairo_rel_move_to, <a href="cairo-cairo-t.html#id2922031">cairo_rel_move_to ()</a> </dt> -<dt>cairo_pattern_status, <a href="cairo-cairo-pattern-t.html#id2619408">cairo_pattern_status ()</a> +<dt>cairo_reset_clip, <a href="cairo-cairo-t.html#id2924434">cairo_reset_clip ()</a> </dt> -<dt>cairo_pattern_t, <a href="cairo-cairo-pattern-t.html#id2652427">cairo_pattern_t</a> +<dt>cairo_restore, <a href="cairo-cairo-t.html#id2917671">cairo_restore ()</a> </dt> -<dt>cairo_pdf_surface_create, <a href="cairo-PDF-Backend.html#id2653228">cairo_pdf_surface_create ()</a> +<dt>cairo_rotate, <a href="cairo-cairo-t.html#id2920345">cairo_rotate ()</a> </dt> -<dt>cairo_pdf_surface_create_for_stream, <a href="cairo-PDF-Backend.html#id2636330">cairo_pdf_surface_create_for_stream ()</a> +<dt>cairo_save, <a href="cairo-cairo-t.html#id2917498">cairo_save ()</a> </dt> -<dt>cairo_pdf_surface_set_dpi, <a href="cairo-PDF-Backend.html#id2650115">cairo_pdf_surface_set_dpi ()</a> +<dt>cairo_scale, <a href="cairo-cairo-t.html#id2920227">cairo_scale ()</a> </dt> -<dt>cairo_ps_surface_create, <a href="cairo-PS-Backend.html#id2625778">cairo_ps_surface_create ()</a> +<dt>cairo_scaled_font_create, <a href="cairo-Fonts.html#id2908276">cairo_scaled_font_create ()</a> </dt> -<dt>cairo_ps_surface_create_for_stream, <a href="cairo-PS-Backend.html#id2651919">cairo_ps_surface_create_for_stream ()</a> +<dt>cairo_scaled_font_destroy, <a href="cairo-Fonts.html#id2857806">cairo_scaled_font_destroy ()</a> </dt> -<dt>cairo_ps_surface_set_dpi, <a href="cairo-PS-Backend.html#id2655418">cairo_ps_surface_set_dpi ()</a> +<dt>cairo_scaled_font_extents, <a href="cairo-Fonts.html#id2858202">cairo_scaled_font_extents ()</a> </dt> -<dt>cairo_quartz_surface_create, <a href="cairo-Quartz-Backend.html#id2606583">cairo_quartz_surface_create ()</a> +<dt>cairo_scaled_font_glyph_extents, <a href="cairo-Fonts.html#id2858492">cairo_scaled_font_glyph_extents ()</a> </dt> -<dt>cairo_read_func_t, <a href="cairo-cairo-t.html#id2677240">cairo_read_func_t ()</a> +<dt>cairo_scaled_font_reference, <a href="cairo-Fonts.html#id2857706">cairo_scaled_font_reference ()</a> </dt> -<dt>cairo_rectangle, <a href="cairo-cairo-t.html#id2670174">cairo_rectangle ()</a> +<dt>cairo_scaled_font_status, <a href="cairo-Fonts.html#id2857895">cairo_scaled_font_status ()</a> </dt> -<dt>cairo_reference, <a href="cairo-cairo-t.html#id2665327">cairo_reference ()</a> +<dt>cairo_scaled_font_t, <a href="cairo-Fonts.html#id2909638">cairo_scaled_font_t</a> </dt> -<dt>cairo_rel_curve_to, <a href="cairo-cairo-t.html#id2669992">cairo_rel_curve_to ()</a> +<dt>cairo_select_font_face, <a href="cairo-cairo-t.html#id2924754">cairo_select_font_face ()</a> </dt> -<dt>cairo_rel_line_to, <a href="cairo-cairo-t.html#id2669893">cairo_rel_line_to ()</a> +<dt>cairo_set_antialias, <a href="cairo-cairo-t.html#id2919071">cairo_set_antialias ()</a> </dt> -<dt>cairo_rel_move_to, <a href="cairo-cairo-t.html#id2669795">cairo_rel_move_to ()</a> +<dt>cairo_set_dash, <a href="cairo-cairo-t.html#id2919909">cairo_set_dash ()</a> </dt> -<dt>cairo_reset_clip, <a href="cairo-cairo-t.html#id2672195">cairo_reset_clip ()</a> +<dt>cairo_set_fill_rule, <a href="cairo-cairo-t.html#id2919275">cairo_set_fill_rule ()</a> </dt> -<dt>cairo_restore, <a href="cairo-cairo-t.html#id2665680">cairo_restore ()</a> +<dt>cairo_set_font_face, <a href="cairo-cairo-t.html#id2925866">cairo_set_font_face ()</a> </dt> -<dt>cairo_rotate, <a href="cairo-cairo-t.html#id2668108">cairo_rotate ()</a> +<dt>cairo_set_font_matrix, <a href="cairo-cairo-t.html#id2925030">cairo_set_font_matrix ()</a> </dt> -<dt>cairo_save, <a href="cairo-cairo-t.html#id2665507">cairo_save ()</a> +<dt>cairo_set_font_options, <a href="cairo-cairo-t.html#id2925255">cairo_set_font_options ()</a> </dt> -<dt>cairo_scale, <a href="cairo-cairo-t.html#id2667991">cairo_scale ()</a> +<dt>cairo_set_font_size, <a href="cairo-cairo-t.html#id2924894">cairo_set_font_size ()</a> </dt> -<dt>cairo_scaled_font_create, <a href="cairo-Fonts.html#id2608070">cairo_scaled_font_create ()</a> +<dt>cairo_set_line_cap, <a href="cairo-cairo-t.html#id2919598">cairo_set_line_cap ()</a> </dt> -<dt>cairo_scaled_font_destroy, <a href="cairo-Fonts.html#id2608340">cairo_scaled_font_destroy ()</a> +<dt>cairo_set_line_join, <a href="cairo-cairo-t.html#id2919767">cairo_set_line_join ()</a> </dt> -<dt>cairo_scaled_font_extents, <a href="cairo-Fonts.html#id2608647">cairo_scaled_font_extents ()</a> +<dt>cairo_set_line_width, <a href="cairo-cairo-t.html#id2919384">cairo_set_line_width ()</a> </dt> -<dt>cairo_scaled_font_glyph_extents, <a href="cairo-Fonts.html#id2608937">cairo_scaled_font_glyph_extents ()</a> +<dt>cairo_set_matrix, <a href="cairo-cairo-t.html#id2920530">cairo_set_matrix ()</a> </dt> -<dt>cairo_scaled_font_reference, <a href="cairo-Fonts.html#id2608252">cairo_scaled_font_reference ()</a> +<dt>cairo_set_miter_limit, <a href="cairo-cairo-t.html#id2920029">cairo_set_miter_limit ()</a> </dt> -<dt>cairo_scaled_font_t, <a href="cairo-Fonts.html#id2657499">cairo_scaled_font_t</a> +<dt>cairo_set_operator, <a href="cairo-cairo-t.html#id2918103">cairo_set_operator ()</a> </dt> -<dt>cairo_select_font_face, <a href="cairo-cairo-t.html#id2672516">cairo_select_font_face ()</a> +<dt>cairo_set_source, <a href="cairo-cairo-t.html#id2918516">cairo_set_source ()</a> </dt> -<dt>cairo_set_dash, <a href="cairo-cairo-t.html#id2667672">cairo_set_dash ()</a> +<dt>cairo_set_source_rgb, <a href="cairo-cairo-t.html#id2918216">cairo_set_source_rgb ()</a> </dt> -<dt>cairo_set_fill_rule, <a href="cairo-cairo-t.html#id2667039">cairo_set_fill_rule ()</a> +<dt>cairo_set_source_rgba, <a href="cairo-cairo-t.html#id2918356">cairo_set_source_rgba ()</a> </dt> -<dt>cairo_set_font_face, <a href="cairo-cairo-t.html#id2673627">cairo_set_font_face ()</a> +<dt>cairo_set_source_surface, <a href="cairo-cairo-t.html#id2918652">cairo_set_source_surface ()</a> </dt> -<dt>cairo_set_font_matrix, <a href="cairo-cairo-t.html#id2672792">cairo_set_font_matrix ()</a> +<dt>cairo_set_tolerance, <a href="cairo-cairo-t.html#id2918862">cairo_set_tolerance ()</a> </dt> -<dt>cairo_set_font_options, <a href="cairo-cairo-t.html#id2673016">cairo_set_font_options ()</a> +<dt>cairo_show_glyphs, <a href="cairo-cairo-t.html#id2925564">cairo_show_glyphs ()</a> </dt> -<dt>cairo_set_font_size, <a href="cairo-cairo-t.html#id2672655">cairo_set_font_size ()</a> +<dt>cairo_show_page, <a href="cairo-cairo-t.html#id2923508">cairo_show_page ()</a> </dt> -<dt>cairo_set_line_cap, <a href="cairo-cairo-t.html#id2667361">cairo_set_line_cap ()</a> +<dt>cairo_show_text, <a href="cairo-cairo-t.html#id2925487">cairo_show_text ()</a> </dt> -<dt>cairo_set_line_join, <a href="cairo-cairo-t.html#id2667531">cairo_set_line_join ()</a> +<dt>cairo_status, <a href="cairo-cairo-t.html#id2928679">cairo_status ()</a> </dt> -<dt>cairo_set_line_width, <a href="cairo-cairo-t.html#id2667147">cairo_set_line_width ()</a> +<dt>cairo_status_string, <a href="cairo-cairo-t.html#id2928746">cairo_status_string</a> </dt> -<dt>cairo_set_matrix, <a href="cairo-cairo-t.html#id2668293">cairo_set_matrix ()</a> +<dt>cairo_status_t, <a href="cairo-cairo-t.html#id2928295">enum cairo_status_t</a> </dt> -<dt>cairo_set_miter_limit, <a href="cairo-cairo-t.html#id2667792">cairo_set_miter_limit ()</a> +<dt>cairo_status_to_string, <a href="cairo-cairo-t.html#id2928775">cairo_status_to_string ()</a> </dt> -<dt>cairo_set_operator, <a href="cairo-cairo-t.html#id2666113">cairo_set_operator ()</a> +<dt>cairo_stroke, <a href="cairo-cairo-t.html#id2923034">cairo_stroke ()</a> </dt> -<dt>cairo_set_source, <a href="cairo-cairo-t.html#id2666526">cairo_set_source ()</a> +<dt>cairo_stroke_extents, <a href="cairo-cairo-t.html#id2923847">cairo_stroke_extents ()</a> </dt> -<dt>cairo_set_source_rgb, <a href="cairo-cairo-t.html#id2666226">cairo_set_source_rgb ()</a> +<dt>cairo_stroke_preserve, <a href="cairo-cairo-t.html#id2923146">cairo_stroke_preserve ()</a> </dt> -<dt>cairo_set_source_rgba, <a href="cairo-cairo-t.html#id2666365">cairo_set_source_rgba ()</a> +<dt>cairo_subpixel_order_t, <a href="cairo-Fonts.html#id2859486">enum cairo_subpixel_order_t</a> </dt> -<dt>cairo_set_source_surface, <a href="cairo-cairo-t.html#id2666636">cairo_set_source_surface ()</a> +<dt>cairo_surface_create_similar, <a href="cairo-cairo-surface-t.html#id2865836">cairo_surface_create_similar ()</a> </dt> -<dt>cairo_set_tolerance, <a href="cairo-cairo-t.html#id2666846">cairo_set_tolerance ()</a> +<dt>cairo_surface_destroy, <a href="cairo-cairo-surface-t.html#id2902022">cairo_surface_destroy ()</a> </dt> -<dt>cairo_show_glyphs, <a href="cairo-cairo-t.html#id2673325">cairo_show_glyphs ()</a> +<dt>cairo_surface_finish, <a href="cairo-cairo-surface-t.html#id2902227">cairo_surface_finish ()</a> </dt> -<dt>cairo_show_page, <a href="cairo-cairo-t.html#id2671269">cairo_show_page ()</a> +<dt>cairo_surface_flush, <a href="cairo-cairo-surface-t.html#id2912291">cairo_surface_flush ()</a> </dt> -<dt>cairo_show_text, <a href="cairo-cairo-t.html#id2673248">cairo_show_text ()</a> +<dt>cairo_surface_get_font_options, <a href="cairo-cairo-surface-t.html#id2911874">cairo_surface_get_font_options ()</a> </dt> -<dt>cairo_status, <a href="cairo-cairo-t.html#id2676358">cairo_status ()</a> +<dt>cairo_surface_get_user_data, <a href="cairo-cairo-surface-t.html#id2912168">cairo_surface_get_user_data ()</a> </dt> -<dt>cairo_status_string, <a href="cairo-cairo-t.html#id2676426">cairo_status_string</a> +<dt>cairo_surface_mark_dirty, <a href="cairo-cairo-surface-t.html#id2912362">cairo_surface_mark_dirty ()</a> </dt> -<dt>cairo_status_t, <a href="cairo-cairo-t.html#id2675974">enum cairo_status_t</a> +<dt>cairo_surface_mark_dirty_rectangle, <a href="cairo-cairo-surface-t.html#id2912438">cairo_surface_mark_dirty_rectangle ()</a> </dt> -<dt>cairo_status_to_string, <a href="cairo-cairo-t.html#id2676454">cairo_status_to_string ()</a> +<dt>cairo_surface_reference, <a href="cairo-cairo-surface-t.html#id2913404">cairo_surface_reference ()</a> </dt> -<dt>cairo_stroke, <a href="cairo-cairo-t.html#id2670797">cairo_stroke ()</a> +<dt>cairo_surface_set_device_offset, <a href="cairo-cairo-surface-t.html#id2912602">cairo_surface_set_device_offset ()</a> </dt> -<dt>cairo_stroke_extents, <a href="cairo-cairo-t.html#id2671608">cairo_stroke_extents ()</a> +<dt>cairo_surface_set_user_data, <a href="cairo-cairo-surface-t.html#id2911982">cairo_surface_set_user_data ()</a> </dt> -<dt>cairo_stroke_preserve, <a href="cairo-cairo-t.html#id2670909">cairo_stroke_preserve ()</a> +<dt>cairo_surface_status, <a href="cairo-cairo-surface-t.html#id2902108">cairo_surface_status ()</a> </dt> -<dt>cairo_subpixel_order_t, <a href="cairo-Fonts.html#id2610036">enum cairo_subpixel_order_t</a> +<dt>cairo_surface_t, <a href="cairo-cairo-surface-t.html#id2865758">cairo_surface_t</a> </dt> -<dt>cairo_surface_create_similar, <a href="cairo-cairo-surface-t.html#id2614386">cairo_surface_create_similar ()</a> +<dt>cairo_surface_write_to_png, <a href="cairo-PNG-Backend.html#id2907570">cairo_surface_write_to_png ()</a> </dt> -<dt>cairo_surface_destroy, <a href="cairo-cairo-surface-t.html#id2661578">cairo_surface_destroy ()</a> +<dt>cairo_surface_write_to_png_stream, <a href="cairo-PNG-Backend.html#id2907682">cairo_surface_write_to_png_stream ()</a> </dt> -<dt>cairo_surface_finish, <a href="cairo-cairo-surface-t.html#id2661632">cairo_surface_finish ()</a> +<dt>cairo_t, <a href="cairo-cairo-t.html#id2917016">cairo_t</a> </dt> -<dt>cairo_surface_get_font_options, <a href="cairo-cairo-surface-t.html#id2616377">cairo_surface_get_font_options ()</a> +<dt>cairo_text_extents, <a href="cairo-cairo-t.html#id2925998">cairo_text_extents ()</a> </dt> -<dt>cairo_surface_get_user_data, <a href="cairo-cairo-surface-t.html#id2660085">cairo_surface_get_user_data ()</a> +<dt>cairo_text_extents_t, <a href="cairo-Fonts.html#id2858303">cairo_text_extents_t</a> </dt> -<dt>cairo_surface_reference, <a href="cairo-cairo-surface-t.html#id2661524">cairo_surface_reference ()</a> +<dt>cairo_text_path, <a href="cairo-cairo-t.html#id2926296">cairo_text_path ()</a> </dt> -<dt>cairo_surface_set_device_offset, <a href="cairo-cairo-surface-t.html#id2660208">cairo_surface_set_device_offset ()</a> +<dt>cairo_transform, <a href="cairo-cairo-t.html#id2920438">cairo_transform ()</a> </dt> -<dt>cairo_surface_set_user_data, <a href="cairo-cairo-surface-t.html#id2616485">cairo_surface_set_user_data ()</a> +<dt>cairo_translate, <a href="cairo-cairo-t.html#id2920107">cairo_translate ()</a> </dt> -<dt>cairo_surface_t, <a href="cairo-cairo-surface-t.html#id2614308">cairo_surface_t</a> +<dt>cairo_user_data_key_t, <a href="cairo-cairo-t.html#id2929477">cairo_user_data_key_t</a> </dt> -<dt>cairo_surface_write_to_png, <a href="cairo-PNG-Backend.html#id2652188">cairo_surface_write_to_png ()</a> +<dt>cairo_user_to_device, <a href="cairo-cairo-t.html#id2920684">cairo_user_to_device ()</a> </dt> -<dt>cairo_surface_write_to_png_stream, <a href="cairo-PNG-Backend.html#id2651723">cairo_surface_write_to_png_stream ()</a> +<dt>cairo_user_to_device_distance, <a href="cairo-cairo-t.html#id2920790">cairo_user_to_device_distance ()</a> </dt> -<dt>cairo_t, <a href="cairo-cairo-t.html#id2665044">cairo_t</a> +<dt>cairo_win32_font_face_create_for_logfontw, <a href="cairo-Microsoft-Windows-Backend.html#id2910998">cairo_win32_font_face_create_for_logfontw ()</a> </dt> -<dt>cairo_text_extents, <a href="cairo-cairo-t.html#id2673759">cairo_text_extents ()</a> +<dt>cairo_win32_scaled_font_done_font, <a href="cairo-Microsoft-Windows-Backend.html#id2906778">cairo_win32_scaled_font_done_font ()</a> </dt> -<dt>cairo_text_extents_t, <a href="cairo-Fonts.html#id2608748">cairo_text_extents_t</a> +<dt>cairo_win32_scaled_font_get_metrics_factor, <a href="cairo-Microsoft-Windows-Backend.html#id2907267">cairo_win32_scaled_font_get_metrics_factor ()</a> </dt> -<dt>cairo_text_path, <a href="cairo-cairo-t.html#id2674057">cairo_text_path ()</a> +<dt>cairo_win32_scaled_font_select_font, <a href="cairo-Microsoft-Windows-Backend.html#id2906602">cairo_win32_scaled_font_select_font ()</a> </dt> -<dt>cairo_transform, <a href="cairo-cairo-t.html#id2668202">cairo_transform ()</a> +<dt>cairo_win32_surface_create, <a href="cairo-Microsoft-Windows-Backend.html#id2877092">cairo_win32_surface_create ()</a> </dt> -<dt>cairo_translate, <a href="cairo-cairo-t.html#id2667870">cairo_translate ()</a> +<dt>cairo_write_func_t, <a href="cairo-cairo-t.html#id2929690">cairo_write_func_t ()</a> </dt> -<dt>cairo_user_data_key_t, <a href="cairo-cairo-t.html#id2677157">cairo_user_data_key_t</a> +<dt>cairo_xcb_surface_create, <a href="cairo-XCB-Backend.html#id2906914">cairo_xcb_surface_create ()</a> </dt> -<dt>cairo_user_to_device, <a href="cairo-cairo-t.html#id2668447">cairo_user_to_device ()</a> +<dt>cairo_xcb_surface_create_for_bitmap, <a href="cairo-XCB-Backend.html#id2903715">cairo_xcb_surface_create_for_bitmap ()</a> </dt> -<dt>cairo_user_to_device_distance, <a href="cairo-cairo-t.html#id2668553">cairo_user_to_device_distance ()</a> +<dt>cairo_xcb_surface_set_size, <a href="cairo-XCB-Backend.html#id2906187">cairo_xcb_surface_set_size ()</a> </dt> -<dt>cairo_win32_font_face_create_for_logfontw, <a href="cairo-Microsoft-Windows-Backend.html#id2651539">cairo_win32_font_face_create_for_logfontw ()</a> +<dt>cairo_xlib_surface_create, <a href="cairo-XLib-Backend.html#id2903965">cairo_xlib_surface_create ()</a> </dt> -<dt>cairo_win32_scaled_font_done_font, <a href="cairo-Microsoft-Windows-Backend.html#id2658183">cairo_win32_scaled_font_done_font ()</a> +<dt>cairo_xlib_surface_create_for_bitmap, <a href="cairo-XLib-Backend.html#id2861735">cairo_xlib_surface_create_for_bitmap ()</a> </dt> -<dt>cairo_win32_scaled_font_get_metrics_factor, <a href="cairo-Microsoft-Windows-Backend.html#id2607369">cairo_win32_scaled_font_get_metrics_factor ()</a> +<dt>cairo_xlib_surface_set_drawable, <a href="cairo-XLib-Backend.html#id2903385">cairo_xlib_surface_set_drawable ()</a> </dt> -<dt>cairo_win32_scaled_font_select_font, <a href="cairo-Microsoft-Windows-Backend.html#id2658006">cairo_win32_scaled_font_select_font ()</a> -</dt> -<dt>cairo_win32_surface_create, <a href="cairo-Microsoft-Windows-Backend.html#id2651474">cairo_win32_surface_create ()</a> -</dt> -<dt>cairo_write_func_t, <a href="cairo-cairo-t.html#id2677369">cairo_write_func_t ()</a> -</dt> -<dt>cairo_xcb_surface_create, <a href="cairo-XCB-Backend.html#id2607558">cairo_xcb_surface_create ()</a> -</dt> -<dt>cairo_xcb_surface_create_for_bitmap, <a href="cairo-XCB-Backend.html#id2655812">cairo_xcb_surface_create_for_bitmap ()</a> -</dt> -<dt>cairo_xcb_surface_set_size, <a href="cairo-XCB-Backend.html#id2655958">cairo_xcb_surface_set_size ()</a> -</dt> -<dt>cairo_xlib_surface_create, <a href="cairo-XLib-Backend.html#id2677786">cairo_xlib_surface_create ()</a> -</dt> -<dt>cairo_xlib_surface_create_for_bitmap, <a href="cairo-XLib-Backend.html#id2656290">cairo_xlib_surface_create_for_bitmap ()</a> -</dt> -<dt>cairo_xlib_surface_set_size, <a href="cairo-XLib-Backend.html#id2678712">cairo_xlib_surface_set_size ()</a> +<dt>cairo_xlib_surface_set_size, <a href="cairo-XLib-Backend.html#id2903266">cairo_xlib_surface_set_size ()</a> </dt> </dl> </div> @@ -467,7 +451,7 @@ <h3>T</h3> <dl> <dt>types</dt> -<dd><dl><dt>cairo_matrix, <a href="cairo-cairo-matrix-t.html#id2614976">Description</a> +<dd><dl><dt>cairo_matrix, <a href="cairo-cairo-matrix-t.html#id2876757">Description</a> </dt></dl></dd> </dl> </div> diff --git a/doc/public/html/pt01.html b/doc/public/html/pt01.html index edaf9a6..2ac9c24 100644 --- a/doc/public/html/pt01.html +++ b/doc/public/html/pt01.html @@ -22,7 +22,7 @@ <td><a accesskey="n" href="pt02.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> </tr></table> <div class="part" lang="en"><div class="titlepage"><div><div><h1 class="title"> -<a name="id2596364"></a>Tutorial</h1></div></div></div></div> +<a name="id2847791"></a>Tutorial</h1></div></div></div></div> <table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"> <td align="left"><a accesskey="p" href="index.html"><b><< Cairo: A Vector Graphics Library</b></a></td> <td align="right"><a accesskey="n" href="pt02.html"><b>Part II. Reference >></b></a></td> diff --git a/doc/public/html/pt02.html b/doc/public/html/pt02.html index afab452..d620072 100644 --- a/doc/public/html/pt02.html +++ b/doc/public/html/pt02.html @@ -23,7 +23,7 @@ </tr></table> <div class="part" lang="en"> <div class="titlepage"><div><div><h1 class="title"> -<a name="id2558232"></a>Reference</h1></div></div></div> +<a name="id2809658"></a>Reference</h1></div></div></div> <font color="red"><xi:include></xi:include></font> </div> <table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"> diff --git a/doc/public/tmpl/cairo-font.sgml b/doc/public/tmpl/cairo-font.sgml index a41b7cc..78c9d3b 100644 --- a/doc/public/tmpl/cairo-font.sgml +++ b/doc/public/tmpl/cairo-font.sgml @@ -35,6 +35,7 @@ Font Handling </para> @font_face: +@Returns: <!-- ##### FUNCTION cairo_font_face_destroy ##### --> @@ -45,6 +46,15 @@ Font Handling @font_face: +<!-- ##### FUNCTION cairo_font_face_status ##### --> +<para> + +</para> + +@font_face: +@Returns: + + <!-- ##### FUNCTION cairo_font_face_get_user_data ##### --> <para> @@ -85,6 +95,7 @@ Font Handling </para> @scaled_font: +@Returns: <!-- ##### FUNCTION cairo_scaled_font_destroy ##### --> @@ -95,6 +106,15 @@ Font Handling @scaled_font: +<!-- ##### FUNCTION cairo_scaled_font_status ##### --> +<para> + +</para> + +@scaled_font: +@Returns: + + <!-- ##### STRUCT cairo_font_extents_t ##### --> <para> @@ -208,16 +228,6 @@ Font Handling @Returns: -<!-- ##### ENUM cairo_antialias_t ##### --> -<para> - -</para> - -@CAIRO_ANTIALIAS_DEFAULT: -@CAIRO_ANTIALIAS_NONE: -@CAIRO_ANTIALIAS_GRAY: -@CAIRO_ANTIALIAS_SUBPIXEL: - <!-- ##### FUNCTION cairo_font_options_set_antialias ##### --> <para> diff --git a/doc/public/tmpl/cairo-pattern.sgml b/doc/public/tmpl/cairo-pattern.sgml index a837252..78964ef 100644 --- a/doc/public/tmpl/cairo-pattern.sgml +++ b/doc/public/tmpl/cairo-pattern.sgml @@ -87,6 +87,7 @@ cairo_pattern_t </para> @pattern: +@Returns: <!-- ##### FUNCTION cairo_pattern_destroy ##### --> diff --git a/doc/public/tmpl/cairo-surface.sgml b/doc/public/tmpl/cairo-surface.sgml index 5d069fc..64e65f9 100644 --- a/doc/public/tmpl/cairo-surface.sgml +++ b/doc/public/tmpl/cairo-surface.sgml @@ -43,6 +43,7 @@ cairo_surface_t </para> @surface: +@Returns: <!-- ##### FUNCTION cairo_surface_destroy ##### --> @@ -53,6 +54,15 @@ cairo_surface_t @surface: +<!-- ##### FUNCTION cairo_surface_status ##### --> +<para> + +</para> + +@surface: +@Returns: + + <!-- ##### FUNCTION cairo_surface_finish ##### --> <para> @@ -94,6 +104,34 @@ cairo_surface_t @Returns: +<!-- ##### FUNCTION cairo_surface_flush ##### --> +<para> + +</para> + +@surface: + + +<!-- ##### FUNCTION cairo_surface_mark_dirty ##### --> +<para> + +</para> + +@surface: + + +<!-- ##### FUNCTION cairo_surface_mark_dirty_rectangle ##### --> +<para> + +</para> + +@surface: +@x: +@y: +@width: +@height: + + <!-- ##### FUNCTION cairo_surface_set_device_offset ##### --> <para> diff --git a/doc/public/tmpl/cairo-xlib.sgml b/doc/public/tmpl/cairo-xlib.sgml index cc106e8..d4cda45 100644 --- a/doc/public/tmpl/cairo-xlib.sgml +++ b/doc/public/tmpl/cairo-xlib.sgml @@ -53,3 +53,14 @@ XLib Backend @height: +<!-- ##### FUNCTION cairo_xlib_surface_set_drawable ##### --> +<para> + +</para> + +@surface: +@drawable: +@width: +@height: + + diff --git a/doc/public/tmpl/cairo.sgml b/doc/public/tmpl/cairo.sgml index c339842..3f2ec8d 100644 --- a/doc/public/tmpl/cairo.sgml +++ b/doc/public/tmpl/cairo.sgml @@ -48,6 +48,7 @@ Drawing contexts. </para> @cr: +@Returns: <!-- ##### FUNCTION cairo_destroy ##### --> @@ -190,6 +191,25 @@ Drawing contexts. @tolerance: +<!-- ##### ENUM cairo_antialias_t ##### --> +<para> + +</para> + +@CAIRO_ANTIALIAS_DEFAULT: +@CAIRO_ANTIALIAS_NONE: +@CAIRO_ANTIALIAS_GRAY: +@CAIRO_ANTIALIAS_SUBPIXEL: + +<!-- ##### FUNCTION cairo_set_antialias ##### --> +<para> + +</para> + +@cr: +@antialias: + + <!-- ##### ENUM cairo_fill_rule_t ##### --> <para> @@ -845,6 +865,15 @@ Drawing contexts. @Returns: +<!-- ##### FUNCTION cairo_get_antialias ##### --> +<para> + +</para> + +@cr: +@Returns: + + <!-- ##### FUNCTION cairo_get_current_point ##### --> <para> @@ -1115,3 +1144,10 @@ Drawing contexts. @Returns: +<!-- ##### FUNCTION cairo_debug_reset_static_data ##### --> +<para> + +</para> + + + diff --git a/doc/public/xml/cairo-font.xml b/doc/public/xml/cairo-font.xml index 8ba3b99..2918c00 100644 --- a/doc/public/xml/cairo-font.xml +++ b/doc/public/xml/cairo-font.xml @@ -20,8 +20,10 @@ typedef <link linkend="cairo-font-face-t">cairo_font_face_t</link>; typedef <link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link>; -<link linkend="void">void</link> <link linkend="cairo-font-face-reference">cairo_font_face_reference</link> (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face); +<link linkend="cairo-font-face-t">cairo_font_face_t</link>* <link linkend="cairo-font-face-reference">cairo_font_face_reference</link> + (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face); <link linkend="void">void</link> <link linkend="cairo-font-face-destroy">cairo_font_face_destroy</link> (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face); +<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-font-face-status">cairo_font_face_status</link> (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face); <link linkend="void">void</link>* <link linkend="cairo-font-face-get-user-data">cairo_font_face_get_user_data</link> (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face, const <link linkend="cairo-user-data-key-t">cairo_user_data_key_t</link> *key); <link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-font-face-set-user-data">cairo_font_face_set_user_data</link> @@ -34,8 +36,10 @@ typedef <link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link>; const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *font_matrix, const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *ctm, const <link linkend="cairo-font-options-t">cairo_font_options_t</link> *options); -<link linkend="void">void</link> <link linkend="cairo-scaled-font-reference">cairo_scaled_font_reference</link> (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font); +<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link>* <link linkend="cairo-scaled-font-reference">cairo_scaled_font_reference</link> + (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font); <link linkend="void">void</link> <link linkend="cairo-scaled-font-destroy">cairo_scaled_font_destroy</link> (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font); +<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-scaled-font-status">cairo_scaled_font_status</link> (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font); <link linkend="cairo-font-extents-t">cairo_font_extents_t</link>; <link linkend="void">void</link> <link linkend="cairo-scaled-font-extents">cairo_scaled_font_extents</link> (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font, <link linkend="cairo-font-extents-t">cairo_font_extents_t</link> *extents); @@ -56,7 +60,6 @@ typedef <link linkend="cairo-font-options-t">cairo_font_options_t</link>; unsigned <link linkend="long">long</link> <link linkend="cairo-font-options-hash">cairo_font_options_hash</link> (const <link linkend="cairo-font-options-t">cairo_font_options_t</link> *options); <link linkend="cairo-bool-t">cairo_bool_t</link> <link linkend="cairo-font-options-equal">cairo_font_options_equal</link> (const <link linkend="cairo-font-options-t">cairo_font_options_t</link> *options, const <link linkend="cairo-font-options-t">cairo_font_options_t</link> *other); -enum <link linkend="cairo-antialias-t">cairo_antialias_t</link>; <link linkend="void">void</link> <link linkend="cairo-font-options-set-antialias">cairo_font_options_set_antialias</link> (<link linkend="cairo-font-options-t">cairo_font_options_t</link> *options, <link linkend="cairo-antialias-t">cairo_antialias_t</link> antialias); @@ -128,7 +131,8 @@ to a scaled font to speed up the computation of metrics.</para> </para></refsect2> <refsect2> <title><anchor id="cairo-font-face-reference"/>cairo_font_face_reference ()</title> -<indexterm><primary>cairo_font_face_reference</primary></indexterm><programlisting><link linkend="void">void</link> cairo_font_face_reference (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face);</programlisting> +<indexterm><primary>cairo_font_face_reference</primary></indexterm><programlisting><link linkend="cairo-font-face-t">cairo_font_face_t</link>* cairo_font_face_reference + (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face);</programlisting> <para> Increases the reference count on <parameter>font_face</parameter> by one. This prevents <parameter>font_face</parameter> from being destroyed until a matching call to @@ -140,6 +144,8 @@ Increases the reference count on <parameter>font_face</parameter> by one. This p <listitem><simpara> a <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link>, (may be NULL in which case this function does nothing). </simpara></listitem></varlistentry> +<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the referenced <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link>. +</simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> <title><anchor id="cairo-font-face-destroy"/>cairo_font_face_destroy ()</title> @@ -156,6 +162,22 @@ See <link linkend="cairo-font-face-reference"><function>cairo_font_face_referenc </simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> +<title><anchor id="cairo-font-face-status"/>cairo_font_face_status ()</title> +<indexterm><primary>cairo_font_face_status</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_font_face_status (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face);</programlisting> +<para> +Checks whether an error has previously occurred for this +font face</para> +<para> + +</para><variablelist role="params"> +<varlistentry><term><parameter>font_face</parameter> :</term> +<listitem><simpara> a <link linkend="cairo-font-face-t"><type>cairo_font_face_t</type></link> +</simpara></listitem></varlistentry> +<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal> or another error such as + <literal>CAIRO_STATUS_NO_MEMORY</literal>. +</simpara></listitem></varlistentry> +</variablelist></refsect2> +<refsect2> <title><anchor id="cairo-font-face-get-user-data"/>cairo_font_face_get_user_data ()</title> <indexterm><primary>cairo_font_face_get_user_data</primary></indexterm><programlisting><link linkend="void">void</link>* cairo_font_face_get_user_data (<link linkend="cairo-font-face-t">cairo_font_face_t</link> *font_face, const <link linkend="cairo-user-data-key-t">cairo_user_data_key_t</link> *key);</programlisting> @@ -246,7 +268,8 @@ be used.</para> </variablelist></refsect2> <refsect2> <title><anchor id="cairo-scaled-font-reference"/>cairo_scaled_font_reference ()</title> -<indexterm><primary>cairo_scaled_font_reference</primary></indexterm><programlisting><link linkend="void">void</link> cairo_scaled_font_reference (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);</programlisting> +<indexterm><primary>cairo_scaled_font_reference</primary></indexterm><programlisting><link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link>* cairo_scaled_font_reference + (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);</programlisting> <para> Increases the reference count on <parameter>scaled_font</parameter> by one. This prevents <parameter>scaled_font</parameter> from being destroyed until a matching call to @@ -258,6 +281,10 @@ Increases the reference count on <parameter>scaled_font</parameter> by one. This <listitem><simpara> a <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link>, (may be NULL in which case this function does nothing) </simpara></listitem></varlistentry> +<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> + + +</simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> <title><anchor id="cairo-scaled-font-destroy"/>cairo_scaled_font_destroy ()</title> @@ -274,6 +301,22 @@ See <link linkend="cairo-scaled-font-reference"><function>cairo_scaled_font_refe </simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> +<title><anchor id="cairo-scaled-font-status"/>cairo_scaled_font_status ()</title> +<indexterm><primary>cairo_scaled_font_status</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_scaled_font_status (<link linkend="cairo-scaled-font-t">cairo_scaled_font_t</link> *scaled_font);</programlisting> +<para> +Checks whether an error has previously occurred for this +scaled_font.</para> +<para> + +</para><variablelist role="params"> +<varlistentry><term><parameter>scaled_font</parameter> :</term> +<listitem><simpara> a <link linkend="cairo-scaled-font-t"><type>cairo_scaled_font_t</type></link> +</simpara></listitem></varlistentry> +<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal> or another error such as + <literal>CAIRO_STATUS_NO_MEMORY</literal>. +</simpara></listitem></varlistentry> +</variablelist></refsect2> +<refsect2> <title><anchor id="cairo-font-extents-t"/>cairo_font_extents_t</title> <indexterm><primary>cairo_font_extents_t</primary></indexterm><programlisting>typedef struct { double ascent; @@ -577,45 +620,6 @@ Compares two font options objects for equality.</para> </simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> -<title><anchor id="cairo-antialias-t"/>enum cairo_antialias_t</title> -<indexterm><primary>cairo_antialias_t</primary></indexterm><programlisting>typedef enum _cairo_antialias { - CAIRO_ANTIALIAS_DEFAULT, - CAIRO_ANTIALIAS_NONE, - CAIRO_ANTIALIAS_GRAY, - CAIRO_ANTIALIAS_SUBPIXEL -} cairo_antialias_t; -</programlisting> -<para> -Specifies the type of antialiasing to do when rendering text.</para> -<para> - -</para><variablelist role="enum"> -<varlistentry> -<term><literal>CAIRO_ANTIALIAS_DEFAULT</literal></term> -<listitem><simpara> Use the default antialiasing for - the font subsystem and target device -</simpara></listitem> -</varlistentry> -<varlistentry> -<term><literal>CAIRO_ANTIALIAS_NONE</literal></term> -<listitem><simpara> Do no antialiasing of fonts; use bilevel text -</simpara></listitem> -</varlistentry> -<varlistentry> -<term><literal>CAIRO_ANTIALIAS_GRAY</literal></term> -<listitem><simpara> Perform single-color antialiasing (using - shades of gray for black text on a white background, for example). -</simpara></listitem> -</varlistentry> -<varlistentry> -<term><literal>CAIRO_ANTIALIAS_SUBPIXEL</literal></term> -<listitem><simpara> Perform antialiasing by taking - advantage of the order of subpixel elements on devices - such as LCD panels -</simpara></listitem> -</varlistentry> -</variablelist></refsect2> -<refsect2> <title><anchor id="cairo-font-options-set-antialias"/>cairo_font_options_set_antialias ()</title> <indexterm><primary>cairo_font_options_set_antialias</primary></indexterm><programlisting><link linkend="void">void</link> cairo_font_options_set_antialias (<link linkend="cairo-font-options-t">cairo_font_options_t</link> *options, diff --git a/doc/public/xml/cairo-pattern.xml b/doc/public/xml/cairo-pattern.xml index 9812de7..fdf40e1 100644 --- a/doc/public/xml/cairo-pattern.xml +++ b/doc/public/xml/cairo-pattern.xml @@ -40,7 +40,7 @@ typedef <link linkend="cairo-pattern-t">cairo_pattern_t</link>; <link linkend="double">double</link> cx1, <link linkend="double">double</link> cy1, <link linkend="double">double</link> radius1); -<link linkend="void">void</link> <link linkend="cairo-pattern-reference">cairo_pattern_reference</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern); +<link linkend="cairo-pattern-t">cairo_pattern_t</link>* <link linkend="cairo-pattern-reference">cairo_pattern_reference</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern); <link linkend="void">void</link> <link linkend="cairo-pattern-destroy">cairo_pattern_destroy</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern); <link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-pattern-status">cairo_pattern_status</link> (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern); <link linkend="void">void</link> <link linkend="cairo-pattern-add-color-stop-rgb">cairo_pattern_add_color_stop_rgb</link> @@ -100,7 +100,7 @@ enum <link linkend="cairo-extend-t">cairo_extend_t</link>; <link linkend="double">double</link> green, <link linkend="double">double</link> blue);</programlisting> <para> -Create a new cairo_pattern_t corresponding to a opaque color. The +Creates a new cairo_pattern_t corresponding to an opaque color. The color components are floating point numbers in the range 0 to 1. If the values passed in are outside that range, they will be clamped.</para> @@ -133,7 +133,7 @@ the status of a pattern use <link linkend="cairo-pattern-status"><function>cairo <link linkend="double">double</link> blue, <link linkend="double">double</link> alpha);</programlisting> <para> -Create a new cairo_pattern_t corresponding to a translucent color. +Creates a new cairo_pattern_t corresponding to a translucent color. The color components are floating point numbers in the range 0 to 1. If the values passed in are outside that range, they will be clamped.</para> @@ -196,7 +196,12 @@ Create a new linear gradient cairo_pattern_t along the line defined by (x0, y0) and (x1, y1). Before using the gradient pattern, a number of color stops should be defined using <link linkend="cairo-pattern-add-color-stop-rgb"><function>cairo_pattern_add_color_stop_rgb()</function></link> or -<link linkend="cairo-pattern-add-color-stop-rgba"><function>cairo_pattern_add_color_stop_rgba()</function></link>.</para> +<link linkend="cairo-pattern-add-color-stop-rgba"><function>cairo_pattern_add_color_stop_rgba()</function></link>. +</para> +<para> +Note: The coordinates here are in pattern space. For a new pattern, +pattern space is identical to user space, but the relationship +between the spaces can be changed with <link linkend="cairo-pattern-set-matrix"><function>cairo_pattern_set_matrix()</function></link>.</para> <para> </para><variablelist role="params"> @@ -232,11 +237,16 @@ the status of a pattern use <link linkend="cairo-pattern-status"><function>cairo <link linkend="double">double</link> cy1, <link linkend="double">double</link> radius1);</programlisting> <para> -Create a new radial gradient cairo_pattern_t between the two +Creates a new radial gradient cairo_pattern_t between the two circles defined by (x0, y0, c0) and (x1, y1, c0). Before using the gradient pattern, a number of color stops should be defined using <link linkend="cairo-pattern-add-color-stop-rgb"><function>cairo_pattern_add_color_stop_rgb()</function></link> or -<link linkend="cairo-pattern-add-color-stop-rgba"><function>cairo_pattern_add_color_stop_rgba()</function></link>.</para> +<link linkend="cairo-pattern-add-color-stop-rgba"><function>cairo_pattern_add_color_stop_rgba()</function></link>. +</para> +<para> +Note: The coordinates here are in pattern space. For a new pattern, +pattern space is identical to user space, but the relationship +between the spaces can be changed with <link linkend="cairo-pattern-set-matrix"><function>cairo_pattern_set_matrix()</function></link>.</para> <para> </para><variablelist role="params"> @@ -270,7 +280,7 @@ the status of a pattern use <link linkend="cairo-pattern-status"><function>cairo </variablelist></refsect2> <refsect2> <title><anchor id="cairo-pattern-reference"/>cairo_pattern_reference ()</title> -<indexterm><primary>cairo_pattern_reference</primary></indexterm><programlisting><link linkend="void">void</link> cairo_pattern_reference (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern);</programlisting> +<indexterm><primary>cairo_pattern_reference</primary></indexterm><programlisting><link linkend="cairo-pattern-t">cairo_pattern_t</link>* cairo_pattern_reference (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern);</programlisting> <para> Increases the reference count on <parameter>pattern</parameter> by one. This prevents <parameter>pattern</parameter> from being destroyed until a matching call to @@ -281,6 +291,8 @@ Increases the reference count on <parameter>pattern</parameter> by one. This pre <varlistentry><term><parameter>pattern</parameter> :</term> <listitem><simpara> a <link linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link> </simpara></listitem></varlistentry> +<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the referenced <link linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link>. +</simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> <title><anchor id="cairo-pattern-destroy"/>cairo_pattern_destroy ()</title> @@ -308,7 +320,8 @@ pattern.</para> <varlistentry><term><parameter>pattern</parameter> :</term> <listitem><simpara> a <link linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link> </simpara></listitem></varlistentry> -<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal> or <literal>CAIRO_STATUS_NO_MEMORY</literal> +<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal>, <literal>CAIRO_STATUS_NO_MEMORY</literal>, or +<literal>CAIRO_STATUS_PATTERN_TYPE_MISMATCH</literal>. </simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> @@ -320,24 +333,36 @@ pattern.</para> <link linkend="double">double</link> green, <link linkend="double">double</link> blue);</programlisting> <para> +Adds an opaque color stop to a gradient pattern. The offset +specifies the location along the gradient's control vector. For +example, a linear gradient's control vector is from (x0,y0) to +(x1,y1) while a radial gradient's control vector is from any point +on the start circle to the corresponding point on the end circle. +</para> +<para> +The color is specified in the same way as in <link linkend="cairo-set-source-rgb"><function>cairo_set_source_rgb()</function></link>. +</para> +<para> +Note: If the pattern is not a gradient pattern, (eg. a linear or +radial pattern), then the pattern will be put into an error status +with a status of CAIRO_STATUS_PATTERN_MISMATCH.</para> +<para> </para><variablelist role="params"> <varlistentry><term><parameter>pattern</parameter> :</term> -<listitem><simpara> +<listitem><simpara> a <link linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link> </simpara></listitem></varlistentry> <varlistentry><term><parameter>offset</parameter> :</term> -<listitem><simpara> +<listitem><simpara> an offset in the range [0.0 .. 1.0] </simpara></listitem></varlistentry> <varlistentry><term><parameter>red</parameter> :</term> -<listitem><simpara> +<listitem><simpara> red component of color </simpara></listitem></varlistentry> <varlistentry><term><parameter>green</parameter> :</term> -<listitem><simpara> +<listitem><simpara> green component of color </simpara></listitem></varlistentry> <varlistentry><term><parameter>blue</parameter> :</term> -<listitem><simpara> - - +<listitem><simpara> blue component of color </simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> @@ -350,27 +375,39 @@ pattern.</para> <link linkend="double">double</link> blue, <link linkend="double">double</link> alpha);</programlisting> <para> +Adds a translucent color stop to a gradient pattern. The offset +specifies the location along the gradient's control vector. For +example, a linear gradient's control vector is from (x0,y0) to +(x1,y1) while a radial gradient's control vector is from any point +on the start circle to the corresponding point on the end circle. +</para> +<para> +The color is specified in the same way as in <link linkend="cairo-set-source-rgba"><function>cairo_set_source_rgba()</function></link>. +</para> +<para> +Note: If the pattern is not a gradient pattern, (eg. a linear or +radial pattern), then the pattern will be put into an error status +with a status of CAIRO_STATUS_PATTERN_MISMATCH.</para> +<para> </para><variablelist role="params"> <varlistentry><term><parameter>pattern</parameter> :</term> -<listitem><simpara> +<listitem><simpara> a <link linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link> </simpara></listitem></varlistentry> <varlistentry><term><parameter>offset</parameter> :</term> -<listitem><simpara> +<listitem><simpara> an offset in the range [0.0 .. 1.0] </simpara></listitem></varlistentry> <varlistentry><term><parameter>red</parameter> :</term> -<listitem><simpara> +<listitem><simpara> red component of color </simpara></listitem></varlistentry> <varlistentry><term><parameter>green</parameter> :</term> -<listitem><simpara> +<listitem><simpara> green component of color </simpara></listitem></varlistentry> <varlistentry><term><parameter>blue</parameter> :</term> -<listitem><simpara> +<listitem><simpara> blue component of color </simpara></listitem></varlistentry> <varlistentry><term><parameter>alpha</parameter> :</term> -<listitem><simpara> - - +<listitem><simpara> alpha component of color </simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> @@ -378,15 +415,46 @@ pattern.</para> <indexterm><primary>cairo_pattern_set_matrix</primary></indexterm><programlisting><link linkend="void">void</link> cairo_pattern_set_matrix (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern, const <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting> <para> +Sets the pattern's transformation matrix to <parameter>matrix</parameter>. This matrix is +a transformation from user space to pattern space. +</para> +<para> +When a pattern is first created it always has the identity matrix +for its transformation matrix, which means that pattern space is +initially identical to user space. +</para> +<para> +Important: Please note that the direction of this transformation +matrix is from user space to pattern space. This means that if you +imagine the flow from a pattern to user space (and on to device +space), then coordinates in that flow will be transformed by the +inverse of the pattern matrix. +</para> +<para> +For example, if you want to make a pattern appear twice as large as +it does by default the correct code to use is: +</para> +<para> +<informalexample><programlisting> +cairo_matrix_init_scale (&matrix, 0.5, 0.5); +cairo_pattern_set_matrix (pattern, &matrix); +</programlisting></informalexample> +</para> +<para> +Meanwhile, using values of 2.0 rather than 0.5 in the code above +would cause the pattern to appear at half of its default size. +</para> +<para> +Also, please note the discussion of the user-space locking +semantics of <link linkend="cairo-set-source"><function>cairo_set_source()</function></link>.</para> +<para> </para><variablelist role="params"> <varlistentry><term><parameter>pattern</parameter> :</term> -<listitem><simpara> +<listitem><simpara> a <link linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link> </simpara></listitem></varlistentry> <varlistentry><term><parameter>matrix</parameter> :</term> -<listitem><simpara> - - +<listitem><simpara> a <link linkend="cairo-matrix-t"><type>cairo_matrix_t</type></link> </simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> @@ -394,13 +462,15 @@ pattern.</para> <indexterm><primary>cairo_pattern_get_matrix</primary></indexterm><programlisting><link linkend="void">void</link> cairo_pattern_get_matrix (<link linkend="cairo-pattern-t">cairo_pattern_t</link> *pattern, <link linkend="cairo-matrix-t">cairo_matrix_t</link> *matrix);</programlisting> <para> +Stores the pattern's transformation matrix into <parameter>matrix</parameter>.</para> +<para> </para><variablelist role="params"> <varlistentry><term><parameter>pattern</parameter> :</term> -<listitem><simpara> +<listitem><simpara> a <link linkend="cairo-pattern-t"><type>cairo_pattern_t</type></link> </simpara></listitem></varlistentry> <varlistentry><term><parameter>matrix</parameter> :</term> -<listitem><simpara> +<listitem><simpara> return value for the matrix </simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> diff --git a/doc/public/xml/cairo-surface.xml b/doc/public/xml/cairo-surface.xml index ad20cbb..abe7c97 100644 --- a/doc/public/xml/cairo-surface.xml +++ b/doc/public/xml/cairo-surface.xml @@ -24,8 +24,9 @@ typedef <link linkend="cairo-surface-t">cairo_surface_t</link>; <link linkend="cairo-content-t">cairo_content_t</link> content, <link linkend="int">int</link> width, <link linkend="int">int</link> height); -<link linkend="void">void</link> <link linkend="cairo-surface-reference">cairo_surface_reference</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface); +<link linkend="cairo-surface-t">cairo_surface_t</link>* <link linkend="cairo-surface-reference">cairo_surface_reference</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface); <link linkend="void">void</link> <link linkend="cairo-surface-destroy">cairo_surface_destroy</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface); +<link linkend="cairo-status-t">cairo_status_t</link> <link linkend="cairo-surface-status">cairo_surface_status</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface); <link linkend="void">void</link> <link linkend="cairo-surface-finish">cairo_surface_finish</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface); <link linkend="void">void</link> <link linkend="cairo-surface-get-font-options">cairo_surface_get_font_options</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface, <link linkend="cairo-font-options-t">cairo_font_options_t</link> *options); @@ -35,6 +36,14 @@ typedef <link linkend="cairo-surface-t">cairo_surface_t</link>; <link linkend="cairo-destroy-func-t">cairo_destroy_func_t</link> destroy); <link linkend="void">void</link>* <link linkend="cairo-surface-get-user-data">cairo_surface_get_user_data</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface, const <link linkend="cairo-user-data-key-t">cairo_user_data_key_t</link> *key); +<link linkend="void">void</link> <link linkend="cairo-surface-flush">cairo_surface_flush</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface); +<link linkend="void">void</link> <link linkend="cairo-surface-mark-dirty">cairo_surface_mark_dirty</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface); +<link linkend="void">void</link> <link linkend="cairo-surface-mark-dirty-rectangle">cairo_surface_mark_dirty_rectangle</link> + (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface, + <link linkend="int">int</link> x, + <link linkend="int">int</link> y, + <link linkend="int">int</link> width, + <link linkend="int">int</link> height); <link linkend="void">void</link> <link linkend="cairo-surface-set-device-offset">cairo_surface_set_device_offset</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface, <link linkend="double">double</link> x_offset, <link linkend="double">double</link> y_offset); @@ -112,26 +121,50 @@ or any other error occurs. </variablelist></refsect2> <refsect2> <title><anchor id="cairo-surface-reference"/>cairo_surface_reference ()</title> -<indexterm><primary>cairo_surface_reference</primary></indexterm><programlisting><link linkend="void">void</link> cairo_surface_reference (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);</programlisting> +<indexterm><primary>cairo_surface_reference</primary></indexterm><programlisting><link linkend="cairo-surface-t">cairo_surface_t</link>* cairo_surface_reference (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);</programlisting> +<para> +Increases the reference count on <parameter>surface</parameter> by one. This prevents +<parameter>surface</parameter> from being destroyed until a matching call to +<link linkend="cairo-surface-destroy"><function>cairo_surface_destroy()</function></link> is made.</para> <para> </para><variablelist role="params"> <varlistentry><term><parameter>surface</parameter> :</term> -<listitem><simpara> - - +<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> +</simpara></listitem></varlistentry> +<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the referenced <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link>. </simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> <title><anchor id="cairo-surface-destroy"/>cairo_surface_destroy ()</title> <indexterm><primary>cairo_surface_destroy</primary></indexterm><programlisting><link linkend="void">void</link> cairo_surface_destroy (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);</programlisting> <para> +Decreases the reference count on <parameter>surface</parameter> by one. If the result is +zero, then <parameter>surface</parameter> and all associated resources are freed. See +<link linkend="cairo-surface-reference"><function>cairo_surface_reference()</function></link>.</para> +<para> </para><variablelist role="params"> <varlistentry><term><parameter>surface</parameter> :</term> -<listitem><simpara> - +<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link> +</simpara></listitem></varlistentry> +</variablelist></refsect2> +<refsect2> +<title><anchor id="cairo-surface-status"/>cairo_surface_status ()</title> +<indexterm><primary>cairo_surface_status</primary></indexterm><programlisting><link linkend="cairo-status-t">cairo_status_t</link> cairo_surface_status (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);</programlisting> +<para> +Checks whether an error has previously occurred for this +surface.</para> +<para> +</para><variablelist role="params"> +<varlistentry><term><parameter>surface</parameter> :</term> +<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> +</simpara></listitem></varlistentry> +<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> <literal>CAIRO_STATUS_SUCCESS</literal>, <literal>CAIRO_STATUS_NULL_POINTER</literal>, +<literal>CAIRO_STATUS_NO_MEMORY</literal>, <literal>CAIRO_STATUS_READ_ERROR</literal>, +<literal>CAIRO_STATUS_INVALID_CONTENT</literal>, <literal>CAIRO_STATUS_INVALUE_FORMAT</literal>, or +<literal>CAIRO_STATUS_INVALID_VISUAL</literal>. </simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> @@ -233,6 +266,68 @@ attached to </simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> +<title><anchor id="cairo-surface-flush"/>cairo_surface_flush ()</title> +<indexterm><primary>cairo_surface_flush</primary></indexterm><programlisting><link linkend="void">void</link> cairo_surface_flush (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);</programlisting> +<para> +Do any pending drawing for the surface and also restore any +temporary modification's cairo has made to the surface's +state. This function must be called before switching from +drawing on the surface with cairo to drawing on it directly +with native APIs. If the surface doesn't support direct access, +then this function does nothing.</para> +<para> + +</para><variablelist role="params"> +<varlistentry><term><parameter>surface</parameter> :</term> +<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> +</simpara></listitem></varlistentry> +</variablelist></refsect2> +<refsect2> +<title><anchor id="cairo-surface-mark-dirty"/>cairo_surface_mark_dirty ()</title> +<indexterm><primary>cairo_surface_mark_dirty</primary></indexterm><programlisting><link linkend="void">void</link> cairo_surface_mark_dirty (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface);</programlisting> +<para> +Tells cairo that drawing has been done to surface using means other +than cairo, and that cairo should reread any cached areas. Note +that you must call <link linkend="cairo-surface-flush"><function>cairo_surface_flush()</function></link> before doing such drawing.</para> +<para> + +</para><variablelist role="params"> +<varlistentry><term><parameter>surface</parameter> :</term> +<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> +</simpara></listitem></varlistentry> +</variablelist></refsect2> +<refsect2> +<title><anchor id="cairo-surface-mark-dirty-rectangle"/>cairo_surface_mark_dirty_rectangle ()</title> +<indexterm><primary>cairo_surface_mark_dirty_rectangle</primary></indexterm><programlisting><link linkend="void">void</link> cairo_surface_mark_dirty_rectangle + (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface, + <link linkend="int">int</link> x, + <link linkend="int">int</link> y, + <link linkend="int">int</link> width, + <link linkend="int">int</link> height);</programlisting> +<para> +Like <link linkend="cairo-surface-mark-dirty"><function>cairo_surface_mark_dirty()</function></link>, but drawing has been done only to +the specified rectangle, so that cairo can retain cached contents +for other parts of the surface.</para> +<para> + +</para><variablelist role="params"> +<varlistentry><term><parameter>surface</parameter> :</term> +<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> +</simpara></listitem></varlistentry> +<varlistentry><term><parameter>x</parameter> :</term> +<listitem><simpara> X coordinate of dirty rectangle +</simpara></listitem></varlistentry> +<varlistentry><term><parameter>y</parameter> :</term> +<listitem><simpara> Y coordinate of dirty rectangle +</simpara></listitem></varlistentry> +<varlistentry><term><parameter>width</parameter> :</term> +<listitem><simpara> width of dirty rectangle +</simpara></listitem></varlistentry> +<varlistentry><term><parameter>height</parameter> :</term> +<listitem><simpara> height of dirty rectangle +</simpara></listitem></varlistentry> +</variablelist></refsect2> +<refsect2> <title><anchor id="cairo-surface-set-device-offset"/>cairo_surface_set_device_offset ()</title> <indexterm><primary>cairo_surface_set_device_offset</primary></indexterm><programlisting><link linkend="void">void</link> cairo_surface_set_device_offset (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface, <link linkend="double">double</link> x_offset, diff --git a/doc/public/xml/cairo-xlib.xml b/doc/public/xml/cairo-xlib.xml index a19d43f..27f2c7f 100644 --- a/doc/public/xml/cairo-xlib.xml +++ b/doc/public/xml/cairo-xlib.xml @@ -32,6 +32,10 @@ <link linkend="void">void</link> <link linkend="cairo-xlib-surface-set-size">cairo_xlib_surface_set_size</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface, <link linkend="int">int</link> width, <link linkend="int">int</link> height); +<link linkend="void">void</link> <link linkend="cairo-xlib-surface-set-drawable">cairo_xlib_surface_set_drawable</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface, + <link linkend="Drawable">Drawable</link> drawable, + <link linkend="int">int</link> width, + <link linkend="int">int</link> height); </synopsis> </refsynopsisdiv> @@ -152,6 +156,37 @@ this function on a surface created for a Pixmap.</para> <listitem><simpara> the new height of the surface </simpara></listitem></varlistentry> </variablelist></refsect2> +<refsect2> +<title><anchor id="cairo-xlib-surface-set-drawable"/>cairo_xlib_surface_set_drawable ()</title> +<indexterm><primary>cairo_xlib_surface_set_drawable</primary></indexterm><programlisting><link linkend="void">void</link> cairo_xlib_surface_set_drawable (<link linkend="cairo-surface-t">cairo_surface_t</link> *surface, + <link linkend="Drawable">Drawable</link> drawable, + <link linkend="int">int</link> width, + <link linkend="int">int</link> height);</programlisting> +<para> +Informs cairo of a new X Drawable underlying the +surface. The drawable must match the display, screen +and format of the existing drawable or the application +will get X protocol errors and will probably terminate. +No checks are done by this function to ensure this +compatibility.</para> +<para> + +</para><variablelist role="params"> +<varlistentry><term><parameter>surface</parameter> :</term> +<listitem><simpara> a <link linkend="cairo-surface-t"><type>cairo_surface_t</type></link> for the XLib backend +</simpara></listitem></varlistentry> +<varlistentry><term><parameter>drawable</parameter> :</term> +<listitem><simpara> the new drawable for the surface +</simpara></listitem></varlistentry> +<varlistentry><term><parameter>width</parameter> :</term> +<listitem><simpara> +</simpara></listitem></varlistentry> +<varlistentry><term><parameter>height</parameter> :</term> +<listitem><simpara> + + +</simpara></listitem></varlistentry> +</variablelist></refsect2> </refsect1> diff --git a/doc/public/xml/cairo.xml b/doc/public/xml/cairo.xml index 972bdf7..b491a22 100644 --- a/doc/public/xml/cairo.xml +++ b/doc/public/xml/cairo.xml @@ -20,7 +20,7 @@ typedef <link linkend="cairo-t">cairo_t</link>; <link linkend="cairo-t">cairo_t</link>* <link linkend="cairo-create">cairo_create</link> (<link linkend="cairo-surface-t">cairo_surface_t</link> *target); -<link linkend="void">void</link> <link linkend="cairo-reference">cairo_reference</link> (<link linkend="cairo-t">cairo_t</link> *cr); +<link linkend="cairo-t">cairo_t</link>* <link linkend="cairo-reference">cairo_reference</link> (<link linkend="cairo-t">cairo_t</link> *cr); <link linkend="void">void</link> <link linkend="cairo-destroy">cairo_destroy</link> (<link linkend="cairo-t">cairo_t</link> *cr); <link linkend="void">void</link> <link linkend="cairo-save">cairo_save</link> (<link linkend="cairo-t">cairo_t</link> *cr); <link linkend="void">void</link> <link linkend="cairo-restore">cairo_restore</link> (<link linkend="cairo-t">cairo_t</link> *cr); @@ -48,6 +48,9 @@ enum <link linkend="cairo-operator-t">cairo_operator_t</link>; <link linkend="double">double</link> y); <link linkend="void">void</link> <link linkend="cairo-set-tolerance">cairo_set_tolerance</link> (<link linkend="cairo-t">cairo_t</link> *cr, <link linkend="double">double</link> tolerance); +enum <link linkend="cairo-antialias-t">cairo_antialias_t</link>; +<link linkend="void">void</link> <link linkend="cairo-set-antialias">cairo_set_antialias</link> (<link linkend="cairo-t">cairo_t</link> *cr, + <link linkend="cairo-antialias-t">cairo_antialias_t</link> antialias); enum <link linkend="cairo-fill-rule-t">cairo_fill_rule_t</link>; <link linkend="void">void</link> <link linkend="cairo-set-fill-rule">cairo_set_fill_rule</link> (<link linkend="cairo-t">cairo_t</link> *cr, <link linkend="cairo-fill-rule-t">cairo_fill_rule_t</link> fill_rule); @@ -212,6 +215,7 @@ enum <link linkend="cairo-font-weight-t">cairo_font_weight_t</link>; <link linkend="cairo-operator-t">cairo_operator_t</link> <link linkend="cairo-get-operator">cairo_get_operator</link> (<link linkend="cairo-t">cairo_t</link> *cr); <link linkend="cairo-pattern-t">cairo_pattern_t</link>* <link linkend="cairo-get-source">cairo_get_source</link> (<link linkend="cairo-t">cairo_t</link> *cr); <link linkend="double">double</link> <link linkend="cairo-get-tolerance">cairo_get_tolerance</link> (<link linkend="cairo-t">cairo_t</link> *cr); +<link linkend="cairo-antialias-t">cairo_antialias_t</link> <link linkend="cairo-get-antialias">cairo_get_antialias</link> (<link linkend="cairo-t">cairo_t</link> *cr); <link linkend="void">void</link> <link linkend="cairo-get-current-point">cairo_get_current_point</link> (<link linkend="cairo-t">cairo_t</link> *cr, <link linkend="double">double</link> *x, <link linkend="double">double</link> *y); @@ -254,6 +258,7 @@ enum <link linkend="cairo-filter-t">cairo_filter_t</link>; <link linkend="cairo-status-t">cairo_status_t</link> (<link linkend="cairo-write-func-t">*cairo_write_func_t</link>) (<link linkend="void">void</link> *closure, unsigned <link linkend="char">char</link> *data, unsigned <link linkend="int">int</link> length); +<link linkend="void">void</link> <link linkend="cairo-debug-reset-static-data">cairo_debug_reset_static_data</link> (void); </synopsis> </refsynopsisdiv> @@ -338,7 +343,7 @@ provide a way to achieve this explicitly). See also the </variablelist></refsect2> <refsect2> <title><anchor id="cairo-reference"/>cairo_reference ()</title> -<indexterm><primary>cairo_reference</primary></indexterm><programlisting><link linkend="void">void</link> cairo_reference (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting> +<indexterm><primary>cairo_reference</primary></indexterm><programlisting><link linkend="cairo-t">cairo_t</link>* cairo_reference (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting> <para> Increases the reference count on <parameter>cr</parameter> by one. This prevents <parameter>cr</parameter> from being destroyed until a matching call to <link linkend="cairo-destroy"><function>cairo_destroy()</function></link> @@ -349,6 +354,8 @@ is made.</para> <varlistentry><term><parameter>cr</parameter> :</term> <listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link> </simpara></listitem></varlistentry> +<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the referenced <link linkend="cairo-t"><type>cairo_t</type></link>. +</simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> <title><anchor id="cairo-destroy"/>cairo_destroy ()</title> @@ -633,6 +640,12 @@ will then be used for any subsequent drawing operation until a new source pattern is set. </para> <para> +Note: The pattern's transformation matrix will be locked to the +user space in effect at the time of <link linkend="cairo-set-source"><function>cairo_set_source()</function></link>. This means +that further modifications of the CTM will not affect the source +pattern. See <link linkend="cairo-pattern-set-matrix"><function>cairo_pattern_set_matrix()</function></link>. +</para> +<para> XXX: I'd also like to direct the reader's attention to some (not-yet-written) section on cairo's imaging model. How would I do that if such a section existed? (cworth).</para> @@ -710,6 +723,68 @@ is unlikely to improve appearance significantly.)</para> </simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> +<title><anchor id="cairo-antialias-t"/>enum cairo_antialias_t</title> +<indexterm><primary>cairo_antialias_t</primary></indexterm><programlisting>typedef enum _cairo_antialias { + CAIRO_ANTIALIAS_DEFAULT, + CAIRO_ANTIALIAS_NONE, + CAIRO_ANTIALIAS_GRAY, + CAIRO_ANTIALIAS_SUBPIXEL +} cairo_antialias_t; +</programlisting> +<para> +Specifies the type of antialiasing to do when rendering text or shapes.</para> +<para> + +</para><variablelist role="enum"> +<varlistentry> +<term><literal>CAIRO_ANTIALIAS_DEFAULT</literal></term> +<listitem><simpara> Use the default antialiasing for + the subsystem and target device +</simpara></listitem> +</varlistentry> +<varlistentry> +<term><literal>CAIRO_ANTIALIAS_NONE</literal></term> +<listitem><simpara> Use a bilevel alpha mask +</simpara></listitem> +</varlistentry> +<varlistentry> +<term><literal>CAIRO_ANTIALIAS_GRAY</literal></term> +<listitem><simpara> Perform single-color antialiasing (using + shades of gray for black text on a white background, for example). +</simpara></listitem> +</varlistentry> +<varlistentry> +<term><literal>CAIRO_ANTIALIAS_SUBPIXEL</literal></term> +<listitem><simpara> Perform antialiasing by taking + advantage of the order of subpixel elements on devices + such as LCD panels +</simpara></listitem> +</varlistentry> +</variablelist></refsect2> +<refsect2> +<title><anchor id="cairo-set-antialias"/>cairo_set_antialias ()</title> +<indexterm><primary>cairo_set_antialias</primary></indexterm><programlisting><link linkend="void">void</link> cairo_set_antialias (<link linkend="cairo-t">cairo_t</link> *cr, + <link linkend="cairo-antialias-t">cairo_antialias_t</link> antialias);</programlisting> +<para> +Set the antialiasing mode of the rasterizer used for drawing shapes. +This value is a hint, and a particular backend may or may not support +a particular value. At the current time, no backend supports +<literal>CAIRO_ANTIALIAS_SUBPIXEL</literal> when drawing shapes. +</para> +<para> +Note that this option does not affect text rendering, instead see +<link linkend="cairo-font-options-set-antialias"><function>cairo_font_options_set_antialias()</function></link>.</para> +<para> + +</para><variablelist role="params"> +<varlistentry><term><parameter>cr</parameter> :</term> +<listitem><simpara> a <link linkend="cairo-t"><type>cairo_t</type></link> +</simpara></listitem></varlistentry> +<varlistentry><term><parameter>antialias</parameter> :</term> +<listitem><simpara> the new antialiasing mode +</simpara></listitem></varlistentry> +</variablelist></refsect2> +<refsect2> <title><anchor id="cairo-fill-rule-t"/>enum cairo_fill_rule_t</title> <indexterm><primary>cairo_fill_rule_t</primary></indexterm><programlisting>typedef enum _cairo_fill_rule { CAIRO_FILL_RULE_WINDING, @@ -1540,8 +1615,9 @@ See <link linkend="cairo-set-line-width"><function>cairo_set_line_width()</funct <indexterm><primary>cairo_fill</primary></indexterm><programlisting><link linkend="void">void</link> cairo_fill (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting> <para> A drawing operator that fills the current path according to the -current fill rule. After cairo_fill, the current path will be -cleared from the cairo context. See <link linkend="cairo-set-fill-rule"><function>cairo_set_fill_rule()</function></link> and +current fill rule, (each sub-path is implicitly closed before being +filled). After cairo_fill, the current path will be cleared from +the cairo context. See <link linkend="cairo-set-fill-rule"><function>cairo_set_fill_rule()</function></link> and <link linkend="cairo-fill-preserve"><function>cairo_fill_preserve()</function></link>.</para> <para> @@ -1555,8 +1631,9 @@ cleared from the cairo context. See <link linkend="cairo-set-fill-rule"><functio <indexterm><primary>cairo_fill_preserve</primary></indexterm><programlisting><link linkend="void">void</link> cairo_fill_preserve (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting> <para> A drawing operator that fills the current path according to the -current fill rule. Unlike <link linkend="cairo-fill"><function>cairo_fill()</function></link>, cairo_fill_preserve -preserves the path within the cairo context. +current fill rule, (each sub-path is implicitly closed before being +filled). Unlike <link linkend="cairo-fill"><function>cairo_fill()</function></link>, cairo_fill_preserve preserves the +path within the cairo context. </para> <para> See <link linkend="cairo-set-fill-rule"><function>cairo_set_fill_rule()</function></link> and <link linkend="cairo-fill"><function>cairo_fill()</function></link>.</para> @@ -1875,7 +1952,7 @@ only for applications with simple font needs: Cairo doesn't provide for operations such as listing all available fonts on the system, and it is expected that most applications will need to use a more comprehensive font handling and text layout library in addition to -Cairo.</para> +cairo.</para> <para> </para><variablelist role="params"> @@ -2227,6 +2304,20 @@ Gets the current tolerance value, as set by <link linkend="cairo-set-tolerance"> </simpara></listitem></varlistentry> </variablelist></refsect2> <refsect2> +<title><anchor id="cairo-get-antialias"/>cairo_get_antialias ()</title> +<indexterm><primary>cairo_get_antialias</primary></indexterm><programlisting><link linkend="cairo-antialias-t">cairo_antialias_t</link> cairo_get_antialias (<link linkend="cairo-t">cairo_t</link> *cr);</programlisting> +<para> +Gets the current shape antialiasing mode, as set by <link linkend="cairo-set-shape-antialias"><function>cairo_set_shape_antialias()</function></link>.</para> +<para> + +</para><variablelist role="params"> +<varlistentry><term><parameter>cr</parameter> :</term> +<listitem><simpara> a cairo context +</simpara></listitem></varlistentry> +<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the current shape antialiasing mode. +</simpara></listitem></varlistentry> +</variablelist></refsect2> +<refsect2> <title><anchor id="cairo-get-current-point"/>cairo_get_current_point ()</title> <indexterm><primary>cairo_get_current_point</primary></indexterm><programlisting><link linkend="void">void</link> cairo_get_current_point (<link linkend="cairo-t">cairo_t</link> *cr, <link linkend="double">double</link> *x, @@ -2894,6 +2985,32 @@ CAIRO_STATUS_WRITE_ERROR otherwise.</para> <varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the status code of the write operation </simpara></listitem></varlistentry> </variablelist></refsect2> +<refsect2> +<title><anchor id="cairo-debug-reset-static-data"/>cairo_debug_reset_static_data ()</title> +<indexterm><primary>cairo_debug_reset_static_data</primary></indexterm><programlisting><link linkend="void">void</link> cairo_debug_reset_static_data (void);</programlisting> +<para> +Resets all static data within cairo to its original state, +(ie. identical to the state at the time of program invocation). For +example, all caches within cairo will be flushed empty. +</para> +<para> +This function is intended to be useful when using memory-checking +tools such as valgrind. When valgrind's memcheck analyzes a +cairo-using program without a call to cairo_debug_reset_static_data, +it will report all data reachable via cairo's static objects as +"still reachable". Calling cairo_debug_reset_static_data just prior +to program termination will make it easier to get squeaky clean +reports from valgrind. +</para> +<para> +WARNING: It is only safe to call this function when there are no +active cairo objects remaining, (ie. the appropriate destroy +functions have been called as necessary). If there are active cairo +objects, this call is likely to cause a crash, (eg. an assertion +failure due to a hash table being destroyed when non-empty).</para> +<para> + +</para></refsect2> </refsect1> diff --git a/pixman/AUTHORS b/pixman/AUTHORS new file mode 100644 index 0000000..d858e59 --- /dev/null +++ b/pixman/AUTHORS @@ -0,0 +1,19 @@ +David R Bacon <dbacon@cis.ksu.edu> Fixes to compile on x86_64. +Billy Biggs <vektor@dumbterm.net> Fix to use stdint datatypes. +Dave Beckett <Dave.Beckett@bristol.ac.uk> Combined libpixregion, libic, and slim. +Jakub Bogusz <qboosh@pld-linux.org> Fixes for 64-bit machines. +Anders Carlsson <andersca@gnome.org> Build fixes. New accessor functions. +Richard Henderson <rth@twiddle.net> "slim" macros for better shared libraries +Owen Taylor <otaylor@redhat.com> Support for both transform and repeat +Keith Packard <keithp@keithp.com> The original implementation of the compositing code. +David Reveman <c99drn@cs.umu.se> Byte-order, clipping and format fixes. +Vladimir Vukicevic <vladimir@pobox.com> Bug fix. +Bryan Worth <bryan@theworths.org> Cleanups to not depend on X header files. +Carl Worth <carl@theworths.org> General maintenance. Original port from X server code. +Richard Worth <richard@theworths.org> Build fixes for cygwin. + +and the "X Window System authors" (pixregion code) + +(Please let us know if we have missed anyone. I would be interested in +having more precise attribution for the pixregion code if anyone knows +who wrote that.) diff --git a/pixman/COPYING b/pixman/COPYING new file mode 100644 index 0000000..5d8dca6 --- /dev/null +++ b/pixman/COPYING @@ -0,0 +1,92 @@ +libpixregion + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +---------------------------------------------------------------------- +libic + +Copyright 2001 Keith Packard + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation, and that the name of Keith Packard not be used in +advertising or publicity pertaining to distribution of the software without +specific, written prior permission. Keith Packard makes no +representations about the suitability of this software for any purpose. It +is provided "as is" without express or implied warranty. + +KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +---------------------------------------------------------------------- +slim + +slim is Copyright 2003 Richard Henderson + +Permission to use, copy, modify, distribute, and sell this software +and its documentation for any purpose is hereby granted without fee, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Richard Henderson not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. Richard Henderson +makes no representations about the suitability of this software for +any purpose. It is provided "as is" without express or implied +warranty. + +RICHARD HENDERSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL RICHARD HENDERSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/pixman/ChangeLog b/pixman/ChangeLog new file mode 100644 index 0000000..6817dc8 --- /dev/null +++ b/pixman/ChangeLog @@ -0,0 +1,1294 @@ +2005-08-12 Billy Biggs <vektor@dumbterm.net> + + * src/icrect.c: (pixman_fill_rect_1bpp): Fix to be correct for + arbitrary xDst values. + +2005-08-11 Billy Biggs <vektor@dumbterm.net> + + * src/icrect.c: (pixman_fill_rect_1bpp), (pixman_color_rects): + Add support for filling 1bpp images (used to clear A1 masks). + +2005-08-10 Billy Biggs <vektor@dumbterm.net> + + reviewed by: cworth and Jeff Muizelaar at various stages + + * src/fbcompose.c: (PictureTransformPoint3d), (fbFetch_a8r8g8b8), + (fbFetch_x8r8g8b8), (fbFetch_a8b8g8r8), (fbFetch_x8b8g8r8), + (fbFetch_r8g8b8), (fbFetch_b8g8r8), (fbFetch_r5g6b5), + (fbFetch_b5g6r5), (fbFetch_a1r5g5b5), (fbFetch_x1r5g5b5), + (fbFetch_a1b5g5r5), (fbFetch_x1b5g5r5), (fbFetch_a4r4g4b4), + (fbFetch_x4r4g4b4), (fbFetch_a4b4g4r4), (fbFetch_x4b4g4r4), + (fbFetch_a8), (fbFetch_r3g3b2), (fbFetch_b2g3r3), + (fbFetch_a2r2g2b2), (fbFetch_a2b2g2r2), (fbFetch_c8), (fbFetch_a4), + (fbFetch_r1g2b1), (fbFetch_b1g2r1), (fbFetch_a1r1g1b1), + (fbFetch_a1b1g1r1), (fbFetch_c4), (fbFetch_a1), (fbFetch_g1), + (fetchProcForPicture), (fbFetchPixel_a8r8g8b8), + (fbFetchPixel_x8r8g8b8), (fbFetchPixel_a8b8g8r8), + (fbFetchPixel_x8b8g8r8), (fbFetchPixel_r8g8b8), + (fbFetchPixel_b8g8r8), (fbFetchPixel_r5g6b5), + (fbFetchPixel_b5g6r5), (fbFetchPixel_a1r5g5b5), + (fbFetchPixel_x1r5g5b5), (fbFetchPixel_a1b5g5r5), + (fbFetchPixel_x1b5g5r5), (fbFetchPixel_a4r4g4b4), + (fbFetchPixel_x4r4g4b4), (fbFetchPixel_a4b4g4r4), + (fbFetchPixel_x4b4g4r4), (fbFetchPixel_a8), (fbFetchPixel_r3g3b2), + (fbFetchPixel_b2g3r3), (fbFetchPixel_a2r2g2b2), + (fbFetchPixel_a2b2g2r2), (fbFetchPixel_c8), (fbFetchPixel_a4), + (fbFetchPixel_r1g2b1), (fbFetchPixel_b1g2r1), + (fbFetchPixel_a1r1g1b1), (fbFetchPixel_a1b1g1r1), + (fbFetchPixel_c4), (fbFetchPixel_a1), (fbFetchPixel_g1), + (fetchPixelProcForPicture), (fbStore_a8r8g8b8), (fbStore_x8r8g8b8), + (fbStore_a8b8g8r8), (fbStore_x8b8g8r8), (fbStore_r8g8b8), + (fbStore_b8g8r8), (fbStore_r5g6b5), (fbStore_b5g6r5), + (fbStore_a1r5g5b5), (fbStore_x1r5g5b5), (fbStore_a1b5g5r5), + (fbStore_x1b5g5r5), (fbStore_a4r4g4b4), (fbStore_x4r4g4b4), + (fbStore_a4b4g4r4), (fbStore_x4b4g4r4), (fbStore_a8), + (fbStore_r3g3b2), (fbStore_b2g3r3), (fbStore_a2r2g2b2), + (fbStore_c8), (fbStore_a4), (fbStore_r1g2b1), (fbStore_b1g2r1), + (fbStore_a1r1g1b1), (fbStore_a1b1g1r1), (fbStore_c4), (fbStore_a1), + (fbStore_g1), (storeProcForPicture), (fbCombineMaskU), + (fbCombineClear), (fbCombineSrcU), (fbCombineOverU), + (fbCombineOverReverseU), (fbCombineInU), (fbCombineInReverseU), + (fbCombineOutU), (fbCombineOutReverseU), (fbCombineAtopU), + (fbCombineAtopReverseU), (fbCombineXorU), (fbCombineAddU), + (fbCombineSaturateU), (fbCombineDisjointOutPart), + (fbCombineDisjointInPart), (fbCombineDisjointGeneralU), + (fbCombineDisjointOverU), (fbCombineDisjointInU), + (fbCombineDisjointInReverseU), (fbCombineDisjointOutU), + (fbCombineDisjointOutReverseU), (fbCombineDisjointAtopU), + (fbCombineDisjointAtopReverseU), (fbCombineDisjointXorU), + (fbCombineConjointOutPart), (fbCombineConjointInPart), + (fbCombineConjointGeneralU), (fbCombineConjointOverU), + (fbCombineConjointOverReverseU), (fbCombineConjointInU), + (fbCombineConjointInReverseU), (fbCombineConjointOutU), + (fbCombineConjointOutReverseU), (fbCombineConjointAtopU), + (fbCombineConjointAtopReverseU), (fbCombineConjointXorU), + (fbCombineMaskC), (fbCombineMaskValueC), (fbCombineMaskAlphaC), + (fbCombineClearC), (fbCombineSrcC), (fbCombineOverC), + (fbCombineOverReverseC), (fbCombineInC), (fbCombineInReverseC), + (fbCombineOutC), (fbCombineOutReverseC), (fbCombineAtopC), + (fbCombineAtopReverseC), (fbCombineXorC), (fbCombineAddC), + (fbCombineSaturateC), (fbCombineDisjointGeneralC), + (fbCombineDisjointOverC), (fbCombineDisjointInC), + (fbCombineDisjointInReverseC), (fbCombineDisjointOutC), + (fbCombineDisjointOutReverseC), (fbCombineDisjointAtopC), + (fbCombineDisjointAtopReverseC), (fbCombineDisjointXorC), + (fbCombineConjointGeneralC), (fbCombineConjointOverC), + (fbCombineConjointOverReverseC), (fbCombineConjointInC), + (fbCombineConjointInReverseC), (fbCombineConjointOutC), + (fbCombineConjointOutReverseC), (fbCombineConjointAtopC), + (fbCombineConjointAtopReverseC), (fbCombineConjointXorC), + (fbFetchSolid), (fbFetch), (gradientPixel), (fbFetchSourcePict), + (fbFetchTransformed), (fbFetchExternalAlpha), (fbStore), + (fbStoreExternalAlpha), (fbCompositeRect), + (pixman_compositeGeneral): Port fbcompose.c from xserver into + pixman. Add #defines for gradients, convolution filters, and + indexed colour formats to keep the patch small. Use pixman + regions instead of X server regions as appropriate. + + * src/iccompose.c: Remove iccompose.c, replaced by fbcompose.c. + + * src/fbpict.h: Add a slightly-trimmed version of fbpict.h from + xserver/fb to make the port smaller and cleaner. + * src/ic.c: Use the redundant fbpict.h defines and add in the + struct for indexed colour support. + * src/icimage.h: Remove defines now in fbpict.h. + * src/pixman-xserver-compat.h: Add some constants and types + required by fbcompose.c + + * src/Makefile.am: Add fbcompose.c and fbpict.h, remove iccompose.c. + +2005-08-10 Keith Packard <keithp@keithp.com> + + * src/pixregion.c: (pixman_region_union_rect): + Union with empty rectangle should yield SUCCESS, not FAILURE + +2005-08-06 Jeff Muizelaar <jeff@infidigm.net> + + * src/iccompose.c: (fbCombineMaskAlphaC), (fbCombineAtopC), + (fbCombineXorC), (fbCombineSaturateU), (fbCombineSaturateC), + (fbCombineDisjointGeneralC), (fbCombineConjointGeneralC): + Fix problems in render fb implementation found by rendercheck: + - fbCombineSaturate was pointed at fbCombineDisjointOver, instead of + fbCombineDisjointOverReverse as it should. Instead, point + fbCombineDisjointOverReverse at fbCombineSaturate (which is likely + to be faster). + - fix previously-unused fbCombineSaturate implementation. + - fbCombineMaskAlphaC was just a copy of fbCombineMaskValueC. Make + it do what it's supposed to (return a cs.alpha). + - fbCombineAtopC didn't invert the source alpha value. + - fix copy'n'paste errors in fbCombine(Dis/Con)jointGeneralC, also + source alpha wasn't treated in a component fashion. + + From anholt. + + +2005-08-06 Jeff Muizelaar <jeff@infidigm.net> + + * src/iccompose.c: (fbFetch_r8g8b8): + Temporarily disable the 24bpp WORKING_UNALIGNED_INT because of a crash + when using electric-fence when accessing hte last pixel of a drawable + (last pixel is 3 bytes, read it as a 4 byte word, and you're reading one + extra pixel, which doesn't normally matter, but does in a few rare cases). + Should be easy to work around, but that will come later. + + From jaymz + +2005-08-05 Jeff Muizelaar <jeff@infidigm.net> + + * src/pixman-xserver-compat.h: Fix fbGetDrawable + + Patch from Billy Biggs <vektor@dumbterm.net>. + +2005-08-05 Jeff Muizelaar <jeff@infidigm.net> + + * src/icint.h: Fix some of the 4 bit per channel PICT definitions + + Patch from Billy Biggs <vektor@dumbterm.net>. + +2005-08-05 Jeff Muizelaar <jeff@infidigm.net> + + * src/ic.c: (fbCompositeSolidMask_nx8x8888), + (fbCompositeSolidMask_nx8x0888), (fbCompositeSolidMask_nx8x0565), + (fbCompositeSolidMask_nx8888x0565), + (fbCompositeSolidMask_nx8888x0565C), (fbCompositeSrc_8888x0565), + (fbCompositeTrans_0565xnx0565), (fbCompositeTrans_0888xnx0888), + (fbCompositeSrcSrc_nxn), (pixman_composite): + Fix up the fast-path compositing operators; those are useful + for sources without alpha, but can't be used for sources with + alpha. Also, replaced fbCompositeSrcSrc_nxn with call to + fbBlt as this function must handle 1, 4, 8, 16, 24, 32 bpp + objects. Would be nice to optimize fbBlt for common cases + involving 8, 16, 24 and 32bpp. + + From Keith Packard. + +2005-08-01 Billy Biggs <vektor@dumbterm.net> + + * src/fbedge.c: (clip255), (add_saturate_8), + (fbRasterizeEdges8): Optimize spans where the same value is + being added to multiple pixels. This improves the speed of + rasterizing wide trapezoids. + + * src/icint.h: Add an INLINE macro that matches the one from + fbpict.h in xserver/fb. + +2005-08-01 Amaury Jacquot <sxpert@esitcom.org> + + * NEWS: fix typo + +2005-07-30 Jeff Muizelaar <jeff@infidigm.net> + + * src/ic.c: (fbCompositeSolidMask_nx8x0888), + (fbCompositeSolidMask_nx8x0565), (fbCompositeSolidMask_nx1xn), + (fbCompositeTrans_0565xnx0565), (fbCompositeTrans_0888xnx0888), + (fbCompositeSrcSrc_nxn), (pixman_composite): + * src/icblt.c: (fbBlt): + * src/iccompose.c: (fbFetch_r8g8b8): + Finish up merging the optimization work from jaymz. + +2005-07-30 Jeff Muizelaar <jeff@infidigm.net> + + * src/iccompose.c: (fbCombineMaskAlphaU), + (fbCombineDisjointOutPart), (fbCombineDisjointInPart), + (fbCombineConjointOutPart), (fbCombineConjointInPart), + (fbStore_a8r8g8b8), (fbStore_x8r8g8b8), (fbStore_a8b8g8r8), + (fbStore_x8b8g8r8), (fbStore_r8g8b8), (fbStore_b8g8r8), + (fbStore_r5g6b5), (fbStore_b5g6r5), (fbStore_a1r5g5b5), + (fbStore_x1r5g5b5), (fbStore_a1b5g5r5), (fbStore_x1b5g5r5), + (fbStore_a4r4g4b4), (fbStore_x4r4g4b4), (fbStore_a4b4g4r4), + (fbStore_x4b4g4r4), (fbStore_a8), (fbStore_r3g3b2), + (fbStore_b2g3r3), (fbStore_a2r2g2b2), (fbStore_a4), + (fbStore_r1g2b1), (fbStore_b1g2r1), (fbStore_a1r1g1b1), + (fbStore_a1b1g1r1), (fbStore_a1), (fbFetch_external), + (fbStore_external), (fbFetch_transform), (fbFetcha_transform): + s/uint(8|16|32)_t/CARD(8|16|32)/ + +2005-07-30 Jeff Muizelaar <jeff@infidigm.net> + + * src/ic.c: (fbCompositeSolidMask_nx8x0888), + (fbCompositeSolidMask_nx8x0565), (fbCompositeTrans_0565xnx0565), + (fbCompositeTrans_0888xnx0888), (fbCompositeSrcSrc_nxn), + (pixman_composite): + Add some optimizations from jaymz. Also adds some compile warnings + that will hopefully go away as we continue merging. + +2005-07-28 Carl Worth <cworth@cworth.org> + + * configure.in: Add -head to LIBPIXMAN_VERSION after tagging with + SNAPSHOT_0_1_6. + +2005-07-28 Carl Worth <cworth@cworth.org> + + * NEWS: Add notes for snapshot 0.1.6. + + * configure.in: Increment version to 0.1.6. + +2005-07-27 Owen Taylor <otaylor@redhat.com> + + * src/icint.h (FbGetStipPixels): Fix units for stride return + to be FbStip-sized. + +2005-07-16 Jeff Muizelaar <jeff@infidigm.net> + + * src/ic.c: (pixman_composite): + Add call to fbCompositeSrcSrc_nxn that I missed. + +2005-07-14 Carl Worth <cworth@cworth.org> + + * src/icimage.c: (pixman_image_set_component_alpha): Whitespace fix. + (pixman_image_destroy): Fix leak of the clip region associated + with an image. (NOTE: xserver/render doesn't have the same bug + since it has FreePicture that calls into both DestroyPicture and + DestroyPictureClip separately). + +2005-07-09 Jeff Muizelaar <jeff@infidigm.net> + + * src/ic.c: (fbIn24), (fbCompositeTrans_0565xnx0565), + (fbCompositeSrcSrc_nxn), (pixman_composite): + Begin merging in newer fb code. + + The code comes from keithp: + Initial import of Composite extension along with + name change from Apportion. + Added some accelerated code to fbpict to make this initial + hack a bit faster. "real" extension bits to follow. + +2005-07-09 Jeff Muizelaar <jeff@infidigm.net> + + * src/ic.c: (fbCompositeSolidMask_nx8x8888), + (fbCompositeSolidMask_nx8888x8888C), + (fbCompositeSolidMask_nx8x0888), (fbCompositeSolidMask_nx8x0565), + (fbCompositeSolidMask_nx8888x0565C), (fbCompositeSrc_8888x8888), + (fbCompositeSrc_8888x0888), (fbCompositeSrc_8888x0565), + (fbCompositeSrc_0565x0565), (fbCompositeSrcAdd_8000x8000), + (fbCompositeSrcAdd_8888x8888), (fbCompositeSrcAdd_1000x1000), + (fbCompositeSolidMask_nx1xn), (pixman_composite): + More misc merging. Mostly s/pixman_composite/fbComposite/. + +2005-07-09 Jeff Muizelaar <jeff@infidigm.net> + + * src/ic.c: (fbOver), (fbOver24), (fbIn), + (pixman_compositeSolidMask_nx8x8888), + (pixman_compositeSolidMask_nx8888x8888C), + (pixman_compositeSolidMask_nx8x0888), + (pixman_compositeSolidMask_nx8x0565), + (pixman_compositeSolidMask_nx8888x0565C), + (pixman_compositeSrc_8888x8888), (pixman_compositeSrc_8888x0888), + (pixman_compositeSrc_8888x0565), (pixman_compositeSrc_0565x0565), + (pixman_compositeSrcAdd_8000x8000), + (pixman_compositeSrcAdd_8888x8888), + (pixman_compositeSrcAdd_1000x1000), + (pixman_compositeSolidMask_nx1xn), (pixman_composite): + More misc merging. Mostly stuff like s/uint32_t/CARD32/. + +2005-06-25 Jeff Muizelaar <jeff@infidigm.net> + + * src/ic.c: (fbOver): + * src/icblt.c: (fbBlt), (fbBlt24Line), (fbBlt24), (fbBltOdd), + (fbBltOdd24), (fbBltStip): + * src/icbltone.c: (fbBltOne): + * src/iccompose.c: (fbCombineMaskU), (fbCombineMaskC), + (fbCombineMaskValueC), (fbCombineMaskAlphaC), (fbCombineOverU), + (fbCombineOverC), (fbCombineOverReverseU), (fbCombineOverReverseC), + (fbCombineInU), (fbCombineInC), (fbCombineInReverseU), + (fbCombineInReverseC), (fbCombineOutU), (fbCombineOutC), + (fbCombineOutReverseU), (fbCombineOutReverseC), (fbCombineAtopU), + (fbCombineAtopC), (fbCombineAtopReverseU), (fbCombineAtopReverseC), + (fbCombineXorU), (fbCombineXorC), (fbCombineAddU), (fbCombineAddC), + (fbCombineDisjointGeneralU), (fbCombineDisjointGeneralC), + (fbCombineDisjointOverU), (fbCombineConjointGeneralU), + (fbCombineConjointGeneralC), (fbCombineConjointOverU), + (fbFetch_a8r8g8b8), (fbFetch_x8r8g8b8), (fbFetch_a8b8g8r8), + (fbFetch_x8b8g8r8), (fbFetch_r8g8b8), (fbFetch_b8g8r8), + (fbFetch_r5g6b5), (fbFetch_b5g6r5), (fbFetch_a1r5g5b5), + (fbFetch_x1r5g5b5), (fbFetch_a1b5g5r5), (fbFetch_x1b5g5r5), + (fbFetch_a4r4g4b4), (fbFetch_x4r4g4b4), (fbFetch_a4b4g4r4), + (fbFetch_x4b4g4r4), (fbFetch_a8), (fbFetcha_a8), (fbFetch_r3g3b2), + (fbFetch_b2g3r3), (fbFetch_a2r2g2b2), (fbFetch_a4), (fbFetcha_a4), + (fbFetch_r1g2b1), (fbFetch_b1g2r1), (fbFetch_a1r1g1b1), + (fbFetch_a1b1g1r1), (fbFetcha_a1), (fbFetch_a1), + (fbBuildCompositeOperand), (pixman_compositeGeneral): + * src/icint.h: + * src/icrop.h: + * src/icutil.c: + * src/pixman-xserver-compat.h: + + Merge over most of the low-hanging renames from xserver/fb. + +2005-06-25 Jeff Muizelaar <jeff@infidigm.net> + + * src/icint.h: + Fix broken build on older gcc's caused by overzealous s/IC_/FB_/g + +2005-06-24 Jeff Muizelaar <jeff@infidigm.net> + + * src/ic.c: + * src/icblt.c: + * src/icbltone.c: + * src/iccolor.c: + * src/iccompose.c: + * src/icformat.c: + * src/icimage.c: + * src/icimage.h: + * src/icint.h: + * src/icpixels.c: + * src/icrect.c: + * src/icrop.h: + * src/icstipple.c: + * src/ictrap.c: + * src/ictri.c: + * src/icutil.c: + * src/pixman-xserver-compat.h: + + s/Ic/Fb/g + This gets read of most of the [Ii][cC]'s the rest will probably dealt + with on a case by case basis. + + trimmed function list again. + +2005-06-24 Jeff Muizelaar <jeff@infidigm.net> + + * src/ic.c: + * src/icblt.c: + * src/icbltone.c: + * src/iccompose.c: + * src/icimage.h: + * src/icint.h: + * src/icrop.h: + * src/icstipple.c: + * src/icutil.c: + + selective s/Ic/fb/g. + + I took out the list of functions because it was ridiculously long. + +2005-06-24 Jeff Muizelaar <jeff@infidigm.net> + + * src/ic.c: (pixman_compositeSrcAdd_1000x1000), + (pixman_compositeSolidMask_nx1xn): + * src/icblt.c: (IcBlt), (IcBlt24Line), (IcBltOdd), (IcSetBltOdd), + (IcBltStip): + * src/icbltone.c: (IcBltOne), (IcBltOne24): + * src/icint.h: + * src/icpixels.c: (IcPixelsCreate): + * src/icrop.h: + * src/icstipple.c: (IcTransparentSpan): + * src/icutil.c: (IcReplicatePixel): + * src/pixman-xserver-compat.h: + s/IC_/FB_/g + + * src/pixman.h: + add #define FB_BITS IC_BITS so that FB_BITS get defined early enough + +2005-06-23 Jeff Muizelaar <jeff@infidigm.net> + + * src/iccompose.c: (fbCombineClear), (fbCombineSrcU), + (fbCombineSrcC), (fbCombineDst), (fbCombineOverU), + (fbCombineOverC), (fbCombineOverReverseU), (fbCombineOverReverseC), + (fbCombineInU), (fbCombineInC), (fbCombineInReverseU), + (fbCombineInReverseC), (fbCombineOutU), (fbCombineOutC), + (fbCombineOutReverseU), (fbCombineOutReverseC), (fbCombineAtopU), + (fbCombineAtopC), (fbCombineAtopReverseU), (fbCombineAtopReverseC), + (fbCombineXorU), (fbCombineXorC), (fbCombineAddU), (fbCombineAddC), + (fbCombineDisjointOverU), (fbCombineDisjointOverC), + (fbCombineDisjointOverReverseU), (fbCombineDisjointOverReverseC), + (fbCombineDisjointInU), (fbCombineDisjointInC), + (fbCombineDisjointInReverseU), (fbCombineDisjointInReverseC), + (fbCombineDisjointOutU), (fbCombineDisjointOutC), + (fbCombineDisjointOutReverseU), (fbCombineDisjointOutReverseC), + (fbCombineDisjointAtopU), (fbCombineDisjointAtopC), + (fbCombineDisjointAtopReverseU), (fbCombineDisjointAtopReverseC), + (fbCombineDisjointXorU), (fbCombineDisjointXorC), + (fbCombineConjointOverU), (fbCombineConjointOverC), + (fbCombineConjointOverReverseU), (fbCombineConjointOverReverseC), + (fbCombineConjointInU), (fbCombineConjointInC), + (fbCombineConjointInReverseU), (fbCombineConjointInReverseC), + (fbCombineConjointOutU), (fbCombineConjointOutC), + (fbCombineConjointOutReverseU), (fbCombineConjointOutReverseC), + (fbCombineConjointAtopU), (fbCombineConjointAtopC), + (fbCombineConjointAtopReverseU), (fbCombineConjointAtopReverseC), + (fbCombineConjointXorU), (fbCombineConjointXorC): + + s/IcCombine/fbCombine/ + +2005-06-23 Jeff Muizelaar <jeff@infidigm.net> + + * src/iccompose.c: (IcCombineMaskU), (IcCombineMaskC), + (IcCombineMaskValueC), (IcCombineMaskAlphaU), + (IcCombineMaskAlphaC), (IcCombineClear), (IcCombineSrcU), + (IcCombineSrcC), (IcCombineDst), (IcCombineOverU), + (IcCombineOverC), (IcCombineOverReverseU), (IcCombineOverReverseC), + (IcCombineInU), (IcCombineInC), (IcCombineInReverseU), + (IcCombineInReverseC), (IcCombineOutU), (IcCombineOutC), + (IcCombineOutReverseU), (IcCombineOutReverseC), (IcCombineAtopU), + (IcCombineAtopC), (IcCombineAtopReverseU), (IcCombineAtopReverseC), + (IcCombineXorU), (IcCombineXorC), (IcCombineAddU), (IcCombineAddC), + (IcCombineDisjointGeneralU), (IcCombineDisjointGeneralC), + (IcCombineDisjointOverU), (IcCombineDisjointOverC), + (IcCombineDisjointOverReverseU), (IcCombineDisjointOverReverseC), + (IcCombineDisjointInU), (IcCombineDisjointInC), + (IcCombineDisjointInReverseU), (IcCombineDisjointInReverseC), + (IcCombineDisjointOutU), (IcCombineDisjointOutC), + (IcCombineDisjointOutReverseU), (IcCombineDisjointOutReverseC), + (IcCombineDisjointAtopU), (IcCombineDisjointAtopC), + (IcCombineDisjointAtopReverseU), (IcCombineDisjointAtopReverseC), + (IcCombineDisjointXorU), (IcCombineDisjointXorC), + (IcCombineConjointGeneralU), (IcCombineConjointGeneralC), + (IcCombineConjointOverU), (IcCombineConjointOverC), + (IcCombineConjointOverReverseU), (IcCombineConjointOverReverseC), + (IcCombineConjointInU), (IcCombineConjointInC), + (IcCombineConjointInReverseU), (IcCombineConjointInReverseC), + (IcCombineConjointOutU), (IcCombineConjointOutC), + (IcCombineConjointOutReverseU), (IcCombineConjointOutReverseC), + (IcCombineConjointAtopU), (IcCombineConjointAtopC), + (IcCombineConjointAtopReverseU), (IcCombineConjointAtopReverseC), + (IcCombineConjointXorU), (IcCombineConjointXorC), + (IcFetch_a8r8g8b8), (IcFetch_x8r8g8b8), (IcFetch_a8b8g8r8), + (IcFetch_x8b8g8r8), (IcFetch_r8g8b8), (IcFetch_b8g8r8), + (IcFetch_r5g6b5), (IcFetch_b5g6r5), (IcFetch_a1r5g5b5), + (IcFetch_x1r5g5b5), (IcFetch_a1b5g5r5), (IcFetch_x1b5g5r5), + (IcFetch_a4r4g4b4), (IcFetch_x4r4g4b4), (IcFetch_a4b4g4r4), + (IcFetch_x4b4g4r4), (IcFetch_a8), (IcFetcha_a8), (IcFetch_r3g3b2), + (IcFetch_b2g3r3), (IcFetch_a2r2g2b2), (IcFetch_a4), (IcFetcha_a4), + (IcFetch_r1g2b1), (IcFetch_b1g2r1), (IcFetch_a1r1g1b1), + (IcFetch_a1b1g1r1), (IcFetcha_a1), (IcFetch_a1), + (IcStore_a8r8g8b8), (IcStore_x8r8g8b8), (IcStore_a8b8g8r8), + (IcStore_x8b8g8r8), (IcStore_r8g8b8), (IcStore_b8g8r8), + (IcStore_r5g6b5), (IcStore_b5g6r5), (IcStore_a1r5g5b5), + (IcStore_x1r5g5b5), (IcStore_a1b5g5r5), (IcStore_x1b5g5r5), + (IcStore_a4r4g4b4), (IcStore_x4r4g4b4), (IcStore_a4b4g4r4), + (IcStore_x4b4g4r4), (IcStore_a8), (IcStore_r3g3b2), + (IcStore_b2g3r3), (IcStore_a2r2g2b2), (IcStore_a4), + (IcStore_r1g2b1), (IcStore_b1g2r1), (IcStore_a1r1g1b1), + (IcStore_a1b1g1r1), (IcStore_a1), (IcFetch_external), + (IcFetcha_external), (IcStore_external), (IcFetch_transform), + (IcFetcha_transform), (IcStepOver), (IcStepDown), (IcSet), + (IcStepOver_external), (IcStepDown_external), (IcSet_external), + (IcStepOver_transform), (IcStepDown_transform), (IcSet_transform), + (IcBuildCompositeOperand), (pixman_compositeGeneral): + * src/icimage.h: + + s/pixman_compositeOperand/FbCompositeOperand/g. + +2005-06-23 Jeff Muizelaar <jeff@infidigm.net> + + * src/ic.c: (pixman_compositeSrcAdd_1000x1000), + (pixman_compositeSolidMask_nx1xn): + * src/icblt.c: (IcBlt), (IcBlt24Line), (IcBlt24), (IcBltOdd), + (IcBltOdd24), (IcSetBltOdd), (IcBltStip): + * src/icbltone.c: (IcBltOne), (IcBltOne24): + * src/iccompose.c: (IcFetch_a8r8g8b8), (IcFetch_x8r8g8b8), + (IcFetch_a8b8g8r8), (IcFetch_x8b8g8r8), (IcFetch_r8g8b8), + (IcFetch_b8g8r8), (IcFetch_r5g6b5), (IcFetch_b5g6r5), + (IcFetch_a1r5g5b5), (IcFetch_x1r5g5b5), (IcFetch_a1b5g5r5), + (IcFetch_x1b5g5r5), (IcFetch_a4r4g4b4), (IcFetch_x4r4g4b4), + (IcFetch_a4b4g4r4), (IcFetch_x4b4g4r4), (IcFetch_a8), + (IcFetcha_a8), (IcFetch_r3g3b2), (IcFetch_b2g3r3), + (IcFetch_a2r2g2b2), (IcFetch_a4), (IcFetcha_a4), (IcFetch_r1g2b1), + (IcFetch_b1g2r1), (IcFetch_a1r1g1b1), (IcFetch_a1b1g1r1), + (IcFetcha_a1), (IcFetch_a1), (IcStore_a8r8g8b8), + (IcStore_x8r8g8b8), (IcStore_a8b8g8r8), (IcStore_x8b8g8r8), + (IcStore_r8g8b8), (IcStore_b8g8r8), (IcStore_r5g6b5), + (IcStore_b5g6r5), (IcStore_a1r5g5b5), (IcStore_x1r5g5b5), + (IcStore_a1b5g5r5), (IcStore_x1b5g5r5), (IcStore_a4r4g4b4), + (IcStore_x4r4g4b4), (IcStore_a4b4g4r4), (IcStore_x4b4g4r4), + (IcStore_a8), (IcStore_r3g3b2), (IcStore_b2g3r3), + (IcStore_a2r2g2b2), (IcStore_a4), (IcStore_r1g2b1), + (IcStore_b1g2r1), (IcStore_a1r1g1b1), (IcStore_a1b1g1r1), + (IcStore_a1), (IcBuildCompositeOperand): + * src/icimage.c: (pixman_image_create_for_data): + * src/icstipple.c: (IcTransparentSpan): + + s/pixman_bits_t/FbBits/s + +2005-06-23 Jeff Muizelaar <jeff@infidigm.net> + + * src/ic.c: (pixman_compositeSrcAdd_8000x8000), + (pixman_compositeSrcAdd_8888x8888): + more merging: + + 630. Fix incorrect datatype for the pixmap width in + fbCompositeSrcAdd_8000x8000(), and add some small optimisations + (#A.1423, Keith Packard). + +2005-06-23 Jeff Muizelaar <jeff@infidigm.net> + + * src/icint.h: + * src/icblt.c: (IcBlt): + Start the xserver/fb -> libpixman merging with a copy + optimization. + +2005-05-26 Keith Packard <keithp@keithp.com> + + * src/iccompose.c: (IcFetch_transform), (IcFetcha_transform), + (IcBuildCompositeOperand): + * src/icimage.c: (pixman_image_init), (pixman_image_destroy), + (pixman_image_set_clip_region), (IcClipImageSrc): + * src/icimage.h: + + Split clipping into separate source and destination operand + clips. By default, source operands are not affected by + any client clipping. This matches the desired semantics + for cairo. When this code is ported back to the X server, + that will have to select the clipping option which clip + source operands to the client clip. + +2005-05-18 Carl Worth <cworth@cworth.org> + + * configure.in: Add -head to CAIRO_VERSION after tagging with + SNAPSHOT_0_1_5. + +2005-05-18 Carl Worth <cworth@cworth.org> + + * NEWS: Add notes for snapshot 0.1.5. + + * configure.in: Increment version to 0.1.5. + +2005-05-18 Carl Worth <cworth@cworth.org> + + * src/icimage.c (pixman_image_destroy): Clear pointers to NULL + after destroying/freeing them. + +2005-05-18 Carl Worth <cworth@cworth.org> + + * src/pixman.h: Declare pixman_fixed16_16_t properly as int32_t + rather than just int. Reported by Lance Fetters. + +2005-05-12 Keith Packard <keithp@keithp.com> + + reviewed by: cworth + + * src/ictrap.c: (pixman_composite_trapezoids): + libpixman creates an A8 format object and sometimes forgets to + destroy (when the bounds of the trapezoids are empty). + Avoids creating the format object in that case. + +2005-04-27 Owen Taylor <otaylor@redhat.com> + + * src/icimage.c (pixman_image_set_clip_region): Set + image->pCompositeClip here. + (IcComputeCompositeRegion) src/icrect.c (pixman_color_rects): + Remove workaround clipping to the clientClip. + +2005-04-27 Owen Taylor <otaylor@redhat.com> + + * src/ic.c: Don't use pixman_compositeSrc_8888x8888 when + the source is x8r8g8b8 or x8b8g8r8. + +2005-03-29 T Rowley <tim.rowley@gmail.com> + + * src/pixman.h: add AIX to the test for inttypes.h + +2005-03-11 Owen Taylor <otaylor@redhat.com> + + * src/icformat.c (pixman_format_init): Set format->depth + correctly instead of just using the bpp. + +2005-03-07 Carl Worth <cworth@cworth.org> + + * configure.in: Increment version to 0.1.4-head post-snapshot. + + * RELEASING: Add notes on using -head suffix for PIXMAN_VERSION. + + * NEWS: Add notes for snapshot 0.1.4. + + * configure.in: Increment version to 0.1.4. + +2005-03-04 Carl Worth <cworth@cworth.org> + + * src/ictrap.c (pixman_composite_trapezoids): Intersect bounds of + trapezoids with the bounds of the destination surface before + creating an intermediate surface. + +2005-03-04 Carl Worth <cworth@cworth.org> + + * src/ictrap.c (pixman_composite_trapezoids): Add comment from + xserver's mitrap.c. + +2005-03-04 David Reveman <davidr@novell.com> + + * src/pixman.h: + * src/ictrap.c: Add pixman_add_trapezoids. + +2005-03-03 Carl Worth <cworth@cworth.org> + + * src/icimage.c (miIsSolidAlpha): Port from render/mipict.c. + + * src/ictrap.c (pixman_composite_trapezoids): Merge in + optimization from render/mitrap.c for op==ADD and solid alpha src. + +2005-03-03 Carl Worth <cworth@cworth.org> + + * src/pixman-xserver-compat.h (BoxRec, BoxPtr, Bool, TRUE, FALSE): + Add a few more things that might be helpful when moving more files + over from xserver. + +2005-03-03 Carl Worth <cworth@cworth.org> + + * src/icint.h: + * src/ictrap.c: Move definitions of MIN and MAX macros from + ictrap.c to icint.h. + +2005-03-03 Carl Worth <cworth@cworth.org> + + * src/ictrap.c (pixman_composite_trapezoids): Remove dead "if + (!format)" code which also makes things more in synch with the + server's mitrap.c. + +2005-03-03 Carl Worth <cworth@cworth.org> + + * src/ictrap.c: Restore original copyright and license which must + have been inadvertently changed. + +2005-03-02 Carl Worth <cworth@cworth.org> + + * src/pixman-xserver-compat.h: Fix comment to clarify that + libpixman regards the xserver repository as its canonical upstream + for some files. + + * src/ic.c, src/icblt.c, src/icbltone.c, src/iccolor.c, + src/iccompose.c, src/icformat.c, src/icimage.c, src/icimage.h, + src/icint.h, src/icpixels.c, src/icrect.c, src/icrop.h, + src/icstipple.c, src/ictransform.c, src/ictrap.c, src/ictri.c, + src/icutil.c, src/pixman.h, src/slim_internal.h: Convert file + encodings from ISO-8859 to UTF-8. + +2005-02-21 Carl Worth <cworth@cworth.org> + + * src/renderedge.h: Add only-just-better-than-ASCII-art diagram + showing all macros used in locating sub-pixel sample rows/columns. + + * src/renderedge.h (RenderEdgeStepSmall, RenderEdgeStepBig): Add + missing protective parentheses around macro parameter usage. + +2005-02-21 Carl Worth <cworth@cworth.org> + + * src/ic.c: + * src/icint.h: Move definition of __inline for non-gcc from ic.c + to icint.h so it applies to more code in the implementation. + +2005-02-06 Owen Taylor <otaylor@redhat.com> + + * configure.in: Add AC_PREREQ(2.54) to help the Debian + auto-guess-which-configure-version hack. + +2005-01-26 Carl Worth <cworth@cworth.org> + + * src/pixman.h: Use 32-bits for pixman_bits_t, even on 64-bit + platforms. This should fix bug #2335 as well as rendering problems + seen on 64-bit platforms. + +2005-01-21 Carl Worth <cworth@cworth.org> + + * NEWS: Add notes for snapshot 0.1.3. + + * configure.in: Increment version to 0.1.3 + + * RELEASING: Add reminder to diff pixman.h to look for API changes + since the last snapshot. + + * src/Makefile.am (libpixman_la_SOURCES): Add missing files to + satisfy make distcheck. + + * Makefile.am (RELEASE_UPLOAD_DIR): Update for changed www + directory on server. + + * src/pixman-xserver-compat.h): Add pixman-xserver-compat.h, (that + was supposed to go in a couple of commits ago). + + * src/fbedgeimp.h (rasterizeEdges): Avoid buffer ovverrun when + trapezoid's right edge is on a pixel boundary. + + * src/ictri.c (IcRasterizeTriangle): + * src/ictrap.c (pixman_composite_trapezoids): Switch to use new + fbRasterizeTrapezoid. Gut old IcRasterizeTrapezoid + implementation. Remove lots of code, (and all the bugs with it). + + * src/icint.h: Replace IcRasterizeTrapezoid with + fbRasterizeTrapezoid. Add a couple of missing typedefs. + + * src/renderedge.h: + * src/renderedge.c (RenderLineFixedEdgeInit): + * src/fbtrap.c: + + * src/fbedge.c: Minor changes to allow things to compile within + libpixman tree, (replace xserver include directives with + pixman-xserver-compat.h and sprinkle a few const qualifiers). + + * src/Makefile.am (libpixman_la_SOURCES): Add sources for new + point-sampling rasterization. + + * src/fbtrap.c: Merge in changes from xserver, (mostly just + whitespace). + +2005-01-18 Carl Worth <cworth@cworth.org> + + * src/fbedge.c: + * src/fbedgeimp.h: + * src/fbtrap.c: + * src/renderedge.c: + * src/renderedge.h: Add pristine files from the X server + containing Keith's newer point-sampling implementation of + trapezoid rasterization. The plan is to munge these files as + little as possible to make them work within libpixman, (so that it + will be easier to share patches between libpixman and the X + server). + +2005-01-13 Carl Worth <cworth@cworth.org> + + * src/ictrap.c (IcRasterizeTrapezoid): Force alpha to 0 when the + left edge is entirely above top. (This is a workaround for some + bizarre edge effects in the current algorithm). + (IcRasterizeTrapezoid): Fix the above correction so that it + doesn't force 0 alpha when the left edge is positioned above but + slopes so as to contain some of the pixel. + +2005-01-07 Carl Worth <cworth@cworth.org> + + * src/icrop.h: + * src/icint.h: Restore extern tag for variable declarations, + (accidentally removed when recently removing extern from function + prototypes). + +2005-01-04 Carl Worth <cworth@cworth.org> + + * src/ic.c (pixman_composite): Do nothing if src image has width + or height == 0 to avoid potential divide-by-zero. + +2004-12-23 Carl Worth <cworth@cworth.org> + + * src/slim_internal.h: Rename __internal_linkage to + pixman_private. + + * src/icrop.h: + * src/icint.h: + * src/icimage.h: Track rename to pixman_private and move it to + before the function return value to quiet gcc warnings about + visibility attribute ignored for non-class type. + + * configure.in: + * src/Makefile.am (INCLUDES): Add the following warnings when + compiling with gcc: -Wall -Wpointer-arith -Wstrict-prototypes + -Wmissing-prototypes -Wmissing-declarations -Wnested-externs + -fno-strict-aliasing + + * src/icrect.c (pixman_color_rects): Fix to actually call + pixman_fill_rect_32bpp in the 32 bpp case. Thanks to + TOKUNAGA Hiroyuki <tkng@xem.jp>. + (pixman_fill_rect_8bpp, pixman_fill_rect_32bpp): Fix typo in + naming: bbp -> bpp. + +2004-12-20 Alexander Larsson <alexl@redhat.com> + + * src/icrect.c: (pixman_fill_rect_8bbp), (pixman_fill_rect_32bbp), + (pixman_fill_rect_general), (pixman_color_rects), + (pixman_fill_rectangles): + Special case solid color rectangle fills. + +2004-10-28 Carl Worth <cworth@cworth.org> + + * Makefile.am (release-verify-newer): Abort release-publish if + there's already a published tar file with the current version. + (release-publish): Add code to update the LATEST-package-version + file. + +2004-10-27 Carl Worth <cworth@cworth.org> + + * RELEASING: Put the tag command back which was accidentally + removed from the instructions. + + * NEWS: Update date since 0.1.2 release didn't get pushed out + until today. + + * RELEASING: Update release instructions to include new + release-publish target. + Suggest "cvs -q update -Ad" as an alternative to checkout. + + * Makefile.am (release-publish): Add release-check and + release-publish targets to simplify the release process. + +2004-10-13 Carl Worth <cworth@cworth.org> + + * NEWS: Add notes for snapshot 0.1.2 + + * configure.in: Increment version to 0.1.2 + + * src/icint.h (MOD): + * src/iccompose.c (IcFetch_transform): + * src/ic.c (pixman_composite): Switch from two different buggy mod + macros to a new MOD macro which should work in C89 or C99. + +2004-09-12 David Reveman <c99drn@cs.umu.se> + + * src/icformat.c (pixman_format_init): pixman_format_init expects + that all variables not touched are zero. We need to add a memset + here to make that true. + Added pixman_format_get_masks, which allow clients to get the + masks from a format. + + * src/icimage.c: Added the implementation of pixman_image_get_format, + which was missing. + + * src/icint.h: slim_hidden_proto pixman_image_set_component_alpha. + + * src/pixman.h: Added pixman_image_set_component_alpha, making it + possible to use component alpha. + + * src/icimage.c (pixman_image_set_clip_region): Make a copy of + the client owned region. + (IcComputeCompositeRegion): Intersect possible client region. + Added pixman_image_set_component_alpha. + + * src/icint.h: Include "../config.h". + Define IMAGE_BYTE_ORDER and BITMAP_BIT_ORDER correctly. + + * configure.in: Added AC_C_BIGENDIAN. + + * src/ic.c (pixman_composite): + * src/iccompose.c (IcFetch_transform, IcFetcha_transform): + * src/icimage.h: Added support for both transform and repeat + (thanks to Owen Taylor <otaylor@redhat.com>). + +2004-05-06 Carl Worth <cworth@isi.edu> + + * src/icimage.c (pixman_image_set_clip_region): Leave + clientClipType as CT_NONE if region is NULL (thanks to Vladimir + Vukicevic <vladimir@pobox.com>). + +2004-04-16 Carl Worth <cworth@isi.edu> + + * NEWS: Add notes for snapshot 0.1.1 + + * configure.in: Increment LIBPIXMAN_VERSION to 0.1.1 + + * src/ictrap.c (IcCreateAlphaPicture): + * src/icrect.c (pixman_color_rects): + * src/pixregion.c (pixman_region16_print, pixman_region16_valid): + * src/icint.h (IcBitsMask): + * src/icimage.h: + * src/icimage.c (pixman_image_change): + * src/icformat.c (pixman_format_create): + * src/pixman.h: Fix bogus names such as PIXMAN_FORMAT_NAME_AR_GB32 + that were left over from a broken search-and-replace. Normalize + structure defintions, (eg. struct _pixman_region16_t -> struct + pixman_region16). Normalize indentation. + + * AUTHORS: Fix alphabetization. + +2004-02-24 Carl Worth <cworth@isi.edu> + + * AUTHORS: Added attribution for several authors after sifting + through the ChangeLog. + Fix email address for Anders Carlsson. + +2004-01-24 Carl Worth <cworth@isi.edu> + + * src/iccompose.c (IcFetch_transform): + (IcFetcha_transform): Remove dead-code (useless n++). + +2004-01-22 Richard Worth <richard@theworths.org> + + * src/Makefile.am: Add '-no-undefined' to end of + libpixman_la_LDFLAGS tp enable building shared libary under + cygwin. + + * src/pixman.h: Remove all 'extern ' and ' __external_linkage' + (macro for __declspec(dllexport) and __declspec(dllimport)) + from function declarations. These are no longer needed for cygwin. + +2003-12-17 Carl Worth <cworth@east.isi.edu> + + * src/pixman.h: Remove trailing commas from enum, (some compilers + like to complain about this). + +2003-12-12 Dave Beckett <Dave.Beckett@bristol.ac.uk> + + * src/Makefile.am: Remove LIBPIXMAN_CFLAGS/LIBS cruft. + (libpixman_la_SOURCES): slim_export.h slim_import.h gone. + +2003-12-12 Carl Worth <cworth@east.isi.edu> + + * src/pixman.h: Fold contents of slim_export/import.h directly + into this file to avoid dependence on external slim package. + + * src/icint.h: + * src/pixregionint.h: Use quote-based include now that + slim_internal is an internal file. + + * src/icint.h: Follow convention of other files for + multi-inclusion guard (_IC_INT_H_) + + + * configure.in: Remove cruft. + +2003-12-10 Dave Beckett <Dave.Beckett@bristol.ac.uk> + + * update.pl: fixes for wrong order of renames + + * src/pixregion.c, src/pixman.h, src/ictri.c, src/ictrap.c, src/icimage.c, src/icformat.c, src/ic.c: + Correct some more renames where the order of the renaming + caused later renames to fail due to earlier prefixes failing. + + * update.pl: Add rename fixes + + * src/pixregionint.h, src/pixregion.c, src/pixman.h, src/ictri.c, src/ictrap.c, src/ictransform.c, src/icrect.c, src/icpixels.c, src/icint.h, src/icimage.h, src/icimage.c, src/icformat.c, src/iccompose.c, src/iccolor.c: + Correct over-eager renames of the form pixman_thing_tName into + pixman_thing_name. It was inevitable really this would happen! + + * update.pl: Added helper script for updating names in source. + + * src/pixregionint.h, src/pixregion.c, src/pixman.h, src/icutil.c, src/ictri.c, src/ictrap.c, src/ictransform.c, src/icstipple.c, src/icrop.h, src/icrect.c, src/icpixels.c, src/icint.h, src/icimage.h, src/icimage.c, src/icformat.c, src/iccompose.c, src/iccolor.c, src/icbltone.c, src/icblt.c, src/ic.c: + Rename exported Ic* and PixRegion* functions, types, enums + to be prefixed pixman (or PIXMAN for enum values) + + * libpixman.pc.in, README: libpixman is the pixel manipulation library + + * src/pixregionint.h, src/icint.h: + Change ic.h/pixregion.h headers inclusions to be pixman.h + + * src/ic.h: Removed ic.h, merged into pixman.h + + * src/pixman.h: + Merged pixregion.h (former name and CVS history of this file) + and ic.h (now CVS deleted here). + + * src/Makefile.am: + Updated for libpixregion,libic to libpixman source merges. + Added -I$(srcdir) so we get internal headers from here even + when srcdir != builddir. + + * libpixman.pc.in, configure.in, Makefile.am: + Updated for libpixregion,libic to libpixman package name, dependencies. + + * README, COPYING, AUTHORS: + Merge of libic, slim AUTHORS, COPYING, README + + * Initial repository copy of libpixregion, libic, slim CVS. + + * Constructed a merged ChangeLog below via emacs VC mode (which rocks!) + +2003-12-09 Carl Worth <cworth@isi.edu> + + * ChangeLog.libpixregion, autogen.sh, ChangeLog.libic: + * autogen.sh: Allow names of all autofoo programs to be + overridden via environment variables. + +2003-11-25 Carl Worth <cworth@isi.edu> + + * ChangeLog.libic, src/icutil.c: + * configure.in: Bump version to 0.1.5 for new 64-bit fixes. + + * src/icutil.c (icStipple8Bits): One more fix needed for 64-bit + machine (alpha in this case). Thanks to Jakub Bogusz + <qboosh@pld-linux.org>. + +2003-11-17 Carl Worth <cworth@isi.edu> + + * src/icrop.h, src/icutil.c, ChangeLog.libic: + * src/icutil.c (icStipple1Bits): + * src/icrop.h (IcStipple16Bits): Fixes needed to compile libic on + x86_64. Many thanks to David R Bacon <dbacon@cis.ksu.edu>. + +2003-11-06 Carl Worth <cworth@isi.edu> + + * ChangeLog.libic, src/ic.h: Removed stale version from ic.h. + Better to have no version listed than the wrong one. + +2003-11-01 Carl Worth <cworth@isi.edu> + + * ChangeLog.libic, src/ic.h, src/icimage.c: + Add IcImageGetDepth. Bump version to 0.1.3 + +2003-10-29 Carl Worth <cworth@isi.edu> + + * ChangeLog.libpixregion, configure.in, ChangeLog.libic: + Drop AC_CONFIG_AUX_DIR(config) as it was confusing "make distcheck" + + * ChangeLog.libic, src/icimage.c, src/icimage.h: + Fix memory leak of image->transform. + Remove currently unused DevUnion type and IcImageChange function. + + * ChangeLog.libic: + Bumped version to 0.1.2 to indicate new IcOperator type. + + * ChangeLog.libic, src/ic.c, src/ic.h, src/icblt.c, src/icbltone.c, src/iccolor.c, src/iccompose.c, src/icimage.c, src/icimage.h, src/icint.h, src/icrect.c, src/ictransform.c, src/ictrap.c, src/ictri.c: + Patch from Bryan Worth <bryan@theworths.org> to eliminate lots of leftover, + undesired dependencies on X header files. + +2003-09-24 Carl Worth <cworth@isi.edu> + + * ChangeLog.slim: + Require __GNUC__ >= 3 before defining slim_hidden_def macro + +2003-09-23 Carl Worth <cworth@isi.edu> + + * src/slim_internal.h: + Require __GNUC__ >= 3 before defining slim_hidden_def macro + +2003-09-10 Carl Worth <cworth@isi.edu> + + * src/ic.c, src/iccolor.c, src/icformat.c, src/icimage.c, src/icrect.c, ChangeLog.libic, ChangeLog.libpixregion, configure.in, src/pixregion.c: + Updated calls to slim_hidden_def to track cahnges in slim 0.2.0 + + * ChangeLog.slim: Bump version number to 0.2.0 + + * ChangeLog.slim, src/slim_internal.h: + Remove ';' from slim_hidden_def. Bump version to 0.1.1 + +2003-09-05 Carl Worth <cworth@isi.edu> + + * ChangeLog.libic, src/ic.c, src/ic.h, src/icblt.c, src/icbltone.c, src/iccolor.c, src/iccompose.c, src/icformat.c, src/icimage.c, src/icimage.h, src/icint.h, src/icpixels.c, src/icrect.c, src/icrop.h, src/icstipple.c, src/ictransform.c, src/ictrap.c, src/ictri.c, src/icutil.c: + Expose functions for creating IcFormat based on IcFormatName or masks. + The actual IcFormat struct is no longer exposed. + Bump version number to 0.1.1 + + * ChangeLog.libic: Portability fix for OpenBSD (from Michael Schubert) + +2003-09-02 Carl Worth <cworth@isi.edu> + + * src/ic.h: Portability fix for OpenBSD (from Michael Schubert) + +2003-08-19 Carl Worth <cworth@isi.edu> + + * autogen.sh: Add --enable-maintainer-mode to autogen.sh + + * autogen.sh: + Fixed to give a better warning if pkg-config is not installed + +2003-08-01 Richard Henderson <rth@twiddle.net> + + * ChangeLog.libic, src/iccolor.c: + * src/iccolor.c (Ones): Define as __builtin_popcount when available. + +2003-07-31 Richard Henderson <rth@twiddle.net> + + * src/ic.c, src/ic.h, src/iccolor.c, src/iccompose.c, src/icformat.c, src/icimage.c, src/icimage.h, src/icint.h, src/icrect.c, src/icrop.h, src/ictri.c, ChangeLog.libic: + * configure.in: Check for slim revision. + * libic.pc.in: Depend on slim. + + * src/ic.c, src/iccompose.c: Don't include icimage.h. + * src/icimage.h: Don't include ic.h. + + * src/ic.h: Include slim_{export,import}.h as appropriate. Mark all + symbols __external_linkage. + * src/icint.h: Include slim_import.h; mark symbols __internal_linkage; + add slim hidden_proto declarations. + * src/icimage.h: Mark all symbols __internal_linkage. + * src/icrop.h: Likewise. + + * src/ic.c (IcComposite): Provide hidden definition. + * src/iccolor.c (IcColorToPixel): Likewise. + * src/icformat.c (IcFormatInit): Likewise. + * src/icimage.c (IcImageCreate, IcImageDestroy): Likewise. + (IcImageSetRepeat): Likewise. + * src/icrect.c (IcFillRectangles): Likewise. + * src/tri.c (IcRasterizeTriangle): Make static. + + * ChangeLog.slim, src/slim_internal.h: + * src/slim_internal.h (__internal_linkage): Attribute visibility + not present until gcc 3.3. + + * src/icimage.h, src/icrop.h, src/icutil.c, ChangeLog.libic, src/ic.c, src/icbltone.c, src/iccompose.c: + * src/ic.c: Make everything but IcComposite static. + * src/iccompose.c: Make everything except IcBuildCompositeOperand + and IcCompositeGeneral static. + * src/icbltone.c (Ic8Lane, Ic16Lane, Ic32Lane): Make static. + (IcLaneTable): Turn into a function. + (IcBltOne): Make IcLane const. + (icStipple24Bits): Make static. + * src/icimage.h: Remove lots of now static declarations. + * src/icrop.h: Likewise. + * src/icutil.c (icStipple8Bits, icStipple4Bits): Make static. + (icStipple2Bits, icStipple1Bits): Make static. + (IcStippleTable): Turn into a function. + +2003-07-30 Carl Worth <cworth@isi.edu> + + * ChangeLog.libic, src/ic.h: Committing missed ChangeLog entry + + * ChangeLog.libic, src/ic.h: + Fixed IcRectangle to be compatible with XRectangle. + + * ChangeLog.libpixregion, configure.in, src/pixman.h: + Removed false dependency on X. + +2003-07-30 Richard Henderson <rth@twiddle.net> + + * ChangeLog.slim: + * Makefile.am (EXTRA_DIST, pkgconfigdir, pkgconfig_DATA): New. + * configure.in (AC_OUTPUT): Add slim.pc. + * slim.pc.in: New file. + + * ChangeLog.libpixregion, configure.in, libpixman.pc.in, src/pixman.h, src/pixregion.c, src/pixregionint.h: + * configure.in: Run PKG_CHECK_MODULES on slim. + * libpixregion.pc.in: Require slim. + * src/pixregion.c (PixRegionCreateSimple): Mark hidden. + (PixRegionCopy, PixRegionUnion): Mark hidden. + * src/pixregion.h: Include and use X11/Xfuncproto.h. Include + slim_{export,import}.h as appropriate. Mark all functions with + __external_linkage. + * src/pixregionint.h: Rename include protect to _PIXREGIONINT_H_. + + * src/slim_export.h, src/slim_import.h, src/slim_internal.h, ChangeLog.slim: + * src/slim_internal.h: New file. + * src/slim_export.h: New file. + * src/slim_import.h: New file. + * src/Makefile.am (include_HEADERS): Add them. + * configure.in (AC_INIT): Check for src/slim_export.h + +2003-07-30 Carl Worth <cworth@isi.edu> + + * ChangeLog.slim: Initial commit of slim shell + +2003-07-29 Carl Worth <cworth@isi.edu> + + * src/ic.c, src/ic.h, src/iccompose.c, src/icimage.h, src/icint.h: + Replaced CARD*/INT* datatypes with stdint types (vektor@dumbterm.net). + +2003-07-10 Anders Carlsson <andersca@codefactory.se> + + * ChangeLog.libic: + 2003-07-10 Anders Carlsson <andersca@codefactory.se> + + * autogen.sh: + Pass --enable-maintainer-mode to configure + + * configure.in: + Add compiler warning flags to CFLAGS. + +2003-07-09 Anders Carlsson <andersca@codefactory.se> + + * src/ic.h, src/icimage.c, ChangeLog.libic: + 2003-07-09 Anders Carlsson <andersca@codefactory.se> + + * src/ic.h: + * src/icimage.c: (IcImageGetData): + Add accessor for getting a pointer to the image data. + +2003-07-08 Anders Carlsson <andersca@codefactory.se> + + * src/ic.h, src/icimage.c, ChangeLog.libic: + 2003-07-09 Anders Carlsson <andersca@codefactory.se> + + * src/ic.h: + * src/icimage.c: (IcImageGetWidth), (IcImageGetHeight), + (IcImageGetStride): + Add accessors. + +2003-05-29 Carl Worth <cworth@isi.edu> + + * src/ic.c, src/iccompose.c: Cleanup of some stale unused code. + +2003-05-15 Carl Worth <cworth@isi.edu> + + * src/ic.h, src/iccompose.c, src/icimage.c, src/icimage.h, + src/icint.h, src/ictransform.c, ChangeLog.libic: Fixed + transform/filter support + +2003-05-05 Carl Worth <cworth@isi.edu> + + * ChangeLog.libic, src/ictrap.c: + Avoid crash in IcCompositeTrapezoids when there's nothing to draw. + +2003-04-26 Carl Worth <cworth@isi.edu> + + * ChangeLog.libic, src/icimage.c, src/icimage.h: Fixed memory leak + +2003-04-25 Carl Worth <cworth@isi.edu> + + * ChangeLog.libic, src/ic.h, src/icint.h, src/icrect.c, + src/ictrap.c, src/ictri.c: Remove X datatypes from public + interface + + * configure.in, src/Makefile.am, src/pixman.h, src/pixregionint.h: + Fixed libtool versioning + + * ChangeLog.libic, src/ic.h: + Fixed to not reference XFixed. Fixed libtool versioning + +2003-04-23 Carl Worth <cworth@isi.edu> + + * src/ic.h: extern "C" stuff to support C++ (Fredrik Hglund) + +2003-04-22 Carl Worth <cworth@isi.edu> + + * ChangeLog.libpixregion, configure.in: Fixed typo (Owen Taylor) + +2003-04-17 Carl Worth <cworth@isi.edu> + + * ChangeLog.libic, src/ic.c, src/ic.h, src/iccolor.c, + src/iccompose.c, src/icformat.c, src/icimage.c, src/icimage.h, + src/icint.h, src/icpixels.c, src/icrect.c, src/ictrap.c, + src/ictri.c: Removed reliance on server headers. Reowrked IcFormat + +2003-03-05 Carl Worth <cworth@isi.edu> + + * ChangeLog.libic, src/ic.h, src/icimage.h, src/icint.h: + Updated to use libpixregion + +2003-02-25 Carl Worth <cworth@isi.edu> + + * src/ic.c, src/ic.h, src/iccompose.c, src/icimage.c, + src/icimage.h, src/icint.h, src/ictrap.c, src/ictri.c: updated to + use libpixregion instead of Xlib region code + + * ChangeLog.libpixregion, src/pixman.h, src/pixregion.c: API cleanup + + * src/.cvsignore, src/Makefile.am, src/pixman.h, src/pixregion.c, + src/pixregionint.h: Initial import of libpixregion + + * src/.cvsignore, src/Makefile.am, src/pixman.h, src/pixregion.c, + src/pixregionint.h: New file. + + * .cvsignore, AUTHORS, COPYING, ChangeLog.libpixregion, INSTALL, + Makefile.am, NEWS, README, autogen.sh, configure.in, + libpixman.pc.in: Initial import of libpixregion + + * .cvsignore, AUTHORS, COPYING, ChangeLog.libpixregion, INSTALL, + Makefile.am, NEWS, README, autogen.sh, configure.in, + libpixman.pc.in: New file. + +2003-02-21 Carl Worth <cworth@isi.edu> + + * src/ic.h, src/icimage.h, src/icint.h, src/ictrap.c, src/ictri.c: + Added triangle support + + * src/ictransform.c, ChangeLog.libic, src/ic.c, src/icbltone.c, + src/iccompose.c, src/icformat.c, src/icimage.c, src/icimage.h, + src/icint.h, src/icutil.c: Some reorganization and cruft removal + + * src/ic.c, src/ic.h, src/icimage.c, src/icint.h, src/icpixels.c, + src/icstipple.c, src/ictrap.c: Started cleaning up public libic + interface + + * src/icimage.h, src/icint.h, src/icrop.h: + Initial import of libic code, (still very preliminary). + + * src/icimage.h, src/icint.h, src/icrop.h: New file. + + * src/ictrap.c, src/ictri.c, src/icutil.c: + Initial import of libic code, (still very preliminary). + + * src/ictrap.c, src/ictri.c, src/icutil.c: New file. + + * src/iccompose.c, src/icformat.c, src/icimage.c, src/icpixels.c, src/icrect.c, src/icstipple.c: + Initial import of libic code, (still very preliminary). + + * src/iccompose.c, src/icformat.c, src/icimage.c, src/icpixels.c, src/icrect.c, src/icstipple.c: + New file. + + * src/icbltone.c: + Initial import of libic code, (still very preliminary). + + * src/icbltone.c: New file. + + * src/ic.c, src/ic.h, src/icblt.c: + Initial import of libic code, (still very preliminary). + + * src/ic.c, src/ic.h, src/icblt.c: New file. + + * ChangeLog.libic: + Initial import of libic code, (still very preliminary). + + * ChangeLog.libic: New file. + diff --git a/pixman/ChangeLog.libic b/pixman/ChangeLog.libic new file mode 100644 index 0000000..d6d709f --- /dev/null +++ b/pixman/ChangeLog.libic @@ -0,0 +1,300 @@ +2003-12-08 Carl Worth <cworth@isi.edu> + + * autogen.sh: Allow names of all autofoo programs to be + overridden via environment variables. + +2003-11-25 Carl Worth <cworth@east.isi.edu> + + * configure.in: Bump version to 0.1.5 for new 64-bit fixes. + + * src/icutil.c (icStipple8Bits): One more fix needed for 64-bit + machine (alpha in this case). Thanks to Jakub Bogusz + <qboosh@pld-linux.org>. + +2003-11-17 Carl Worth <cworth@isi.edu> + + * src/icutil.c (icStipple1Bits): + * src/icrop.h (IcStipple16Bits): Fixes needed to compile libic on + x86_64. Many thanks to David R Bacon <dbacon@cis.ksu.edu>. + +2003-11-06 Carl Worth <cworth@east.isi.edu> + + * configure.in: Bump version to 0.1.4 just to mark removal of the + version from ic.h, (so not an interesting change and nothing worth + upgrading to). + + * src/ic.h: Remove IC_MAJOR, IC_MINOR, and IC_REVISION, (which + were stale anyway so less than useful). + +2003-10-31 Carl Worth <cworth@isi.edu> + + * configure.in (LIBIC_VERSION): Bump version to 0.1.3 for new IcImageGetDepth. + + * src/icimage.c (IcImageGetDepth): Add IcImageGetDepth. + +2003-10-29 Carl Worth <cworth@isi.edu> + + * src/icimage.h: Remove currently unused DevUnion datatype to + squelch compiler warning. Remove prototype for currently + unimplemented IcImageChange function. + + * src/icimage.c (IcImageDestroy): Fixed memory leak of + image->transform. + +2003-10-29 Carl Worth <cworth@east.isi.edu> + + * configure.in: Drop AC_CONFIG_AUX_DIR(config) as it was confusing + "make distcheck" + +2003-10-29 Carl Worth <cworth@east.isi.edu> + + * configure.in: Bumped version to 0.1.2 to indicate new IcOperator + type. + + * Everywhere: A large patch from Bryan Worth <bryan@theworths.org> + to eliminate lots of leftover, undesired dependencies on X header + files. More details below: + + * src/ictransform.c: + * src/ictrap.c: + * src/ictri.c: + * src/icrect.c: + * src/iccompose.c: + * src/iccolor.c: + * src/icbltone.c: + * src/icblt.c: + * src/icimage.h: + * src/icimage.c: + * src/ic.c: + Replace CARD8/16/32 with uint8/16/32_t. + Replace INT16 with int16_t. + Use IcOperator in place of char or uint8_t. + Replace Bool/FALSE/TRUE with int/0/1. + + * src/icint.h: Remove includes of X11/X.h, X11/Xmd.h, + X11/Xprotostr.h and X11/extensions/Xrender.h. Add IcPoint. Lift + definitions from X headers for Mask, GXor, ClipByChildren, + PolyEdgeSharp, PolyModePrecise, CPClipMask, and CPLastBit. + + * src/icimage.h: Remove includes of X11/Xdefs.h and X11/Xprotostr.h. + Replace "pointer" with "void *". + Remove include of X11/Xutil.h. + Replace DDXPointRec with IcPoint. + Replace Atom/XID with unsigned long. + + * src/icimage.c: Remove instances of BadAlloc and Success. + Replace XID with unsigned int. + Replace "pointer" with "void *". + Replace Atom with unsigned long. + + * src/ic.h: Introduce new IcOperator enum, rather than using char + or uint8_t. + +2003-09-09 Carl Worth <cworth@isi.edu> + + * configure.in (SLIM_REQUIRED): Updated calls to slim_hidden_def + to track changes in slim 0.2.0. + +2003-09-05 Carl Worth <cworth@isi.edu> + + * configure.in (LIBIC_VERSION): Bumped version to 0.1.1. + + * src/ictrap.c (IcCreateAlphaPicture): Fixed memory leak. + + * src/icimage.h: icimage->image_format now a struct not a + pointer. Rename integral format_name to format_code. + + * src/iccompose.c: Remove unused functions: IcCombineSaturateU, + IcCombineSaturateC, IcFetch_a2b2g2r2, IcFetch_c8, IcFetch_c4, + IcFetch_g1, IcStore_c8, IcStore_g8, IcStore_c4, IcStore_g4, + IcStore_g1. + + * src/iccolor.c (_IcOnes): Rename Ones to _IcOnes and expose it + for internal use. + + * src/ic.h: Changed IcFormatName from an int to an enum. + Changed IcFormat from an exposed struct to an opaque type. + Now expose IcFormatCreate, IcFormatCreateMasks, and + IcFormatDestroy. + +2003-09-02 Carl Worth <cworth@isi.edu> + + * src/ic.h: Include inttypes.h rather than stdint.h on OpenBSD, + (Michael Schubert <michael@schubert.cx>) + +2003-07-31 Richard Henderson <rth@twiddle.net> + + * src/iccolor.c (Ones): Define as __builtin_popcount when available. + +2003-07-31 Richard Henderson <rth@twiddle.net> + + * configure.in: Check for slim revision. + * libic.pc.in: Depend on slim. + + * src/ic.c, src/iccompose.c: Don't include icimage.h. + * src/icimage.h: Don't include ic.h. + + * src/ic.h: Include slim_{export,import}.h as appropriate. Mark all + symbols __external_linkage. + * src/icint.h: Include slim_import.h; mark symbols __internal_linkage; + add slim hidden_proto declarations. + * src/icimage.h: Mark all symbols __internal_linkage. + * src/icrop.h: Likewise. + + * src/ic.c (IcComposite): Provide hidden definition. + * src/iccolor.c (IcColorToPixel): Likewise. + * src/icformat.c (IcFormatInit): Likewise. + * src/icimage.c (IcImageCreate, IcImageDestroy): Likewise. + (IcImageSetRepeat): Likewise. + * src/icrect.c (IcFillRectangles): Likewise. + * src/tri.c (IcRasterizeTriangle): Make static. + +2003-07-31 Richard Henderson <rth@twiddle.net> + + * src/ic.c: Make everything but IcComposite static. + * src/iccompose.c: Make everything except IcBuildCompositeOperand + and IcCompositeGeneral static. + * src/icbltone.c (Ic8Lane, Ic16Lane, Ic32Lane): Make static. + (IcLaneTable): Turn into a function. + (IcBltOne): Make IcLane const. + (icStipple24Bits): Make static. + * src/icimage.h: Remove lots of now static declarations. + * src/icrop.h: Likewise. + * src/icutil.c (icStipple8Bits, icStipple4Bits): Make static. + (icStipple2Bits, icStipple1Bits): Make static. + (IcStippleTable): Turn into a function. + +2003-07-30 Carl Worth <cworth@isi.edu> + + * src/ic.h: Fixed IcRectangle to be compatible with XRectangle. + +2003-07-29 Billy Biggs <vektor@dumbterm.net> + + * src/ic.h: Changed all references to CARD*/INT* to use stdint + names, (eg. uint32_t, int32_t). + +2003-07-10 Anders Carlsson <andersca@codefactory.se> + + * autogen.sh: + Pass --enable-maintainer-mode to configure + + * configure.in: + Add compiler warning flags to CFLAGS. + +2003-07-09 Anders Carlsson <andersca@codefactory.se> + + * src/ic.h: + * src/icimage.c: (IcImageGetData): + Add accessor for getting a pointer to the image data. + +2003-07-09 Anders Carlsson <andersca@codefactory.se> + + * src/ic.h: + * src/icimage.c: (IcImageGetWidth), (IcImageGetHeight), + (IcImageGetStride): + Add accessors. + +2003-05-14 Carl Worth <cworth@isi.edu> + + * src/ic.h: Add IcImageSetFilter. Fixed transform support. + +2003-05-05 Carl Worth <cworth@isi.edu> + + * src/ictrap.c (IcCompositeTrapezoids): Avoid crash if there's + nothing to draw. + +2003-04-26 Carl Worth <cworth@isi.edu> + + * src/icimage.c (IcImageDestroy): Fix memory leak of image->pixels + when owns_pixels == 1; + +2003-04-25 Carl Worth <cworth@east.isi.edu> + + * src/ic.h (IC_REVISION): Added #defines for version. + Don't reference undefined XFixed datatype. + Added IcFixed16_16, IcPointFixed, IcLineFixed, IcRectangle, + IcTriangle, and IcTrapzezoid to eliminate X datatypes in public + interface. + + * configure.in: Fixed libtool versioning. + +2003-04-17 Carl Worth <cworth@isi.edu> + + * src/icint.h: Removed reliance on some server include files, + (this included copy and paste of Xserver/render/picture.h into + icint.h) + + * src/icformat.c (IcFormatInit): Replaced public + IcFormatCreate/IcFormatDestroy with IcFormatInit and an exposed + IcFormat structure. + (_IcFormatCreate): Tracked changes now that IcFormat no longer has + direct and indexed sub-structure. + + * src/iccompose.c: Commented out all code supporting indexed + formats. + + * src/ic.h: Expose IcFormat structure, (with no support for + indexed formats). + + * src/ic.c (IcComposite): Track changes in IcImage structure + (format vs. format_name) + +2003-03-10 Carl Worth <cworth@isi.edu> + + * src/Makefile.am (INCLUDES): Cleaned up to no longer require + includes from X server source tree. + +2003-03-05 Carl Worth <cworth@isi.edu> + + * src/ictri.c (IcTriangles): + (IcTriStrip): + (IcTriFan): fixed argument order to match XRender + + * src/icrect.c (IcRectangle): Add IcRectangle convenience function. + (IcRectangles): fixed argument order to match XRender + + * src/ictri.c (IcTriangles): + (IcTriStrip): + (IcTriFan): Removed format argument from IcTri* functions. + + * src/ictrap.c (IcTrapezoids): Removed format argument from + IcTrapezoids. + + * src/icrect.c (IcRectangles): Initial (painfully slow) + implementation of IcRectangles. + + * src/icimage.c (IcImageCreate): Simplified IcImageCreate, (no + longer requires mask/vlist/error/error_value) + (IcImageSetRepeat): Added IcImageSetRepeat + (IcImageSetClipRegion): Implemented simple IcImageSetClipRegion. + +2003-02-25 Carl Worth <cworth@isi.edu> + + * src/icimage.c (IcImageInit): + (IcImageDestroy): + (IcImageDestroyClip): + (IcClipImageReg): + (IcClipImageSrc): + (IcClipImageSrc): + (SetPictureClipRects): + (IcComputeCompositeRegion): Converted to use libpixregion rather + than region code from Xlib. + + * src/iccompose.c (IcFetch_transform): Converted to use + libpixregion rather than region code from Xlib. + + * src/ic.c (IcComposite): Converted to use libpixregion rather + than region code from Xlib. + +2003-02-21 Carl Worth <cworth@isi.edu> + + * src/ictri.c (IcRasterizeTriangle): Added triangle support to + libic. + + * src/ic.h: Started cleaning up the public interface of + libic. Moved most of the cruft into icint.h. + +2003-02-20 Carl Worth <cworth@isi.edu> + + * AUTHORS: Added AUTHORS, NEWS, ChangeLog. + diff --git a/pixman/ChangeLog.libpixregion b/pixman/ChangeLog.libpixregion new file mode 100644 index 0000000..75b071e --- /dev/null +++ b/pixman/ChangeLog.libpixregion @@ -0,0 +1,47 @@ +2003-12-08 Carl Worth <cworth@isi.edu> + + * autogen.sh: Allow names of all autofoo programs to be + overridden via environment variables. + +2003-10-29 Carl Worth <cworth@east.isi.edu> + + * configure.in: Drop AC_CONFIG_AUX_DIR(config) as it was confusing + "make distcheck" + +2003-09-09 Carl Worth <cworth@isi.edu> + + * configure.in (SLIM_REQUIRED): Updated calls to slim_hidden_def + to track changes in slim 0.2.0. + +2003-07-30 Carl Worth <cworth@east.isi.edu> + + * src/pixregion.h: Implement our own 'extern "C"' block to avoid + false dependency on X. + + * configure.in: Remove unnecessary AC_PATH_XTRA check for X + headers. + +2003-07-30 Richard Henderson <rth@twiddle.net> + + * configure.in: Run PKG_CHECK_MODULES on slim. + * libpixregion.pc.in: Require slim. + * src/pixregion.c (PixRegionCreateSimple): Mark hidden. + (PixRegionCopy, PixRegionUnion): Mark hidden. + * src/pixregion.h: Include and use X11/Xfuncproto.h. Include + slim_{export,import}.h as appropriate. Mark all functions with + __external_linkage. + * src/pixregionint.h: Rename include protect to _PIXREGIONINT_H_. + +2003-04-22 Carl Worth <cworth@isi.edu> + + * configure.in (LIBPIXREGION_MAJOR_VERSION): Fixed typo (Owen Taylor) + +2003-02-25 Carl Worth <cworth@isi.edu> + + * src/pixregion.c (PixRegionCreateSimple): Eliminated useless size + parameter from PixRegionCreateSized, (the server only ever calls + it with a value of 1 or 0). + (PixRegionInit): + (PixRegionUninit): + (PixRegionBreak): Changed these three functions to be static. + diff --git a/pixman/ChangeLog.slim b/pixman/ChangeLog.slim new file mode 100644 index 0000000..c830bf7 --- /dev/null +++ b/pixman/ChangeLog.slim @@ -0,0 +1,39 @@ +2003-09-23 Carl Worth <cworth@east.isi.edu> + + * src/slim_internal.h: The slim_hidden_def macros were causing + build failures with gcc 2.95.4. I've bumped the test for these + macros up to: __GNUC__ >= 3. We'll see if that's sufficient. + +2003-09-09 Carl Worth <cworth@isi.edu> + + * configure.in (SLIM_VERSION): Bump version number to 0.2.0 + instead, (this is an incompatible change after all). + + * configure.in (SLIM_VERSION): Bump version number to 0.1.1 + + * src/slim_internal.h (slim_hidden_def): Remove ';' from macro + definition, (forcing the user to provide it which looks better + anyway). This also helps to avoid confusing etags. + +2003-07-31 Richard Henderson <rth@twiddle.net> + + * src/slim_internal.h (__internal_linkage): Attribute visibility + not present until gcc 3.3. + +2003-07-30 Richard Henderson <rth@twiddle.net> + + * Makefile.am (EXTRA_DIST, pkgconfigdir, pkgconfig_DATA): New. + * configure.in (AC_OUTPUT): Add slim.pc. + * slim.pc.in: New file. + +2003-07-30 Richard Henderson <rth@twiddle.net> + + * src/slim_internal.h: New file. + * src/slim_export.h: New file. + * src/slim_import.h: New file. + * src/Makefile.am (include_HEADERS): Add them. + * configure.in (AC_INIT): Check for src/slim_export.h + +2003-07-29 Carl Worth <cworth@isi.edu> + + * Create package skeleton. diff --git a/pixman/INSTALL b/pixman/INSTALL new file mode 100644 index 0000000..5ccf1c3 --- /dev/null +++ b/pixman/INSTALL @@ -0,0 +1,9 @@ +This code uses automake, in order to generate the Makefiles use: + + $ autogen.sh + +After that, standard build procedures apply: + + $ make + # make install + diff --git a/pixman/Makefile.am b/pixman/Makefile.am new file mode 100644 index 0000000..92ac1e4 --- /dev/null +++ b/pixman/Makefile.am @@ -0,0 +1,7 @@ +SUBDIRS = src + +EXTRA_DIST = \ + COPYING \ + ChangeLog.libic \ + ChangeLog.libpixregion \ + ChangeLog.slim diff --git a/pixman/Makefile.in b/pixman/Makefile.in new file mode 100644 index 0000000..988413f --- /dev/null +++ b/pixman/Makefile.in @@ -0,0 +1,549 @@ +# Makefile.in generated by automake 1.9.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = pixman +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + AUTHORS COPYING ChangeLog INSTALL NEWS TODO +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +ATSUI_FONT_FEATURE = @ATSUI_FONT_FEATURE@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_HAS_ATSUI_FONT_FALSE = @CAIRO_HAS_ATSUI_FONT_FALSE@ +CAIRO_HAS_ATSUI_FONT_TRUE = @CAIRO_HAS_ATSUI_FONT_TRUE@ +CAIRO_HAS_FT_FONT_FALSE = @CAIRO_HAS_FT_FONT_FALSE@ +CAIRO_HAS_FT_FONT_TRUE = @CAIRO_HAS_FT_FONT_TRUE@ +CAIRO_HAS_GLITZ_SURFACE_FALSE = @CAIRO_HAS_GLITZ_SURFACE_FALSE@ +CAIRO_HAS_GLITZ_SURFACE_TRUE = @CAIRO_HAS_GLITZ_SURFACE_TRUE@ +CAIRO_HAS_PDF_SURFACE_FALSE = @CAIRO_HAS_PDF_SURFACE_FALSE@ +CAIRO_HAS_PDF_SURFACE_TRUE = @CAIRO_HAS_PDF_SURFACE_TRUE@ +CAIRO_HAS_PNG_FUNCTIONS_FALSE = @CAIRO_HAS_PNG_FUNCTIONS_FALSE@ +CAIRO_HAS_PNG_FUNCTIONS_TRUE = @CAIRO_HAS_PNG_FUNCTIONS_TRUE@ +CAIRO_HAS_PS_SURFACE_FALSE = @CAIRO_HAS_PS_SURFACE_FALSE@ +CAIRO_HAS_PS_SURFACE_TRUE = @CAIRO_HAS_PS_SURFACE_TRUE@ +CAIRO_HAS_QUARTZ_SURFACE_FALSE = @CAIRO_HAS_QUARTZ_SURFACE_FALSE@ +CAIRO_HAS_QUARTZ_SURFACE_TRUE = @CAIRO_HAS_QUARTZ_SURFACE_TRUE@ +CAIRO_HAS_WIN32_FONT_FALSE = @CAIRO_HAS_WIN32_FONT_FALSE@ +CAIRO_HAS_WIN32_FONT_TRUE = @CAIRO_HAS_WIN32_FONT_TRUE@ +CAIRO_HAS_WIN32_SURFACE_FALSE = @CAIRO_HAS_WIN32_SURFACE_FALSE@ +CAIRO_HAS_WIN32_SURFACE_TRUE = @CAIRO_HAS_WIN32_SURFACE_TRUE@ +CAIRO_HAS_XCB_SURFACE_FALSE = @CAIRO_HAS_XCB_SURFACE_FALSE@ +CAIRO_HAS_XCB_SURFACE_TRUE = @CAIRO_HAS_XCB_SURFACE_TRUE@ +CAIRO_HAS_XLIB_SURFACE_FALSE = @CAIRO_HAS_XLIB_SURFACE_FALSE@ +CAIRO_HAS_XLIB_SURFACE_TRUE = @CAIRO_HAS_XLIB_SURFACE_TRUE@ +CAIRO_LIBS = @CAIRO_LIBS@ +CAIRO_VERSION_MAJOR = @CAIRO_VERSION_MAJOR@ +CAIRO_VERSION_MICRO = @CAIRO_VERSION_MICRO@ +CAIRO_VERSION_MINOR = @CAIRO_VERSION_MINOR@ +CAIRO_VERSION_OTHER = @CAIRO_VERSION_OTHER@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_GTK_DOC_FALSE = @ENABLE_GTK_DOC_FALSE@ +ENABLE_GTK_DOC_TRUE = @ENABLE_GTK_DOC_TRUE@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ +FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_CONFIG = @FREETYPE_CONFIG@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +FT_FONT_FEATURE = @FT_FONT_FEATURE@ +GLITZ_CFLAGS = @GLITZ_CFLAGS@ +GLITZ_LIBS = @GLITZ_LIBS@ +GLITZ_REQUIRES = @GLITZ_REQUIRES@ +GLITZ_SURFACE_FEATURE = @GLITZ_SURFACE_FEATURE@ +GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@ +GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ +HAVE_PTHREAD_FALSE = @HAVE_PTHREAD_FALSE@ +HAVE_PTHREAD_TRUE = @HAVE_PTHREAD_TRUE@ +HTML_DIR = @HTML_DIR@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PDF_LIBS = @PDF_LIBS@ +PDF_SURFACE_FEATURE = @PDF_SURFACE_FEATURE@ +PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ +PKG_CONFIG = @PKG_CONFIG@ +PNG_CFLAGS = @PNG_CFLAGS@ +PNG_FUNCTIONS_FEATURE = @PNG_FUNCTIONS_FEATURE@ +PNG_LIBS = @PNG_LIBS@ +PNG_REQUIRES = @PNG_REQUIRES@ +PS_LIBS = @PS_LIBS@ +PS_SURFACE_FEATURE = @PS_SURFACE_FEATURE@ +QUARTZ_SURFACE_FEATURE = @QUARTZ_SURFACE_FEATURE@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +VERSION_INFO = @VERSION_INFO@ +WIN32_FONT_FEATURE = @WIN32_FONT_FEATURE@ +WIN32_SURFACE_FEATURE = @WIN32_SURFACE_FEATURE@ +XCB_CFLAGS = @XCB_CFLAGS@ +XCB_LIBS = @XCB_LIBS@ +XCB_SURFACE_FEATURE = @XCB_SURFACE_FEATURE@ +XLIB_SURFACE_FEATURE = @XLIB_SURFACE_FEATURE@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XRENDER_REQUIRES = @XRENDER_REQUIRES@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = src +EXTRA_DIST = \ + COPYING \ + ChangeLog.libic \ + ChangeLog.libpixregion \ + ChangeLog.slim + +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu pixman/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu pixman/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/pixman/NEWS b/pixman/NEWS new file mode 100644 index 0000000..cb41258 --- /dev/null +++ b/pixman/NEWS @@ -0,0 +1,135 @@ +Snapshot 0.1.6 (2005-07-28 Carl Worth <cworth@cworth.org>) +========================================================== +Behavioral changes +------------------ +Clips are changed to only affect destination operands, not +sources. This gives the desired behavior for cairo. If the X server's +Render implementation wants to use pixman it will have to select +source clipping, (presumably through a new API call that we can add at +that point). + +Bug fixes +--------- +Fix leak of the clip region associated with an image in +pixman_image_destroy. + +Fix units for stride return to be FbStip-sized, (this bug was causing +non antialiased text in cairo to appear as garbage). + +Other changes +------------- +The implementation has been merged considerably with xserver/fb. Most +of the merge was just name changes, but there were likely some bug +fixes or performance improvements in there as well. + +Snapshot 0.1.5 (2005-05-18 Carl Worth <cworth@cworth.org>) +========================================================== +Bug fixes +--------- +Fix confusion of depth and bpp which was causing cairo to crash on +some X servers. + +Properly declare pixman_fixed16_16_t as int32_t which fixes +compilation failures on some platforms. + +Fix to find inttypes.h on AIX. + +Fix bug in compositing when the source image has no alpha channel. + +Some fixes to the clipping code. + +Fix memory leak when asked to draw a degenerate trapezoid list. + +Snapshot 0.1.4 (2005-03-07 Carl Worth <cworth@cworth.org>) +========================================================== +API Addition +------------ +Add new function: + + void + pixman_add_trapezoids (pixman_image_t *dst, + int x_off, + int y_off, + const pixman_trapezoid_t *traps, + int ntraps); + +Performance improvement +----------------------- +Restrict size of intermediate surface used while compositing +trapezoids based on the bounds of the desination surface. + +Bug fixes +--------- +Fix rendering on 64-bit platforms. + +Snapshot 0.1.3 (2005-01-21 Carl Worth <cworth@cworth.org>) +========================================================== +Performance improvements +------------------------ +Solid fills are now much faster, (thanks to Alexander Larsson). + +Bug fixes +--------- +Fixed to quiet warnings in newer versions of gcc. + +Don't divide-by-zero if given an image of size 0x0. + +Fixed several corner cases where values outside a trapezoid would be +drawn with alpha 1/255 (in the 8-bit case). + +Internal changes +---------------- +Imported the newer point-sampling trapezoid rasterization code that +Keith Packard wrote for the X server. This provide pixel-perfect +matching with the Render extension as well as code that is simpler, +more robust, and easier to maintain. + +Snapshot 0.1.2 (2004-10-27 Carl Worth <cworth@cworth.org>) +========================================================== +New functionality +----------------- +Added three new functions: + + pixman_image_set_component_alpha + pixman_format_get_masks + pixman_image_get_format + +The first enables component-alpha compositing which can be used for +optimizing sub-pixel rendering of text and other geometry. This is +useful when the geometrical relationship of the sub-pixel components +of the display device are known, (eg. with flat-panel monitors rather +than CRTs). + +The other two functions are simple query functions that were missing. + +Bug fixes +--------- +Enabling both transform and repeat simultaneously now works. +Some byte-order fixes. +Clipping fixes: pixman now takes a copy of the client clipping region + client clipping is now actually used, it wasn't earlier. + +Snapshot 0.1.1 (2004-04-16 Carl Worth <cworth@east.isi.edu>) +============================================================ +Build fixes for cygwin +---------------------- +This snapshot adds the -no-undefined flag during compilation which is +necessart for building a shared library under cygwin. + +Cleanup of the public API +------------------------- +We recently noticed that there were a coupld of bugs in the script +that renamed libic to libpixman. Fixing this requires the following +changes in the public API: + + PIXMAN_FORMAT_AR_GB32 -> PIXMAN_FORMAT_ARGB32 + PIXMAN_FORMAT_RG_B24 -> PIXMAN_FORMAT_RGB24 + +While we're changing that, we also normalized the names of structure +tags, for example: + + struct _pixman_region16_t -> struct pixman_region16 + etc. + +but users are expected to use typedefs such as pixman_region16_t +anyway. diff --git a/pixman/README b/pixman/README new file mode 100644 index 0000000..621ab94 --- /dev/null +++ b/pixman/README @@ -0,0 +1,47 @@ +libpixman - Pixel manipulation library + +libpixman is a merge of libpixregion and libic. +It also includes the slim headers. + +---------------------------------------------------------------------- +libpixregion - Pixel region Library + +libpixregion is a generic library for manipulating pixel regions. A +PixRegion is a set of Y-X banded rectangles that cover the desired +region. + +The original code for libxregion was part of the reference X server +implementation of the X Window System. A modified copy of the code +also exists in the Xlib client library. libpixregion was formed so +that both the X server and client libraries could share common code +for region manipulation. + +libpixregion is also intended to be applicable outside of the X Window +System. The public interface of libpixregion does not depend on any +part of the X Window System. + +---------------------------------------------------------------------- +libic - Image compositing library + +libic is a generic image compositing library. libic provides +Porter/Duff compositing of images and implicit mask generation for +geometric primitives including trapezoids, triangles, and rectangles. + +The semantics of libic are designed to precisely match the +specification of the X Render extension. In fact, the initial +implementation of libic was lifted from the reference implementation +of RENDER from the X server. + +However, libic is intended to be useful independent of the X Window +System. The public interface exported by libic does not contain any +X-specific data structures. + +Carl Worth +cworth@isi.edu + +Keith Packard (keithp@keithp.com) originally wrote all the original +RENDER code that was yanked out to become libic. Keith also provided +impetus and guidance in the development of libic. + +---------------------------------------------------------------------- +slim - Shared Library Interface Macros diff --git a/pixman/TODO b/pixman/TODO new file mode 100644 index 0000000..5560d8d --- /dev/null +++ b/pixman/TODO @@ -0,0 +1,10 @@ +Need to finish up libpixman to the point where there X server can use +it in place of its original copy of all this code (eg. in fb). This +means merging features that have happened in either tree since the +birth of libpixman. Off-hand I can think of the following things that +have happened: + + * libpixman has fix for transform + repeat + * X server has some (MMX? SSE?) optimized compositing code + +But see the logs for more details. diff --git a/pixman/src/Makefile.am b/pixman/src/Makefile.am new file mode 100644 index 0000000..50b3516 --- /dev/null +++ b/pixman/src/Makefile.am @@ -0,0 +1,34 @@ +noinst_LTLIBRARIES = libpixman.la + +libpixman_la_SOURCES = \ + pixman.h \ + pixman-remap.h \ + pixman-xserver-compat.h \ + pixregion.c \ + pixregionint.h \ + fbpict.h \ + ic.c \ + icblt.c \ + icbltone.c \ + iccolor.c \ + icformat.c \ + icimage.c \ + icimage.h \ + icint.h \ + icpixels.c \ + icrect.c \ + icrop.h \ + icstipple.c \ + ictrap.c \ + ictransform.c \ + ictri.c \ + icutil.c \ + fbedge.c \ + fbedgeimp.h \ + fbtrap.c \ + fbcompose.c \ + renderedge.c \ + renderedge.h \ + slim_internal.h + +INCLUDES = -I$(top_srcdir) -I$(srcdir) $(WARN_CFLAGS) diff --git a/pixman/src/Makefile.in b/pixman/src/Makefile.in new file mode 100644 index 0000000..0e3ddca --- /dev/null +++ b/pixman/src/Makefile.in @@ -0,0 +1,547 @@ +# Makefile.in generated by automake 1.9.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +SOURCES = $(libpixman_la_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = pixman/src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libpixman_la_LIBADD = +am_libpixman_la_OBJECTS = pixregion.lo ic.lo icblt.lo icbltone.lo \ + iccolor.lo icformat.lo icimage.lo icpixels.lo icrect.lo \ + icstipple.lo ictrap.lo ictransform.lo ictri.lo icutil.lo \ + fbedge.lo fbtrap.lo fbcompose.lo renderedge.lo +libpixman_la_OBJECTS = $(am_libpixman_la_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libpixman_la_SOURCES) +DIST_SOURCES = $(libpixman_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +ATSUI_FONT_FEATURE = @ATSUI_FONT_FEATURE@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CAIRO_CFLAGS = @CAIRO_CFLAGS@ +CAIRO_HAS_ATSUI_FONT_FALSE = @CAIRO_HAS_ATSUI_FONT_FALSE@ +CAIRO_HAS_ATSUI_FONT_TRUE = @CAIRO_HAS_ATSUI_FONT_TRUE@ +CAIRO_HAS_FT_FONT_FALSE = @CAIRO_HAS_FT_FONT_FALSE@ +CAIRO_HAS_FT_FONT_TRUE = @CAIRO_HAS_FT_FONT_TRUE@ +CAIRO_HAS_GLITZ_SURFACE_FALSE = @CAIRO_HAS_GLITZ_SURFACE_FALSE@ +CAIRO_HAS_GLITZ_SURFACE_TRUE = @CAIRO_HAS_GLITZ_SURFACE_TRUE@ +CAIRO_HAS_PDF_SURFACE_FALSE = @CAIRO_HAS_PDF_SURFACE_FALSE@ +CAIRO_HAS_PDF_SURFACE_TRUE = @CAIRO_HAS_PDF_SURFACE_TRUE@ +CAIRO_HAS_PNG_FUNCTIONS_FALSE = @CAIRO_HAS_PNG_FUNCTIONS_FALSE@ +CAIRO_HAS_PNG_FUNCTIONS_TRUE = @CAIRO_HAS_PNG_FUNCTIONS_TRUE@ +CAIRO_HAS_PS_SURFACE_FALSE = @CAIRO_HAS_PS_SURFACE_FALSE@ +CAIRO_HAS_PS_SURFACE_TRUE = @CAIRO_HAS_PS_SURFACE_TRUE@ +CAIRO_HAS_QUARTZ_SURFACE_FALSE = @CAIRO_HAS_QUARTZ_SURFACE_FALSE@ +CAIRO_HAS_QUARTZ_SURFACE_TRUE = @CAIRO_HAS_QUARTZ_SURFACE_TRUE@ +CAIRO_HAS_WIN32_FONT_FALSE = @CAIRO_HAS_WIN32_FONT_FALSE@ +CAIRO_HAS_WIN32_FONT_TRUE = @CAIRO_HAS_WIN32_FONT_TRUE@ +CAIRO_HAS_WIN32_SURFACE_FALSE = @CAIRO_HAS_WIN32_SURFACE_FALSE@ +CAIRO_HAS_WIN32_SURFACE_TRUE = @CAIRO_HAS_WIN32_SURFACE_TRUE@ +CAIRO_HAS_XCB_SURFACE_FALSE = @CAIRO_HAS_XCB_SURFACE_FALSE@ +CAIRO_HAS_XCB_SURFACE_TRUE = @CAIRO_HAS_XCB_SURFACE_TRUE@ +CAIRO_HAS_XLIB_SURFACE_FALSE = @CAIRO_HAS_XLIB_SURFACE_FALSE@ +CAIRO_HAS_XLIB_SURFACE_TRUE = @CAIRO_HAS_XLIB_SURFACE_TRUE@ +CAIRO_LIBS = @CAIRO_LIBS@ +CAIRO_VERSION_MAJOR = @CAIRO_VERSION_MAJOR@ +CAIRO_VERSION_MICRO = @CAIRO_VERSION_MICRO@ +CAIRO_VERSION_MINOR = @CAIRO_VERSION_MINOR@ +CAIRO_VERSION_OTHER = @CAIRO_VERSION_OTHER@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_GTK_DOC_FALSE = @ENABLE_GTK_DOC_FALSE@ +ENABLE_GTK_DOC_TRUE = @ENABLE_GTK_DOC_TRUE@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ +FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_CONFIG = @FREETYPE_CONFIG@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +FREETYPE_REQUIRES = @FREETYPE_REQUIRES@ +FT_FONT_FEATURE = @FT_FONT_FEATURE@ +GLITZ_CFLAGS = @GLITZ_CFLAGS@ +GLITZ_LIBS = @GLITZ_LIBS@ +GLITZ_REQUIRES = @GLITZ_REQUIRES@ +GLITZ_SURFACE_FEATURE = @GLITZ_SURFACE_FEATURE@ +GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@ +GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ +HAVE_PTHREAD_FALSE = @HAVE_PTHREAD_FALSE@ +HAVE_PTHREAD_TRUE = @HAVE_PTHREAD_TRUE@ +HTML_DIR = @HTML_DIR@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PDF_LIBS = @PDF_LIBS@ +PDF_SURFACE_FEATURE = @PDF_SURFACE_FEATURE@ +PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ +PKG_CONFIG = @PKG_CONFIG@ +PNG_CFLAGS = @PNG_CFLAGS@ +PNG_FUNCTIONS_FEATURE = @PNG_FUNCTIONS_FEATURE@ +PNG_LIBS = @PNG_LIBS@ +PNG_REQUIRES = @PNG_REQUIRES@ +PS_LIBS = @PS_LIBS@ +PS_SURFACE_FEATURE = @PS_SURFACE_FEATURE@ +QUARTZ_SURFACE_FEATURE = @QUARTZ_SURFACE_FEATURE@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +VERSION_INFO = @VERSION_INFO@ +WIN32_FONT_FEATURE = @WIN32_FONT_FEATURE@ +WIN32_SURFACE_FEATURE = @WIN32_SURFACE_FEATURE@ +XCB_CFLAGS = @XCB_CFLAGS@ +XCB_LIBS = @XCB_LIBS@ +XCB_SURFACE_FEATURE = @XCB_SURFACE_FEATURE@ +XLIB_SURFACE_FEATURE = @XLIB_SURFACE_FEATURE@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XRENDER_REQUIRES = @XRENDER_REQUIRES@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +noinst_LTLIBRARIES = libpixman.la +libpixman_la_SOURCES = \ + pixman.h \ + pixman-remap.h \ + pixman-xserver-compat.h \ + pixregion.c \ + pixregionint.h \ + fbpict.h \ + ic.c \ + icblt.c \ + icbltone.c \ + iccolor.c \ + icformat.c \ + icimage.c \ + icimage.h \ + icint.h \ + icpixels.c \ + icrect.c \ + icrop.h \ + icstipple.c \ + ictrap.c \ + ictransform.c \ + ictri.c \ + icutil.c \ + fbedge.c \ + fbedgeimp.h \ + fbtrap.c \ + fbcompose.c \ + renderedge.c \ + renderedge.h \ + slim_internal.h + +INCLUDES = -I$(top_srcdir) -I$(srcdir) $(WARN_CFLAGS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu pixman/src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu pixman/src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libpixman.la: $(libpixman_la_OBJECTS) $(libpixman_la_DEPENDENCIES) + $(LINK) $(libpixman_la_LDFLAGS) $(libpixman_la_OBJECTS) $(libpixman_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbcompose.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbedge.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fbtrap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ic.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icblt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icbltone.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iccolor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icformat.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icimage.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icpixels.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icrect.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icstipple.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ictransform.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ictrap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ictri.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icutil.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pixregion.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/renderedge.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/pixman/src/fbcompose.c b/pixman/src/fbcompose.c new file mode 100644 index 0000000..8b3799b --- /dev/null +++ b/pixman/src/fbcompose.c @@ -0,0 +1,3617 @@ +/* + * $XdotOrg: xc/programs/Xserver/fb/fbcompose.c,v 1.5 2005/01/13 20:49:21 sandmann Exp $ + * + * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. + * 2005 Lars Knoll & Zack Rusin, Trolltech + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +#include <stdio.h> +#include "pixman-xserver-compat.h" +#include "fbpict.h" + +#ifdef RENDER + +#include "pixregionint.h" + +// #define PIXMAN_CONVOLUTION +// #define PIXMAN_GRADIENTS +// #define PIXMAN_INDEXED_FORMATS + +static Bool +PictureTransformPoint3d (pixman_transform_t *transform, + PictVector *vector) +{ + PictVector result; + int i, j; + xFixed_32_32 partial; + xFixed_48_16 v; + + for (j = 0; j < 3; j++) + { + v = 0; + for (i = 0; i < 3; i++) + { + partial = ((xFixed_48_16) transform->matrix[j][i] * + (xFixed_48_16) vector->vector[i]); + v += partial >> 16; + } + if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16) + return FALSE; + result.vector[j] = (xFixed) v; + } + if (!result.vector[2]) + return FALSE; + *vector = result; + return TRUE; +} + +#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b)) + +#define SCANLINE_BUFFER_LENGTH 2048 + +typedef FASTCALL void (*fetchProc)(const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed); + +/* + * All of the fetch functions + */ + +static FASTCALL void +fbFetch_a8r8g8b8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + memcpy(buffer, (const CARD32 *)bits + x, width*sizeof(CARD32)); +} + +static FASTCALL void +fbFetch_x8r8g8b8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD32 *pixel = (const CARD32 *)bits + x; + const CARD32 *end = pixel + width; + while (pixel < end) { + *buffer++ = *pixel++ | 0xff000000; + } +} + +static FASTCALL void +fbFetch_a8b8g8r8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD32 *pixel = (CARD32 *)bits + x; + const CARD32 *end = pixel + width; + while (pixel < end) { + *buffer++ = ((*pixel & 0xff00ff00) | + ((*pixel >> 16) & 0xff) | + ((*pixel & 0xff) << 16)); + ++pixel; + } +} + +static FASTCALL void +fbFetch_x8b8g8r8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD32 *pixel = (CARD32 *)bits + x; + const CARD32 *end = pixel + width; + while (pixel < end) { + *buffer++ = 0xff000000 | + ((*pixel & 0x0000ff00) | + ((*pixel >> 16) & 0xff) | + ((*pixel & 0xff) << 16)); + ++pixel; + } +} + +static FASTCALL void +fbFetch_r8g8b8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD8 *pixel = (const CARD8 *)bits + 3*x; + const CARD8 *end = pixel + 3*width; + while (pixel < end) { + CARD32 b = Fetch24(pixel) | 0xff000000; + pixel += 3; + *buffer++ = b; + } +} + +static FASTCALL void +fbFetch_b8g8r8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD8 *pixel = (const CARD8 *)bits + 3*x; + const CARD8 *end = pixel + 3*width; + while (pixel < end) { + CARD32 b = 0xff000000; +#if IMAGE_BYTE_ORDER == MSBFirst + b |= (*pixel++); + b |= (*pixel++ << 8); + b |= (*pixel++ << 16); +#else + b |= (*pixel++ << 16); + b |= (*pixel++ << 8); + b |= (*pixel++); +#endif + } +} + +static FASTCALL void +fbFetch_r5g6b5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD16 *pixel = (const CARD16 *)bits + x; + const CARD16 *end = pixel + width; + while (pixel < end) { + CARD32 p = *pixel++; + CARD32 r = (((p) << 3) & 0xf8) | + (((p) << 5) & 0xfc00) | + (((p) << 8) & 0xf80000); + r |= (r >> 5) & 0x70007; + r |= (r >> 6) & 0x300; + *buffer++ = 0xff000000 | r; + } +} + +static FASTCALL void +fbFetch_b5g6r5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD16 *pixel = (const CARD16 *)bits + x; + const CARD16 *end = pixel + width; + while (pixel < end) { + CARD32 p = *pixel++; + CARD32 r,g,b; + + b = ((p & 0xf800) | ((p & 0xe000) >> 5)) >> 8; + g = ((p & 0x07e0) | ((p & 0x0600) >> 6)) << 5; + r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14; + *buffer++ = (0xff000000 | r | g | b); + } +} + +static FASTCALL void +fbFetch_a1r5g5b5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD16 *pixel = (const CARD16 *)bits + x; + const CARD16 *end = pixel + width; + while (pixel < end) { + CARD32 p = *pixel++; + CARD32 r,g,b, a; + + a = (CARD32) ((CARD8) (0 - ((p & 0x8000) >> 15))) << 24; + r = ((p & 0x7c00) | ((p & 0x7000) >> 5)) << 9; + g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; + b = ((p & 0x001c) | ((p & 0x001f) << 5)) >> 2; + *buffer++ = (a | r | g | b); + } +} + +static FASTCALL void +fbFetch_x1r5g5b5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD16 *pixel = (const CARD16 *)bits + x; + const CARD16 *end = pixel + width; + while (pixel < end) { + CARD32 p = *pixel++; + CARD32 r,g,b; + + r = ((p & 0x7c00) | ((p & 0x7000) >> 5)) << 9; + g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; + b = ((p & 0x001c) | ((p & 0x001f) << 5)) >> 2; + *buffer++ = (0xff000000 | r | g | b); + } +} + +static FASTCALL void +fbFetch_a1b5g5r5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD16 *pixel = (const CARD16 *)bits + x; + const CARD16 *end = pixel + width; + while (pixel < end) { + CARD32 p = *pixel++; + CARD32 r,g,b, a; + + a = (CARD32) ((CARD8) (0 - ((p & 0x8000) >> 15))) << 24; + b = ((p & 0x7c00) | ((p & 0x7000) >> 5)) >> 7; + g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; + r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14; + *buffer++ = (a | r | g | b); + } +} + +static FASTCALL void +fbFetch_x1b5g5r5 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD16 *pixel = (const CARD16 *)bits + x; + const CARD16 *end = pixel + width; + while (pixel < end) { + CARD32 p = *pixel++; + CARD32 r,g,b; + + b = ((p & 0x7c00) | ((p & 0x7000) >> 5)) >> 7; + g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6; + r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14; + *buffer++ = (0xff000000 | r | g | b); + } +} + +static FASTCALL void +fbFetch_a4r4g4b4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD16 *pixel = (const CARD16 *)bits + x; + const CARD16 *end = pixel + width; + while (pixel < end) { + CARD32 p = *pixel++; + CARD32 r,g,b, a; + + a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16; + r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12; + g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; + b = ((p & 0x000f) | ((p & 0x000f) << 4)); + *buffer++ = (a | r | g | b); + } +} + +static FASTCALL void +fbFetch_x4r4g4b4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD16 *pixel = (const CARD16 *)bits + x; + const CARD16 *end = pixel + width; + while (pixel < end) { + CARD32 p = *pixel++; + CARD32 r,g,b; + + r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12; + g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; + b = ((p & 0x000f) | ((p & 0x000f) << 4)); + *buffer++ = (0xff000000 | r | g | b); + } +} + +static FASTCALL void +fbFetch_a4b4g4r4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD16 *pixel = (const CARD16 *)bits + x; + const CARD16 *end = pixel + width; + while (pixel < end) { + CARD32 p = *pixel++; + CARD32 r,g,b, a; + + a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16; + b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12; + g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; + r = ((p & 0x000f) | ((p & 0x000f) << 4)); + *buffer++ = (a | r | g | b); + } +} + +static FASTCALL void +fbFetch_x4b4g4r4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD16 *pixel = (const CARD16 *)bits + x; + const CARD16 *end = pixel + width; + while (pixel < end) { + CARD32 p = *pixel++; + CARD32 r,g,b; + + b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12; + g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8; + r = ((p & 0x000f) | ((p & 0x000f) << 4)); + *buffer++ = (0xff000000 | r | g | b); + } +} + +static FASTCALL void +fbFetch_a8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD8 *pixel = (const CARD8 *)bits + x; + const CARD8 *end = pixel + width; + while (pixel < end) { + *buffer++ = (*pixel++) << 24; + } +} + +static FASTCALL void +fbFetch_r3g3b2 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD8 *pixel = (const CARD8 *)bits + x; + const CARD8 *end = pixel + width; + while (pixel < end) { + CARD32 p = *pixel++; + CARD32 r,g,b; + + r = ((p & 0xe0) | ((p & 0xe0) >> 3) | ((p & 0xc0) >> 6)) << 16; + g = ((p & 0x1c) | ((p & 0x18) >> 3) | ((p & 0x1c) << 3)) << 8; + b = (((p & 0x03) ) | + ((p & 0x03) << 2) | + ((p & 0x03) << 4) | + ((p & 0x03) << 6)); + *buffer++ = (0xff000000 | r | g | b); + } +} + +static FASTCALL void +fbFetch_b2g3r3 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD8 *pixel = (const CARD8 *)bits + x; + const CARD8 *end = pixel + width; + while (pixel < end) { + CARD32 p = *pixel++; + CARD32 r,g,b; + + b = (((p & 0xc0) ) | + ((p & 0xc0) >> 2) | + ((p & 0xc0) >> 4) | + ((p & 0xc0) >> 6)); + g = ((p & 0x38) | ((p & 0x38) >> 3) | ((p & 0x30) << 2)) << 8; + r = (((p & 0x07) ) | + ((p & 0x07) << 3) | + ((p & 0x06) << 6)) << 16; + *buffer++ = (0xff000000 | r | g | b); + } +} + +static FASTCALL void +fbFetch_a2r2g2b2 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD8 *pixel = (const CARD8 *)bits + x; + const CARD8 *end = pixel + width; + while (pixel < end) { + CARD32 p = *pixel++; + CARD32 a,r,g,b; + + a = ((p & 0xc0) * 0x55) << 18; + r = ((p & 0x30) * 0x55) << 12; + g = ((p & 0x0c) * 0x55) << 6; + b = ((p & 0x03) * 0x55); + *buffer++ = a|r|g|b; + } +} + +static FASTCALL void +fbFetch_a2b2g2r2 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD8 *pixel = (const CARD8 *)bits + x; + const CARD8 *end = pixel + width; + while (pixel < end) { + CARD32 p = *pixel++; + CARD32 a,r,g,b; + + a = ((p & 0xc0) * 0x55) << 18; + b = ((p & 0x30) * 0x55) >> 6; + g = ((p & 0x0c) * 0x55) << 6; + r = ((p & 0x03) * 0x55) << 16; + *buffer++ = a|r|g|b; + } +} + +static FASTCALL void +fbFetch_c8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + const CARD8 *pixel = (const CARD8 *)bits + x; + const CARD8 *end = pixel + width; + while (pixel < end) { + CARD32 p = *pixel++; + *buffer++ = indexed->rgba[p]; + } +} + +#define Fetch8(l,o) (((CARD8 *) (l))[(o) >> 2]) +#if IMAGE_BYTE_ORDER == MSBFirst +#define Fetch4(l,o) ((o) & 2 ? Fetch8(l,o) & 0xf : Fetch8(l,o) >> 4) +#else +#define Fetch4(l,o) ((o) & 2 ? Fetch8(l,o) >> 4 : Fetch8(l,o) & 0xf) +#endif + +static FASTCALL void +fbFetch_a4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 p = Fetch4(bits, i + x); + + p |= p << 4; + *buffer++ = p << 24; + } +} + +static FASTCALL void +fbFetch_r1g2b1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 p = Fetch4(bits, i + x); + CARD32 r,g,b; + + r = ((p & 0x8) * 0xff) << 13; + g = ((p & 0x6) * 0x55) << 7; + b = ((p & 0x1) * 0xff); + *buffer++ = 0xff000000|r|g|b; + } +} + +static FASTCALL void +fbFetch_b1g2r1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 p = Fetch4(bits, i + x); + CARD32 r,g,b; + + b = ((p & 0x8) * 0xff) >> 3; + g = ((p & 0x6) * 0x55) << 7; + r = ((p & 0x1) * 0xff) << 16; + *buffer++ = 0xff000000|r|g|b; + } +} + +static FASTCALL void +fbFetch_a1r1g1b1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 p = Fetch4(bits, i + x); + CARD32 a,r,g,b; + + a = ((p & 0x8) * 0xff) << 21; + r = ((p & 0x4) * 0xff) << 14; + g = ((p & 0x2) * 0xff) << 7; + b = ((p & 0x1) * 0xff); + *buffer++ = a|r|g|b; + } +} + +static FASTCALL void +fbFetch_a1b1g1r1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 p = Fetch4(bits, i + x); + CARD32 a,r,g,b; + + a = ((p & 0x8) * 0xff) << 21; + r = ((p & 0x4) * 0xff) >> 3; + g = ((p & 0x2) * 0xff) << 7; + b = ((p & 0x1) * 0xff) << 16; + *buffer++ = a|r|g|b; + } +} + +static FASTCALL void +fbFetch_c4 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 p = Fetch4(bits, i + x); + + *buffer++ = indexed->rgba[p]; + } +} + + +static FASTCALL void +fbFetch_a1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 p = ((CARD32 *)bits)[(i + x) >> 5]; + CARD32 a; +#if BITMAP_BIT_ORDER == MSBFirst + a = p >> (0x1f - ((i+x) & 0x1f)); +#else + a = p >> ((i+x) & 0x1f); +#endif + a = a & 1; + a |= a << 1; + a |= a << 2; + a |= a << 4; + *buffer++ = a << 24; + } +} + +static FASTCALL void +fbFetch_g1 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 p = ((CARD32 *)bits)[(i+x) >> 5]; + CARD32 a; +#if BITMAP_BIT_ORDER == MSBFirst + a = p >> (0x1f - ((i+x) & 0x1f)); +#else + a = p >> ((i+x) & 0x1f); +#endif + a = a & 1; + *buffer++ = indexed->rgba[a]; + } +} + +static fetchProc fetchProcForPicture (PicturePtr pict) +{ + switch(pict->format_code) { + case PICT_a8r8g8b8: return fbFetch_a8r8g8b8; + case PICT_x8r8g8b8: return fbFetch_x8r8g8b8; + case PICT_a8b8g8r8: return fbFetch_a8b8g8r8; + case PICT_x8b8g8r8: return fbFetch_x8b8g8r8; + + /* 24bpp formats */ + case PICT_r8g8b8: return fbFetch_r8g8b8; + case PICT_b8g8r8: return fbFetch_b8g8r8; + + /* 16bpp formats */ + case PICT_r5g6b5: return fbFetch_r5g6b5; + case PICT_b5g6r5: return fbFetch_b5g6r5; + + case PICT_a1r5g5b5: return fbFetch_a1r5g5b5; + case PICT_x1r5g5b5: return fbFetch_x1r5g5b5; + case PICT_a1b5g5r5: return fbFetch_a1b5g5r5; + case PICT_x1b5g5r5: return fbFetch_x1b5g5r5; + case PICT_a4r4g4b4: return fbFetch_a4r4g4b4; + case PICT_x4r4g4b4: return fbFetch_x4r4g4b4; + case PICT_a4b4g4r4: return fbFetch_a4b4g4r4; + case PICT_x4b4g4r4: return fbFetch_x4b4g4r4; + + /* 8bpp formats */ + case PICT_a8: return fbFetch_a8; + case PICT_r3g3b2: return fbFetch_r3g3b2; + case PICT_b2g3r3: return fbFetch_b2g3r3; + case PICT_a2r2g2b2: return fbFetch_a2r2g2b2; + case PICT_a2b2g2r2: return fbFetch_a2b2g2r2; + case PICT_c8: return fbFetch_c8; + case PICT_g8: return fbFetch_c8; + + /* 4bpp formats */ + case PICT_a4: return fbFetch_a4; + case PICT_r1g2b1: return fbFetch_r1g2b1; + case PICT_b1g2r1: return fbFetch_b1g2r1; + case PICT_a1r1g1b1: return fbFetch_a1r1g1b1; + case PICT_a1b1g1r1: return fbFetch_a1b1g1r1; + case PICT_c4: return fbFetch_c4; + case PICT_g4: return fbFetch_c4; + + /* 1bpp formats */ + case PICT_a1: return fbFetch_a1; + case PICT_g1: return fbFetch_g1; + default: + return 0; + } +} + +/* + * Pixel wise fetching + */ + +typedef FASTCALL CARD32 (*fetchPixelProc)(const FbBits *bits, int offset, miIndexedPtr indexed); + +static FASTCALL CARD32 +fbFetchPixel_a8r8g8b8 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + return ((CARD32 *)bits)[offset]; +} + +static FASTCALL CARD32 +fbFetchPixel_x8r8g8b8 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + return ((CARD32 *)bits)[offset] | 0xff000000; +} + +static FASTCALL CARD32 +fbFetchPixel_a8b8g8r8 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD32 *)bits)[offset]; + + return ((pixel & 0xff000000) | + ((pixel >> 16) & 0xff) | + (pixel & 0x0000ff00) | + ((pixel & 0xff) << 16)); +} + +static FASTCALL CARD32 +fbFetchPixel_x8b8g8r8 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD32 *)bits)[offset]; + + return ((0xff000000) | + ((pixel >> 16) & 0xff) | + (pixel & 0x0000ff00) | + ((pixel & 0xff) << 16)); +} + +static FASTCALL CARD32 +fbFetchPixel_r8g8b8 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD8 *pixel = ((CARD8 *) bits) + (offset*3); +#if IMAGE_BYTE_ORDER == MSBFirst + return (0xff000000 | + (pixel[0] << 16) | + (pixel[1] << 8) | + (pixel[2])); +#else + return (0xff000000 | + (pixel[2] << 16) | + (pixel[1] << 8) | + (pixel[0])); +#endif +} + +static FASTCALL CARD32 +fbFetchPixel_b8g8r8 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD8 *pixel = ((CARD8 *) bits) + (offset*3); +#if IMAGE_BYTE_ORDER == MSBFirst + return (0xff000000 | + (pixel[2] << 16) | + (pixel[1] << 8) | + (pixel[0])); +#else + return (0xff000000 | + (pixel[0] << 16) | + (pixel[1] << 8) | + (pixel[2])); +#endif +} + +static FASTCALL CARD32 +fbFetchPixel_r5g6b5 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD16 *) bits)[offset]; + CARD32 r,g,b; + + r = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) << 8; + g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5; + b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2; + return (0xff000000 | r | g | b); +} + +static FASTCALL CARD32 +fbFetchPixel_b5g6r5 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD16 *) bits)[offset]; + CARD32 r,g,b; + + b = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) >> 8; + g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5; + r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14; + return (0xff000000 | r | g | b); +} + +static FASTCALL CARD32 +fbFetchPixel_a1r5g5b5 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD16 *) bits)[offset]; + CARD32 a,r,g,b; + + a = (CARD32) ((CARD8) (0 - ((pixel & 0x8000) >> 15))) << 24; + r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9; + g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; + b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2; + return (a | r | g | b); +} + +static FASTCALL CARD32 +fbFetchPixel_x1r5g5b5 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD16 *) bits)[offset]; + CARD32 r,g,b; + + r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9; + g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; + b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2; + return (0xff000000 | r | g | b); +} + +static FASTCALL CARD32 +fbFetchPixel_a1b5g5r5 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD16 *) bits)[offset]; + CARD32 a,r,g,b; + + a = (CARD32) ((CARD8) (0 - ((pixel & 0x8000) >> 15))) << 24; + b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7; + g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; + r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14; + return (a | r | g | b); +} + +static FASTCALL CARD32 +fbFetchPixel_x1b5g5r5 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD16 *) bits)[offset]; + CARD32 r,g,b; + + b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7; + g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; + r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14; + return (0xff000000 | r | g | b); +} + +static FASTCALL CARD32 +fbFetchPixel_a4r4g4b4 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD16 *) bits)[offset]; + CARD32 a,r,g,b; + + a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16; + r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; + g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; + b = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)); + return (a | r | g | b); +} + +static FASTCALL CARD32 +fbFetchPixel_x4r4g4b4 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD16 *) bits)[offset]; + CARD32 r,g,b; + + r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; + g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; + b = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)); + return (0xff000000 | r | g | b); +} + +static FASTCALL CARD32 +fbFetchPixel_a4b4g4r4 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD16 *) bits)[offset]; + CARD32 a,r,g,b; + + a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16; + b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; + g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; + r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)); + return (a | r | g | b); +} + +static FASTCALL CARD32 +fbFetchPixel_x4b4g4r4 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD16 *) bits)[offset]; + CARD32 r,g,b; + + b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; + g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; + r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)); + return (0xff000000 | r | g | b); +} + +static FASTCALL CARD32 +fbFetchPixel_a8 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD8 *) bits)[offset]; + + return pixel << 24; +} + +static FASTCALL CARD32 +fbFetchPixel_r3g3b2 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD8 *) bits)[offset]; + CARD32 r,g,b; + + r = ((pixel & 0xe0) | ((pixel & 0xe0) >> 3) | ((pixel & 0xc0) >> 6)) << 16; + g = ((pixel & 0x1c) | ((pixel & 0x18) >> 3) | ((pixel & 0x1c) << 3)) << 8; + b = (((pixel & 0x03) ) | + ((pixel & 0x03) << 2) | + ((pixel & 0x03) << 4) | + ((pixel & 0x03) << 6)); + return (0xff000000 | r | g | b); +} + +static FASTCALL CARD32 +fbFetchPixel_b2g3r3 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD8 *) bits)[offset]; + CARD32 r,g,b; + + b = (((pixel & 0xc0) ) | + ((pixel & 0xc0) >> 2) | + ((pixel & 0xc0) >> 4) | + ((pixel & 0xc0) >> 6)); + g = ((pixel & 0x38) | ((pixel & 0x38) >> 3) | ((pixel & 0x30) << 2)) << 8; + r = (((pixel & 0x07) ) | + ((pixel & 0x07) << 3) | + ((pixel & 0x06) << 6)) << 16; + return (0xff000000 | r | g | b); +} + +static FASTCALL CARD32 +fbFetchPixel_a2r2g2b2 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD8 *) bits)[offset]; + CARD32 a,r,g,b; + + a = ((pixel & 0xc0) * 0x55) << 18; + r = ((pixel & 0x30) * 0x55) << 12; + g = ((pixel & 0x0c) * 0x55) << 6; + b = ((pixel & 0x03) * 0x55); + return a|r|g|b; +} + +static FASTCALL CARD32 +fbFetchPixel_a2b2g2r2 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD8 *) bits)[offset]; + CARD32 a,r,g,b; + + a = ((pixel & 0xc0) * 0x55) << 18; + b = ((pixel & 0x30) * 0x55) >> 6; + g = ((pixel & 0x0c) * 0x55) << 6; + r = ((pixel & 0x03) * 0x55) << 16; + return a|r|g|b; +} + +static FASTCALL CARD32 +fbFetchPixel_c8 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD8 *) bits)[offset]; + return indexed->rgba[pixel]; +} + +#define Fetch8(l,o) (((CARD8 *) (l))[(o) >> 2]) +#if IMAGE_BYTE_ORDER == MSBFirst +#define Fetch4(l,o) ((o) & 2 ? Fetch8(l,o) & 0xf : Fetch8(l,o) >> 4) +#else +#define Fetch4(l,o) ((o) & 2 ? Fetch8(l,o) >> 4 : Fetch8(l,o) & 0xf) +#endif + +static FASTCALL CARD32 +fbFetchPixel_a4 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = Fetch4(bits, offset); + + pixel |= pixel << 4; + return pixel << 24; +} + +static FASTCALL CARD32 +fbFetchPixel_r1g2b1 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = Fetch4(bits, offset); + CARD32 r,g,b; + + r = ((pixel & 0x8) * 0xff) << 13; + g = ((pixel & 0x6) * 0x55) << 7; + b = ((pixel & 0x1) * 0xff); + return 0xff000000|r|g|b; +} + +static FASTCALL CARD32 +fbFetchPixel_b1g2r1 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = Fetch4(bits, offset); + CARD32 r,g,b; + + b = ((pixel & 0x8) * 0xff) >> 3; + g = ((pixel & 0x6) * 0x55) << 7; + r = ((pixel & 0x1) * 0xff) << 16; + return 0xff000000|r|g|b; +} + +static FASTCALL CARD32 +fbFetchPixel_a1r1g1b1 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = Fetch4(bits, offset); + CARD32 a,r,g,b; + + a = ((pixel & 0x8) * 0xff) << 21; + r = ((pixel & 0x4) * 0xff) << 14; + g = ((pixel & 0x2) * 0xff) << 7; + b = ((pixel & 0x1) * 0xff); + return a|r|g|b; +} + +static FASTCALL CARD32 +fbFetchPixel_a1b1g1r1 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = Fetch4(bits, offset); + CARD32 a,r,g,b; + + a = ((pixel & 0x8) * 0xff) << 21; + r = ((pixel & 0x4) * 0xff) >> 3; + g = ((pixel & 0x2) * 0xff) << 7; + b = ((pixel & 0x1) * 0xff) << 16; + return a|r|g|b; +} + +static FASTCALL CARD32 +fbFetchPixel_c4 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = Fetch4(bits, offset); + + return indexed->rgba[pixel]; +} + + +static FASTCALL CARD32 +fbFetchPixel_a1 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD32 *)bits)[offset >> 5]; + CARD32 a; +#if BITMAP_BIT_ORDER == MSBFirst + a = pixel >> (0x1f - (offset & 0x1f)); +#else + a = pixel >> (offset & 0x1f); +#endif + a = a & 1; + a |= a << 1; + a |= a << 2; + a |= a << 4; + return a << 24; +} + +static FASTCALL CARD32 +fbFetchPixel_g1 (const FbBits *bits, int offset, miIndexedPtr indexed) +{ + CARD32 pixel = ((CARD32 *)bits)[offset >> 5]; + CARD32 a; +#if BITMAP_BIT_ORDER == MSBFirst + a = pixel >> (0x1f - (offset & 0x1f)); +#else + a = pixel >> (offset & 0x1f); +#endif + a = a & 1; + return indexed->rgba[a]; +} + +static fetchPixelProc fetchPixelProcForPicture (PicturePtr pict) +{ + switch(pict->format_code) { + case PICT_a8r8g8b8: return fbFetchPixel_a8r8g8b8; + case PICT_x8r8g8b8: return fbFetchPixel_x8r8g8b8; + case PICT_a8b8g8r8: return fbFetchPixel_a8b8g8r8; + case PICT_x8b8g8r8: return fbFetchPixel_x8b8g8r8; + + /* 24bpp formats */ + case PICT_r8g8b8: return fbFetchPixel_r8g8b8; + case PICT_b8g8r8: return fbFetchPixel_b8g8r8; + + /* 16bpp formats */ + case PICT_r5g6b5: return fbFetchPixel_r5g6b5; + case PICT_b5g6r5: return fbFetchPixel_b5g6r5; + + case PICT_a1r5g5b5: return fbFetchPixel_a1r5g5b5; + case PICT_x1r5g5b5: return fbFetchPixel_x1r5g5b5; + case PICT_a1b5g5r5: return fbFetchPixel_a1b5g5r5; + case PICT_x1b5g5r5: return fbFetchPixel_x1b5g5r5; + case PICT_a4r4g4b4: return fbFetchPixel_a4r4g4b4; + case PICT_x4r4g4b4: return fbFetchPixel_x4r4g4b4; + case PICT_a4b4g4r4: return fbFetchPixel_a4b4g4r4; + case PICT_x4b4g4r4: return fbFetchPixel_x4b4g4r4; + + /* 8bpp formats */ + case PICT_a8: return fbFetchPixel_a8; + case PICT_r3g3b2: return fbFetchPixel_r3g3b2; + case PICT_b2g3r3: return fbFetchPixel_b2g3r3; + case PICT_a2r2g2b2: return fbFetchPixel_a2r2g2b2; + case PICT_a2b2g2r2: return fbFetchPixel_a2b2g2r2; + case PICT_c8: return fbFetchPixel_c8; + case PICT_g8: return fbFetchPixel_c8; + + /* 4bpp formats */ + case PICT_a4: return fbFetchPixel_a4; + case PICT_r1g2b1: return fbFetchPixel_r1g2b1; + case PICT_b1g2r1: return fbFetchPixel_b1g2r1; + case PICT_a1r1g1b1: return fbFetchPixel_a1r1g1b1; + case PICT_a1b1g1r1: return fbFetchPixel_a1b1g1r1; + case PICT_c4: return fbFetchPixel_c4; + case PICT_g4: return fbFetchPixel_c4; + + /* 1bpp formats */ + case PICT_a1: return fbFetchPixel_a1; + case PICT_g1: return fbFetchPixel_g1; + default: + return 0; + } +} + + + +/* + * All the store functions + */ + +typedef FASTCALL void (*storeProc) (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed); + +#define Splita(v) CARD32 a = ((v) >> 24), r = ((v) >> 16) & 0xff, g = ((v) >> 8) & 0xff, b = (v) & 0xff +#define Split(v) CARD32 r = ((v) >> 16) & 0xff, g = ((v) >> 8) & 0xff, b = (v) & 0xff + +static FASTCALL void +fbStore_a8r8g8b8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + memcpy(((CARD32 *)bits) + x, values, width*sizeof(CARD32)); +} + +static FASTCALL void +fbStore_x8r8g8b8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD32 *pixel = (CARD32 *)bits + x; + for (i = 0; i < width; ++i) + *pixel++ = values[i] & 0xffffff; +} + +static FASTCALL void +fbStore_a8b8g8r8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD32 *pixel = (CARD32 *)bits + x; + for (i = 0; i < width; ++i) + *pixel++ = (values[i] & 0xff00ff00) | ((values[i] >> 16) && 0xff) | ((values[i] & 0xff) << 16); +} + +static FASTCALL void +fbStore_x8b8g8r8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD32 *pixel = (CARD32 *)bits + x; + for (i = 0; i < width; ++i) + *pixel++ = (values[i] & 0x0000ff00) | ((values[i] >> 16) && 0xff) | ((values[i] & 0xff) << 16); +} + +static FASTCALL void +fbStore_r8g8b8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD8 *pixel = ((CARD8 *) bits) + x; + for (i = 0; i < width; ++i) { + Store24(pixel, values[i]); + pixel += 3; + } +} + +static FASTCALL void +fbStore_b8g8r8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD8 *pixel = ((CARD8 *) bits) + x; + for (i = 0; i < width; ++i) { +#if IMAGE_BYTE_ORDER == MSBFirst + *pixel++ = Blue(values[i]); + *pixel++ = Green(values[i]); + *pixel++ = Red(values[i]); +#else + *pixel++ = Red(values[i]); + *pixel++ = Green(values[i]); + *pixel++ = Blue(values[i]); +#endif + } +} + +static FASTCALL void +fbStore_r5g6b5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD16 *pixel = ((CARD16 *) bits) + x; + for (i = 0; i < width; ++i) { + CARD32 s = values[i]; + *pixel++ = ((s >> 3) & 0x001f) | + ((s >> 5) & 0x07e0) | + ((s >> 8) & 0xf800); + } +} + +static FASTCALL void +fbStore_b5g6r5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD16 *pixel = ((CARD16 *) bits) + x; + for (i = 0; i < width; ++i) { + Split(values[i]); + *pixel++ = (((b << 8) & 0xf800) | + ((g << 3) & 0x07e0) | + ((r >> 3) )); + } +} + +static FASTCALL void +fbStore_a1r5g5b5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD16 *pixel = ((CARD16 *) bits) + x; + for (i = 0; i < width; ++i) { + Splita(values[i]); + *pixel++ = (((a << 8) & 0x8000) | + ((r << 7) & 0x7c00) | + ((g << 2) & 0x03e0) | + ((b >> 3) )); + } +} + +static FASTCALL void +fbStore_x1r5g5b5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD16 *pixel = ((CARD16 *) bits) + x; + for (i = 0; i < width; ++i) { + Split(values[i]); + *pixel++ = (((r << 7) & 0x7c00) | + ((g << 2) & 0x03e0) | + ((b >> 3) )); + } +} + +static FASTCALL void +fbStore_a1b5g5r5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD16 *pixel = ((CARD16 *) bits) + x; + for (i = 0; i < width; ++i) { + Splita(values[i]); + *pixel++ = (((a << 8) & 0x8000) | + ((b << 7) & 0x7c00) | + ((g << 2) & 0x03e0) | + ((r >> 3) )); + } +} + +static FASTCALL void +fbStore_x1b5g5r5 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD16 *pixel = ((CARD16 *) bits) + x; + for (i = 0; i < width; ++i) { + Split(values[i]); + *pixel++ = (((b << 7) & 0x7c00) | + ((g << 2) & 0x03e0) | + ((r >> 3) )); + } +} + +static FASTCALL void +fbStore_a4r4g4b4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD16 *pixel = ((CARD16 *) bits) + x; + for (i = 0; i < width; ++i) { + Splita(values[i]); + *pixel++ = (((a << 8) & 0xf000) | + ((r << 4) & 0x0f00) | + ((g ) & 0x00f0) | + ((b >> 4) )); + } +} + +static FASTCALL void +fbStore_x4r4g4b4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD16 *pixel = ((CARD16 *) bits) + x; + for (i = 0; i < width; ++i) { + Split(values[i]); + *pixel++ = (((r << 4) & 0x0f00) | + ((g ) & 0x00f0) | + ((b >> 4) )); + } +} + +static FASTCALL void +fbStore_a4b4g4r4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD16 *pixel = ((CARD16 *) bits) + x; + for (i = 0; i < width; ++i) { + Splita(values[i]); + *pixel++ = (((a << 8) & 0xf000) | + ((b << 4) & 0x0f00) | + ((g ) & 0x00f0) | + ((r >> 4) )); + } +} + +static FASTCALL void +fbStore_x4b4g4r4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD16 *pixel = ((CARD16 *) bits) + x; + for (i = 0; i < width; ++i) { + Split(values[i]); + *pixel++ = (((b << 4) & 0x0f00) | + ((g ) & 0x00f0) | + ((r >> 4) )); + } +} + +static FASTCALL void +fbStore_a8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD8 *pixel = ((CARD8 *) bits) + x; + for (i = 0; i < width; ++i) { + *pixel++ = values[i] >> 24; + } +} + +static FASTCALL void +fbStore_r3g3b2 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD8 *pixel = ((CARD8 *) bits) + x; + for (i = 0; i < width; ++i) { + Split(values[i]); + *pixel++ = (((r ) & 0xe0) | + ((g >> 3) & 0x1c) | + ((b >> 6) )); + } +} + +static FASTCALL void +fbStore_b2g3r3 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD8 *pixel = ((CARD8 *) bits) + x; + for (i = 0; i < width; ++i) { + Split(values[i]); + *pixel++ = (((b ) & 0xe0) | + ((g >> 3) & 0x1c) | + ((r >> 6) )); + } +} + +static FASTCALL void +fbStore_a2r2g2b2 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD8 *pixel = ((CARD8 *) bits) + x; + for (i = 0; i < width; ++i) { + Splita(values[i]); + *pixel++ = (((a ) & 0xc0) | + ((r >> 2) & 0x30) | + ((g >> 4) & 0x0c) | + ((b >> 6) )); + } +} + +static FASTCALL void +fbStore_c8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + CARD8 *pixel = ((CARD8 *) bits) + x; + for (i = 0; i < width; ++i) { + *pixel++ = miIndexToEnt24(indexed,values[i]); + } +} + +#define Store8(l,o,v) (((CARD8 *) l)[(o) >> 3] = (v)) +#if IMAGE_BYTE_ORDER == MSBFirst +#define Store4(l,o,v) Store8(l,o,((o) & 4 ? \ + (Fetch8(l,o) & 0xf0) | (v) : \ + (Fetch8(l,o) & 0x0f) | ((v) << 4))) +#else +#define Store4(l,o,v) Store8(l,o,((o) & 4 ? \ + (Fetch8(l,o) & 0x0f) | ((v) << 4) : \ + (Fetch8(l,o) & 0xf0) | (v))) +#endif + +static FASTCALL void +fbStore_a4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + for (i = 0; i < width; ++i) { + Store4(bits, i + x, values[i]>>28); + } +} + +static FASTCALL void +fbStore_r1g2b1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 pixel; + + Split(values[i]); + pixel = (((r >> 4) & 0x8) | + ((g >> 5) & 0x6) | + ((b >> 7) )); + Store4(bits, i + x, pixel); + } +} + +static FASTCALL void +fbStore_b1g2r1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 pixel; + + Split(values[i]); + pixel = (((b >> 4) & 0x8) | + ((g >> 5) & 0x6) | + ((r >> 7) )); + Store4(bits, i + x, pixel); + } +} + +static FASTCALL void +fbStore_a1r1g1b1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 pixel; + Splita(values[i]); + pixel = (((a >> 4) & 0x8) | + ((r >> 5) & 0x4) | + ((g >> 6) & 0x2) | + ((b >> 7) )); + Store4(bits, i + x, pixel); + } +} + +static FASTCALL void +fbStore_a1b1g1r1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 pixel; + Splita(values[i]); + pixel = (((a >> 4) & 0x8) | + ((b >> 5) & 0x4) | + ((g >> 6) & 0x2) | + ((r >> 7) )); + Store4(bits, i + x, pixel); + } +} + +static FASTCALL void +fbStore_c4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 pixel; + + pixel = miIndexToEnt24(indexed, values[i]); + Store4(bits, i + x, pixel); + } +} + +static FASTCALL void +fbStore_a1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 *pixel = ((CARD32 *) bits) + ((i+x) >> 5); + CARD32 mask = FbStipMask((i+x) & 0x1f, 1); + + CARD32 v = values[i] & 0x80000000 ? mask : 0; + *pixel = (*pixel & ~mask) | v; + } +} + +static FASTCALL void +fbStore_g1 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 *pixel = ((CARD32 *) bits) + ((i+x) >> 5); + CARD32 mask = FbStipMask((i+x) & 0x1f, 1); + + CARD32 v = miIndexToEntY24(indexed,values[i]) ? mask : 0; + *pixel = (*pixel & ~mask) | v; + } +} + + +static storeProc storeProcForPicture (PicturePtr pict) +{ + switch(pict->format_code) { + case PICT_a8r8g8b8: return fbStore_a8r8g8b8; + case PICT_x8r8g8b8: return fbStore_x8r8g8b8; + case PICT_a8b8g8r8: return fbStore_a8b8g8r8; + case PICT_x8b8g8r8: return fbStore_x8b8g8r8; + + /* 24bpp formats */ + case PICT_r8g8b8: return fbStore_r8g8b8; + case PICT_b8g8r8: return fbStore_b8g8r8; + + /* 16bpp formats */ + case PICT_r5g6b5: return fbStore_r5g6b5; + case PICT_b5g6r5: return fbStore_b5g6r5; + + case PICT_a1r5g5b5: return fbStore_a1r5g5b5; + case PICT_x1r5g5b5: return fbStore_x1r5g5b5; + case PICT_a1b5g5r5: return fbStore_a1b5g5r5; + case PICT_x1b5g5r5: return fbStore_x1b5g5r5; + case PICT_a4r4g4b4: return fbStore_a4r4g4b4; + case PICT_x4r4g4b4: return fbStore_x4r4g4b4; + case PICT_a4b4g4r4: return fbStore_a4b4g4r4; + case PICT_x4b4g4r4: return fbStore_x4b4g4r4; + + /* 8bpp formats */ + case PICT_a8: return fbStore_a8; + case PICT_r3g3b2: return fbStore_r3g3b2; + case PICT_b2g3r3: return fbStore_b2g3r3; + case PICT_a2r2g2b2: return fbStore_a2r2g2b2; + case PICT_c8: return fbStore_c8; + case PICT_g8: return fbStore_c8; + + /* 4bpp formats */ + case PICT_a4: return fbStore_a4; + case PICT_r1g2b1: return fbStore_r1g2b1; + case PICT_b1g2r1: return fbStore_b1g2r1; + case PICT_a1r1g1b1: return fbStore_a1r1g1b1; + case PICT_a1b1g1r1: return fbStore_a1b1g1r1; + case PICT_c4: return fbStore_c4; + case PICT_g4: return fbStore_c4; + + /* 1bpp formats */ + case PICT_a1: return fbStore_a1; + case PICT_g1: return fbStore_g1; + default: + return 0; + } +} + + +/* + * Combine src and mask + */ +static FASTCALL void +fbCombineMaskU (CARD32 *src, const CARD32 *mask, int width) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 a = mask[i] >> 24; + CARD32 s = src[i]; + FbByteMul(s, a); + src[i] = s; + } +} + +/* + * All of the composing functions + */ + +static FASTCALL void +fbCombineClear (CARD32 *dest, const CARD32 *src, int width) +{ + memset(dest, 0, width*sizeof(CARD32)); +} + +static FASTCALL void +fbCombineSrcU (CARD32 *dest, const CARD32 *src, int width) +{ + memcpy(dest, src, width*sizeof(CARD32)); +} + + +static FASTCALL void +fbCombineOverU (CARD32 *dest, const CARD32 *src, int width) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 s = src[i]; + CARD32 d = dest[i]; + CARD32 ia = Alpha(~s); + + FbByteMulAdd(d, ia, s); + dest[i] = d; + } +} + +static FASTCALL void +fbCombineOverReverseU (CARD32 *dest, const CARD32 *src, int width) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 s = src[i]; + CARD32 d = dest[i]; + CARD32 ia = Alpha(~dest[i]); + FbByteMulAdd(s, ia, d); + dest[i] = s; + } +} + +static FASTCALL void +fbCombineInU (CARD32 *dest, const CARD32 *src, int width) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 s = src[i]; + CARD32 a = Alpha(dest[i]); + FbByteMul(s, a); + dest[i] = s; + } +} + +static FASTCALL void +fbCombineInReverseU (CARD32 *dest, const CARD32 *src, int width) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 d = dest[i]; + CARD32 a = Alpha(src[i]); + FbByteMul(d, a); + dest[i] = d; + } +} + +static FASTCALL void +fbCombineOutU (CARD32 *dest, const CARD32 *src, int width) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 s = src[i]; + CARD32 a = Alpha(~dest[i]); + FbByteMul(s, a); + dest[i] = s; + } +} + +static FASTCALL void +fbCombineOutReverseU (CARD32 *dest, const CARD32 *src, int width) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 d = dest[i]; + CARD32 a = Alpha(~src[i]); + FbByteMul(d, a); + dest[i] = d; + } +} + +static FASTCALL void +fbCombineAtopU (CARD32 *dest, const CARD32 *src, int width) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 s = src[i]; + CARD32 d = dest[i]; + CARD32 dest_a = Alpha(d); + CARD32 src_ia = Alpha(~s); + + FbByteAddMul(s, dest_a, d, src_ia); + dest[i] = s; + } +} + +static FASTCALL void +fbCombineAtopReverseU (CARD32 *dest, const CARD32 *src, int width) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 s = src[i]; + CARD32 d = dest[i]; + CARD32 src_a = Alpha(s); + CARD32 dest_ia = Alpha(~d); + + FbByteAddMul(s, dest_ia, d, src_a); + dest[i] = s; + } +} + +static FASTCALL void +fbCombineXorU (CARD32 *dest, const CARD32 *src, int width) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 s = src[i]; + CARD32 d = dest[i]; + CARD32 src_ia = Alpha(~s); + CARD32 dest_ia = Alpha(~d); + + FbByteAddMul(s, dest_ia, d, src_ia); + dest[i] = s; + } +} + +static FASTCALL void +fbCombineAddU (CARD32 *dest, const CARD32 *src, int width) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 s = src[i]; + CARD32 d = dest[i]; + FbByteAdd(d, s); + dest[i] = d; + } +} + +static FASTCALL void +fbCombineSaturateU (CARD32 *dest, const CARD32 *src, int width) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 s = src[i]; + CARD32 d = dest[i]; + CARD16 sa, da; + + sa = s >> 24; + da = ~d >> 24; + if (sa > da) + { + sa = FbIntDiv(da, sa); + FbByteMul(s, sa); + } + FbByteAdd(d, s); + dest[i] = d; + } +} + +/* + * All of the disjoint composing functions + + The four entries in the first column indicate what source contributions + come from each of the four areas of the picture -- areas covered by neither + A nor B, areas covered only by A, areas covered only by B and finally + areas covered by both A and B. + + Disjoint Conjoint + Fa Fb Fa Fb +(0,0,0,0) 0 0 0 0 +(0,A,0,A) 1 0 1 0 +(0,0,B,B) 0 1 0 1 +(0,A,B,A) 1 min((1-a)/b,1) 1 max(1-a/b,0) +(0,A,B,B) min((1-b)/a,1) 1 max(1-b/a,0) 1 +(0,0,0,A) max(1-(1-b)/a,0) 0 min(1,b/a) 0 +(0,0,0,B) 0 max(1-(1-a)/b,0) 0 min(a/b,1) +(0,A,0,0) min(1,(1-b)/a) 0 max(1-b/a,0) 0 +(0,0,B,0) 0 min(1,(1-a)/b) 0 max(1-a/b,0) +(0,0,B,A) max(1-(1-b)/a,0) min(1,(1-a)/b) min(1,b/a) max(1-a/b,0) +(0,A,0,B) min(1,(1-b)/a) max(1-(1-a)/b,0) max(1-b/a,0) min(1,a/b) +(0,A,B,0) min(1,(1-b)/a) min(1,(1-a)/b) max(1-b/a,0) max(1-a/b,0) + + */ + +#define CombineAOut 1 +#define CombineAIn 2 +#define CombineBOut 4 +#define CombineBIn 8 + +#define CombineClear 0 +#define CombineA (CombineAOut|CombineAIn) +#define CombineB (CombineBOut|CombineBIn) +#define CombineAOver (CombineAOut|CombineBOut|CombineAIn) +#define CombineBOver (CombineAOut|CombineBOut|CombineBIn) +#define CombineAAtop (CombineBOut|CombineAIn) +#define CombineBAtop (CombineAOut|CombineBIn) +#define CombineXor (CombineAOut|CombineBOut) + +/* portion covered by a but not b */ +static INLINE CARD8 +fbCombineDisjointOutPart (CARD8 a, CARD8 b) +{ + /* min (1, (1-b) / a) */ + + b = ~b; /* 1 - b */ + if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ + return 0xff; /* 1 */ + return FbIntDiv(b,a); /* (1-b) / a */ +} + +/* portion covered by both a and b */ +static INLINE CARD8 +fbCombineDisjointInPart (CARD8 a, CARD8 b) +{ + /* max (1-(1-b)/a,0) */ + /* = - min ((1-b)/a - 1, 0) */ + /* = 1 - min (1, (1-b)/a) */ + + b = ~b; /* 1 - b */ + if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ + return 0; /* 1 - 1 */ + return ~FbIntDiv(b,a); /* 1 - (1-b) / a */ +} + +static FASTCALL void +fbCombineDisjointGeneralU (CARD32 *dest, const CARD32 *src, int width, CARD8 combine) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 s = src[i]; + CARD32 d = dest[i]; + CARD32 m,n,o,p; + CARD16 Fa, Fb, t, u, v; + CARD8 sa = s >> 24; + CARD8 da = d >> 24; + + switch (combine & CombineA) { + default: + Fa = 0; + break; + case CombineAOut: + Fa = fbCombineDisjointOutPart (sa, da); + break; + case CombineAIn: + Fa = fbCombineDisjointInPart (sa, da); + break; + case CombineA: + Fa = 0xff; + break; + } + + switch (combine & CombineB) { + default: + Fb = 0; + break; + case CombineBOut: + Fb = fbCombineDisjointOutPart (da, sa); + break; + case CombineBIn: + Fb = fbCombineDisjointInPart (da, sa); + break; + case CombineB: + Fb = 0xff; + break; + } + m = FbGen (s,d,0,Fa,Fb,t, u, v); + n = FbGen (s,d,8,Fa,Fb,t, u, v); + o = FbGen (s,d,16,Fa,Fb,t, u, v); + p = FbGen (s,d,24,Fa,Fb,t, u, v); + s = m|n|o|p; + dest[i] = s; + } +} + +static FASTCALL void +fbCombineDisjointOverU (CARD32 *dest, const CARD32 *src, int width) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 s = src[i]; + CARD16 a = s >> 24; + + if (a != 0x00) + { + if (a != 0xff) + { + CARD32 d = dest[i]; + a = fbCombineDisjointOutPart (d >> 24, a); + FbByteMulAdd(d, a, s); + s = d; + } + dest[i] = s; + } + } +} + +static FASTCALL void +fbCombineDisjointInU (CARD32 *dest, const CARD32 *src, int width) +{ + fbCombineDisjointGeneralU (dest, src, width, CombineAIn); +} + +static FASTCALL void +fbCombineDisjointInReverseU (CARD32 *dest, const CARD32 *src, int width) +{ + fbCombineDisjointGeneralU (dest, src, width, CombineBIn); +} + +static FASTCALL void +fbCombineDisjointOutU (CARD32 *dest, const CARD32 *src, int width) +{ + fbCombineDisjointGeneralU (dest, src, width, CombineAOut); +} + +static FASTCALL void +fbCombineDisjointOutReverseU (CARD32 *dest, const CARD32 *src, int width) +{ + fbCombineDisjointGeneralU (dest, src, width, CombineBOut); +} + +static FASTCALL void +fbCombineDisjointAtopU (CARD32 *dest, const CARD32 *src, int width) +{ + fbCombineDisjointGeneralU (dest, src, width, CombineAAtop); +} + +static FASTCALL void +fbCombineDisjointAtopReverseU (CARD32 *dest, const CARD32 *src, int width) +{ + fbCombineDisjointGeneralU (dest, src, width, CombineBAtop); +} + +static FASTCALL void +fbCombineDisjointXorU (CARD32 *dest, const CARD32 *src, int width) +{ + fbCombineDisjointGeneralU (dest, src, width, CombineXor); +} + +/* portion covered by a but not b */ +static INLINE CARD8 +fbCombineConjointOutPart (CARD8 a, CARD8 b) +{ + /* max (1-b/a,0) */ + /* = 1-min(b/a,1) */ + + /* min (1, (1-b) / a) */ + + if (b >= a) /* b >= a -> b/a >= 1 */ + return 0x00; /* 0 */ + return ~FbIntDiv(b,a); /* 1 - b/a */ +} + +/* portion covered by both a and b */ +static INLINE CARD8 +fbCombineConjointInPart (CARD8 a, CARD8 b) +{ + /* min (1,b/a) */ + + if (b >= a) /* b >= a -> b/a >= 1 */ + return 0xff; /* 1 */ + return FbIntDiv(b,a); /* b/a */ +} + +static FASTCALL void +fbCombineConjointGeneralU (CARD32 *dest, const CARD32 *src, int width, CARD8 combine) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 s = src[i]; + CARD32 d = dest[i]; + CARD32 m,n,o,p; + CARD16 Fa, Fb, t, u, v; + CARD8 sa = s >> 24; + CARD8 da = d >> 24; + + switch (combine & CombineA) { + default: + Fa = 0; + break; + case CombineAOut: + Fa = fbCombineConjointOutPart (sa, da); + break; + case CombineAIn: + Fa = fbCombineConjointInPart (sa, da); + break; + case CombineA: + Fa = 0xff; + break; + } + + switch (combine & CombineB) { + default: + Fb = 0; + break; + case CombineBOut: + Fb = fbCombineConjointOutPart (da, sa); + break; + case CombineBIn: + Fb = fbCombineConjointInPart (da, sa); + break; + case CombineB: + Fb = 0xff; + break; + } + m = FbGen (s,d,0,Fa,Fb,t, u, v); + n = FbGen (s,d,8,Fa,Fb,t, u, v); + o = FbGen (s,d,16,Fa,Fb,t, u, v); + p = FbGen (s,d,24,Fa,Fb,t, u, v); + s = m|n|o|p; + dest[i] = s; + } +} + +static FASTCALL void +fbCombineConjointOverU (CARD32 *dest, const CARD32 *src, int width) +{ + fbCombineConjointGeneralU (dest, src, width, CombineAOver); +} + + +static FASTCALL void +fbCombineConjointOverReverseU (CARD32 *dest, const CARD32 *src, int width) +{ + fbCombineConjointGeneralU (dest, src, width, CombineBOver); +} + + +static FASTCALL void +fbCombineConjointInU (CARD32 *dest, const CARD32 *src, int width) +{ + fbCombineConjointGeneralU (dest, src, width, CombineAIn); +} + + +static FASTCALL void +fbCombineConjointInReverseU (CARD32 *dest, const CARD32 *src, int width) +{ + fbCombineConjointGeneralU (dest, src, width, CombineBIn); +} + +static FASTCALL void +fbCombineConjointOutU (CARD32 *dest, const CARD32 *src, int width) +{ + fbCombineConjointGeneralU (dest, src, width, CombineAOut); +} + +static FASTCALL void +fbCombineConjointOutReverseU (CARD32 *dest, const CARD32 *src, int width) +{ + fbCombineConjointGeneralU (dest, src, width, CombineBOut); +} + +static FASTCALL void +fbCombineConjointAtopU (CARD32 *dest, const CARD32 *src, int width) +{ + fbCombineConjointGeneralU (dest, src, width, CombineAAtop); +} + +static FASTCALL void +fbCombineConjointAtopReverseU (CARD32 *dest, const CARD32 *src, int width) +{ + fbCombineConjointGeneralU (dest, src, width, CombineBAtop); +} + +static FASTCALL void +fbCombineConjointXorU (CARD32 *dest, const CARD32 *src, int width) +{ + fbCombineConjointGeneralU (dest, src, width, CombineXor); +} + +static CombineFuncU fbCombineFuncU[] = { + fbCombineClear, + fbCombineSrcU, + 0, /* CombineDst */ + fbCombineOverU, + fbCombineOverReverseU, + fbCombineInU, + fbCombineInReverseU, + fbCombineOutU, + fbCombineOutReverseU, + fbCombineAtopU, + fbCombineAtopReverseU, + fbCombineXorU, + fbCombineAddU, + fbCombineSaturateU, + 0, + 0, + fbCombineClear, + fbCombineSrcU, + 0, /* CombineDst */ + fbCombineDisjointOverU, + fbCombineSaturateU, /* DisjointOverReverse */ + fbCombineDisjointInU, + fbCombineDisjointInReverseU, + fbCombineDisjointOutU, + fbCombineDisjointOutReverseU, + fbCombineDisjointAtopU, + fbCombineDisjointAtopReverseU, + fbCombineDisjointXorU, + 0, + 0, + 0, + 0, + fbCombineClear, + fbCombineSrcU, + 0, /* CombineDst */ + fbCombineConjointOverU, + fbCombineConjointOverReverseU, + fbCombineConjointInU, + fbCombineConjointInReverseU, + fbCombineConjointOutU, + fbCombineConjointOutReverseU, + fbCombineConjointAtopU, + fbCombineConjointAtopReverseU, + fbCombineConjointXorU, +}; + +static FASTCALL void +fbCombineMaskC (CARD32 *src, CARD32 *mask, int width) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 a = mask[i]; + + CARD32 x; + CARD16 xa; + + if (!a) + { + src[i] = 0; + continue; + } + + x = src[i]; + if (a == 0xffffffff) + { + x = x >> 24; + x |= x << 8; + x |= x << 16; + mask[i] = x; + continue; + } + + xa = x >> 24; + FbByteMulC(x, a); + src[i] = x; + FbByteMul(a, xa); + mask[i] = a; + } +} + +static FASTCALL void +fbCombineMaskValueC (CARD32 *src, const CARD32 *mask, int width) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 a = mask[i]; + CARD32 x; + + if (!a) + { + src[i] = 0; + continue; + } + + if (a == 0xffffffff) + continue; + + x = src[i]; + FbByteMulC(x, a); + src[i] = x; + } +} + + +static FASTCALL void +fbCombineMaskAlphaC (const CARD32 *src, CARD32 *mask, int width) +{ + int i; + for (i = 0; i < width; ++i) { + CARD32 a = mask[i]; + CARD32 x; + + if (!a) + continue; + + x = src[i] >> 24; + if (x == 0xff) + continue; + if (a == 0xffffffff) + { + x = x >> 24; + x |= x << 8; + x |= x << 16; + mask[i] = x; + continue; + } + + FbByteMul(a, x); + mask[i] = a; + } +} + +static FASTCALL void +fbCombineClearC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + memset(dest, 0, width*sizeof(CARD32)); +} + +static FASTCALL void +fbCombineSrcC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineMaskValueC(src, mask, width); + memcpy(dest, src, width*sizeof(CARD32)); +} + +static FASTCALL void +fbCombineOverC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + int i; + fbCombineMaskC(src, mask, width); + for (i = 0; i < width; ++i) { + CARD32 s = src[i]; + CARD32 a = ~mask[i]; + + if (a != 0xffffffff) + { + if (a) + { + CARD32 d = dest[i]; + FbByteMulAddC(d, a, s); + s = d; + } + dest[i] = s; + } + } +} + +static FASTCALL void +fbCombineOverReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + int i; + fbCombineMaskValueC(src, mask, width); + for (i = 0; i < width; ++i) { + CARD32 d = dest[i]; + CARD32 a = ~d >> 24; + + if (a) + { + CARD32 s = src[i]; + if (a != 0xff) + { + FbByteMulAdd(s, a, d); + } + dest[i] = s; + } + } +} + +static FASTCALL void +fbCombineInC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + int i; + fbCombineMaskValueC(src, mask, width); + for (i = 0; i < width; ++i) { + CARD32 d = dest[i]; + CARD16 a = d >> 24; + CARD32 s = 0; + if (a) + { + s = src[i]; + if (a != 0xff) + { + FbByteMul(s, a); + } + } + dest[i] = s; + } +} + +static FASTCALL void +fbCombineInReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + int i; + fbCombineMaskAlphaC(src, mask, width); + for (i = 0; i < width; ++i) { + CARD32 a = mask[i]; + + if (a != 0xffffffff) + { + CARD32 d = 0; + if (a) + { + d = dest[i]; + FbByteMulC(d, a); + } + dest[i] = d; + } + } +} + +static FASTCALL void +fbCombineOutC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + int i; + fbCombineMaskValueC(src, mask, width); + for (i = 0; i < width; ++i) { + CARD32 d = dest[i]; + CARD16 a = ~d >> 24; + CARD32 s = 0; + if (a) + { + s = src[i]; + if (a != 0xff) + { + FbByteMul(s, a); + } + } + dest[i] = s; + } +} + +static FASTCALL void +fbCombineOutReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + int i; + fbCombineMaskAlphaC(src, mask, width); + for (i = 0; i < width; ++i) { + CARD32 a = ~mask[i]; + + if (a != 0xffffffff) + { + CARD32 d = 0; + if (a) + { + d = dest[i]; + FbByteMulC(d, a); + } + dest[i] = d; + } + } +} + +static FASTCALL void +fbCombineAtopC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + int i; + fbCombineMaskC(src, mask, width); + for (i = 0; i < width; ++i) { + CARD32 d = dest[i]; + CARD32 s = src[i]; + CARD32 ad = ~mask[i]; + CARD16 as = d >> 24; + FbByteAddMulC(d, ad, s, as); + dest[i] = d; + } +} + +static FASTCALL void +fbCombineAtopReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + int i; + fbCombineMaskC(src, mask, width); + for (i = 0; i < width; ++i) { + + CARD32 d = dest[i]; + CARD32 s = src[i]; + CARD32 ad = mask[i]; + CARD16 as = ~d >> 24; + FbByteAddMulC(d, ad, s, as); + dest[i] = d; + } +} + +static FASTCALL void +fbCombineXorC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + int i; + fbCombineMaskC(src, mask, width); + for (i = 0; i < width; ++i) { + CARD32 d = dest[i]; + CARD32 s = src[i]; + CARD32 ad = ~mask[i]; + CARD16 as = ~d >> 24; + FbByteAddMulC(d, ad, s, as); + dest[i] = d; + } +} + +static FASTCALL void +fbCombineAddC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + int i; + fbCombineMaskValueC(src, mask, width); + for (i = 0; i < width; ++i) { + CARD32 s = src[i]; + CARD32 d = dest[i]; + FbByteAdd(d, s); + dest[i] = d; + } +} + +static FASTCALL void +fbCombineSaturateC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + int i; + fbCombineMaskC(src, mask, width); + for (i = 0; i < width; ++i) { + CARD32 s, d; + CARD16 sa, sr, sg, sb, da; + CARD16 t, u, v; + CARD32 m,n,o,p; + + d = dest[i]; + s = src[i]; + sa = (mask[i] >> 24); + sr = (mask[i] >> 16) & 0xff; + sg = (mask[i] >> 8) & 0xff; + sb = (mask[i] ) & 0xff; + da = ~d >> 24; + + if (sb <= da) + m = FbAdd(s,d,0,t); + else + m = FbGen (s, d, 0, (da << 8) / sb, 0xff, t, u, v); + + if (sg <= da) + n = FbAdd(s,d,8,t); + else + n = FbGen (s, d, 8, (da << 8) / sg, 0xff, t, u, v); + + if (sr <= da) + o = FbAdd(s,d,16,t); + else + o = FbGen (s, d, 16, (da << 8) / sr, 0xff, t, u, v); + + if (sa <= da) + p = FbAdd(s,d,24,t); + else + p = FbGen (s, d, 24, (da << 8) / sa, 0xff, t, u, v); + + dest[i] = m|n|o|p; + } +} + +static FASTCALL void +fbCombineDisjointGeneralC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width, CARD8 combine) +{ + int i; + fbCombineMaskC(src, mask, width); + for (i = 0; i < width; ++i) { + CARD32 s, d; + CARD32 m,n,o,p; + CARD32 Fa, Fb; + CARD16 t, u, v; + CARD32 sa; + CARD8 da; + + s = src[i]; + sa = mask[i]; + d = dest[i]; + da = d >> 24; + + switch (combine & CombineA) { + default: + Fa = 0; + break; + case CombineAOut: + m = fbCombineDisjointOutPart ((CARD8) (sa >> 0), da); + n = fbCombineDisjointOutPart ((CARD8) (sa >> 8), da) << 8; + o = fbCombineDisjointOutPart ((CARD8) (sa >> 16), da) << 16; + p = fbCombineDisjointOutPart ((CARD8) (sa >> 24), da) << 24; + Fa = m|n|o|p; + break; + case CombineAIn: + m = fbCombineDisjointInPart ((CARD8) (sa >> 0), da); + n = fbCombineDisjointInPart ((CARD8) (sa >> 8), da) << 8; + o = fbCombineDisjointInPart ((CARD8) (sa >> 16), da) << 16; + p = fbCombineDisjointInPart ((CARD8) (sa >> 24), da) << 24; + Fa = m|n|o|p; + break; + case CombineA: + Fa = 0xffffffff; + break; + } + + switch (combine & CombineB) { + default: + Fb = 0; + break; + case CombineBOut: + m = fbCombineDisjointOutPart (da, (CARD8) (sa >> 0)); + n = fbCombineDisjointOutPart (da, (CARD8) (sa >> 8)) << 8; + o = fbCombineDisjointOutPart (da, (CARD8) (sa >> 16)) << 16; + p = fbCombineDisjointOutPart (da, (CARD8) (sa >> 24)) << 24; + Fb = m|n|o|p; + break; + case CombineBIn: + m = fbCombineDisjointInPart (da, (CARD8) (sa >> 0)); + n = fbCombineDisjointInPart (da, (CARD8) (sa >> 8)) << 8; + o = fbCombineDisjointInPart (da, (CARD8) (sa >> 16)) << 16; + p = fbCombineDisjointInPart (da, (CARD8) (sa >> 24)) << 24; + Fb = m|n|o|p; + break; + case CombineB: + Fb = 0xffffffff; + break; + } + m = FbGen (s,d,0,FbGet8(Fa,0),FbGet8(Fb,0),t, u, v); + n = FbGen (s,d,8,FbGet8(Fa,8),FbGet8(Fb,8),t, u, v); + o = FbGen (s,d,16,FbGet8(Fa,16),FbGet8(Fb,16),t, u, v); + p = FbGen (s,d,24,FbGet8(Fa,24),FbGet8(Fb,24),t, u, v); + s = m|n|o|p; + dest[i] = s; + } +} + +static FASTCALL void +fbCombineDisjointOverC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOver); +} + +static FASTCALL void +fbCombineDisjointInC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineDisjointGeneralC (dest, src, mask, width, CombineAIn); +} + +static FASTCALL void +fbCombineDisjointInReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineDisjointGeneralC (dest, src, mask, width, CombineBIn); +} + +static FASTCALL void +fbCombineDisjointOutC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOut); +} + +static FASTCALL void +fbCombineDisjointOutReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineDisjointGeneralC (dest, src, mask, width, CombineBOut); +} + +static FASTCALL void +fbCombineDisjointAtopC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineDisjointGeneralC (dest, src, mask, width, CombineAAtop); +} + +static FASTCALL void +fbCombineDisjointAtopReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineDisjointGeneralC (dest, src, mask, width, CombineBAtop); +} + +static FASTCALL void +fbCombineDisjointXorC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineDisjointGeneralC (dest, src, mask, width, CombineXor); +} + +static FASTCALL void +fbCombineConjointGeneralC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width, CARD8 combine) +{ + int i; + fbCombineMaskC(src, mask, width); + for (i = 0; i < width; ++i) { + CARD32 s, d; + CARD32 m,n,o,p; + CARD32 Fa, Fb; + CARD16 t, u, v; + CARD32 sa; + CARD8 da; + + s = src[i]; + sa = mask[i]; + d = dest[i]; + da = d >> 24; + + switch (combine & CombineA) { + default: + Fa = 0; + break; + case CombineAOut: + m = fbCombineConjointOutPart ((CARD8) (sa >> 0), da); + n = fbCombineConjointOutPart ((CARD8) (sa >> 8), da) << 8; + o = fbCombineConjointOutPart ((CARD8) (sa >> 16), da) << 16; + p = fbCombineConjointOutPart ((CARD8) (sa >> 24), da) << 24; + Fa = m|n|o|p; + break; + case CombineAIn: + m = fbCombineConjointInPart ((CARD8) (sa >> 0), da); + n = fbCombineConjointInPart ((CARD8) (sa >> 8), da) << 8; + o = fbCombineConjointInPart ((CARD8) (sa >> 16), da) << 16; + p = fbCombineConjointInPart ((CARD8) (sa >> 24), da) << 24; + Fa = m|n|o|p; + break; + case CombineA: + Fa = 0xffffffff; + break; + } + + switch (combine & CombineB) { + default: + Fb = 0; + break; + case CombineBOut: + m = fbCombineConjointOutPart (da, (CARD8) (sa >> 0)); + n = fbCombineConjointOutPart (da, (CARD8) (sa >> 8)) << 8; + o = fbCombineConjointOutPart (da, (CARD8) (sa >> 16)) << 16; + p = fbCombineConjointOutPart (da, (CARD8) (sa >> 24)) << 24; + Fb = m|n|o|p; + break; + case CombineBIn: + m = fbCombineConjointInPart (da, (CARD8) (sa >> 0)); + n = fbCombineConjointInPart (da, (CARD8) (sa >> 8)) << 8; + o = fbCombineConjointInPart (da, (CARD8) (sa >> 16)) << 16; + p = fbCombineConjointInPart (da, (CARD8) (sa >> 24)) << 24; + Fb = m|n|o|p; + break; + case CombineB: + Fb = 0xffffffff; + break; + } + m = FbGen (s,d,0,FbGet8(Fa,0),FbGet8(Fb,0),t, u, v); + n = FbGen (s,d,8,FbGet8(Fa,8),FbGet8(Fb,8),t, u, v); + o = FbGen (s,d,16,FbGet8(Fa,16),FbGet8(Fb,16),t, u, v); + p = FbGen (s,d,24,FbGet8(Fa,24),FbGet8(Fb,24),t, u, v); + s = m|n|o|p; + dest[i] = s; + } +} + +static FASTCALL void +fbCombineConjointOverC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineConjointGeneralC (dest, src, mask, width, CombineAOver); +} + +static FASTCALL void +fbCombineConjointOverReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineConjointGeneralC (dest, src, mask, width, CombineBOver); +} + +static FASTCALL void +fbCombineConjointInC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineConjointGeneralC (dest, src, mask, width, CombineAIn); +} + +static FASTCALL void +fbCombineConjointInReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineConjointGeneralC (dest, src, mask, width, CombineBIn); +} + +static FASTCALL void +fbCombineConjointOutC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineConjointGeneralC (dest, src, mask, width, CombineAOut); +} + +static FASTCALL void +fbCombineConjointOutReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineConjointGeneralC (dest, src, mask, width, CombineBOut); +} + +static FASTCALL void +fbCombineConjointAtopC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineConjointGeneralC (dest, src, mask, width, CombineAAtop); +} + +static FASTCALL void +fbCombineConjointAtopReverseC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineConjointGeneralC (dest, src, mask, width, CombineBAtop); +} + +static FASTCALL void +fbCombineConjointXorC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) +{ + fbCombineConjointGeneralC (dest, src, mask, width, CombineXor); +} + +static CombineFuncC fbCombineFuncC[] = { + fbCombineClearC, + fbCombineSrcC, + 0, /* Dest */ + fbCombineOverC, + fbCombineOverReverseC, + fbCombineInC, + fbCombineInReverseC, + fbCombineOutC, + fbCombineOutReverseC, + fbCombineAtopC, + fbCombineAtopReverseC, + fbCombineXorC, + fbCombineAddC, + fbCombineSaturateC, + 0, + 0, + fbCombineClearC, /* 0x10 */ + fbCombineSrcC, + 0, /* Dest */ + fbCombineDisjointOverC, + fbCombineSaturateC, /* DisjointOverReverse */ + fbCombineDisjointInC, + fbCombineDisjointInReverseC, + fbCombineDisjointOutC, + fbCombineDisjointOutReverseC, + fbCombineDisjointAtopC, + fbCombineDisjointAtopReverseC, + fbCombineDisjointXorC, /* 0x1b */ + 0, + 0, + 0, + 0, + fbCombineClearC, + fbCombineSrcC, + 0, /* Dest */ + fbCombineConjointOverC, + fbCombineConjointOverReverseC, + fbCombineConjointInC, + fbCombineConjointInReverseC, + fbCombineConjointOutC, + fbCombineConjointOutReverseC, + fbCombineConjointAtopC, + fbCombineConjointAtopReverseC, + fbCombineConjointXorC, +}; + + +FbComposeFunctions composeFunctions = { + fbCombineFuncU, + fbCombineFuncC, + fbCombineMaskU +}; + + +static void fbFetchSolid(PicturePtr pict, int x, int y, int width, CARD32 *buffer) +{ + FbBits *bits; + FbStride stride; + int bpp; + int xoff, yoff; + CARD32 color; + CARD32 *end; + fetchPixelProc fetch = fetchPixelProcForPicture(pict); +#ifdef PIXMAN_INDEXED_FORMATS + miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; +#else + miIndexedPtr indexed = 0; +#endif + + fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff); + bits += yoff*stride + (xoff*bpp >> FB_SHIFT); + + color = fetch(bits, 0, indexed); + + end = buffer + width; + while (buffer < end) + *buffer++ = color; +} + +static void fbFetch(PicturePtr pict, int x, int y, int width, CARD32 *buffer) +{ + FbBits *bits; + FbStride stride; + int bpp; + int xoff, yoff; + fetchProc fetch = fetchProcForPicture(pict); +#ifdef PIXMAN_INDEXED_FORMATS + miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; +#else + miIndexedPtr indexed = 0; +#endif + + fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff); + x += xoff; + y += yoff; + + bits += y*stride; + + fetch(bits, x, width, buffer, indexed); +} + +#define DIV(a,b) ((((a) < 0) == ((b) < 0)) ? (a) / (b) :\ + ((a) - (b) + 1 - (((b) < 0) << 1)) / (b)) + +#ifdef PIXMAN_GRADIENTS +static CARD32 gradientPixel(const SourcePictPtr pGradient, xFixed_48_16 pos, unsigned int spread) +{ + int ipos = (pos * PICT_GRADIENT_STOPTABLE_SIZE - 1) >> 16; + + /* calculate the actual offset. */ + if (ipos < 0 || ipos >= PICT_GRADIENT_STOPTABLE_SIZE) { + if (pGradient->type == SourcePictTypeConical || spread == RepeatNormal) { + ipos = ipos % PICT_GRADIENT_STOPTABLE_SIZE; + ipos = ipos < 0 ? PICT_GRADIENT_STOPTABLE_SIZE + ipos : ipos; + + } else if (spread == RepeatReflect) { + const int limit = PICT_GRADIENT_STOPTABLE_SIZE * 2 - 1; + ipos = ipos % limit; + ipos = ipos < 0 ? limit + ipos : ipos; + ipos = ipos >= PICT_GRADIENT_STOPTABLE_SIZE ? limit - ipos : ipos; + + } else if (spread == RepeatPad) { + if (ipos < 0) + ipos = 0; + else if (ipos >= PICT_GRADIENT_STOPTABLE_SIZE) + ipos = PICT_GRADIENT_STOPTABLE_SIZE-1; + } else { /* RepeatNone */ + return 0; + } + } + + assert(ipos >= 0); + assert(ipos < PICT_GRADIENT_STOPTABLE_SIZE); + + return pGradient->linear.colorTable[ipos]; +} + +static void fbFetchSourcePict(PicturePtr pict, int x, int y, int width, CARD32 *buffer) +{ + SourcePictPtr pGradient = pict->pSourcePict; + CARD32 *end = buffer + width; + + if (pGradient->type == SourcePictTypeSolidFill) { + register CARD32 color = pGradient->solidFill.color; + while (buffer < end) { + *buffer++ = color; + } + } else if (pGradient->type == SourcePictTypeLinear) { + PictVector v, unit; + xFixed_32_32 l; + xFixed_48_16 dx, dy, a, b, off; + + v.vector[0] = IntToxFixed(x); + v.vector[1] = IntToxFixed(y); + v.vector[2] = xFixed1; + if (pict->transform) { + if (!PictureTransformPoint3d (pict->transform, &v)) + return; + unit.vector[0] = pict->transform->matrix[0][0]; + unit.vector[1] = pict->transform->matrix[1][0]; + unit.vector[2] = pict->transform->matrix[2][0]; + } else { + unit.vector[0] = xFixed1; + unit.vector[1] = 0; + unit.vector[2] = 0; + } + + dx = pGradient->linear.p2.x - pGradient->linear.p1.x; + dy = pGradient->linear.p2.y - pGradient->linear.p1.y; + l = dx*dx + dy*dy; + if (l != 0) { + a = (dx << 32) / l; + b = (dy << 32) / l; + off = (-a*pGradient->linear.p1.x - b*pGradient->linear.p1.y)>>16; + } + if (l == 0 || (unit.vector[2] == 0 && v.vector[2] == xFixed1)) { + xFixed_48_16 inc, t; + /* affine transformation only */ + if (l == 0) { + t = 0; + inc = 0; + } else { + t = ((a*v.vector[0] + b*v.vector[1]) >> 16) + off; + inc = (a * unit.vector[0] + b * unit.vector[1]) >> 16; + } + while (buffer < end) { + *buffer++ = gradientPixel(pGradient, t, pict->repeat); + t += inc; + } + } else { + /* projective transformation */ + while (buffer < end) { + xFixed_48_16 t; + if (v.vector[2] == 0) { + t = 0; + } else { + xFixed_48_16 x, y; + x = ((xFixed_48_16)v.vector[0] << 16) / v.vector[2]; + y = ((xFixed_48_16)v.vector[1] << 16) / v.vector[2]; + t = ((a*x + b*y) >> 16) + off; + } + *buffer++ = gradientPixel(pGradient, t, pict->repeat); + v.vector[0] += unit.vector[0]; + v.vector[1] += unit.vector[1]; + v.vector[2] += unit.vector[2]; + } + } + } else { + /* radial or conical */ + Bool projective = FALSE; + double cx = 1.; + double cy = 0.; + double cz = 0.; + double rx = x; + double ry = y; + double rz = 1.; + + if (pict->transform) { + PictVector v; + v.vector[0] = IntToxFixed(x); + v.vector[1] = IntToxFixed(y); + v.vector[2] = xFixed1; + if (!PictureTransformPoint3d (pict->transform, &v)) + return; + + cx = pict->transform->matrix[0][0]/65536.; + cy = pict->transform->matrix[1][0]/65536.; + cz = pict->transform->matrix[2][0]/65536.; + rx = v.vector[0]/65536.; + ry = v.vector[1]/65536.; + rz = v.vector[2]/65536.; + projective = pict->transform->matrix[2][0] != 0 || v.vector[2] != xFixed1; + } + + if (pGradient->type == SourcePictTypeRadial) { + if (!projective) { + rx -= pGradient->radial.fx; + ry -= pGradient->radial.fy; + + while (buffer < end) { + double b = 2*(rx*pGradient->radial.dx + ry*pGradient->radial.dy); + double c = -(rx*rx + ry*ry); + double det = (b * b) - (4 * pGradient->radial.a * c); + double s = (-b + sqrt(det))/(2. * pGradient->radial.a); + *buffer = gradientPixel(pGradient, + (xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536), + pict->repeat); + ++buffer; + rx += cx; + ry += cy; + } + } else { + while (buffer < end) { + double x, y; + double b, c, det, s; + if (rz != 0) { + x = rx/rz; + y = ry/rz; + } else { + x = y = 0.; + } + x -= pGradient->radial.fx; + y -= pGradient->radial.fy; + b = 2*(x*pGradient->radial.dx + y*pGradient->radial.dy); + c = -(x*x + y*y); + det = (b * b) - (4 * pGradient->radial.a * c); + s = (-b + sqrt(det))/(2. * pGradient->radial.a); + *buffer = gradientPixel(pGradient, + (xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536), + pict->repeat); + ++buffer; + rx += cx; + ry += cy; + rz += cz; + } + } + } else /* SourcePictTypeConical */ { + double a = pGradient->conical.angle/(180.*65536); + if (!projective) { + rx -= pGradient->conical.center.x/65536.; + ry -= pGradient->conical.center.y/65536.; + + while (buffer < end) { + double angle = atan2(ry, rx) + a; + *buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))), + pict->repeat); + ++buffer; + rx += cx; + ry += cy; + } + } else { + + while (buffer < end) { + double x, y; + if (rz != 0) { + x = rx/rz; + y = ry/rz; + } else { + x = y = 0.; + } + x -= pGradient->conical.center.x/65536.; + y -= pGradient->conical.center.y/65536.; + double angle = atan2(y, x) + a; + *buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))), + pict->repeat); + ++buffer; + rx += cx; + ry += cy; + rz += cz; + } + } + } + } +} +#endif /* PIXMAN_GRADIENTS */ + + +static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 *buffer) +{ + FbBits *bits; + FbStride stride; + int bpp; + int xoff, yoff; + fetchPixelProc fetch; + PictVector v; + PictVector unit; + int i; + BoxRec box; +#ifdef PIXMAN_INDEXED_FORMATS + miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; +#else + miIndexedPtr indexed = 0; +#endif + + fetch = fetchPixelProcForPicture(pict); + + fbGetDrawable(pict->pDrawable, bits, stride, bpp, xoff, yoff); + x += xoff; + y += yoff; + + v.vector[0] = IntToxFixed(x); + v.vector[1] = IntToxFixed(y); + v.vector[2] = xFixed1; + + /* when using convolution filters one might get here without a transform */ + if (pict->transform) { + if (!PictureTransformPoint3d (pict->transform, &v)) + return; + unit.vector[0] = pict->transform->matrix[0][0]; + unit.vector[1] = pict->transform->matrix[1][0]; + unit.vector[2] = pict->transform->matrix[2][0]; + } else { + unit.vector[0] = xFixed1; + unit.vector[1] = 0; + unit.vector[2] = 0; + } + + if (pict->filter == PIXMAN_FILTER_NEAREST || pict->filter == PIXMAN_FILTER_FAST) + { + if (pict->repeat == RepeatNormal) { + if (PIXREGION_NUM_RECTS(pict->pCompositeClip) == 1) { + box = pict->pCompositeClip->extents; + for (i = 0; i < width; ++i) { + if (!v.vector[2]) { + buffer[i] = 0; + } else { + y = MOD(DIV(v.vector[1],v.vector[2]), pict->pDrawable->height); + x = MOD(DIV(v.vector[0],v.vector[2]), pict->pDrawable->width); + buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed); + } + v.vector[0] += unit.vector[0]; + v.vector[1] += unit.vector[1]; + v.vector[2] += unit.vector[2]; + } + } else { + for (i = 0; i < width; ++i) { + if (!v.vector[2]) { + buffer[i] = 0; + } else { + y = MOD(DIV(v.vector[1],v.vector[2]), pict->pDrawable->height); + x = MOD(DIV(v.vector[0],v.vector[2]), pict->pDrawable->width); + if (pixman_region_contains_point (pict->pCompositeClip, x, y, &box)) + buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed); + else + buffer[i] = 0; + } + v.vector[0] += unit.vector[0]; + v.vector[1] += unit.vector[1]; + v.vector[2] += unit.vector[2]; + } + } + } else { + if (PIXREGION_NUM_RECTS(pict->pCompositeClip) == 1) { + box = pict->pCompositeClip->extents; + for (i = 0; i < width; ++i) { + if (!v.vector[2]) { + buffer[i] = 0; + } else { + y = DIV(v.vector[1],v.vector[2]); + x = DIV(v.vector[0],v.vector[2]); + buffer[i] = ((x < box.x1) | (x >= box.x2) | (y < box.y1) | (y >= box.y2)) ? + 0 : fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed); + } + v.vector[0] += unit.vector[0]; + v.vector[1] += unit.vector[1]; + v.vector[2] += unit.vector[2]; + } + } else { + for (i = 0; i < width; ++i) { + if (!v.vector[2]) { + buffer[i] = 0; + } else { + y = DIV(v.vector[1],v.vector[2]); + x = DIV(v.vector[0],v.vector[2]); + if (pixman_region_contains_point (pict->pCompositeClip, x, y, &box)) + buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed); + else + buffer[i] = 0; + } + v.vector[0] += unit.vector[0]; + v.vector[1] += unit.vector[1]; + v.vector[2] += unit.vector[2]; + } + } + } + } else if (pict->filter == PIXMAN_FILTER_BILINEAR || pict->filter == PIXMAN_FILTER_GOOD || pict->filter == PIXMAN_FILTER_BEST) { + if (pict->repeat == RepeatNormal) { + if (PIXREGION_NUM_RECTS(pict->pCompositeClip) == 1) { + box = pict->pCompositeClip->extents; + for (i = 0; i < width; ++i) { + if (!v.vector[2]) { + buffer[i] = 0; + } else { + int x1, x2, y1, y2, distx, idistx, disty, idisty, k; + FbBits *b; + CARD32 tl, tr, bl, br, r; + xFixed_48_16 div; + + div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2]; + x1 = div >> 16; + distx = ((xFixed)div >> 8) & 0xff; + x2 = x1 + 1; + div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2]; + y1 = div >> 16; + y2 = y1 + 1; + disty = ((xFixed)div >> 8) & 0xff; + + idistx = 256 - distx; + idisty = 256 - disty; + + x1 = MOD (x1, pict->pDrawable->width); + x2 = MOD (x2, pict->pDrawable->width); + y1 = MOD (y1, pict->pDrawable->height); + y2 = MOD (y2, pict->pDrawable->height); + + b = bits + (y1 + pict->pDrawable->y)*stride; + + tl = fetch(b, x1 + pict->pDrawable->x, indexed); + tr = fetch(b, x2 + pict->pDrawable->x, indexed); + b = bits + (y2 + pict->pDrawable->y)*stride; + bl = fetch(b, x1 + pict->pDrawable->x, indexed); + br = fetch(b, x2 + pict->pDrawable->x, indexed); + + r = 0; + for (k = 0; k < 32; k += 8) { + CARD32 t, b; + t = FbGet8(tl,k) * idistx + FbGet8(tr,k) * distx; + b = FbGet8(bl,k) * idistx + FbGet8(br,k) * distx; + r |= ((((t * idisty) + (b * disty)) >> 16) & 0xff) << k; + } + buffer[i] = r; + } + v.vector[0] += unit.vector[0]; + v.vector[1] += unit.vector[1]; + v.vector[2] += unit.vector[2]; + } + } else { + for (i = 0; i < width; ++i) { + if (!v.vector[2]) { + buffer[i] = 0; + } else { + int x1, x2, y1, y2, distx, idistx, disty, idisty, k; + FbBits *b; + CARD32 tl, tr, bl, br, r; + xFixed_48_16 div; + + div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2]; + x1 = div >> 16; + distx = ((xFixed)div >> 8) & 0xff; + x2 = x1 + 1; + div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2]; + y1 = div >> 16; + y2 = y1 + 1; + disty = ((xFixed)div >> 8) & 0xff; + + idistx = 256 - distx; + idisty = 256 - disty; + + x1 = MOD (x1, pict->pDrawable->width); + x2 = MOD (x2, pict->pDrawable->width); + y1 = MOD (y1, pict->pDrawable->height); + y2 = MOD (y2, pict->pDrawable->height); + + b = bits + (y1 + pict->pDrawable->y)*stride; + + tl = pixman_region_contains_point(pict->pCompositeClip, x1, y1, &box) + ? fetch(b, x1 + pict->pDrawable->x, indexed) : 0; + tr = pixman_region_contains_point(pict->pCompositeClip, x2, y1, &box) + ? fetch(b, x2 + pict->pDrawable->x, indexed) : 0; + b = bits + (y2 + pict->pDrawable->y)*stride; + bl = pixman_region_contains_point(pict->pCompositeClip, x1, y2, &box) + ? fetch(b, x1 + pict->pDrawable->x, indexed) : 0; + br = pixman_region_contains_point(pict->pCompositeClip, x2, y2, &box) + ? fetch(b, x2 + pict->pDrawable->x, indexed) : 0; + + r = 0; + for (k = 0; k < 32; k += 8) { + CARD32 t, b; + t = FbGet8(tl,k) * idistx + FbGet8(tr,k) * distx; + b = FbGet8(bl,k) * idistx + FbGet8(br,k) * distx; + r |= ((((t * idisty) + (b * disty)) >> 16) & 0xff) << k; + } + buffer[i] = r; + } + v.vector[0] += unit.vector[0]; + v.vector[1] += unit.vector[1]; + v.vector[2] += unit.vector[2]; + } + } + } else { + if (PIXREGION_NUM_RECTS(pict->pCompositeClip) == 1) { + box = pict->pCompositeClip->extents; + for (i = 0; i < width; ++i) { + if (!v.vector[2]) { + buffer[i] = 0; + } else { + int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off, k; + FbBits *b; + CARD32 tl, tr, bl, br, r; + Bool x1_out, x2_out, y1_out, y2_out; + xFixed_48_16 div; + + div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2]; + x1 = div >> 16; + distx = ((xFixed)div >> 8) & 0xff; + x2 = x1 + 1; + div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2]; + y1 = div >> 16; + y2 = y1 + 1; + disty = ((xFixed)div >> 8) & 0xff; + + idistx = 256 - distx; + idisty = 256 - disty; + + b = bits + (y1 + pict->pDrawable->y)*stride; + x_off = x1 + pict->pDrawable->x; + + x1_out = (x1 < box.x1) | (x1 >= box.x2); + x2_out = (x2 < box.x1) | (x2 >= box.x2); + y1_out = (y1 < box.y1) | (y1 >= box.y2); + y2_out = (y2 < box.y1) | (y2 >= box.y2); + + tl = x1_out|y1_out ? 0 : fetch(b, x_off, indexed); + tr = x2_out|y1_out ? 0 : fetch(b, x_off + 1, indexed); + b += stride; + bl = x1_out|y2_out ? 0 : fetch(b, x_off, indexed); + br = x2_out|y2_out ? 0 : fetch(b, x_off + 1, indexed); + + r = 0; + for (k = 0; k < 32; k += 8) { + CARD32 t, b; + t = FbGet8(tl,k) * idistx + FbGet8(tr,k) * distx; + b = FbGet8(bl,k) * idistx + FbGet8(br,k) * distx; + r |= ((((t * idisty) + (b * disty)) >> 16) & 0xff) << k; + } + buffer[i] = r; + } + v.vector[0] += unit.vector[0]; + v.vector[1] += unit.vector[1]; + v.vector[2] += unit.vector[2]; + } + } else { + for (i = 0; i < width; ++i) { + if (!v.vector[2]) { + buffer[i] = 0; + } else { + int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off, k; + FbBits *b; + CARD32 tl, tr, bl, br, r; + xFixed_48_16 div; + + div = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2]; + x1 = div >> 16; + distx = ((xFixed)div >> 8) & 0xff; + x2 = x1 + 1; + div = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2]; + y1 = div >> 16; + y2 = y1 + 1; + disty = ((xFixed)div >> 8) & 0xff; + + idistx = 256 - distx; + idisty = 256 - disty; + + b = bits + (y1 + pict->pDrawable->y)*stride; + x_off = x1 + pict->pDrawable->x; + + tl = pixman_region_contains_point(pict->pCompositeClip, x1, y1, &box) + ? fetch(b, x_off, indexed) : 0; + tr = pixman_region_contains_point(pict->pCompositeClip, x2, y1, &box) + ? fetch(b, x_off + 1, indexed) : 0; + b += stride; + bl = pixman_region_contains_point(pict->pCompositeClip, x1, y2, &box) + ? fetch(b, x_off, indexed) : 0; + br = pixman_region_contains_point(pict->pCompositeClip, x2, y2, &box) + ? fetch(b, x_off + 1, indexed) : 0; + + r = 0; + for (k = 0; k < 32; k += 8) { + CARD32 t, b; + t = FbGet8(tl,k) * idistx + FbGet8(tr,k) * distx; + b = FbGet8(bl,k) * idistx + FbGet8(br,k) * distx; + r |= ((((t * idisty) + (b * disty)) >> 16) & 0xff) << k; + } + buffer[i] = r; + } + v.vector[0] += unit.vector[0]; + v.vector[1] += unit.vector[1]; + v.vector[2] += unit.vector[2]; + } + } + } +#ifdef PIXMAN_CONVOLUTION + } else if (pict->filter == PictFilterConvolution) { + xFixed *params = pict->filter_params; + INT32 cwidth = xFixedToInt(params[0]); + INT32 cheight = xFixedToInt(params[1]); + int xoff = params[0] >> 1; + int yoff = params[1] >> 1; + params += 2; + for (i = 0; i < width; ++i) { + if (!v.vector[2]) { + buffer[i] = 0; + } else { + int x1, x2, y1, y2, x, y; + INT32 srtot, sgtot, sbtot, satot; + xFixed *p = params; + xFixed_48_16 tmp; + tmp = ((xFixed_48_16)v.vector[0] << 16)/v.vector[2] - xoff; + x1 = xFixedToInt(tmp); + x2 = x1 + cwidth; + tmp = ((xFixed_48_16)v.vector[1] << 16)/v.vector[2] - yoff; + y1 = xFixedToInt(tmp); + y2 = y1 + cheight; + + srtot = sgtot = sbtot = satot = 0; + + for (y = y1; y < y2; y++) { + int ty = (pict->repeat == RepeatNormal) ? MOD (y, pict->pDrawable->height) : y; + for (x = x1; x < x2; x++) { + if (*p) { + int tx = (pict->repeat == RepeatNormal) ? MOD (x, pict->pDrawable->width) : x; + if (pixman_region_contains_point (pict->pCompositeClip, tx, ty, &box)) { + FbBits *b = bits + (ty + pict->pDrawable->y)*stride; + CARD32 c = fetch(b, tx + pict->pDrawable->x, indexed); + + srtot += Red(c) * *p; + sgtot += Green(c) * *p; + sbtot += Blue(c) * *p; + satot += Alpha(c) * *p; + } + } + p++; + } + } + + if (satot < 0) satot = 0; else if (satot > 0xff) satot = 0xff; + if (srtot < 0) srtot = 0; else if (srtot > 0xff) srtot = 0xff; + if (sgtot < 0) sgtot = 0; else if (sgtot > 0xff) sgtot = 0xff; + if (sbtot < 0) sbtot = 0; else if (sbtot > 0xff) sbtot = 0xff; + + buffer[i] = ((satot << 24) | + (srtot << 16) | + (sgtot << 8) | + (sbtot )); + } + v.vector[0] += unit.vector[0]; + v.vector[1] += unit.vector[1]; + v.vector[2] += unit.vector[2]; + } +#endif + } +} + + +static void fbFetchExternalAlpha(PicturePtr pict, int x, int y, int width, CARD32 *buffer) +{ + int i; + CARD32 _alpha_buffer[SCANLINE_BUFFER_LENGTH]; + CARD32 *alpha_buffer = _alpha_buffer; + + if (!pict->alphaMap) { + fbFetchTransformed(pict, x, y, width, buffer); + return; + } + + if (width > SCANLINE_BUFFER_LENGTH) + alpha_buffer = (CARD32 *) malloc(width*sizeof(CARD32)); + + fbFetchTransformed(pict, x, y, width, buffer); + fbFetchTransformed(pict->alphaMap, x - pict->alphaOrigin.x, y - pict->alphaOrigin.y, width, alpha_buffer); + for (i = 0; i < width; ++i) { + int a = alpha_buffer[i]>>24; + buffer[i] = (a << 24) + | (div_255(Red(buffer[i]) * a) << 16) + | (div_255(Green(buffer[i]) * a) << 8) + | (div_255(Blue(buffer[i]) * a)); + } + + if (alpha_buffer != _alpha_buffer) + free(alpha_buffer); +} + +static void fbStore(PicturePtr pict, int x, int y, int width, CARD32 *buffer) +{ + FbBits *bits; + FbStride stride; + int bpp; + int xoff, yoff; + storeProc store = storeProcForPicture(pict); +#ifdef PIXMAN_INDEXED_FORMATS + miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; +#else + miIndexedPtr indexed = 0; +#endif + + fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff); + x += xoff; + y += yoff; + + bits += y*stride; + store(bits, buffer, x, width, indexed); +} + +static void fbStoreExternalAlpha(PicturePtr pict, int x, int y, int width, CARD32 *buffer) +{ + FbBits *bits, *alpha_bits; + FbStride stride, astride; + int bpp, abpp; + int xoff, yoff; + int ax, ay; + storeProc store; + storeProc astore; +#ifdef PIXMAN_INDEXED_FORMATS + miIndexedPtr indexed = (miIndexedPtr) pict->pFormat->index.devPrivate; +#else + miIndexedPtr indexed = 0; +#endif + miIndexedPtr aindexed; + + if (!pict->alphaMap) { + fbStore(pict, x, y, width, buffer); + return; + } + + store = storeProcForPicture(pict); + astore = storeProcForPicture(pict->alphaMap); +#ifdef PIXMAN_INDEXED_FORMATS + aindexed = (miIndexedPtr) pict->alphaMap->pFormat->index.devPrivate; +#else + aindexed = 0; +#endif + + ax = x; + ay = y; + + fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff); + x += xoff; + y += yoff; + fbGetDrawable (pict->alphaMap->pDrawable, alpha_bits, astride, abpp, xoff, yoff); + ax += xoff; + ay += yoff; + + bits += y*stride; + alpha_bits += (ay - pict->alphaOrigin.y)*astride; + + + store(bits, buffer, x, width, indexed); + astore(alpha_bits, buffer, ax - pict->alphaOrigin.x, width, aindexed); +} + +typedef void (*scanStoreProc)(PicturePtr , int , int , int , CARD32 *); +typedef void (*scanFetchProc)(PicturePtr , int , int , int , CARD32 *); + +static void +fbCompositeRect (const FbComposeData *data, CARD32 *scanline_buffer) +{ + CARD32 *src_buffer = scanline_buffer; + CARD32 *dest_buffer = src_buffer + data->width; + int i; + scanStoreProc store; + scanFetchProc fetchSrc = 0, fetchMask = 0, fetchDest = 0; + + if (data->op == PIXMAN_OPERATOR_CLEAR) + fetchSrc = 0; + else if (!data->src->pDrawable) { +#ifdef PIXMAN_GRADIENTS + if (data->src->pSourcePict) + fetchSrc = fbFetchSourcePict; +#endif + } else if (data->src->alphaMap) + fetchSrc = fbFetchExternalAlpha; + else if (data->src->repeat == RepeatNormal && + data->src->pDrawable->width == 1 && data->src->pDrawable->height == 1) + fetchSrc = fbFetchSolid; +#ifdef PIXMAN_CONVOLUTION + else if (!data->src->transform && data->src->filter != PictFilterConvolution) + fetchSrc = fbFetch; +#else + else if (!data->src->transform) + fetchSrc = fbFetch; +#endif + else + fetchSrc = fbFetchTransformed; + + if (data->mask && data->op != PIXMAN_OPERATOR_CLEAR) { + if (!data->mask->pDrawable) { +#ifdef PIXMAN_GRADIENTS + if (data->mask->pSourcePict) + fetchMask = fbFetchSourcePict; +#endif + } else if (data->mask->alphaMap) + fetchMask = fbFetchExternalAlpha; + else if (data->mask->repeat == RepeatNormal + && data->mask->pDrawable->width == 1 && data->mask->pDrawable->height == 1) + fetchMask = fbFetchSolid; +#ifdef PIXMAN_CONVOLUTION + else if (!data->mask->transform && data->mask->filter != PictFilterConvolution) + fetchMask = fbFetch; +#else + else if (!data->mask->transform) + fetchMask = fbFetch; +#endif + else + fetchMask = fbFetchTransformed; + } else { + fetchMask = 0; + } + + if (data->dest->alphaMap) { + fetchDest = fbFetchExternalAlpha; + store = fbStoreExternalAlpha; + } else { + fetchDest = fbFetch; + store = fbStore; + } + if (data->op == PIXMAN_OPERATOR_CLEAR || data->op == PIXMAN_OPERATOR_SRC) + fetchDest = 0; + + if (fetchSrc && fetchMask && data->mask && data->mask->componentAlpha && PICT_FORMAT_RGB(data->mask->format_code)) { + CARD32 *mask_buffer = dest_buffer + data->width; + CombineFuncC compose = composeFunctions.combineC[data->op]; + if (!compose) + return; + + for (i = 0; i < data->height; ++i) + { + /* fill first half of scanline with source */ + fetchSrc(data->src, data->xSrc, data->ySrc + i, data->width, src_buffer); + fetchMask(data->mask, data->xMask, data->yMask + i, data->width, mask_buffer); + + /* fill dest into second half of scanline */ + if (fetchDest) + fetchDest(data->dest, data->xDest, data->yDest + i, data->width, dest_buffer); + + /* blend */ + compose(dest_buffer, src_buffer, mask_buffer, data->width); + + /* write back */ + store(data->dest, data->xDest, data->yDest + i, data->width, dest_buffer); + } + } else { + + CombineFuncU compose = composeFunctions.combineU[data->op]; + if (!compose) + return; + + if (fetchSrc == fbFetchSolid && (!fetchMask || fetchMask == fbFetchSolid)) { + fetchSrc(data->src, data->xSrc, data->ySrc, data->width, src_buffer); + if (fetchMask) { + fetchMask(data->mask, data->xMask, data->yMask, data->width, dest_buffer); + composeFunctions.combineMaskU(src_buffer, dest_buffer, data->width); + } + fetchSrc = 0; + fetchMask = 0; + } + + for (i = 0; i < data->height; ++i) { + /* fill first half of scanline with source */ + if (fetchSrc) { + fetchSrc(data->src, data->xSrc, data->ySrc + i, data->width, src_buffer); + + /* add in mask */ + if (fetchMask) { + fetchMask(data->mask, data->xMask, data->yMask + i, data->width, dest_buffer); + composeFunctions.combineMaskU(src_buffer, dest_buffer, data->width); + } + } + + /* fill dest into second half of scanline */ + if (fetchDest) + fetchDest(data->dest, data->xDest, data->yDest + i, data->width, dest_buffer); + + /* blend */ + compose(dest_buffer, src_buffer, data->width); + + /* write back */ + store(data->dest, data->xDest, data->yDest + i, data->width, dest_buffer); + } + } +} + +void +pixman_compositeGeneral (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + pixman_region16_t *region; + int n; + BoxPtr pbox; + Bool srcRepeat = FALSE; + Bool maskRepeat = FALSE; + int w, h; + CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3]; + CARD32 *scanline_buffer = _scanline_buffer; + FbComposeData compose_data; + + if (pSrc->pDrawable) + srcRepeat = pSrc->repeat == RepeatNormal && !pSrc->transform + && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1); + + if (pMask && pMask->pDrawable) + maskRepeat = pMask->repeat == RepeatNormal && !pMask->transform + && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1); + + if (op == PIXMAN_OPERATOR_OVER && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format_code) && !pSrc->alphaMap) + op = PIXMAN_OPERATOR_SRC; + + region = pixman_region_create(); + pixman_region_union_rect (region, region, xDst, yDst, width, height); + + if (!FbComputeCompositeRegion (region, + pSrc, + pMask, + pDst, + xSrc, + ySrc, + xMask, + yMask, + xDst, + yDst, + width, + height)) + return; + + compose_data.op = op; + compose_data.src = pSrc; + compose_data.mask = pMask; + compose_data.dest = pDst; + if (width > SCANLINE_BUFFER_LENGTH) + scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); + + n = pixman_region_num_rects (region); + pbox = pixman_region_rects (region); + while (n--) + { + h = pbox->y2 - pbox->y1; + compose_data.ySrc = pbox->y1 - yDst + ySrc; + compose_data.yMask = pbox->y1 - yDst + yMask; + compose_data.yDest = pbox->y1; + while (h) + { + compose_data.height = h; + w = pbox->x2 - pbox->x1; + compose_data.xSrc = pbox->x1 - xDst + xSrc; + compose_data.xMask = pbox->x1 - xDst + xMask; + compose_data.xDest = pbox->x1; + if (maskRepeat) + { + compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height); + if (compose_data.height > pMask->pDrawable->height - compose_data.yMask) + compose_data.height = pMask->pDrawable->height - compose_data.yMask; + } + if (srcRepeat) + { + compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height); + if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc) + compose_data.height = pSrc->pDrawable->height - compose_data.ySrc; + } + while (w) + { + compose_data.width = w; + if (maskRepeat) + { + compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width); + if (compose_data.width > pMask->pDrawable->width - compose_data.xMask) + compose_data.width = pMask->pDrawable->width - compose_data.xMask; + } + if (srcRepeat) + { + compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width); + if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc) + compose_data.width = pSrc->pDrawable->width - compose_data.xSrc; + } + fbCompositeRect(&compose_data, scanline_buffer); + w -= compose_data.width; + compose_data.xSrc += compose_data.width; + compose_data.xMask += compose_data.width; + compose_data.xDest += compose_data.width; + } + h -= compose_data.height; + compose_data.ySrc += compose_data.height; + compose_data.yMask += compose_data.height; + compose_data.yDest += compose_data.height; + } + pbox++; + } + pixman_region_destroy (region); + + if (scanline_buffer != _scanline_buffer) + free(scanline_buffer); +} + +#endif diff --git a/pixman/src/fbedge.c b/pixman/src/fbedge.c new file mode 100644 index 0000000..15835f3 --- /dev/null +++ b/pixman/src/fbedge.c @@ -0,0 +1,304 @@ +/* + * $Id: fbedge.c,v 1.3 2005/08/02 01:01:24 vektor Exp $ + * + * Copyright © 2004 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include <string.h> +#include "pixman-xserver-compat.h" + +#ifdef RENDER + +/* + * 4 bit alpha + */ + +#define N_BITS 4 +#define rasterizeEdges fbRasterizeEdges4 + +#if BITMAP_BIT_ORDER == LSBFirst +#define Shift4(o) ((o) << 2) +#else +#define Shift4(o) ((1-(o)) << 2) +#endif + +#define Get4(x,o) (((x) >> Shift4(o)) & 0xf) +#define Put4(x,o,v) (((x) & ~(0xf << Shift4(o))) | (((v) & 0xf) << Shift4(o))) + +#define DefineAlpha(line,x) \ + CARD8 *__ap = (CARD8 *) line + ((x) >> 1); \ + int __ao = (x) & 1 + +#define StepAlpha ((__ap += __ao), (__ao ^= 1)) + +#define AddAlpha(a) { \ + CARD8 __o = *__ap; \ + CARD8 __a = (a) + Get4(__o, __ao); \ + *__ap = Put4 (__o, __ao, __a | (0 - ((__a) >> 4))); \ +} + +#include "fbedgeimp.h" + +#undef AddAlpha +#undef StepAlpha +#undef DefineAlpha +#undef rasterizeEdges +#undef N_BITS + + +/* + * 1 bit alpha + */ + +#define N_BITS 1 +#define rasterizeEdges fbRasterizeEdges1 + +#include "fbedgeimp.h" + +#undef rasterizeEdges +#undef N_BITS + +/* + * 8 bit alpha + */ + +static INLINE CARD8 +clip255 (int x) +{ + if (x > 255) return 255; + return x; +} + +static INLINE void +add_saturate_8 (CARD8 *buf, int value, int length) +{ + while (length--) + { + *buf = clip255 (*buf + value); + buf++; + } +} + +/* + * We want to detect the case where we add the same value to a long + * span of pixels. The triangles on the end are filled in while we + * count how many sub-pixel scanlines contribute to the middle section. + * + * +--------------------------+ + * fill_height =| \ / + * +------------------+ + * |================| + * fill_start fill_end + */ +static void +fbRasterizeEdges8 (FbBits *buf, + int width, + int stride, + RenderEdge *l, + RenderEdge *r, + xFixed t, + xFixed b) +{ + xFixed y = t; + FbBits *line; + int fill_start = -1, fill_end = -1; + int fill_size = 0; + + line = buf + xFixedToInt (y) * stride; + + for (;;) + { + CARD8 *ap = (CARD8 *) line; + xFixed lx, rx; + int lxi, rxi; + + /* clip X */ + lx = l->x; + if (lx < 0) + lx = 0; + rx = r->x; + if (xFixedToInt (rx) >= width) + rx = IntToxFixed (width); + + /* Skip empty (or backwards) sections */ + if (rx > lx) + { + int lxs, rxs; + + /* Find pixel bounds for span. */ + lxi = xFixedToInt (lx); + rxi = xFixedToInt (rx); + + /* Sample coverage for edge pixels */ + lxs = RenderSamplesX (lx, 8); + rxs = RenderSamplesX (rx, 8); + + /* Add coverage across row */ + if (lxi == rxi) + { + ap[lxi] = clip255 (ap[lxi] + rxs - lxs); + } + else + { + ap[lxi] = clip255 (ap[lxi] + N_X_FRAC(8) - lxs); + + /* Move forward so that lxi/rxi is the pixel span */ + lxi++; + + /* Don't bother trying to optimize the fill unless + * the span is longer than 4 pixels. */ + if (rxi - lxi > 4) + { + if (fill_start < 0) + { + fill_start = lxi; + fill_end = rxi; + fill_size++; + } + else + { + if (lxi >= fill_end || rxi < fill_start) + { + /* We're beyond what we saved, just fill it */ + add_saturate_8 (ap + fill_start, + fill_size * N_X_FRAC(8), + fill_end - fill_start); + fill_start = lxi; + fill_end = rxi; + fill_size = 1; + } + else + { + /* Update fill_start */ + if (lxi > fill_start) + { + add_saturate_8 (ap + fill_start, + fill_size * N_X_FRAC(8), + lxi - fill_start); + fill_start = lxi; + } + else if (lxi < fill_start) + { + add_saturate_8 (ap + lxi, N_X_FRAC(8), + fill_start - lxi); + } + + /* Update fill_end */ + if (rxi < fill_end) + { + add_saturate_8 (ap + rxi, + fill_size * N_X_FRAC(8), + fill_end - rxi); + fill_end = rxi; + } + else if (fill_end < rxi) + { + add_saturate_8 (ap + fill_end, + N_X_FRAC(8), + rxi - fill_end); + } + fill_size++; + } + } + } + else + { + add_saturate_8 (ap + lxi, N_X_FRAC(8), rxi - lxi); + } + + /* Do not add in a 0 alpha here. This check is + * necessary to avoid a buffer overrun, (when rx + * is exactly on a pixel boundary). */ + if (rxs) + ap[rxi] = clip255 (ap[rxi] + rxs); + } + } + + if (y == b) { + /* We're done, make sure we clean up any remaining fill. */ + if (fill_start != fill_end) { + if (fill_size == N_Y_FRAC(8)) + { + memset (ap + fill_start, 0xff, fill_end - fill_start); + } + else + { + add_saturate_8 (ap + fill_start, fill_size * N_X_FRAC(8), + fill_end - fill_start); + } + } + break; + } + + if (xFixedFrac (y) != Y_FRAC_LAST(8)) + { + RenderEdgeStepSmall (l); + RenderEdgeStepSmall (r); + y += STEP_Y_SMALL(8); + } + else + { + RenderEdgeStepBig (l); + RenderEdgeStepBig (r); + y += STEP_Y_BIG(8); + if (fill_start != fill_end) + { + if (fill_size == N_Y_FRAC(8)) + { + memset (ap + fill_start, 0xff, fill_end - fill_start); + } + else + { + add_saturate_8 (ap + fill_start, fill_size * N_X_FRAC(8), + fill_end - fill_start); + } + fill_start = fill_end = -1; + fill_size = 0; + } + line += stride; + } + } +} + +void +fbRasterizeEdges (FbBits *buf, + int bpp, + int width, + int stride, + RenderEdge *l, + RenderEdge *r, + xFixed t, + xFixed b) +{ + switch (bpp) { + case 1: + fbRasterizeEdges1 (buf, width, stride, l, r, t, b); + break; + case 4: + fbRasterizeEdges4 (buf, width, stride, l, r, t, b); + break; + case 8: + fbRasterizeEdges8 (buf, width, stride, l, r, t, b); + break; + } +} + +#endif /* RENDER */ diff --git a/pixman/src/fbedgeimp.h b/pixman/src/fbedgeimp.h new file mode 100644 index 0000000..8c3d055 --- /dev/null +++ b/pixman/src/fbedgeimp.h @@ -0,0 +1,138 @@ +/* + * $Id: fbedgeimp.h,v 1.2 2005/01/21 18:38:42 cworth Exp $ + * + * Copyright © 2004 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef rasterizeSpan +#endif + +static void +rasterizeEdges (FbBits *buf, + int width, + int stride, + RenderEdge *l, + RenderEdge *r, + xFixed t, + xFixed b) +{ + xFixed y = t; + FbBits *line; + + line = buf + xFixedToInt (y) * stride; + + for (;;) + { + xFixed lx, rx; + int lxi, rxi; + + /* clip X */ + lx = l->x; + if (lx < 0) + lx = 0; + rx = r->x; + if (xFixedToInt (rx) >= width) + rx = IntToxFixed (width); + + /* Skip empty (or backwards) sections */ + if (rx > lx) + { + + /* Find pixel bounds for span. */ + lxi = xFixedToInt (lx); + rxi = xFixedToInt (rx); + +#if N_BITS == 1 + { + FbBits *a = line; + FbBits startmask, endmask; + int nmiddle; + int width = rxi - lxi; + int x = lxi; + + a += x >> FB_SHIFT; + x &= FB_MASK; + + FbMaskBits (x, width, startmask, nmiddle, endmask); + if (startmask) + *a++ |= startmask; + while (nmiddle--) + *a++ = FB_ALLONES; + if (endmask) + *a |= endmask; + } +#else + { + DefineAlpha(line,lxi); + int lxs, rxs; + + /* Sample coverage for edge pixels */ + lxs = RenderSamplesX (lx, N_BITS); + rxs = RenderSamplesX (rx, N_BITS); + + /* Add coverage across row */ + if (lxi == rxi) + { + AddAlpha (rxs - lxs); + } + else + { + int xi; + + AddAlpha (N_X_FRAC(N_BITS) - lxs); + StepAlpha; + for (xi = lxi + 1; xi < rxi; xi++) + { + AddAlpha (N_X_FRAC(N_BITS)); + StepAlpha; + } + /* Do not add in a 0 alpha here. This check is + * necessary to avoid a buffer overrun, (when rx + * is exactly on a pixel boundary). */ + if (rxs) + AddAlpha (rxs); + } + } +#endif + } + + if (y == b) + break; + +#if N_BITS > 1 + if (xFixedFrac (y) != Y_FRAC_LAST(N_BITS)) + { + RenderEdgeStepSmall (l); + RenderEdgeStepSmall (r); + y += STEP_Y_SMALL(N_BITS); + } + else +#endif + { + RenderEdgeStepBig (l); + RenderEdgeStepBig (r); + y += STEP_Y_BIG(N_BITS); + line += stride; + } + } +} + +#undef rasterizeSpan diff --git a/pixman/src/fbpict.h b/pixman/src/fbpict.h new file mode 100644 index 0000000..20d6e6c --- /dev/null +++ b/pixman/src/fbpict.h @@ -0,0 +1,356 @@ +/* + * $Id: fbpict.h,v 1.1 2005/08/11 04:10:13 vektor Exp $ + * + * Copyright © 2000 Keith Packard + * 2005 Lars Knoll & Zack Rusin, Trolltech + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + +#ifndef _FBPICT_H_ +#define _FBPICT_H_ + +#include "pixman-xserver-compat.h" +#include "renderedge.h" + +#define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) ) +#define FbIntDiv(a,b) (((CARD16) (a) * 255) / (b)) + +#define FbGet8(v,i) ((CARD16) (CARD8) ((v) >> i)) + +/* + * There are two ways of handling alpha -- either as a single unified value or + * a separate value for each component, hence each macro must have two + * versions. The unified alpha version has a 'U' at the end of the name, + * the component version has a 'C'. Similarly, functions which deal with + * this difference will have two versions using the same convention. + */ + +#define FbOverU(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),(a),(t)) + FbGet8(x,i),\ + (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) + +#define FbOverC(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),FbGet8(a,i),(t)) + FbGet8(x,i),\ + (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) + +#define FbInU(x,i,a,t) ((CARD32) FbIntMult(FbGet8(x,i),(a),(t)) << (i)) + +#define FbInC(x,i,a,t) ((CARD32) FbIntMult(FbGet8(x,i),FbGet8(a,i),(t)) << (i)) + +#define FbGen(x,y,i,ax,ay,t,u,v) ((t) = (FbIntMult(FbGet8(y,i),ay,(u)) + \ + FbIntMult(FbGet8(x,i),ax,(v))),\ + (CARD32) ((CARD8) ((t) | \ + (0 - ((t) >> 8)))) << (i)) + +#define FbAdd(x,y,i,t) ((t) = FbGet8(x,i) + FbGet8(y,i), \ + (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i)) + + +#define Alpha(x) ((x) >> 24) +#define Red(x) (((x) >> 16) & 0xff) +#define Green(x) (((x) >> 8) & 0xff) +#define Blue(x) ((x) & 0xff) + +#define fbComposeGetSolid(pict, bits) { \ + FbBits *__bits__; \ + FbStride __stride__; \ + int __bpp__; \ + int __xoff__,__yoff__; \ +\ + fbGetDrawable((pict)->pDrawable,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ + switch (__bpp__) { \ + case 32: \ + (bits) = *(CARD32 *) __bits__; \ + break; \ + case 24: \ + (bits) = Fetch24 ((CARD8 *) __bits__); \ + break; \ + case 16: \ + (bits) = *(CARD16 *) __bits__; \ + (bits) = cvt0565to0888(bits); \ + break; \ + case 8: \ + (bits) = *(CARD8 *) __bits__; \ + (bits) = (bits) << 24; \ + break; \ + case 1: \ + (bits) = *(CARD32 *) __bits__; \ + (bits) = FbLeftStipBits((bits),1) ? 0xff000000 : 0x00000000;\ + break; \ + default: \ + return; \ + } \ + /* manage missing src alpha */ \ + if ((pict)->image_format.alphaMask == 0) \ + (bits) |= 0xff000000; \ +} + +#define fbComposeGetStart(pict,x,y,type,stride,line,mul) {\ + FbBits *__bits__; \ + FbStride __stride__; \ + int __bpp__; \ + int __xoff__,__yoff__; \ +\ + fbGetDrawable((pict)->pDrawable,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ + (stride) = __stride__ * sizeof (FbBits) / sizeof (type); \ + (line) = ((type *) __bits__) + (stride) * ((y) + __yoff__) + (mul) * ((x) + __xoff__); \ +} + +#define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \ + (((s) >> 5) & 0x07e0) | \ + (((s) >> 8) & 0xf800)) +#define cvt0565to0888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \ + ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \ + ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000))) + +#if IMAGE_BYTE_ORDER == MSBFirst +#define Fetch24(a) ((unsigned long) (a) & 1 ? \ + ((*(a) << 16) | *((CARD16 *) ((a)+1))) : \ + ((*((CARD16 *) (a)) << 8) | *((a)+2))) +#define Store24(a,v) ((unsigned long) (a) & 1 ? \ + ((*(a) = (CARD8) ((v) >> 16)), \ + (*((CARD16 *) ((a)+1)) = (CARD16) (v))) : \ + ((*((CARD16 *) (a)) = (CARD16) ((v) >> 8)), \ + (*((a)+2) = (CARD8) (v)))) +#else +#define Fetch24(a) ((unsigned long) (a) & 1 ? \ + ((*(a)) | (*((CARD16 *) ((a)+1)) << 8)) : \ + ((*((CARD16 *) (a))) | (*((a)+2) << 16))) +#define Store24(a,v) ((unsigned long) (a) & 1 ? \ + ((*(a) = (CARD8) (v)), \ + (*((CARD16 *) ((a)+1)) = (CARD16) ((v) >> 8))) : \ + ((*((CARD16 *) (a)) = (CARD16) (v)),\ + (*((a)+2) = (CARD8) ((v) >> 16)))) +#endif + +/* + The methods below use some tricks to be able to do two color + components at the same time. +*/ + +/* + x_c = (x_c * a) / 255 +*/ +#define FbByteMul(x, a) do { \ + CARD32 t = ((x & 0xff00ff) * a) + 0x800080; \ + t = (t + ((t >> 8) & 0xff00ff)) >> 8; \ + t &= 0xff00ff; \ + \ + x = (((x >> 8) & 0xff00ff) * a) + 0x800080; \ + x = (x + ((x >> 8) & 0xff00ff)); \ + x &= 0xff00ff00; \ + x += t; \ + } while (0) + +/* + x_c = (x_c * a) / 255 + y +*/ +#define FbByteMulAdd(x, a, y) do { \ + CARD32 t = ((x & 0xff00ff) * a) + 0x800080; \ + t = (t + ((t >> 8) & 0xff00ff)) >> 8; \ + t &= 0xff00ff; \ + t += y & 0xff00ff; \ + t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ + t &= 0xff00ff; \ + \ + x = (((x >> 8) & 0xff00ff) * a) + 0x800080; \ + x = (x + ((x >> 8) & 0xff00ff)) >> 8; \ + x &= 0xff00ff; \ + x += (y >> 8) & 0xff00ff; \ + x |= 0x1000100 - ((t >> 8) & 0xff00ff); \ + x &= 0xff00ff; \ + x <<= 8; \ + x += t; \ + } while (0) + +/* + x_c = (x_c * a + y_c * b) / 255 +*/ +#define FbByteAddMul(x, a, y, b) do { \ + CARD32 t; \ + CARD32 r = (x >> 24) * a + (y >> 24) * b + 0x80; \ + r += (r >> 8); \ + r >>= 8; \ + \ + t = (x & 0xff00) * a + (y & 0xff00) * b + 0x8000; \ + t += (t >> 8); \ + t >>= 16; \ + \ + t |= r << 16; \ + t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ + t &= 0xff00ff; \ + t <<= 8; \ + \ + r = ((x >> 16) & 0xff) * a + ((y >> 16) & 0xff) * b + 0x80; \ + r += (r >> 8); \ + r >>= 8; \ + \ + x = (x & 0xff) * a + (y & 0xff) * b + 0x80; \ + x += (x >> 8); \ + x >>= 8; \ + x |= r << 16; \ + x |= 0x1000100 - ((x >> 8) & 0xff00ff); \ + x &= 0xff00ff; \ + x |= t; \ +} while (0) + +/* + x_c = (x_c * a + y_c *b) / 256 +*/ +#define FbByteAddMul_256(x, a, y, b) do { \ + CARD32 t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; \ + t >>= 8; \ + t &= 0xff00ff; \ + \ + x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; \ + x &= 0xff00ff00; \ + x += t; \ +} while (0) +/* + x_c = (x_c * a_c) / 255 +*/ +#define FbByteMulC(x, a) do { \ + CARD32 t; \ + CARD32 r = (x & 0xff) * (a & 0xff); \ + r |= (x & 0xff0000) * ((a >> 16) & 0xff); \ + r += 0x800080; \ + r = (r + ((r >> 8) & 0xff00ff)) >> 8; \ + r &= 0xff00ff; \ + \ + x >>= 8; \ + t = (x & 0xff) * ((a >> 8) & 0xff); \ + t |= (x & 0xff0000) * (a >> 24); \ + t += 0x800080; \ + t = t + ((t >> 8) & 0xff00ff); \ + x = r | (t & 0xff00ff00); \ + \ + } while (0) + +/* + x_c = (x_c * a) / 255 + y +*/ +#define FbByteMulAddC(x, a, y) do { \ + CARD32 t; \ + CARD32 r = (x & 0xff) * (a & 0xff); \ + r |= (x & 0xff0000) * ((a >> 16) & 0xff); \ + r += 0x800080; \ + r = (r + ((r >> 8) & 0xff00ff)) >> 8; \ + r &= 0xff00ff; \ + r += y & 0xff00ff; \ + r |= 0x1000100 - ((r >> 8) & 0xff00ff); \ + r &= 0xff00ff; \ + \ + x >>= 8; \ + t = (x & 0xff) * ((a >> 8) & 0xff); \ + t |= (x & 0xff0000) * (a >> 24); \ + t += 0x800080; \ + t = (t + ((t >> 8) & 0xff00ff)) >> 8; \ + t &= 0xff00ff; \ + t += (y >> 8) & 0xff00ff; \ + t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ + t &= 0xff00ff; \ + x = r | (t << 8); \ + } while (0) + +/* + x_c = (x_c * a_c + y_c * b) / 255 +*/ +#define FbByteAddMulC(x, a, y, b) do { \ + CARD32 t; \ + CARD32 r = (x >> 24) * (a >> 24) + (y >> 24) * b + 0x80; \ + r += (r >> 8); \ + r >>= 8; \ + \ + t = (x & 0xff00) * ((a >> 8) & 0xff) + (y & 0xff00) * b + 0x8000; \ + t += (t >> 8); \ + t >>= 16; \ + \ + t |= r << 16; \ + t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ + t &= 0xff00ff; \ + t <<= 8; \ + \ + r = ((x >> 16) & 0xff) * ((a >> 16) & 0xff) + ((y >> 16) & 0xff) * b + 0x80; \ + r += (r >> 8); \ + r >>= 8; \ + \ + x = (x & 0xff) * (a & 0xff) + (y & 0xff) * b + 0x80; \ + x += (x >> 8); \ + x >>= 8; \ + x |= r << 16; \ + x |= 0x1000100 - ((x >> 8) & 0xff00ff); \ + x &= 0xff00ff; \ + x |= t; \ +} while (0) + +/* + x_c = min(x_c + y_c, 255) +*/ +#define FbByteAdd(x, y) do { \ + CARD32 t; \ + CARD32 r = (x & 0xff00ff) + (y & 0xff00ff); \ + r |= 0x1000100 - ((r >> 8) & 0xff00ff); \ + r &= 0xff00ff; \ + \ + t = ((x >> 8) & 0xff00ff) + ((y >> 8) & 0xff00ff); \ + t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ + r |= (t & 0xff00ff) << 8; \ + x = r; \ + } while (0) + +#define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8) + +#if defined(__i386__) && defined(__GNUC__) +#define FASTCALL __attribute__((regparm(3))) +#else +#define FASTCALL +#endif + +#if defined(__GNUC__) +#define INLINE __inline__ +#else +#define INLINE +#endif + +typedef struct _FbComposeData { + CARD8 op; + PicturePtr src; + PicturePtr mask; + PicturePtr dest; + INT16 xSrc; + INT16 ySrc; + INT16 xMask; + INT16 yMask; + INT16 xDest; + INT16 yDest; + CARD16 width; + CARD16 height; +} FbComposeData; + +typedef FASTCALL void (*CombineMaskU) (CARD32 *src, const CARD32 *mask, int width); +typedef FASTCALL void (*CombineFuncU) (CARD32 *dest, const CARD32 *src, int width); +typedef FASTCALL void (*CombineFuncC) (CARD32 *dest, CARD32 *src, CARD32 *mask, int width); + +typedef struct _FbComposeFunctions { + CombineFuncU *combineU; + CombineFuncC *combineC; + CombineMaskU combineMaskU; +} FbComposeFunctions; + +#endif /* _FBPICT_H_ */ diff --git a/pixman/src/fbtrap.c b/pixman/src/fbtrap.c new file mode 100644 index 0000000..c569701 --- /dev/null +++ b/pixman/src/fbtrap.c @@ -0,0 +1,236 @@ +/* + * $Id: fbtrap.c,v 1.3 2005/01/21 18:26:28 cworth Exp $ + * + * Copyright © 2004 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "pixman-xserver-compat.h" + +#ifdef RENDER + +/* XXX: Haven't added addTraps to libpixman yet. */ +#if 0 +void +fbAddTraps (PicturePtr pPicture, + INT16 x_off, + INT16 y_off, + int ntrap, + xTrap *traps) +{ + FbBits *buf; + int bpp; + int width; + int stride; + int height; + int pxoff, pyoff; + + xFixed x_off_fixed; + xFixed y_off_fixed; + RenderEdge l, r; + xFixed t, b; + + fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff); + + width = pPicture->pDrawable->width; + height = pPicture->pDrawable->height; + x_off += pxoff; + y_off += pyoff; + + x_off_fixed = IntToxFixed(y_off); + y_off_fixed = IntToxFixed(y_off); + + while (ntrap--) + { + t = traps->top.y + y_off_fixed; + if (t < 0) + t = 0; + t = RenderSampleCeilY (t, bpp); + + b = traps->bot.y + y_off_fixed; + if (xFixedToInt (b) >= height) + b = IntToxFixed (height) - 1; + b = RenderSampleFloorY (b, bpp); + + if (b >= t) + { + /* initialize edge walkers */ + RenderEdgeInit (&l, bpp, t, + traps->top.l + x_off_fixed, + traps->top.y + y_off_fixed, + traps->bot.l + x_off_fixed, + traps->bot.y + y_off_fixed); + + RenderEdgeInit (&r, bpp, t, + traps->top.r + x_off_fixed, + traps->top.y + y_off_fixed, + traps->bot.r + x_off_fixed, + traps->bot.y + y_off_fixed); + + fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b); + } + traps++; + } +} +#endif + +void +fbRasterizeTrapezoid (PicturePtr pPicture, + const xTrapezoid *trap, + int x_off, + int y_off) +{ + FbBits *buf; + int bpp; + int width; + int stride; + int height; + int pxoff, pyoff; + + xFixed x_off_fixed; + xFixed y_off_fixed; + RenderEdge l, r; + xFixed t, b; + + fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff); + + width = pPicture->pDrawable->width; + height = pPicture->pDrawable->height; + x_off += pxoff; + y_off += pyoff; + + x_off_fixed = IntToxFixed(x_off); + y_off_fixed = IntToxFixed(y_off); + t = trap->top + y_off_fixed; + if (t < 0) + t = 0; + t = RenderSampleCeilY (t, bpp); + + b = trap->bottom + y_off_fixed; + if (xFixedToInt (b) >= height) + b = IntToxFixed (height) - 1; + b = RenderSampleFloorY (b, bpp); + + if (b >= t) + { + /* initialize edge walkers */ + RenderLineFixedEdgeInit (&l, bpp, t, &trap->left, x_off, y_off); + RenderLineFixedEdgeInit (&r, bpp, t, &trap->right, x_off, y_off); + + fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b); + } +} + +/* XXX: Haven't add addTriangles to libpixman yet. */ +#if 0 +static int +_GreaterY (xPointFixed *a, xPointFixed *b) +{ + if (a->y == b->y) + return a->x > b->x; + return a->y > b->y; +} + +/* + * Note that the definition of this function is a bit odd because + * of the X coordinate space (y increasing downwards). + */ +static int +_Clockwise (xPointFixed *ref, xPointFixed *a, xPointFixed *b) +{ + xPointFixed ad, bd; + + ad.x = a->x - ref->x; + ad.y = a->y - ref->y; + bd.x = b->x - ref->x; + bd.y = b->y - ref->y; + + return ((xFixed_32_32) bd.y * ad.x - (xFixed_32_32) ad.y * bd.x) < 0; +} + +/* FIXME -- this could be made more efficient */ +void +fbAddTriangles (PicturePtr pPicture, + INT16 x_off, + INT16 y_off, + int ntri, + xTriangle *tris) +{ + xPointFixed *top, *left, *right, *tmp; + xTrapezoid trap; + + for (; ntri; ntri--, tris++) + { + top = &tris->p1; + left = &tris->p2; + right = &tris->p3; + if (_GreaterY (top, left)) { + tmp = left; left = top; top = tmp; + } + if (_GreaterY (top, right)) { + tmp = right; right = top; top = tmp; + } + if (_Clockwise (top, right, left)) { + tmp = right; right = left; left = tmp; + } + + /* + * Two cases: + * + * + + + * / \ / \ + * / \ / \ + * / + + \ + * / -- -- \ + * / -- -- \ + * / --- --- \ + * +-- --+ + */ + + trap.top = top->y; + trap.left.p1 = *top; + trap.left.p2 = *left; + trap.right.p1 = *top; + trap.right.p2 = *right; + if (right->y < left->y) + trap.bottom = right->y; + else + trap.bottom = left->y; + fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off); + if (right->y < left->y) + { + trap.top = right->y; + trap.bottom = left->y; + trap.right.p1 = *right; + trap.right.p2 = *left; + } + else + { + trap.top = left->y; + trap.bottom = right->y; + trap.left.p1 = *left; + trap.left.p2 = *right; + } + fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off); + } +} +#endif + +#endif /* RENDER */ diff --git a/pixman/src/ic.c b/pixman/src/ic.c new file mode 100644 index 0000000..6bdaba5 --- /dev/null +++ b/pixman/src/ic.c @@ -0,0 +1,1687 @@ +/* + * Copyright © 2000 SuSE, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of SuSE not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. SuSE makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, SuSE, Inc. + */ + +#include "pixman-xserver-compat.h" +#include "fbpict.h" + +#define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \ + (((s) >> 5) & 0x07e0) | \ + (((s) >> 8) & 0xf800)) +#define cvt0565to0888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \ + ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \ + ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000))) + +#if IMAGE_BYTE_ORDER == MSBFirst +#define Fetch24(a) ((unsigned long) (a) & 1 ? \ + ((*(a) << 16) | *((CARD16 *) ((a)+1))) : \ + ((*((CARD16 *) (a)) << 8) | *((a)+2))) +#define Store24(a,v) ((unsigned long) (a) & 1 ? \ + ((*(a) = (CARD8) ((v) >> 16)), \ + (*((CARD16 *) ((a)+1)) = (CARD16) (v))) : \ + ((*((CARD16 *) (a)) = (CARD16) ((v) >> 8)), \ + (*((a)+2) = (CARD8) (v)))) +#else +#define Fetch24(a) ((unsigned long) (a) & 1 ? \ + ((*(a)) | (*((CARD16 *) ((a)+1)) << 8)) : \ + ((*((CARD16 *) (a))) | (*((a)+2) << 16))) +#define Store24(a,v) ((unsigned long) (a) & 1 ? \ + ((*(a) = (CARD8) (v)), \ + (*((CARD16 *) ((a)+1)) = (CARD16) ((v) >> 8))) : \ + ((*((CARD16 *) (a)) = (CARD16) (v)),\ + (*((a)+2) = (CARD8) ((v) >> 16)))) +#endif + +static CARD32 +fbOver (CARD32 x, CARD32 y) +{ + CARD16 a = ~x >> 24; + CARD16 t; + CARD32 m,n,o,p; + + m = FbOverU(x,y,0,a,t); + n = FbOverU(x,y,8,a,t); + o = FbOverU(x,y,16,a,t); + p = FbOverU(x,y,24,a,t); + return m|n|o|p; +} + +static CARD32 +fbOver24 (CARD32 x, CARD32 y) +{ + CARD16 a = ~x >> 24; + CARD16 t; + CARD32 m,n,o; + + m = FbOverU(x,y,0,a,t); + n = FbOverU(x,y,8,a,t); + o = FbOverU(x,y,16,a,t); + return m|n|o; +} + +static CARD32 +fbIn (CARD32 x, CARD8 y) +{ + CARD16 a = y; + CARD16 t; + CARD32 m,n,o,p; + + m = FbInU(x,0,a,t); + n = FbInU(x,8,a,t); + o = FbInU(x,16,a,t); + p = FbInU(x,24,a,t); + return m|n|o|p; +} + +static CARD32 +fbIn24 (CARD32 x, CARD8 y) +{ + CARD16 a = y; + CARD16 t; + CARD32 m,n,o,p; + + m = FbInU(x,0,a,t); + n = FbInU(x,8,a,t); + o = FbInU(x,16,a,t); + p = (y << 24); + return m|n|o|p; +} + +#define genericCombine24(a,b,c,d) (((a)*(c)+(b)*(d))) + +/* + * This macro does src IN mask OVER dst when src and dst are 0888. + * If src has alpha, this will not work + */ +#define inOver0888(alpha, source, destval, dest) { \ + CARD32 dstrb=destval&0xFF00FF; CARD32 dstag=(destval>>8)&0xFF00FF; \ + CARD32 drb=((source&0xFF00FF)-dstrb)*alpha; CARD32 dag=(((source>>8)&0xFF00FF)-dstag)*alpha; \ + dest =((((drb>>8) + dstrb) & 0x00FF00FF) | ((((dag>>8) + dstag) << 8) & 0xFF00FF00)); \ + } + +/* + * This macro does src IN mask OVER dst when src and dst are 0565 and + * mask is a 5-bit alpha value. Again, if src has alpha, this will not + * work. + */ +#define inOver0565(alpha, source, destval, dest) { \ + CARD16 dstrb = destval & 0xf81f; CARD16 dstg = destval & 0x7e0; \ + CARD32 drb = ((source&0xf81f)-dstrb)*alpha; CARD32 dg=((source & 0x7e0)-dstg)*alpha; \ + dest = ((((drb>>5) + dstrb)&0xf81f) | (((dg>>5) + dstg) & 0x7e0)); \ + } + +#define inOver2x0565(alpha, source, destval, dest) { \ + CARD32 dstrb = destval & 0x07e0f81f; CARD32 dstg = (destval & 0xf81f07e0)>>5; \ + CARD32 drb = ((source&0x07e0f81f)-dstrb)*alpha; CARD32 dg=(((source & 0xf81f07e0)>>5)-dstg)*alpha; \ + dest = ((((drb>>5) + dstrb)&0x07e0f81f) | ((((dg>>5) + dstg)<<5) & 0xf81f07e0)); \ + } + +#if IMAGE_BYTE_ORDER == LSBFirst + #define setupPackedReader(count,temp,where,workingWhere,workingVal) count=(int)where; \ + temp=count&3; \ + where-=temp; \ + workingWhere=(CARD32 *)where; \ + workingVal=*workingWhere++; \ + count=4-temp; \ + workingVal>>=(8*temp) + #define readPacked(where,x,y,z) {if(!(x)) { (x)=4; y=*z++; } where=(y)&0xff; (y)>>=8; (x)--;} + #define readPackedSource(where) readPacked(where,ws,workingSource,wsrc) + #define readPackedDest(where) readPacked(where,wd,workingiDest,widst) + #define writePacked(what) workingoDest>>=8; workingoDest|=(what<<24); ww--; if(!ww) { ww=4; *wodst++=workingoDest; } +#else + #warning "I havn't tested fbCompositeTrans_0888xnx0888() on big endian yet!" + #define setupPackedReader(count,temp,where,workingWhere,workingVal) count=(int)where; \ + temp=count&3; \ + where-=temp; \ + workingWhere=(CARD32 *)where; \ + workingVal=*workingWhere++; \ + count=4-temp; \ + workingVal<<=(8*temp) + #define readPacked(where,x,y,z) {if(!(x)) { (x)=4; y=*z++; } where=(y)>>24; (y)<<=8; (x)--;} + #define readPackedSource(where) readPacked(where,ws,workingSource,wsrc) + #define readPackedDest(where) readPacked(where,wd,workingiDest,widst) + #define writePacked(what) workingoDest<<=8; workingoDest|=what; ww--; if(!ww) { ww=4; *wodst++=workingoDest; } +#endif +/* + * Naming convention: + * + * opSRCxMASKxDST + */ + +static void +fbCompositeSolidMask_nx8x8888 (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + CARD32 src, srca; + CARD32 *dstLine, *dst, d, dstMask; + CARD8 *maskLine, *mask, m; + FbStride dstStride, maskStride; + CARD16 w; + + fbComposeGetSolid(pSrc, src); + + dstMask = FbFullMask (pDst->pixels->depth); + srca = src >> 24; + if (src == 0) + return; + + fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); + fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); + + while (height--) + { + dst = dstLine; + dstLine += dstStride; + mask = maskLine; + maskLine += maskStride; + w = width; + + while (w--) + { + m = *mask++; + if (m == 0xff) + { + if (srca == 0xff) + *dst = src & dstMask; + else + *dst = fbOver (src, *dst) & dstMask; + } + else if (m) + { + d = fbIn (src, m); + *dst = fbOver (d, *dst) & dstMask; + } + dst++; + } + } +} + +static void +fbCompositeSolidMask_nx8888x8888C (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + CARD32 src, srca; + CARD32 *dstLine, *dst, d, dstMask; + CARD32 *maskLine, *mask, ma; + FbStride dstStride, maskStride; + CARD16 w; + CARD32 m, n, o, p; + + fbComposeGetSolid(pSrc, src); + + dstMask = FbFullMask (pDst->pixels->depth); + srca = src >> 24; + if (src == 0) + return; + + fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); + fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); + + while (height--) + { + dst = dstLine; + dstLine += dstStride; + mask = maskLine; + maskLine += maskStride; + w = width; + + while (w--) + { + ma = *mask++; + if (ma == 0xffffffff) + { + if (srca == 0xff) + *dst = src & dstMask; + else + *dst = fbOver (src, *dst) & dstMask; + } + else if (ma) + { + d = *dst; +#define FbInOverC(src,srca,msk,dst,i,result) { \ + CARD16 __a = FbGet8(msk,i); \ + CARD32 __t, __ta; \ + CARD32 __i; \ + __t = FbIntMult (FbGet8(src,i), __a,__i); \ + __ta = (CARD8) ~FbIntMult (srca, __a,__i); \ + __t = __t + FbIntMult(FbGet8(dst,i),__ta,__i); \ + __t = (CARD32) (CARD8) (__t | (-(__t >> 8))); \ + result = __t << (i); \ +} + FbInOverC (src, srca, ma, d, 0, m); + FbInOverC (src, srca, ma, d, 8, n); + FbInOverC (src, srca, ma, d, 16, o); + FbInOverC (src, srca, ma, d, 24, p); + *dst = m|n|o|p; + } + dst++; + } + } +} + +#define srcAlphaCombine24(a,b) genericCombine24(a,b,srca,srcia) +static void +fbCompositeSolidMask_nx8x0888 (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + CARD32 src, srca, srcia; + CARD8 *dstLine, *dst, *edst; + CARD8 *maskLine, *mask, m; + FbStride dstStride, maskStride; + CARD16 w; + CARD32 rs,gs,bs,rd,gd,bd; + + fbComposeGetSolid(pSrc, src); + + srca = src >> 24; + srcia = 255-srca; + if (src == 0) + return; + + rs=src&0xff; + gs=(src>>8)&0xff; + bs=(src>>16)&0xff; + + fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 3); + fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); + + while (height--) + { + /* fixme: cleanup unused */ + unsigned int wt,wd; + CARD32 workingiDest; + CARD32 *widst; + + edst=dst = dstLine; + dstLine += dstStride; + mask = maskLine; + maskLine += maskStride; + w = width; + +#ifndef NO_MASKED_PACKED_READ + setupPackedReader(wd,wt,edst,widst,workingiDest); +#endif + + while (w--) + { +#ifndef NO_MASKED_PACKED_READ + readPackedDest(rd); + readPackedDest(gd); + readPackedDest(bd); +#else + rd= *edst++; + gd= *edst++; + bd= *edst++; +#endif + m = *mask++; + if (m == 0xff) + { + if (srca == 0xff) + { + *dst++=rs; + *dst++=gs; + *dst++=bs; + } + else + { + *dst++=(srcAlphaCombine24(rs, rd)>>8); + *dst++=(srcAlphaCombine24(gs, gd)>>8); + *dst++=(srcAlphaCombine24(bs, bd)>>8); + } + } + else if (m) + { + int na=(srca*(int)m)>>8; + int nia=255-na; + *dst++=(genericCombine24(rs, rd, na, nia)>>8); + *dst++=(genericCombine24(gs, gd, na, nia)>>8); + *dst++=(genericCombine24(bs, bd, na, nia)>>8); + } + else + { + dst+=3; + } + } + } +} + +static void +fbCompositeSolidMask_nx8x0565 (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + CARD32 src, srca8, srca5; + CARD16 *dstLine, *dst; + CARD16 d; + CARD32 t; + CARD8 *maskLine, *mask, m; + FbStride dstStride, maskStride; + CARD16 w,src16; + + fbComposeGetSolid(pSrc, src); + + if (src == 0) + return; + + srca8 = (src >> 24); + srca5 = (srca8 >> 3); + + src16 = cvt8888to0565(src); + + fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); + fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); + while (height--) + { + dst = dstLine; + dstLine += dstStride; + mask = maskLine; + maskLine += maskStride; + w = width; + + while (w--) + { + m = *mask++; + if (m == 0) + dst++; + else if (srca5 == (0xff >> 3)) + { + if (m == 0xff) + *dst++ = src16; + else + { + d = *dst; + m >>= 3; + inOver0565 (m, src16, d, *dst++); + } + } + else + { + d = *dst; + if (m == 0xff) + { + t = fbOver24 (src, cvt0565to0888 (d)); + } + else + { + t = fbIn (src, m); + t = fbOver (t, cvt0565to0888 (d)); + } + *dst++ = cvt8888to0565 (t); + } + } + } +} + +static void +fbCompositeSolidMask_nx8888x0565 (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + CARD32 src, srca8, srca5; + CARD16 *dstLine, *dst; + CARD16 d; + CARD32 *maskLine, *mask; + CARD32 t; + CARD8 m; + FbStride dstStride, maskStride; + CARD16 w, src16; + + fbComposeGetSolid(pSrc, src); + + if (src == 0) + return; + + srca8 = src >> 24; + srca5 = srca8 >> 3; + src16 = cvt8888to0565(src); + + fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); + fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); + + while (height--) + { + dst = dstLine; + dstLine += dstStride; + mask = maskLine; + maskLine += maskStride; + w = width; + + while (w--) + { + m = *mask++ >> 24; + if (m == 0) + dst++; + else if (srca5 == (0xff >> 3)) + { + if (m == 0xff) + *dst++ = src16; + else + { + d = *dst; + m >>= 3; + inOver0565 (m, src16, d, *dst++); + } + } + else + { + if (m == 0xff) + { + d = *dst; + t = fbOver24 (src, cvt0565to0888 (d)); + *dst++ = cvt8888to0565 (t); + } + else + { + d = *dst; + t = fbIn (src, m); + t = fbOver (t, cvt0565to0888 (d)); + *dst++ = cvt8888to0565 (t); + } + } + } + } +} + +static void +fbCompositeSolidMask_nx8888x0565C (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + CARD32 src, srca; + CARD16 src16; + CARD16 *dstLine, *dst; + CARD32 d; + CARD32 *maskLine, *mask, ma; + FbStride dstStride, maskStride; + CARD16 w; + CARD32 m, n, o; + + fbComposeGetSolid(pSrc, src); + + srca = src >> 24; + if (src == 0) + return; + + src16 = cvt8888to0565(src); + + fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); + fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); + + while (height--) + { + dst = dstLine; + dstLine += dstStride; + mask = maskLine; + maskLine += maskStride; + w = width; + + while (w--) + { + ma = *mask++; + if (ma == 0xffffffff) + { + if (srca == 0xff) + { + *dst = src16; + } + else + { + d = *dst; + d = fbOver24 (src, cvt0565to0888(d)); + *dst = cvt8888to0565(d); + } + } + else if (ma) + { + d = *dst; + d = cvt0565to0888(d); + FbInOverC (src, srca, ma, d, 0, m); + FbInOverC (src, srca, ma, d, 8, n); + FbInOverC (src, srca, ma, d, 16, o); + d = m|n|o; + *dst = cvt8888to0565(d); + } + dst++; + } + } +} + +static void +fbCompositeSrc_8888x8888 (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + CARD32 *dstLine, *dst, dstMask; + CARD32 *srcLine, *src, s; + FbStride dstStride, srcStride; + CARD8 a; + CARD16 w; + + fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); + fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); + + dstMask = FbFullMask (pDst->pixels->depth); + + while (height--) + { + dst = dstLine; + dstLine += dstStride; + src = srcLine; + srcLine += srcStride; + w = width; + + while (w--) + { + s = *src++; + a = s >> 24; + if (a == 0xff) + *dst = s & dstMask; + else if (a) + *dst = fbOver (s, *dst) & dstMask; + dst++; + } + } +} + +static void +fbCompositeSrc_8888x0888 (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + CARD8 *dstLine, *dst; + CARD32 d; + CARD32 *srcLine, *src, s; + CARD8 a; + FbStride dstStride, srcStride; + CARD16 w; + + fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 3); + fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); + + while (height--) + { + dst = dstLine; + dstLine += dstStride; + src = srcLine; + srcLine += srcStride; + w = width; + + while (w--) + { + s = *src++; + a = s >> 24; + if (a) + { + if (a == 0xff) + d = s; + else + d = fbOver24 (s, Fetch24(dst)); + Store24(dst,d); + } + dst += 3; + } + } +} + +static void +fbCompositeSrc_8888x0565 (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + CARD16 *dstLine, *dst; + CARD32 d; + CARD32 *srcLine, *src, s; + CARD8 a; + FbStride dstStride, srcStride; + CARD16 w; + + fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); + + while (height--) + { + dst = dstLine; + dstLine += dstStride; + src = srcLine; + srcLine += srcStride; + w = width; + + while (w--) + { + s = *src++; + a = s >> 24; + if (a) + { + if (a == 0xff) + d = s; + else + { + d = *dst; + d = fbOver24 (s, cvt0565to0888(d)); + } + *dst = cvt8888to0565(d); + } + dst++; + } + } +} + + + +static void +fbCompositeSrcAdd_8000x8000 (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + CARD8 *dstLine, *dst; + CARD8 *srcLine, *src; + FbStride dstStride, srcStride; + CARD16 w; + CARD8 s, d; + CARD16 t; + + fbComposeGetStart (pSrc, xSrc, ySrc, CARD8, srcStride, srcLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 1); + + while (height--) + { + dst = dstLine; + dstLine += dstStride; + src = srcLine; + srcLine += srcStride; + w = width; + + while (w--) + { + s = *src++; + if (s) + { + if (s != 0xff) + { + d = *dst; + t = d + s; + s = t | (0 - (t >> 8)); + } + *dst = s; + } + dst++; + } + } +} + +static void +fbCompositeSrcAdd_8888x8888 (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + CARD32 *dstLine, *dst; + CARD32 *srcLine, *src; + FbStride dstStride, srcStride; + CARD16 w; + CARD32 s, d; + CARD16 t; + CARD32 m,n,o,p; + + fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); + + while (height--) + { + dst = dstLine; + dstLine += dstStride; + src = srcLine; + srcLine += srcStride; + w = width; + + while (w--) + { + s = *src++; + if (s) + { + if (s != 0xffffffff) + { + d = *dst; + if (d) + { + m = FbAdd(s,d,0,t); + n = FbAdd(s,d,8,t); + o = FbAdd(s,d,16,t); + p = FbAdd(s,d,24,t); + s = m|n|o|p; + } + } + *dst = s; + } + dst++; + } + } +} + +static void +fbCompositeSrcAdd_1000x1000 (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + FbBits *dstBits, *srcBits; + FbStride dstStride, srcStride; + int dstBpp, srcBpp; + int dstXoff, dstYoff; + int srcXoff, srcYoff; + + FbGetPixels(pSrc->pixels, srcBits, srcStride, srcBpp, srcXoff, srcYoff); + + FbGetPixels(pDst->pixels, dstBits, dstStride, dstBpp, dstXoff, dstYoff); + + fbBlt (srcBits + srcStride * (ySrc + srcYoff), + srcStride, + xSrc + srcXoff, + + dstBits + dstStride * (yDst + dstYoff), + dstStride, + xDst + dstXoff, + + width, + height, + + GXor, + FB_ALLONES, + srcBpp, + + FALSE, + FALSE); +} + +static void +fbCompositeSolidMask_nx1xn (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + FbBits *dstBits; + FbStip *maskBits; + FbStride dstStride, maskStride; + int dstBpp, maskBpp; + int dstXoff, dstYoff; + int maskXoff, maskYoff; + FbBits src; + + fbComposeGetSolid(pSrc, src); + + if ((src & 0xff000000) != 0xff000000) + { + pixman_compositeGeneral (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); + return; + } + FbGetStipPixels (pMask->pixels, maskBits, maskStride, maskBpp, maskXoff, maskYoff); + FbGetPixels (pDst->pixels, dstBits, dstStride, dstBpp, dstXoff, dstYoff); + + switch (dstBpp) { + case 32: + break; + case 24: + break; + case 16: + src = cvt8888to0565(src); + break; + } + + src = fbReplicatePixel (src, dstBpp); + + fbBltOne (maskBits + maskStride * (yMask + maskYoff), + maskStride, + xMask + maskXoff, + + dstBits + dstStride * (yDst + dstYoff), + dstStride, + (xDst + dstXoff) * dstBpp, + dstBpp, + + width * dstBpp, + height, + + 0x0, + src, + FB_ALLONES, + 0x0); +} + +/* prototype to help with merging */ +static void +fbCompositeSrcSrc_nxn (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height); +/* + * Apply a constant alpha value in an over computation + */ +static void +fbCompositeTrans_0565xnx0565(pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + CARD16 *dstLine, *dst; + CARD16 *srcLine, *src; + FbStride dstStride, srcStride; + CARD16 w; + FbBits mask; + CARD8 maskAlpha; + CARD16 s_16, d_16; + CARD32 s_32, d_32; + + fbComposeGetSolid (pMask, mask); + maskAlpha = mask >> 27; + + if (!maskAlpha) + return; + if (maskAlpha == 0xff) + { + fbCompositeSrcSrc_nxn (PIXMAN_OPERATOR_SRC, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); + return; + } + + fbComposeGetStart (pSrc, xSrc, ySrc, CARD16, srcStride, srcLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); + + while (height--) + { + CARD32 *isrc, *idst; + dst = dstLine; + dstLine += dstStride; + src = srcLine; + srcLine += srcStride; + w = width; + + if(((int)src&1)==1) + { + s_16 = *src++; + d_16 = *dst; + inOver0565(maskAlpha, s_16, d_16, *dst++); + w--; + } + isrc=(CARD32 *)src; + if(((int)dst&1)==0) + { + idst=(CARD32 *)dst; + while (w>1) + { + s_32 = *isrc++; + d_32 = *idst; + inOver2x0565(maskAlpha,s_32,d_32,*idst++); + w-=2; + } + dst=(CARD16 *)idst; + } + else + { + while (w > 1) + { + s_32 = *isrc++; +#if IMAGE_BYTE_ORDER == LSBFirst + s_16=s_32&0xffff; +#else + s_16=s_32>>16; +#endif + d_16 = *dst; + inOver0565(maskAlpha, s_16, d_16, *dst++); +#if IMAGE_BYTE_ORDER == LSBFirst + s_16=s_32>>16; +#else + s_16=s_32&0xffff; +#endif + d_16 = *dst; + inOver0565(maskAlpha, s_16, d_16, *dst++); + w-=2; + } + } + src=(CARD16 *)isrc; + if(w!=0) + { + s_16 = *src; + d_16 = *dst; + inOver0565(maskAlpha, s_16, d_16, *dst); + } + } +} + + + +/* macros for "i can't believe it's not fast" packed pixel handling */ +#define alphamaskCombine24(a,b) genericCombine24(a,b,maskAlpha,maskiAlpha) +static void +fbCompositeTrans_0888xnx0888(pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + CARD8 *dstLine, *dst,*idst; + CARD8 *srcLine, *src; + FbStride dstStride, srcStride; + CARD16 w; + FbBits mask; + CARD16 maskAlpha,maskiAlpha; + + fbComposeGetSolid (pMask, mask); + maskAlpha = mask >> 24; + maskiAlpha= 255-maskAlpha; + + if (!maskAlpha) + return; + /* + if (maskAlpha == 0xff) + { + fbCompositeSrc_0888x0888 (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); + return; + } + */ + + fbComposeGetStart (pSrc, xSrc, ySrc, CARD8, srcStride, srcLine, 3); + fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 3); + + { + unsigned int ws,wt; + CARD32 workingSource; + CARD32 *wsrc, *wdst, *widst; + CARD32 rs, rd, nd; + CARD8 *isrc; + + /* are xSrc and xDst at the same alignment? if not, we need to be complicated :)*/ + /* if(0==0) */ + if( (((xSrc*3)&3)!=((xDst*3)&3)) || ((srcStride&3)!=(dstStride&3))) + { + while (height--) + { + dst = dstLine; + dstLine += dstStride; + isrc = src = srcLine; + srcLine += srcStride; + w = width*3; + + setupPackedReader(ws,wt,isrc,wsrc,workingSource); + + /* get to word aligned */ + switch(!(int)dst&3) + { + case 1: + readPackedSource(rs); + /* *dst++=alphamaskCombine24(rs, *dst)>>8; */ + rd=*dst; /* make gcc happy. hope it doens't cost us too much performance*/ + *dst++=alphamaskCombine24(rs, rd)>>8; + w--; if(w==0) break; + case 2: + readPackedSource(rs); + rd=*dst; + *dst++=alphamaskCombine24(rs, rd)>>8; + w--; if(w==0) break; + case 3: + readPackedSource(rs); + rd=*dst; + *dst++=alphamaskCombine24(rs, rd)>>8; + w--; if(w==0) break; + } + wdst=(CARD32 *)dst; + while (w>3) + { + /* FIXME: write a special readPackedWord macro, which knows how to + * halfword combine + */ + +#if IMAGE_BYTE_ORDER == LSBFirst + rd=*wdst; + readPackedSource(nd); + readPackedSource(rs); + nd|=rs<<8; + readPackedSource(rs); + nd|=rs<<16; + readPackedSource(rs); + nd|=rs<<24; +#else + readPackedSource(nd); + nd<<=24; + readPackedSource(rs); + nd|=rs<<16; + readPackedSource(rs); + nd|=rs<<8; + readPackedSource(rs); + nd|=rs; +#endif + inOver0888(maskAlpha, nd, rd, *wdst++) + w-=4; + } + dst=(CARD8 *)wdst; + switch(w) + { + case 3: + readPackedSource(rs); + rd=*dst; + *dst++=alphamaskCombine24(rs, rd)>>8; + case 2: + readPackedSource(rs); + rd=*dst; + *dst++=alphamaskCombine24(rs, rd)>>8; + case 1: + readPackedSource(rs); + rd=*dst; + *dst++=alphamaskCombine24(rs, rd)>>8; + } + } + } + else + { + while (height--) + { + idst=dst = dstLine; + dstLine += dstStride; + src = srcLine; + srcLine += srcStride; + w = width*3; + /* get to word aligned */ + switch(!(int)src&3) + { + case 1: + rd=alphamaskCombine24(*src++, *dst)>>8; + *dst++=rd; + w--; if(w==0) break; + case 2: + rd=alphamaskCombine24(*src++, *dst)>>8; + *dst++=rd; + w--; if(w==0) break; + case 3: + rd=alphamaskCombine24(*src++, *dst)>>8; + *dst++=rd; + w--; if(w==0) break; + } + wsrc=(CARD32 *)src; + widst=(CARD32 *)dst; + + while(w>3) + { + rs = *wsrc++; + rd = *widst; + inOver0888(maskAlpha, rs, rd, *widst++); + w-=4; + } + src=(CARD8 *)wsrc; + dst=(CARD8 *)widst; + switch(w) + { + case 3: + rd=alphamaskCombine24(*src++, *dst)>>8; + *dst++=rd; + case 2: + rd=alphamaskCombine24(*src++, *dst)>>8; + *dst++=rd; + case 1: + rd=alphamaskCombine24(*src++, *dst)>>8; + *dst++=rd; + } + } + } + } +} + +/* + * Simple bitblt + */ + +static void +fbCompositeSrcSrc_nxn (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + FbBits *dst; + FbBits *src; + FbStride dstStride, srcStride; + int srcXoff, srcYoff; + int dstXoff, dstYoff; + int srcBpp; + int dstBpp; + Bool reverse = FALSE; + Bool upsidedown = FALSE; + + FbGetPixels(pSrc->pixels,src,srcStride,srcBpp,srcXoff,srcYoff); + FbGetPixels(pDst->pixels,dst,dstStride,dstBpp,dstXoff,dstYoff); + + fbBlt (src + (ySrc + srcYoff) * srcStride, + srcStride, + (xSrc + srcXoff) * srcBpp, + + dst + (yDst + dstYoff) * dstStride, + dstStride, + (xDst + dstXoff) * dstBpp, + + (width) * dstBpp, + (height), + + GXcopy, + FB_ALLONES, + dstBpp, + + reverse, + upsidedown); +} + +/* + * Solid fill +void +fbCompositeSolidSrc_nxn (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + +} + */ + +void +pixman_composite (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + int xSrc, + int ySrc, + int xMask, + int yMask, + int xDst, + int yDst, + int width, + int height) +{ + pixman_region16_t *region; + int n; + pixman_box16_t *pbox; + CompositeFunc func; + int srcRepeat = pSrc->repeat; + int maskRepeat = FALSE; + int srcAlphaMap = pSrc->alphaMap != 0; + int maskAlphaMap = FALSE; + int dstAlphaMap = pDst->alphaMap != 0; + int x_msk, y_msk, x_src, y_src, x_dst, y_dst; + int w, h, w_this, h_this; + + if (pSrc->pixels->width == 0 || + pSrc->pixels->height == 0) + { + return; + } + + xDst += pDst->pixels->x; + yDst += pDst->pixels->y; + xSrc += pSrc->pixels->x; + ySrc += pSrc->pixels->y; + if (pMask) + { + xMask += pMask->pixels->x; + yMask += pMask->pixels->y; + maskRepeat = pMask->repeat; + maskAlphaMap = pMask->alphaMap != 0; + } + + region = pixman_region_create(); + pixman_region_union_rect (region, region, xDst, yDst, width, height); + + if (!FbComputeCompositeRegion (region, + pSrc, + pMask, + pDst, + xSrc, + ySrc, + xMask, + yMask, + xDst, + yDst, + width, + height)) + return; + + func = pixman_compositeGeneral; + if (!pSrc->transform && !(pMask && pMask->transform)) + if (!maskAlphaMap && !srcAlphaMap && !dstAlphaMap) + switch (op) { + case PIXMAN_OPERATOR_OVER: + if (pMask) + { + if (srcRepeat && + pSrc->pixels->width == 1 && + pSrc->pixels->height == 1) + { + if (PICT_FORMAT_COLOR(pSrc->format_code)) { + switch (pMask->format_code) { + case PICT_a8: + switch (pDst->format_code) { + case PICT_r5g6b5: + case PICT_b5g6r5: + func = fbCompositeSolidMask_nx8x0565; + break; + case PICT_r8g8b8: + case PICT_b8g8r8: + func = fbCompositeSolidMask_nx8x0888; + break; + case PICT_a8r8g8b8: + case PICT_x8r8g8b8: + case PICT_a8b8g8r8: + case PICT_x8b8g8r8: + func = fbCompositeSolidMask_nx8x8888; + break; + } + break; + case PICT_a8r8g8b8: + if (pMask->componentAlpha) { + switch (pDst->format_code) { + case PICT_a8r8g8b8: + case PICT_x8r8g8b8: + func = fbCompositeSolidMask_nx8888x8888C; + break; + case PICT_r5g6b5: + func = fbCompositeSolidMask_nx8888x0565C; + break; + } + } + else + { + switch (pDst->format_code) { + case PICT_r5g6b5: + func = fbCompositeSolidMask_nx8888x0565; + break; + } + } + break; + case PICT_a8b8g8r8: + if (pMask->componentAlpha) { + switch (pDst->format_code) { + case PICT_a8b8g8r8: + case PICT_x8b8g8r8: + func = fbCompositeSolidMask_nx8888x8888C; + break; + case PICT_b5g6r5: + func = fbCompositeSolidMask_nx8888x0565C; + break; + } + } + else + { + switch (pDst->format_code) { + case PICT_r5g6b5: + func = fbCompositeSolidMask_nx8888x0565; + break; + } + } + break; + case PICT_a1: + switch (pDst->format_code) { + case PICT_r5g6b5: + case PICT_b5g6r5: + case PICT_r8g8b8: + case PICT_b8g8r8: + case PICT_a8r8g8b8: + case PICT_x8r8g8b8: + case PICT_a8b8g8r8: + case PICT_x8b8g8r8: + func = fbCompositeSolidMask_nx1xn; + break; + } + } + } + if (func != pixman_compositeGeneral) + srcRepeat = FALSE; + } + else if (maskRepeat && + pMask->pDrawable->width == 1 && + pMask->pDrawable->height == 1) + { + switch (pSrc->format_code) { + case PICT_r5g6b5: + case PICT_b5g6r5: + if (pDst->format_code == pSrc->format_code) + func = fbCompositeTrans_0565xnx0565; + break; + case PICT_r8g8b8: + case PICT_b8g8r8: + if (pDst->format_code == pSrc->format_code) + func = fbCompositeTrans_0888xnx0888; + break; + } + + if (func != pixman_compositeGeneral) + maskRepeat = FALSE; + } + } + else + { + /* + * Formats without alpha bits are just Copy with Over + */ + if (pSrc->format_code == pDst->format_code && !PICT_FORMAT_A(pSrc->format_code)) + { + func = fbCompositeSrcSrc_nxn; + } + else switch (pSrc->format_code) { + case PICT_a8r8g8b8: + switch (pDst->format_code) { + case PICT_a8r8g8b8: + case PICT_x8r8g8b8: + func = fbCompositeSrc_8888x8888; + break; + case PICT_r8g8b8: + func = fbCompositeSrc_8888x0888; + break; + case PICT_r5g6b5: + func = fbCompositeSrc_8888x0565; + break; + } + break; + case PICT_a8b8g8r8: + switch (pDst->format_code) { + case PICT_a8b8g8r8: + case PICT_x8b8g8r8: + func = fbCompositeSrc_8888x8888; + break; + case PICT_b8g8r8: + func = fbCompositeSrc_8888x0888; + break; + case PICT_b5g6r5: + func = fbCompositeSrc_8888x0565; + break; + } + break; + } + } + break; + case PIXMAN_OPERATOR_ADD: + if (pMask == 0) + { + switch (pSrc->format_code) { + case PICT_a8r8g8b8: + switch (pDst->format_code) { + case PICT_a8r8g8b8: + func = fbCompositeSrcAdd_8888x8888; + break; + } + break; + case PICT_a8b8g8r8: + switch (pDst->format_code) { + case PICT_a8b8g8r8: + func = fbCompositeSrcAdd_8888x8888; + break; + } + break; + case PICT_a8: + switch (pDst->format_code) { + case PICT_a8: + func = fbCompositeSrcAdd_8000x8000; + break; + } + break; + case PICT_a1: + switch (pDst->format_code) { + case PICT_a1: + func = fbCompositeSrcAdd_1000x1000; + break; + } + break; + } + } + break; + case PIXMAN_OPERATOR_SRC: + if (pMask == 0) + { + if (pSrc->format_code == pDst->format_code) + func = fbCompositeSrcSrc_nxn; + } + default: + func = pixman_compositeGeneral; + break; + } + /* if we are transforming, we handle repeats in + * FbFetch[a]_transform + */ + if (pSrc->transform) + srcRepeat = 0; + if (pMask && pMask->transform) + maskRepeat = 0; + + n = pixman_region_num_rects (region); + pbox = pixman_region_rects (region); + while (n--) + { + h = pbox->y2 - pbox->y1; + y_src = pbox->y1 - yDst + ySrc; + y_msk = pbox->y1 - yDst + yMask; + y_dst = pbox->y1; + while (h) + { + h_this = h; + w = pbox->x2 - pbox->x1; + x_src = pbox->x1 - xDst + xSrc; + x_msk = pbox->x1 - xDst + xMask; + x_dst = pbox->x1; + if (maskRepeat) + { + y_msk = MOD (y_msk, pMask->pixels->height); + if (h_this > pMask->pixels->height - y_msk) + h_this = pMask->pixels->height - y_msk; + } + if (srcRepeat) + { + y_src = MOD (y_src, pSrc->pixels->height); + if (h_this > pSrc->pixels->height - y_src) + h_this = pSrc->pixels->height - y_src; + } + while (w) + { + w_this = w; + if (maskRepeat) + { + x_msk = MOD (x_msk, pMask->pixels->width); + if (w_this > pMask->pixels->width - x_msk) + w_this = pMask->pixels->width - x_msk; + } + if (srcRepeat) + { + x_src = MOD (x_src, pSrc->pixels->width); + if (w_this > pSrc->pixels->width - x_src) + w_this = pSrc->pixels->width - x_src; + } + (*func) (op, pSrc, pMask, pDst, + x_src, y_src, x_msk, y_msk, x_dst, y_dst, + w_this, h_this); + w -= w_this; + x_src += w_this; + x_msk += w_this; + x_dst += w_this; + } + h -= h_this; + y_src += h_this; + y_msk += h_this; + y_dst += h_this; + } + pbox++; + } + pixman_region_destroy (region); +} +slim_hidden_def(pixman_composite); diff --git a/pixman/src/icblt.c b/pixman/src/icblt.c new file mode 100644 index 0000000..ee92ba5 --- /dev/null +++ b/pixman/src/icblt.c @@ -0,0 +1,949 @@ +/* + * Id: $ + * + * Copyright © 1998 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "pixman-xserver-compat.h" + +#define InitializeShifts(sx,dx,ls,rs) { \ + if (sx != dx) { \ + if (sx > dx) { \ + ls = sx - dx; \ + rs = FB_UNIT - ls; \ + } else { \ + rs = dx - sx; \ + ls = FB_UNIT - rs; \ + } \ + } \ +} + +void +fbBlt (FbBits *srcLine, + FbStride srcStride, + int srcX, + + FbBits *dstLine, + FbStride dstStride, + int dstX, + + int width, + int height, + + int alu, + FbBits pm, + int bpp, + + Bool reverse, + Bool upsidedown) +{ + FbBits *src, *dst; + int leftShift, rightShift; + FbBits startmask, endmask; + FbBits bits, bits1; + int n, nmiddle; + Bool destInvarient; + int startbyte, endbyte; + FbDeclareMergeRop (); + + /* are we just copying multiples of 8 bits? if so, run, forrest, run! + the memcpy()'s should be pluggable ala mplayer|xine - perhaps we can get + one of the above to give up their code for us. + */ + if((pm==FB_ALLONES) && (alu==GXcopy) && !reverse && (srcX&7)==0 && (dstX&7)==0 && (width&7)==0) + { + CARD8 *isrc=(CARD8 *)srcLine; + CARD8 *idst=(CARD8 *)dstLine; + int sstride=srcStride*sizeof(FbBits); + int dstride=dstStride*sizeof(FbBits); + int j; + width>>=3; + isrc+=(srcX>>3); + idst+=(dstX>>3); + if(!upsidedown) + for(j=0;j<height;j++) + memcpy(idst+j*dstride, isrc+j*sstride, width); + else + for(j=(height-1);j>=0;j--) + memcpy(idst+j*dstride, isrc+j*sstride, width); + + return; + } + +#ifdef FB_24BIT + if (bpp == 24 && !FbCheck24Pix (pm)) + { + fbBlt24 (srcLine, srcStride, srcX, dstLine, dstStride, dstX, + width, height, alu, pm, reverse, upsidedown); + return; + } +#endif + FbInitializeMergeRop(alu, pm); + destInvarient = FbDestInvarientMergeRop(); + if (upsidedown) + { + srcLine += (height - 1) * (srcStride); + dstLine += (height - 1) * (dstStride); + srcStride = -srcStride; + dstStride = -dstStride; + } + FbMaskBitsBytes (dstX, width, destInvarient, startmask, startbyte, + nmiddle, endmask, endbyte); + if (reverse) + { + srcLine += ((srcX + width - 1) >> FB_SHIFT) + 1; + dstLine += ((dstX + width - 1) >> FB_SHIFT) + 1; + srcX = (srcX + width - 1) & FB_MASK; + dstX = (dstX + width - 1) & FB_MASK; + } + else + { + srcLine += srcX >> FB_SHIFT; + dstLine += dstX >> FB_SHIFT; + srcX &= FB_MASK; + dstX &= FB_MASK; + } + if (srcX == dstX) + { + while (height--) + { + src = srcLine; + srcLine += srcStride; + dst = dstLine; + dstLine += dstStride; + if (reverse) + { + if (endmask) + { + bits = *--src; + --dst; + FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); + } + n = nmiddle; + if (destInvarient) + { + while (n--) + *--dst = FbDoDestInvarientMergeRop(*--src); + } + else + { + while (n--) + { + bits = *--src; + --dst; + *dst = FbDoMergeRop (bits, *dst); + } + } + if (startmask) + { + bits = *--src; + --dst; + FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); + } + } + else + { + if (startmask) + { + bits = *src++; + FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); + dst++; + } + n = nmiddle; + if (destInvarient) + { +#if 0 + /* + * This provides some speedup on screen->screen blts + * over the PCI bus, usually about 10%. But fb + * isn't usually used for this operation... + */ + if (_ca2 + 1 == 0 && _cx2 == 0) + { + FbBits t1, t2, t3, t4; + while (n >= 4) + { + t1 = *src++; + t2 = *src++; + t3 = *src++; + t4 = *src++; + *dst++ = t1; + *dst++ = t2; + *dst++ = t3; + *dst++ = t4; + n -= 4; + } + } +#endif + while (n--) + *dst++ = FbDoDestInvarientMergeRop(*src++); + } + else + { + while (n--) + { + bits = *src++; + *dst = FbDoMergeRop (bits, *dst); + dst++; + } + } + if (endmask) + { + bits = *src; + FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); + } + } + } + } + else + { + if (srcX > dstX) + { + leftShift = srcX - dstX; + rightShift = FB_UNIT - leftShift; + } + else + { + rightShift = dstX - srcX; + leftShift = FB_UNIT - rightShift; + } + while (height--) + { + src = srcLine; + srcLine += srcStride; + dst = dstLine; + dstLine += dstStride; + + bits1 = 0; + if (reverse) + { + if (srcX < dstX) + bits1 = *--src; + if (endmask) + { + bits = FbScrRight(bits1, rightShift); + if (FbScrRight(endmask, leftShift)) + { + bits1 = *--src; + bits |= FbScrLeft(bits1, leftShift); + } + --dst; + FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); + } + n = nmiddle; + if (destInvarient) + { + while (n--) + { + bits = FbScrRight(bits1, rightShift); + bits1 = *--src; + bits |= FbScrLeft(bits1, leftShift); + --dst; + *dst = FbDoDestInvarientMergeRop(bits); + } + } + else + { + while (n--) + { + bits = FbScrRight(bits1, rightShift); + bits1 = *--src; + bits |= FbScrLeft(bits1, leftShift); + --dst; + *dst = FbDoMergeRop(bits, *dst); + } + } + if (startmask) + { + bits = FbScrRight(bits1, rightShift); + if (FbScrRight(startmask, leftShift)) + { + bits1 = *--src; + bits |= FbScrLeft(bits1, leftShift); + } + --dst; + FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask); + } + } + else + { + if (srcX > dstX) + bits1 = *src++; + if (startmask) + { + bits = FbScrLeft(bits1, leftShift); + bits1 = *src++; + bits |= FbScrRight(bits1, rightShift); + FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask); + dst++; + } + n = nmiddle; + if (destInvarient) + { + while (n--) + { + bits = FbScrLeft(bits1, leftShift); + bits1 = *src++; + bits |= FbScrRight(bits1, rightShift); + *dst = FbDoDestInvarientMergeRop(bits); + dst++; + } + } + else + { + while (n--) + { + bits = FbScrLeft(bits1, leftShift); + bits1 = *src++; + bits |= FbScrRight(bits1, rightShift); + *dst = FbDoMergeRop(bits, *dst); + dst++; + } + } + if (endmask) + { + bits = FbScrLeft(bits1, leftShift); + if (FbScrLeft(endmask, rightShift)) + { + bits1 = *src; + bits |= FbScrRight(bits1, rightShift); + } + FbDoRightMaskByteMergeRop (dst, bits, endbyte, endmask); + } + } + } + } +} + +#ifdef FB_24BIT + +#undef DEBUG_BLT24 +#ifdef DEBUG_BLT24 + +static unsigned long +getPixel (char *src, int x) +{ + unsigned long l; + + l = 0; + memcpy (&l, src + x * 3, 3); + return l; +} +#endif + +static void +fbBlt24Line (FbBits *src, + int srcX, + + FbBits *dst, + int dstX, + + int width, + + int alu, + FbBits pm, + + Bool reverse) +{ +#ifdef DEBUG_BLT24 + char *origDst = (char *) dst; + FbBits *origLine = dst + ((dstX >> FB_SHIFT) - 1); + int origNlw = ((width + FB_MASK) >> FB_SHIFT) + 3; + int origX = dstX / 24; +#endif + + int leftShift, rightShift; + FbBits startmask, endmask; + int n; + + FbBits bits, bits1; + FbBits mask; + + int rot; + FbDeclareMergeRop (); + + FbInitializeMergeRop (alu, FB_ALLONES); + FbMaskBits(dstX, width, startmask, n, endmask); +#ifdef DEBUG_BLT24 + ErrorF ("dstX %d width %d reverse %d\n", dstX, width, reverse); +#endif + if (reverse) + { + src += ((srcX + width - 1) >> FB_SHIFT) + 1; + dst += ((dstX + width - 1) >> FB_SHIFT) + 1; + rot = FbFirst24Rot (((dstX + width - 8) & FB_MASK)); + rot = FbPrev24Rot(rot); +#ifdef DEBUG_BLT24 + ErrorF ("dstX + width - 8: %d rot: %d\n", (dstX + width - 8) & FB_MASK, rot); +#endif + srcX = (srcX + width - 1) & FB_MASK; + dstX = (dstX + width - 1) & FB_MASK; + } + else + { + src += srcX >> FB_SHIFT; + dst += dstX >> FB_SHIFT; + srcX &= FB_MASK; + dstX &= FB_MASK; + rot = FbFirst24Rot (dstX); +#ifdef DEBUG_BLT24 + ErrorF ("dstX: %d rot: %d\n", dstX, rot); +#endif + } + mask = FbRot24(pm,rot); +#ifdef DEBUG_BLT24 + ErrorF ("pm 0x%x mask 0x%x\n", pm, mask); +#endif + if (srcX == dstX) + { + if (reverse) + { + if (endmask) + { + bits = *--src; + --dst; + *dst = FbDoMaskMergeRop (bits, *dst, mask & endmask); + mask = FbPrev24Pix (mask); + } + while (n--) + { + bits = *--src; + --dst; + *dst = FbDoMaskMergeRop (bits, *dst, mask); + mask = FbPrev24Pix (mask); + } + if (startmask) + { + bits = *--src; + --dst; + *dst = FbDoMaskMergeRop(bits, *dst, mask & startmask); + } + } + else + { + if (startmask) + { + bits = *src++; + *dst = FbDoMaskMergeRop (bits, *dst, mask & startmask); + dst++; + mask = FbNext24Pix(mask); + } + while (n--) + { + bits = *src++; + *dst = FbDoMaskMergeRop (bits, *dst, mask); + dst++; + mask = FbNext24Pix(mask); + } + if (endmask) + { + bits = *src; + *dst = FbDoMaskMergeRop(bits, *dst, mask & endmask); + } + } + } + else + { + if (srcX > dstX) + { + leftShift = srcX - dstX; + rightShift = FB_UNIT - leftShift; + } + else + { + rightShift = dstX - srcX; + leftShift = FB_UNIT - rightShift; + } + + bits1 = 0; + if (reverse) + { + if (srcX < dstX) + bits1 = *--src; + if (endmask) + { + bits = FbScrRight(bits1, rightShift); + if (FbScrRight(endmask, leftShift)) + { + bits1 = *--src; + bits |= FbScrLeft(bits1, leftShift); + } + --dst; + *dst = FbDoMaskMergeRop (bits, *dst, mask & endmask); + mask = FbPrev24Pix(mask); + } + while (n--) + { + bits = FbScrRight(bits1, rightShift); + bits1 = *--src; + bits |= FbScrLeft(bits1, leftShift); + --dst; + *dst = FbDoMaskMergeRop(bits, *dst, mask); + mask = FbPrev24Pix(mask); + } + if (startmask) + { + bits = FbScrRight(bits1, rightShift); + if (FbScrRight(startmask, leftShift)) + { + bits1 = *--src; + bits |= FbScrLeft(bits1, leftShift); + } + --dst; + *dst = FbDoMaskMergeRop (bits, *dst, mask & startmask); + } + } + else + { + if (srcX > dstX) + bits1 = *src++; + if (startmask) + { + bits = FbScrLeft(bits1, leftShift); + bits1 = *src++; + bits |= FbScrRight(bits1, rightShift); + *dst = FbDoMaskMergeRop (bits, *dst, mask & startmask); + dst++; + mask = FbNext24Pix(mask); + } + while (n--) + { + bits = FbScrLeft(bits1, leftShift); + bits1 = *src++; + bits |= FbScrRight(bits1, rightShift); + *dst = FbDoMaskMergeRop(bits, *dst, mask); + dst++; + mask = FbNext24Pix(mask); + } + if (endmask) + { + bits = FbScrLeft(bits1, leftShift); + if (FbScrLeft(endmask, rightShift)) + { + bits1 = *src; + bits |= FbScrRight(bits1, rightShift); + } + *dst = FbDoMaskMergeRop (bits, *dst, mask & endmask); + } + } + } +#ifdef DEBUG_BLT24 + { + int firstx, lastx, x; + + firstx = origX; + if (firstx) + firstx--; + lastx = origX + width/24 + 1; + for (x = firstx; x <= lastx; x++) + ErrorF ("%06x ", getPixel (origDst, x)); + ErrorF ("\n"); + while (origNlw--) + ErrorF ("%08x ", *origLine++); + ErrorF ("\n"); + } +#endif +} + +void +fbBlt24 (FbBits *srcLine, + FbStride srcStride, + int srcX, + + FbBits *dstLine, + FbStride dstStride, + int dstX, + + int width, + int height, + + int alu, + FbBits pm, + + Bool reverse, + Bool upsidedown) +{ + if (upsidedown) + { + srcLine += (height-1) * srcStride; + dstLine += (height-1) * dstStride; + srcStride = -srcStride; + dstStride = -dstStride; + } + while (height--) + { + fbBlt24Line (srcLine, srcX, dstLine, dstX, width, alu, pm, reverse); + srcLine += srcStride; + dstLine += dstStride; + } +#ifdef DEBUG_BLT24 + ErrorF ("\n"); +#endif +} +#endif /* FB_24BIT */ + +#if FB_SHIFT == FB_STIP_SHIFT + 1 + +/* + * Could be generalized to FB_SHIFT > FB_STIP_SHIFT + 1 by + * creating an ring of values stepped through for each line + */ + +void +fbBltOdd (FbBits *srcLine, + FbStride srcStrideEven, + FbStride srcStrideOdd, + int srcXEven, + int srcXOdd, + + FbBits *dstLine, + FbStride dstStrideEven, + FbStride dstStrideOdd, + int dstXEven, + int dstXOdd, + + int width, + int height, + + int alu, + FbBits pm, + int bpp) +{ + FbBits *src; + int leftShiftEven, rightShiftEven; + FbBits startmaskEven, endmaskEven; + int nmiddleEven; + + FbBits *dst; + int leftShiftOdd, rightShiftOdd; + FbBits startmaskOdd, endmaskOdd; + int nmiddleOdd; + + int leftShift, rightShift; + FbBits startmask, endmask; + int nmiddle; + + int srcX, dstX; + + FbBits bits, bits1; + int n; + + Bool destInvarient; + Bool even; + FbDeclareMergeRop (); + + FbInitializeMergeRop (alu, pm); + destInvarient = FbDestInvarientMergeRop(); + + srcLine += srcXEven >> FB_SHIFT; + dstLine += dstXEven >> FB_SHIFT; + srcXEven &= FB_MASK; + dstXEven &= FB_MASK; + srcXOdd &= FB_MASK; + dstXOdd &= FB_MASK; + + FbMaskBits(dstXEven, width, startmaskEven, nmiddleEven, endmaskEven); + FbMaskBits(dstXOdd, width, startmaskOdd, nmiddleOdd, endmaskOdd); + + even = TRUE; + InitializeShifts(srcXEven, dstXEven, leftShiftEven, rightShiftEven); + InitializeShifts(srcXOdd, dstXOdd, leftShiftOdd, rightShiftOdd); + while (height--) + { + src = srcLine; + dst = dstLine; + if (even) + { + srcX = srcXEven; + dstX = dstXEven; + startmask = startmaskEven; + endmask = endmaskEven; + nmiddle = nmiddleEven; + leftShift = leftShiftEven; + rightShift = rightShiftEven; + srcLine += srcStrideEven; + dstLine += dstStrideEven; + even = FALSE; + } + else + { + srcX = srcXOdd; + dstX = dstXOdd; + startmask = startmaskOdd; + endmask = endmaskOdd; + nmiddle = nmiddleOdd; + leftShift = leftShiftOdd; + rightShift = rightShiftOdd; + srcLine += srcStrideOdd; + dstLine += dstStrideOdd; + even = TRUE; + } + if (srcX == dstX) + { + if (startmask) + { + bits = *src++; + *dst = FbDoMaskMergeRop (bits, *dst, startmask); + dst++; + } + n = nmiddle; + if (destInvarient) + { + while (n--) + { + bits = *src++; + *dst = FbDoDestInvarientMergeRop(bits); + dst++; + } + } + else + { + while (n--) + { + bits = *src++; + *dst = FbDoMergeRop (bits, *dst); + dst++; + } + } + if (endmask) + { + bits = *src; + *dst = FbDoMaskMergeRop(bits, *dst, endmask); + } + } + else + { + bits = 0; + if (srcX > dstX) + bits = *src++; + if (startmask) + { + bits1 = FbScrLeft(bits, leftShift); + bits = *src++; + bits1 |= FbScrRight(bits, rightShift); + *dst = FbDoMaskMergeRop (bits1, *dst, startmask); + dst++; + } + n = nmiddle; + if (destInvarient) + { + while (n--) + { + bits1 = FbScrLeft(bits, leftShift); + bits = *src++; + bits1 |= FbScrRight(bits, rightShift); + *dst = FbDoDestInvarientMergeRop(bits1); + dst++; + } + } + else + { + while (n--) + { + bits1 = FbScrLeft(bits, leftShift); + bits = *src++; + bits1 |= FbScrRight(bits, rightShift); + *dst = FbDoMergeRop(bits1, *dst); + dst++; + } + } + if (endmask) + { + bits1 = FbScrLeft(bits, leftShift); + if (FbScrLeft(endmask, rightShift)) + { + bits = *src; + bits1 |= FbScrRight(bits, rightShift); + } + *dst = FbDoMaskMergeRop (bits1, *dst, endmask); + } + } + } +} + +#ifdef FB_24BIT +void +fbBltOdd24 (FbBits *srcLine, + FbStride srcStrideEven, + FbStride srcStrideOdd, + int srcXEven, + int srcXOdd, + + FbBits *dstLine, + FbStride dstStrideEven, + FbStride dstStrideOdd, + int dstXEven, + int dstXOdd, + + int width, + int height, + + int alu, + FbBits pm) +{ + Bool even = TRUE; + + while (height--) + { + if (even) + { + fbBlt24Line (srcLine, srcXEven, dstLine, dstXEven, + width, alu, pm, FALSE); + srcLine += srcStrideEven; + dstLine += dstStrideEven; + even = FALSE; + } + else + { + fbBlt24Line (srcLine, srcXOdd, dstLine, dstXOdd, + width, alu, pm, FALSE); + srcLine += srcStrideOdd; + dstLine += dstStrideOdd; + even = TRUE; + } + } +#if 0 + fprintf (stderr, "\n"); +#endif +} +#endif + +#endif + +#if FB_STIP_SHIFT != FB_SHIFT +void +fbSetBltOdd (FbStip *stip, + FbStride stipStride, + int srcX, + FbBits **bits, + FbStride *strideEven, + FbStride *strideOdd, + int *srcXEven, + int *srcXOdd) +{ + int srcAdjust; + int strideAdjust; + + /* + * bytes needed to align source + */ + srcAdjust = (((int) stip) & (FB_MASK >> 3)); + /* + * FbStip units needed to align stride + */ + strideAdjust = stipStride & (FB_MASK >> FB_STIP_SHIFT); + + *bits = (FbBits *) ((char *) stip - srcAdjust); + if (srcAdjust) + { + *strideEven = FbStipStrideToBitsStride (stipStride + 1); + *strideOdd = FbStipStrideToBitsStride (stipStride); + + *srcXEven = srcX + (srcAdjust << 3); + *srcXOdd = srcX + (srcAdjust << 3) - (strideAdjust << FB_STIP_SHIFT); + } + else + { + *strideEven = FbStipStrideToBitsStride (stipStride); + *strideOdd = FbStipStrideToBitsStride (stipStride + 1); + + *srcXEven = srcX; + *srcXOdd = srcX + (strideAdjust << FB_STIP_SHIFT); + } +} +#endif + +void +fbBltStip (FbStip *src, + FbStride srcStride, /* in FbStip units, not FbBits units */ + int srcX, + + FbStip *dst, + FbStride dstStride, /* in FbStip units, not FbBits units */ + int dstX, + + int width, + int height, + + int alu, + FbBits pm, + int bpp) +{ +#if FB_STIP_SHIFT != FB_SHIFT + if (FB_STIP_ODDSTRIDE(srcStride) || FB_STIP_ODDPTR(src) || + FB_STIP_ODDSTRIDE(dstStride) || FB_STIP_ODDPTR(dst)) + { + FbStride srcStrideEven, srcStrideOdd; + FbStride dstStrideEven, dstStrideOdd; + int srcXEven, srcXOdd; + int dstXEven, dstXOdd; + FbBits *s, *d; + int sx, dx; + + src += srcX >> FB_STIP_SHIFT; + srcX &= FB_STIP_MASK; + dst += dstX >> FB_STIP_SHIFT; + dstX &= FB_STIP_MASK; + + fbSetBltOdd (src, srcStride, srcX, + &s, + &srcStrideEven, &srcStrideOdd, + &srcXEven, &srcXOdd); + + fbSetBltOdd (dst, dstStride, dstX, + &d, + &dstStrideEven, &dstStrideOdd, + &dstXEven, &dstXOdd); + +#ifdef FB_24BIT + if (bpp == 24 && !FbCheck24Pix (pm)) + { + fbBltOdd24 (s, srcStrideEven, srcStrideOdd, + srcXEven, srcXOdd, + + d, dstStrideEven, dstStrideOdd, + dstXEven, dstXOdd, + + width, height, alu, pm); + } + else +#endif + { + fbBltOdd (s, srcStrideEven, srcStrideOdd, + srcXEven, srcXOdd, + + d, dstStrideEven, dstStrideOdd, + dstXEven, dstXOdd, + + width, height, alu, pm, bpp); + } + } + else +#endif + { + fbBlt ((FbBits *) src, FbStipStrideToBitsStride (srcStride), + srcX, + (FbBits *) dst, FbStipStrideToBitsStride (dstStride), + dstX, + width, height, + alu, pm, bpp, FALSE, FALSE); + } +} diff --git a/pixman/src/icbltone.c b/pixman/src/icbltone.c new file mode 100644 index 0000000..58f6e19 --- /dev/null +++ b/pixman/src/icbltone.c @@ -0,0 +1,742 @@ +/* + * Id: $ + * + * Copyright © 1998 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "pixman-xserver-compat.h" + +/* + * Example: srcX = 13 dstX = 8 (FB unit 32 dstBpp 8) + * + * **** **** **** **** **** **** **** **** + * ^ + * ******** ******** ******** ******** + * ^ + * leftShift = 12 + * rightShift = 20 + * + * Example: srcX = 0 dstX = 8 (FB unit 32 dstBpp 8) + * + * **** **** **** **** **** **** **** **** + * ^ + * ******** ******** ******** ******** + * ^ + * + * leftShift = 24 + * rightShift = 8 + */ + +#define LoadBits {\ + if (leftShift) { \ + bitsRight = *src++; \ + bits = (FbStipLeft (bitsLeft, leftShift) | \ + FbStipRight(bitsRight, rightShift)); \ + bitsLeft = bitsRight; \ + } else \ + bits = *src++; \ +} + +#ifndef FBNOPIXADDR + +#define LaneCases1(n,a) case n: (void)FbLaneCase(n,a); break +#define LaneCases2(n,a) LaneCases1(n,a); LaneCases1(n+1,a) +#define LaneCases4(n,a) LaneCases2(n,a); LaneCases2(n+2,a) +#define LaneCases8(n,a) LaneCases4(n,a); LaneCases4(n+4,a) +#define LaneCases16(n,a) LaneCases8(n,a); LaneCases8(n+8,a) +#define LaneCases32(n,a) LaneCases16(n,a); LaneCases16(n+16,a) +#define LaneCases64(n,a) LaneCases32(n,a); LaneCases32(n+32,a) +#define LaneCases128(n,a) LaneCases64(n,a); LaneCases64(n+64,a) +#define LaneCases256(n,a) LaneCases128(n,a); LaneCases128(n+128,a) + +#if FB_SHIFT == 6 +#define LaneCases(a) LaneCases256(0,a) +#endif + +#if FB_SHIFT == 5 +#define LaneCases(a) LaneCases16(0,a) +#endif + +#if FB_SHIFT == 6 +static uint8_t const fb8Lane[256] = { +0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, +22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, +41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, +60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, +79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, +98, 99, 100, 101, 102,103,104,105,106,107,108,109,110,111,112,113,114,115, +116, 117, 118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133, +134, 135, 136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151, +152, 153, 154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169, +170, 171, 172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187, +188, 189, 190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205, +206, 207, 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223, +224, 225, 226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241, +242, 243, 244,245,246,247,248,249,250,251,252,253,254,255, +}; + +static uint8_t const fb16Lane[256] = { + 0x00, 0x03, 0x0c, 0x0f, + 0x30, 0x33, 0x3c, 0x3f, + 0xc0, 0xc3, 0xcc, 0xcf, + 0xf0, 0xf3, 0xfc, 0xff, +}; + +static uint8_t const fb32Lane[16] = { + 0x00, 0x0f, 0xf0, 0xff, +}; +#endif + +#if FB_SHIFT == 5 +static uint8_t const fb8Lane[16] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 +}; + +static uint8_t const fb16Lane[16] = { + 0, 3, 12, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +static uint8_t const fb32Lane[16] = { + 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; +#endif + +static const uint8_t * +fbLaneTable(int bpp) +{ + switch (bpp) { + case 8: + return fb8Lane; + case 16: + return fb16Lane; + case 32: + return fb32Lane; + } + return 0; +} +#endif + +void +fbBltOne (FbStip *src, + FbStride srcStride, /* FbStip units per scanline */ + int srcX, /* bit position of source */ + FbBits *dst, + FbStride dstStride, /* FbBits units per scanline */ + int dstX, /* bit position of dest */ + int dstBpp, /* bits per destination unit */ + + int width, /* width in bits of destination */ + int height, /* height in scanlines */ + + FbBits fgand, /* rrop values */ + FbBits fgxor, + FbBits bgand, + FbBits bgxor) +{ + const FbBits *fbBits; + int pixelsPerDst; /* dst pixels per FbBits */ + int unitsPerSrc; /* src patterns per FbStip */ + int leftShift, rightShift; /* align source with dest */ + FbBits startmask, endmask; /* dest scanline masks */ + FbStip bits=0, bitsLeft, bitsRight;/* source bits */ + FbStip left; + FbBits mask; + int nDst; /* dest longwords (w.o. end) */ + int w; + int n, nmiddle; + int dstS; /* stipple-relative dst X coordinate */ + Bool copy; /* accelerate dest-invariant */ + Bool transparent; /* accelerate 0 nop */ + int srcinc; /* source units consumed */ + Bool endNeedsLoad = FALSE; /* need load for endmask */ +#ifndef FBNOPIXADDR + const CARD8 *fbLane; +#endif + int startbyte, endbyte; + +#ifdef FB_24BIT + if (dstBpp == 24) + { + fbBltOne24 (src, srcStride, srcX, + dst, dstStride, dstX, dstBpp, + width, height, + fgand, fgxor, bgand, bgxor); + return; + } +#endif + + /* + * Number of destination units in FbBits == number of stipple pixels + * used each time + */ + pixelsPerDst = FB_UNIT / dstBpp; + + /* + * Number of source stipple patterns in FbStip + */ + unitsPerSrc = FB_STIP_UNIT / pixelsPerDst; + + copy = FALSE; + transparent = FALSE; + if (bgand == 0 && fgand == 0) + copy = TRUE; + else if (bgand == FB_ALLONES && bgxor == 0) + transparent = TRUE; + + /* + * Adjust source and dest to nearest FbBits boundary + */ + src += srcX >> FB_STIP_SHIFT; + dst += dstX >> FB_SHIFT; + srcX &= FB_STIP_MASK; + dstX &= FB_MASK; + + FbMaskBitsBytes(dstX, width, copy, + startmask, startbyte, nmiddle, endmask, endbyte); + + /* + * Compute effective dest alignment requirement for + * source -- must align source to dest unit boundary + */ + dstS = dstX / dstBpp; + /* + * Compute shift constants for effective alignement + */ + if (srcX >= dstS) + { + leftShift = srcX - dstS; + rightShift = FB_STIP_UNIT - leftShift; + } + else + { + rightShift = dstS - srcX; + leftShift = FB_STIP_UNIT - rightShift; + } + /* + * Get pointer to stipple mask array for this depth + */ + fbBits = 0; /* unused */ + if (pixelsPerDst <= 8) + fbBits = fbStippleTable(pixelsPerDst); +#ifndef FBNOPIXADDR + fbLane = 0; + if (transparent && fgand == 0 && dstBpp >= 8) + fbLane = fbLaneTable(dstBpp); +#endif + + /* + * Compute total number of destination words written, but + * don't count endmask + */ + nDst = nmiddle; + if (startmask) + nDst++; + + dstStride -= nDst; + + /* + * Compute total number of source words consumed + */ + + srcinc = (nDst + unitsPerSrc - 1) / unitsPerSrc; + + if (srcX > dstS) + srcinc++; + if (endmask) + { + endNeedsLoad = nDst % unitsPerSrc == 0; + if (endNeedsLoad) + srcinc++; + } + + srcStride -= srcinc; + + /* + * Copy rectangle + */ + while (height--) + { + w = nDst; /* total units across scanline */ + n = unitsPerSrc; /* units avail in single stipple */ + if (n > w) + n = w; + + bitsLeft = 0; + if (srcX > dstS) + bitsLeft = *src++; + if (n) + { + /* + * Load first set of stipple bits + */ + LoadBits; + + /* + * Consume stipple bits for startmask + */ + if (startmask) + { +#if FB_UNIT > 32 + if (pixelsPerDst == 16) + mask = FbStipple16Bits(FbLeftStipBits(bits,16)); + else +#endif + mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)]; +#ifndef FBNOPIXADDR + if (fbLane) + { + fbTransparentSpan (dst, mask & startmask, fgxor, 1); + } + else +#endif + { + if (mask || !transparent) + FbDoLeftMaskByteStippleRRop (dst, mask, + fgand, fgxor, bgand, bgxor, + startbyte, startmask); + } + bits = FbStipLeft (bits, pixelsPerDst); + dst++; + n--; + w--; + } + /* + * Consume stipple bits across scanline + */ + for (;;) + { + w -= n; + if (copy) + { + while (n--) + { +#if FB_UNIT > 32 + if (pixelsPerDst == 16) + mask = FbStipple16Bits(FbLeftStipBits(bits,16)); + else +#endif + mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)]; + *dst = FbOpaqueStipple (mask, fgxor, bgxor); + dst++; + bits = FbStipLeft(bits, pixelsPerDst); + } + } + else + { +#ifndef FBNOPIXADDR + if (fbLane) + { + while (bits && n) + { + switch (fbLane[FbLeftStipBits(bits,pixelsPerDst)]) { + LaneCases((CARD8 *) dst); + } + bits = FbStipLeft(bits,pixelsPerDst); + dst++; + n--; + } + dst += n; + } + else +#endif + { + while (n--) + { + left = FbLeftStipBits(bits,pixelsPerDst); + if (left || !transparent) + { + mask = fbBits[left]; + *dst = FbStippleRRop (*dst, mask, + fgand, fgxor, bgand, bgxor); + } + dst++; + bits = FbStipLeft(bits, pixelsPerDst); + } + } + } + if (!w) + break; + /* + * Load another set and reset number of available units + */ + LoadBits; + n = unitsPerSrc; + if (n > w) + n = w; + } + } + /* + * Consume stipple bits for endmask + */ + if (endmask) + { + if (endNeedsLoad) + { + LoadBits; + } +#if FB_UNIT > 32 + if (pixelsPerDst == 16) + mask = FbStipple16Bits(FbLeftStipBits(bits,16)); + else +#endif + mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)]; +#ifndef FBNOPIXADDR + if (fbLane) + { + fbTransparentSpan (dst, mask & endmask, fgxor, 1); + } + else +#endif + { + if (mask || !transparent) + FbDoRightMaskByteStippleRRop (dst, mask, + fgand, fgxor, bgand, bgxor, + endbyte, endmask); + } + } + dst += dstStride; + src += srcStride; + } +} + +#ifdef FB_24BIT + +/* + * Crufty macros to initialize the mask array, most of this + * is to avoid compile-time warnings about shift overflow + */ + +#if BITMAP_BIT_ORDER == MSBFirst +#define Mask24Pos(x,r) ((x)*24-(r)) +#else +#define Mask24Pos(x,r) ((x)*24-((r) ? 24 - (r) : 0)) +#endif + +#define Mask24Neg(x,r) (Mask24Pos(x,r) < 0 ? -Mask24Pos(x,r) : 0) +#define Mask24Check(x,r) (Mask24Pos(x,r) < 0 ? 0 : \ + Mask24Pos(x,r) >= FB_UNIT ? 0 : Mask24Pos(x,r)) + +#define Mask24(x,r) (Mask24Pos(x,r) < FB_UNIT ? \ + (Mask24Pos(x,r) < 0 ? \ + 0xffffff >> Mask24Neg (x,r) : \ + 0xffffff << Mask24Check(x,r)) : 0) + +#define SelMask24(b,n,r) ((((b) >> n) & 1) * Mask24(n,r)) + +/* + * Untested for MSBFirst or FB_UNIT == 32 + */ + +#if FB_UNIT == 64 +#define C4_24(b,r) \ + (SelMask24(b,0,r) | \ + SelMask24(b,1,r) | \ + SelMask24(b,2,r) | \ + SelMask24(b,3,r)) + +#define FbStip24New(rot) (2 + (rot != 0)) +#define FbStip24Len 4 + +static const FbBits fbStipple24Bits[3][1 << FbStip24Len] = { + /* rotate 0 */ + { + C4_24( 0, 0), C4_24( 1, 0), C4_24( 2, 0), C4_24( 3, 0), + C4_24( 4, 0), C4_24( 5, 0), C4_24( 6, 0), C4_24( 7, 0), + C4_24( 8, 0), C4_24( 9, 0), C4_24(10, 0), C4_24(11, 0), + C4_24(12, 0), C4_24(13, 0), C4_24(14, 0), C4_24(15, 0), + }, + /* rotate 8 */ + { + C4_24( 0, 8), C4_24( 1, 8), C4_24( 2, 8), C4_24( 3, 8), + C4_24( 4, 8), C4_24( 5, 8), C4_24( 6, 8), C4_24( 7, 8), + C4_24( 8, 8), C4_24( 9, 8), C4_24(10, 8), C4_24(11, 8), + C4_24(12, 8), C4_24(13, 8), C4_24(14, 8), C4_24(15, 8), + }, + /* rotate 16 */ + { + C4_24( 0,16), C4_24( 1,16), C4_24( 2,16), C4_24( 3,16), + C4_24( 4,16), C4_24( 5,16), C4_24( 6,16), C4_24( 7,16), + C4_24( 8,16), C4_24( 9,16), C4_24(10,16), C4_24(11,16), + C4_24(12,16), C4_24(13,16), C4_24(14,16), C4_24(15,16), + } +}; + +#endif + +#if FB_UNIT == 32 +#define C2_24(b,r) \ + (SelMask24(b,0,r) | \ + SelMask24(b,1,r)) + +#define FbStip24Len 2 +#if BITMAP_BIT_ORDER == MSBFirst +#define FbStip24New(rot) (1 + (rot == 0)) +#else +#define FbStip24New(rot) (1 + (rot == 8)) +#endif + +static const FbBits fbStipple24Bits[3][1 << FbStip24Len] = { + /* rotate 0 */ + { + C2_24( 0, 0), C2_24 ( 1, 0), C2_24 ( 2, 0), C2_24 ( 3, 0), + }, + /* rotate 8 */ + { + C2_24( 0, 8), C2_24 ( 1, 8), C2_24 ( 2, 8), C2_24 ( 3, 8), + }, + /* rotate 16 */ + { + C2_24( 0,16), C2_24 ( 1,16), C2_24 ( 2,16), C2_24 ( 3,16), + } +}; +#endif + +#if BITMAP_BIT_ORDER == LSBFirst + +#define FbMergeStip24Bits(left, right, new) \ + (FbStipLeft (left, new) | FbStipRight ((right), (FbStip24Len - (new)))) + +#define FbMergePartStip24Bits(left, right, llen, rlen) \ + (left | FbStipRight(right, llen)) + +#else + +#define FbMergeStip24Bits(left, right, new) \ + ((FbStipLeft (left, new) & ((1 << FbStip24Len) - 1)) | right) + +#define FbMergePartStip24Bits(left, right, llen, rlen) \ + (FbStipLeft(left, rlen) | right) + +#endif + +#define fbFirstStipBits(len,stip) {\ + int __len = (len); \ + if (len <= remain) { \ + stip = FbLeftStipBits(bits, len); \ + } else { \ + stip = FbLeftStipBits(bits, remain); \ + bits = *src++; \ + __len = (len) - remain; \ + stip = FbMergePartStip24Bits(stip, FbLeftStipBits(bits, __len), \ + remain, __len); \ + remain = FB_STIP_UNIT; \ + } \ + bits = FbStipLeft (bits, __len); \ + remain -= __len; \ +} + +#define fbInitStipBits(offset,len,stip) {\ + bits = FbStipLeft (*src++,offset); \ + remain = FB_STIP_UNIT - offset; \ + fbFirstStipBits(len,stip); \ + stip = FbMergeStip24Bits (0, stip, len); \ +} + +#define fbNextStipBits(rot,stip) {\ + int __new = FbStip24New(rot); \ + FbStip __right; \ + fbFirstStipBits(__new, __right); \ + stip = FbMergeStip24Bits (stip, __right, __new); \ + rot = FbNext24Rot (rot); \ +} + +/* + * Use deep mask tables that incorporate rotation, pull + * a variable number of bits out of the stipple and + * reuse the right bits as needed for the next write + * + * Yes, this is probably too much code, but most 24-bpp screens + * have no acceleration so this code is used for stipples, copyplane + * and text + */ +void +fbBltOne24 (FbStip *srcLine, + FbStride srcStride, /* FbStip units per scanline */ + int srcX, /* bit position of source */ + FbBits *dst, + FbStride dstStride, /* FbBits units per scanline */ + int dstX, /* bit position of dest */ + int dstBpp, /* bits per destination unit */ + + int width, /* width in bits of destination */ + int height, /* height in scanlines */ + + FbBits fgand, /* rrop values */ + FbBits fgxor, + FbBits bgand, + FbBits bgxor) +{ + FbStip *src; + FbBits leftMask, rightMask, mask; + int nlMiddle, nl; + FbStip stip, bits; + int remain; + int dstS; + int firstlen; + int rot0, rot; + int nDst; + + srcLine += srcX >> FB_STIP_SHIFT; + dst += dstX >> FB_SHIFT; + srcX &= FB_STIP_MASK; + dstX &= FB_MASK; + rot0 = FbFirst24Rot (dstX); + + FbMaskBits (dstX, width, leftMask, nlMiddle, rightMask); + + dstS = (dstX + 23) / 24; + firstlen = FbStip24Len - dstS; + + nDst = nlMiddle; + if (leftMask) + nDst++; + dstStride -= nDst; + + /* opaque copy */ + if (bgand == 0 && fgand == 0) + { + while (height--) + { + rot = rot0; + src = srcLine; + srcLine += srcStride; + fbInitStipBits (srcX,firstlen, stip); + if (leftMask) + { + mask = fbStipple24Bits[rot >> 3][stip]; + *dst = (*dst & ~leftMask) | (FbOpaqueStipple (mask, + FbRot24(fgxor, rot), + FbRot24(bgxor, rot)) + & leftMask); + dst++; + fbNextStipBits(rot,stip); + } + nl = nlMiddle; + while (nl--) + { + mask = fbStipple24Bits[rot>>3][stip]; + *dst = FbOpaqueStipple (mask, + FbRot24(fgxor, rot), + FbRot24(bgxor, rot)); + dst++; + fbNextStipBits(rot,stip); + } + if (rightMask) + { + mask = fbStipple24Bits[rot >> 3][stip]; + *dst = (*dst & ~rightMask) | (FbOpaqueStipple (mask, + FbRot24(fgxor, rot), + FbRot24(bgxor, rot)) + & rightMask); + } + dst += dstStride; + src += srcStride; + } + } + /* transparent copy */ + else if (bgand == FB_ALLONES && bgxor == 0 && fgand == 0) + { + while (height--) + { + rot = rot0; + src = srcLine; + srcLine += srcStride; + fbInitStipBits (srcX, firstlen, stip); + if (leftMask) + { + if (stip) + { + mask = fbStipple24Bits[rot >> 3][stip] & leftMask; + *dst = (*dst & ~mask) | (FbRot24(fgxor, rot) & mask); + } + dst++; + fbNextStipBits (rot, stip); + } + nl = nlMiddle; + while (nl--) + { + if (stip) + { + mask = fbStipple24Bits[rot>>3][stip]; + *dst = (*dst & ~mask) | (FbRot24(fgxor,rot) & mask); + } + dst++; + fbNextStipBits (rot, stip); + } + if (rightMask) + { + if (stip) + { + mask = fbStipple24Bits[rot >> 3][stip] & rightMask; + *dst = (*dst & ~mask) | (FbRot24(fgxor, rot) & mask); + } + } + dst += dstStride; + } + } + else + { + while (height--) + { + rot = rot0; + src = srcLine; + srcLine += srcStride; + fbInitStipBits (srcX, firstlen, stip); + if (leftMask) + { + mask = fbStipple24Bits[rot >> 3][stip]; + *dst = FbStippleRRopMask (*dst, mask, + FbRot24(fgand, rot), + FbRot24(fgxor, rot), + FbRot24(bgand, rot), + FbRot24(bgxor, rot), + leftMask); + dst++; + fbNextStipBits(rot,stip); + } + nl = nlMiddle; + while (nl--) + { + mask = fbStipple24Bits[rot >> 3][stip]; + *dst = FbStippleRRop (*dst, mask, + FbRot24(fgand, rot), + FbRot24(fgxor, rot), + FbRot24(bgand, rot), + FbRot24(bgxor, rot)); + dst++; + fbNextStipBits(rot,stip); + } + if (rightMask) + { + mask = fbStipple24Bits[rot >> 3][stip]; + *dst = FbStippleRRopMask (*dst, mask, + FbRot24(fgand, rot), + FbRot24(fgxor, rot), + FbRot24(bgand, rot), + FbRot24(bgxor, rot), + rightMask); + } + dst += dstStride; + } + } +} +#endif + diff --git a/pixman/src/iccolor.c b/pixman/src/iccolor.c new file mode 100644 index 0000000..e3e2a30 --- /dev/null +++ b/pixman/src/iccolor.c @@ -0,0 +1,84 @@ +/* + * Copyright © 2000 SuSE, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of SuSE not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. SuSE makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, SuSE, Inc. + */ + +#include "icint.h" + +#ifdef ICINT_NEED_IC_ONES +/* Fall back on HACKMEM 169. */ +int +_FbOnes (unsigned long mask) +{ + register unsigned long y; + + y = (mask >> 1) &033333333333; + y = mask - y - ((y >>1) & 033333333333); + return (((y + (y >> 3)) & 030707070707) % 077); +} +#endif + +void +pixman_color_to_pixel (const pixman_format_t *format, + const pixman_color_t *color, + pixman_bits_t *pixel) +{ + uint32_t r, g, b, a; + + r = color->red >> (16 - _FbOnes (format->redMask)); + g = color->green >> (16 - _FbOnes (format->greenMask)); + b = color->blue >> (16 - _FbOnes (format->blueMask)); + a = color->alpha >> (16 - _FbOnes (format->alphaMask)); + r = r << format->red; + g = g << format->green; + b = b << format->blue; + a = a << format->alpha; + *pixel = r|g|b|a; +} +slim_hidden_def(pixman_color_to_pixel); + +static uint16_t +FbFillColor (uint32_t pixel, int bits) +{ + while (bits < 16) + { + pixel |= pixel << bits; + bits <<= 1; + } + return (uint16_t) pixel; +} + +void +pixman_pixel_to_color (const pixman_format_t *format, + const pixman_bits_t pixel, + pixman_color_t *color) +{ + uint32_t r, g, b, a; + + r = (pixel >> format->red) & format->redMask; + g = (pixel >> format->green) & format->greenMask; + b = (pixel >> format->blue) & format->blueMask; + a = (pixel >> format->alpha) & format->alphaMask; + color->red = FbFillColor (r, _FbOnes (format->redMask)); + color->green = FbFillColor (r, _FbOnes (format->greenMask)); + color->blue = FbFillColor (r, _FbOnes (format->blueMask)); + color->alpha = FbFillColor (r, _FbOnes (format->alphaMask)); +} diff --git a/pixman/src/icformat.c b/pixman/src/icformat.c new file mode 100644 index 0000000..37d9bc5 --- /dev/null +++ b/pixman/src/icformat.c @@ -0,0 +1,193 @@ +/* + * Copyright © 2000 SuSE, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of SuSE not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. SuSE makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, SuSE, Inc. + */ + +#include "icint.h" + +#define Mask(n) ((n) == 32 ? 0xffffffff : ((1 << (n))-1)) + +pixman_format_t * +pixman_format_create (pixman_format_name_t name) +{ + switch (name) { + case PIXMAN_FORMAT_NAME_ARGB32: + return pixman_format_create_masks (32, + 0xff000000, + 0x00ff0000, + 0x0000ff00, + 0x000000ff); + case PIXMAN_FORMAT_NAME_RGB24: + return pixman_format_create_masks (32, + 0x0, + 0xff0000, + 0x00ff00, + 0x0000ff); + case PIXMAN_FORMAT_NAME_A8: + return pixman_format_create_masks (8, 0xff, + 0, 0, 0); + case PIXMAN_FORMAT_NAME_A1: + return pixman_format_create_masks (1, 0x1, + 0, 0, 0); + } + + return NULL; +} + +/* XXX: There's some nonsense going on here. The macros above help + pixman_format_create_masks to encode a format into an int, while + immediately afterwards pixman_format_init goes through the effort of + decoding it. This should all be disentagled, (it's probably + possible to just eliminate the encoding macros altogether). */ +pixman_format_t * +pixman_format_create_masks (int bpp, + int alpha_mask, + int red_mask, + int green_mask, + int blue_mask) +{ + int type; + int format_code; + pixman_format_t *format; + + if (red_mask == 0 && green_mask == 0 && blue_mask == 0) + type = PICT_TYPE_A; + else if (red_mask > blue_mask) + type = PICT_TYPE_ARGB; + else + type = PICT_TYPE_ABGR; + + format_code = PICT_FORMAT (bpp, type, + _FbOnes (alpha_mask), + _FbOnes (red_mask), + _FbOnes (green_mask), + _FbOnes (blue_mask)); + + format = malloc (sizeof (pixman_format_t)); + if (format == NULL) + return NULL; + + pixman_format_init (format, format_code); + + return format; +} + +void +pixman_format_init (pixman_format_t *format, int format_code) +{ + memset (format, 0, sizeof (pixman_format_t)); + +/* XXX: What do we want to lodge in here? + format->id = FakeClientID (0); +*/ + format->format_code = format_code; + + switch (PICT_FORMAT_TYPE(format_code)) { + case PICT_TYPE_ARGB: + + format->alphaMask = Mask(PICT_FORMAT_A(format_code)); + if (format->alphaMask) + format->alpha = (PICT_FORMAT_R(format_code) + + PICT_FORMAT_G(format_code) + + PICT_FORMAT_B(format_code)); + + format->redMask = Mask(PICT_FORMAT_R(format_code)); + format->red = (PICT_FORMAT_G(format_code) + + PICT_FORMAT_B(format_code)); + + format->greenMask = Mask(PICT_FORMAT_G(format_code)); + format->green = PICT_FORMAT_B(format_code); + + format->blueMask = Mask(PICT_FORMAT_B(format_code)); + format->blue = 0; + break; + + case PICT_TYPE_ABGR: + + format->alphaMask = Mask(PICT_FORMAT_A(format_code)); + if (format->alphaMask) + format->alpha = (PICT_FORMAT_B(format_code) + + PICT_FORMAT_G(format_code) + + PICT_FORMAT_R(format_code)); + + format->blueMask = Mask(PICT_FORMAT_B(format_code)); + format->blue = (PICT_FORMAT_G(format_code) + + PICT_FORMAT_R(format_code)); + + format->greenMask = Mask(PICT_FORMAT_G(format_code)); + format->green = PICT_FORMAT_R(format_code); + + format->redMask = Mask(PICT_FORMAT_R(format_code)); + format->red = 0; + break; + + case PICT_TYPE_A: + + format->alpha = 0; + format->alphaMask = Mask(PICT_FORMAT_A(format_code)); + + /* remaining fields already set to zero */ + break; + } + + format->depth = _FbOnes ((format->alphaMask << format->alpha) | + (format->redMask << format->red) | + (format->blueMask << format->blue) | + (format->greenMask << format->green)); +} +slim_hidden_def(pixman_format_init); + +void +pixman_format_destroy (pixman_format_t *format) +{ + free (format); +} + +void +pixman_format_get_masks (pixman_format_t *format, + int *bpp, + int *alpha_mask, + int *red_mask, + int *green_mask, + int *blue_mask) +{ + *bpp = PICT_FORMAT_BPP (format->format_code); + + if (format->alphaMask) + *alpha_mask = format->alphaMask << format->alpha; + else + *alpha_mask = 0; + + if (format->redMask) + *red_mask = format->redMask << format->red; + else + *red_mask = 0; + + if (format->greenMask) + *green_mask = format->greenMask << format->green; + else + *green_mask = 0; + + if (format->blueMask) + *blue_mask = format->blueMask << format->blue; + else + *blue_mask = 0; +} diff --git a/pixman/src/icimage.c b/pixman/src/icimage.c new file mode 100644 index 0000000..86db441 --- /dev/null +++ b/pixman/src/icimage.c @@ -0,0 +1,716 @@ +/* + * Copyright © 2000 SuSE, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of SuSE not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. SuSE makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, SuSE, Inc. + */ + +#include "pixman-xserver-compat.h" + +pixman_image_t * +pixman_image_create (pixman_format_t *format, + int width, + int height) +{ + pixman_image_t *image; + FbPixels *pixels; + + pixels = FbPixelsCreate (width, height, format->depth); + if (pixels == NULL) + return NULL; + + image = pixman_image_createForPixels (pixels, format); + if (image == NULL) { + FbPixelsDestroy (pixels); + return NULL; + } + + image->owns_pixels = 1; + + return image; +} +slim_hidden_def(pixman_image_create); + +pixman_image_t * +pixman_image_create_for_data (FbBits *data, pixman_format_t *format, int width, int height, int bpp, int stride) +{ + pixman_image_t *image; + FbPixels *pixels; + + pixels = FbPixelsCreateForData (data, width, height, format->depth, bpp, stride); + if (pixels == NULL) + return NULL; + + image = pixman_image_createForPixels (pixels, format); + if (image == NULL) { + FbPixelsDestroy (pixels); + return NULL; + } + + image->owns_pixels = 1; + + return image; +} + +pixman_image_t * +pixman_image_createForPixels (FbPixels *pixels, + pixman_format_t *format) +{ + pixman_image_t *image; + + image = malloc (sizeof (pixman_image_t)); + if (!image) + { + return NULL; + } + + image->pixels = pixels; + image->image_format = *format; + image->format_code = format->format_code; +/* XXX: What's all this about? + if (pDrawable->type == DRAWABLE_PIXMAP) + { + ++((PixmapPtr)pDrawable)->refcnt; + image->pNext = 0; + } + else + { + image->pNext = GetPictureWindow(((WindowPtr) pDrawable)); + SetPictureWindow(((WindowPtr) pDrawable), image); + } +*/ + + pixman_image_init (image); + + return image; +} + +void +pixman_image_init (pixman_image_t *image) +{ + image->refcnt = 1; + image->repeat = 0; + image->graphicsExposures = 0; + image->subWindowMode = ClipByChildren; + image->polyEdge = PolyEdgeSharp; + image->polyMode = PolyModePrecise; + /* + * In the server this was 0 because the composite clip list + * can be referenced from a window (and often is) + */ + image->freeCompClip = 0; + image->freeSourceClip = 0; + image->clientClipType = CT_NONE; + image->componentAlpha = 0; + image->compositeClipSource = 0; + + image->alphaMap = 0; + image->alphaOrigin.x = 0; + image->alphaOrigin.y = 0; + + image->clipOrigin.x = 0; + image->clipOrigin.y = 0; + image->clientClip = 0; + + image->dither = 0L; + + image->stateChanges = (1 << (CPLastBit+1)) - 1; +/* XXX: What to lodge here? + image->serialNumber = GC_CHANGE_SERIAL_BIT; +*/ + + image->pCompositeClip = pixman_region_create(); + pixman_region_union_rect (image->pCompositeClip, image->pCompositeClip, + 0, 0, image->pixels->width, image->pixels->height); + image->freeCompClip = 1; + + image->pSourceClip = pixman_region_create (); + pixman_region_union_rect (image->pSourceClip, image->pSourceClip, + 0, 0, image->pixels->width, image->pixels->height); + image->freeSourceClip = 1; + + image->transform = NULL; + + image->filter = PIXMAN_FILTER_NEAREST; + image->filter_params = 0; + image->filter_nparams = 0; + + + image->owns_pixels = 0; +} + +void +pixman_image_set_component_alpha (pixman_image_t *image, + int component_alpha) +{ + if (image) + image->componentAlpha = component_alpha; +} +slim_hidden_def(pixman_image_set_component_alpha); + +int +pixman_image_set_transform (pixman_image_t *image, + pixman_transform_t *transform) +{ + static const pixman_transform_t identity = { { + { xFixed1, 0x00000, 0x00000 }, + { 0x00000, xFixed1, 0x00000 }, + { 0x00000, 0x00000, xFixed1 }, + } }; + + if (transform && memcmp (transform, &identity, sizeof (pixman_transform_t)) == 0) + transform = 0; + + if (transform) + { + if (!image->transform) + { + image->transform = malloc (sizeof (pixman_transform_t)); + if (!image->transform) + return 1; + } + *image->transform = *transform; + } + else + { + if (image->transform) + { + free (image->transform); + image->transform = 0; + } + } + return 0; +} + +void +pixman_image_set_repeat (pixman_image_t *image, + int repeat) +{ + if (image) + image->repeat = repeat; +} +slim_hidden_def(pixman_image_set_repeat); + +void +pixman_image_set_filter (pixman_image_t *image, + pixman_filter_t filter) +{ + if (image) + image->filter = filter; +} + +int +pixman_image_get_width (pixman_image_t *image) +{ + return image->pixels->width; +} + +int +pixman_image_get_height (pixman_image_t *image) +{ + return image->pixels->height; +} + +int +pixman_image_get_depth (pixman_image_t *image) +{ + return image->pixels->depth; +} + +int +pixman_image_get_stride (pixman_image_t *image) +{ + return image->pixels->stride; +} + +pixman_format_t * +pixman_image_get_format (pixman_image_t *image) +{ + return &image->image_format; +} + +FbBits * +pixman_image_get_data (pixman_image_t *image) +{ + return image->pixels->data; +} + +void +pixman_image_destroy (pixman_image_t *image) +{ + pixman_image_destroyClip (image); + + if (image->freeCompClip) { + pixman_region_destroy (image->pCompositeClip); + image->pCompositeClip = NULL; + } + + if (image->freeSourceClip) { + pixman_region_destroy (image->pSourceClip); + image->pSourceClip = NULL; + } + + if (image->owns_pixels) { + FbPixelsDestroy (image->pixels); + image->pixels = NULL; + } + + if (image->transform) { + free (image->transform); + image->transform = NULL; + } + + free (image); +} +slim_hidden_def(pixman_image_destroy); + +void +pixman_image_destroyClip (pixman_image_t *image) +{ + switch (image->clientClipType) { + case CT_NONE: + return; + case CT_PIXMAP: + pixman_image_destroy (image->clientClip); + break; + default: + pixman_region_destroy (image->clientClip); + break; + } + image->clientClip = NULL; + image->clientClipType = CT_NONE; +} + +int +pixman_image_set_clip_region (pixman_image_t *image, + pixman_region16_t *region) +{ + pixman_image_destroyClip (image); + if (region) { + image->clientClip = pixman_region_create (); + pixman_region_copy (image->clientClip, region); + image->clientClipType = CT_REGION; + } + + if (image->freeCompClip) + pixman_region_destroy (image->pCompositeClip); + image->pCompositeClip = pixman_region_create(); + pixman_region_union_rect (image->pCompositeClip, image->pCompositeClip, + 0, 0, image->pixels->width, image->pixels->height); + image->freeCompClip = 1; + if (region) { + pixman_region_translate (image->pCompositeClip, + - image->clipOrigin.x, + - image->clipOrigin.y); + pixman_region_intersect (image->pCompositeClip, + image->pCompositeClip, + region); + pixman_region_translate (image->pCompositeClip, + image->clipOrigin.x, + image->clipOrigin.y); + } + + image->stateChanges |= CPClipMask; + return 0; +} + +#define BOUND(v) (int16_t) ((v) < MINSHORT ? MINSHORT : (v) > MAXSHORT ? MAXSHORT : (v)) + +static __inline int +FbClipImageReg (pixman_region16_t *region, + pixman_region16_t *clip, + int dx, + int dy) +{ + if (pixman_region_num_rects (region) == 1 && + pixman_region_num_rects (clip) == 1) + { + pixman_box16_t *pRbox = pixman_region_rects (region); + pixman_box16_t *pCbox = pixman_region_rects (clip); + int v; + + if (pRbox->x1 < (v = pCbox->x1 + dx)) + pRbox->x1 = BOUND(v); + if (pRbox->x2 > (v = pCbox->x2 + dx)) + pRbox->x2 = BOUND(v); + if (pRbox->y1 < (v = pCbox->y1 + dy)) + pRbox->y1 = BOUND(v); + if (pRbox->y2 > (v = pCbox->y2 + dy)) + pRbox->y2 = BOUND(v); + if (pRbox->x1 >= pRbox->x2 || + pRbox->y1 >= pRbox->y2) + { + pixman_region_empty (region); + } + } + else + { + pixman_region_translate (region, dx, dy); + pixman_region_intersect (region, clip, region); + pixman_region_translate (region, -dx, -dy); + } + return 1; +} + +static __inline int +FbClipImageSrc (pixman_region16_t *region, + pixman_image_t *image, + int dx, + int dy) +{ + /* XXX what to do with clipping from transformed pictures? */ + if (image->transform) + return 1; + if (image->repeat) + { + /* XXX no source clipping */ + if (image->compositeClipSource && + image->clientClipType != CT_NONE) + { + pixman_region_translate (region, + dx - image->clipOrigin.x, + dy - image->clipOrigin.y); + pixman_region_intersect (region, image->clientClip, region); + pixman_region_translate (region, + - (dx - image->clipOrigin.x), + - (dy - image->clipOrigin.y)); + } + return 1; + } + else + { + pixman_region16_t *clip; + + if (image->compositeClipSource) + clip = image->pCompositeClip; + else + clip = image->pSourceClip; + return FbClipImageReg (region, + clip, + dx, + dy); + } + return 1; +} + +/* XXX: Need to decide what to do with this +#define NEXT_VAL(_type) (vlist ? (_type) *vlist++ : (_type) ulist++->val) + +#define NEXT_PTR(_type) ((_type) ulist++->ptr) + +int +pixman_image_change (pixman_image_t *image, + Mask vmask, + unsigned int *vlist, + DevUnion *ulist, + int *error_value) +{ + BITS32 index2; + int error = 0; + BITS32 maskQ; + + maskQ = vmask; + while (vmask && !error) + { + index2 = (BITS32) lowbit (vmask); + vmask &= ~index2; + image->stateChanges |= index2; + switch (index2) + { + case CPRepeat: + { + unsigned int newr; + newr = NEXT_VAL(unsigned int); + if (newr <= xTrue) + image->repeat = newr; + else + { + *error_value = newr; + error = BadValue; + } + } + break; + case CPAlphaMap: + { + pixman_image_t *iAlpha; + + iAlpha = NEXT_PTR(pixman_image_t *); + if (iAlpha) + iAlpha->refcnt++; + if (image->alphaMap) + pixman_image_destroy ((void *) image->alphaMap); + image->alphaMap = iAlpha; + } + break; + case CPAlphaXOrigin: + image->alphaOrigin.x = NEXT_VAL(int16_t); + break; + case CPAlphaYOrigin: + image->alphaOrigin.y = NEXT_VAL(int16_t); + break; + case CPClipXOrigin: + image->clipOrigin.x = NEXT_VAL(int16_t); + break; + case CPClipYOrigin: + image->clipOrigin.y = NEXT_VAL(int16_t); + break; + case CPClipMask: + { + pixman_image_t *mask; + int clipType; + + mask = NEXT_PTR(pixman_image_t *); + if (mask) { + clipType = CT_PIXMAP; + mask->refcnt++; + } else { + clipType = CT_NONE; + } + error = pixman_image_change_clip (image, clipType, + (void *)mask, 0); + break; + } + case CPGraphicsExposure: + { + unsigned int newe; + newe = NEXT_VAL(unsigned int); + if (newe <= xTrue) + image->graphicsExposures = newe; + else + { + *error_value = newe; + error = BadValue; + } + } + break; + case CPSubwindowMode: + { + unsigned int news; + news = NEXT_VAL(unsigned int); + if (news == ClipByChildren || news == IncludeInferiors) + image->subWindowMode = news; + else + { + *error_value = news; + error = BadValue; + } + } + break; + case CPPolyEdge: + { + unsigned int newe; + newe = NEXT_VAL(unsigned int); + if (newe == PolyEdgeSharp || newe == PolyEdgeSmooth) + image->polyEdge = newe; + else + { + *error_value = newe; + error = BadValue; + } + } + break; + case CPPolyMode: + { + unsigned int newm; + newm = NEXT_VAL(unsigned int); + if (newm == PolyModePrecise || newm == PolyModeImprecise) + image->polyMode = newm; + else + { + *error_value = newm; + error = BadValue; + } + } + break; + case CPDither: + image->dither = NEXT_VAL(unsigned long); + break; + case CPComponentAlpha: + { + unsigned int newca; + + newca = NEXT_VAL (unsigned int); + if (newca <= xTrue) + image->componentAlpha = newca; + else + { + *error_value = newca; + error = BadValue; + } + } + break; + default: + *error_value = maskQ; + error = BadValue; + break; + } + } + return error; +} +*/ + +/* XXX: Do we need this? +int +SetPictureClipRects (PicturePtr pPicture, + int xOrigin, + int yOrigin, + int nRect, + xRectangle *rects) +{ + ScreenPtr pScreen = pPicture->pDrawable->pScreen; + PictureScreenPtr ps = GetPictureScreen(pScreen); + pixman_region16_t *clientClip; + int result; + + clientClip = RECTS_TO_REGION(pScreen, + nRect, rects, CT_UNSORTED); + if (!clientClip) + return 1; + result =(*ps->ChangePictureClip) (pPicture, CT_REGION, + (void *) clientClip, 0); + if (result == 0) + { + pPicture->clipOrigin.x = xOrigin; + pPicture->clipOrigin.y = yOrigin; + pPicture->stateChanges |= CPClipXOrigin|CPClipYOrigin|CPClipMask; + pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT; + } + return result; +} +*/ + +int +FbComputeCompositeRegion (pixman_region16_t *region, + pixman_image_t *iSrc, + pixman_image_t *iMask, + pixman_image_t *iDst, + int16_t xSrc, + int16_t ySrc, + int16_t xMask, + int16_t yMask, + int16_t xDst, + int16_t yDst, + uint16_t width, + uint16_t height) +{ + int v; + int x1, y1, x2, y2; + + /* XXX: This code previously directly set the extents of the + region here. I need to decide whether removing that has broken + this. Also, it might be necessary to just make the pixman_region16_t + data structure transparent anyway in which case I can just put + the code back. */ + x1 = xDst; + v = xDst + width; + x2 = BOUND(v); + y1 = yDst; + v = yDst + height; + y2 = BOUND(v); + /* Check for empty operation */ + if (x1 >= x2 || + y1 >= y2) + { + pixman_region_empty (region); + return 1; + } + /* clip against src */ + if (!FbClipImageSrc (region, iSrc, xDst - xSrc, yDst - ySrc)) + { + pixman_region_destroy (region); + return 0; + } + if (iSrc->alphaMap) + { + if (!FbClipImageSrc (region, iSrc->alphaMap, + xDst - (xSrc + iSrc->alphaOrigin.x), + yDst - (ySrc + iSrc->alphaOrigin.y))) + { + pixman_region_destroy (region); + return 0; + } + } + /* clip against mask */ + if (iMask) + { + if (!FbClipImageSrc (region, iMask, xDst - xMask, yDst - yMask)) + { + pixman_region_destroy (region); + return 0; + } + if (iMask->alphaMap) + { + if (!FbClipImageSrc (region, iMask->alphaMap, + xDst - (xMask + iMask->alphaOrigin.x), + yDst - (yMask + iMask->alphaOrigin.y))) + { + pixman_region_destroy (region); + return 0; + } + } + } + if (!FbClipImageReg (region, iDst->pCompositeClip, 0, 0)) + { + pixman_region_destroy (region); + return 0; + } + if (iDst->alphaMap) + { + if (!FbClipImageReg (region, iDst->alphaMap->pCompositeClip, + -iDst->alphaOrigin.x, + -iDst->alphaOrigin.y)) + { + pixman_region_destroy (region); + return 0; + } + } + return 1; +} + +int +miIsSolidAlpha (pixman_image_t *src) +{ + char line[1]; + + /* Alpha-only */ + if (PICT_FORMAT_TYPE (src->format_code) != PICT_TYPE_A) + return 0; + /* repeat */ + if (!src->repeat) + return 0; + /* 1x1 */ + if (src->pixels->width != 1 || src->pixels->height != 1) + return 0; + line[0] = 1; + /* XXX: For the next line, fb has: + (*pScreen->GetImage) (src->pixels, 0, 0, 1, 1, ZPixmap, ~0L, line); + Is the following simple assignment sufficient? + */ + line[0] = src->pixels->data[0]; + switch (src->pixels->bpp) { + case 1: + return (uint8_t) line[0] == 1 || (uint8_t) line[0] == 0x80; + case 4: + return (uint8_t) line[0] == 0xf || (uint8_t) line[0] == 0xf0; + case 8: + return (uint8_t) line[0] == 0xff; + default: + return 0; + } +} diff --git a/pixman/src/icimage.h b/pixman/src/icimage.h new file mode 100644 index 0000000..b3e012f --- /dev/null +++ b/pixman/src/icimage.h @@ -0,0 +1,305 @@ +/* + * Copyright © 2000 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* XXX: This whole file should be moved up into incint.h (and cleaned + up considerably as well) */ + +#ifndef _ICIMAGE_H_ +#define _ICIMAGE_H_ + +/* #include "glyphstr.h" */ +/* #include "scrnintstr.h" */ + +/* XXX: Hmmm... what's needed from here? +#include "resource.h" +*/ + +/* +typedef struct _IndexFormat { + VisualPtr pVisual; + ColormapPtr pColormap; + int nvalues; + xIndexValue *pValues; + void *devPrivate; +} IndexFormatRec; +*/ + +/* +typedef struct pixman_format { + uint32_t id; + uint32_t format; + unsigned char type; + unsigned char depth; + DirectFormatRec direct; + IndexFormatRec index; +} pixman_format_t; +*/ + +struct pixman_image { + FbPixels *pixels; + pixman_format_t image_format; + int format_code; + int refcnt; + + unsigned int repeat : 1; + unsigned int graphicsExposures : 1; + unsigned int subWindowMode : 1; + unsigned int polyEdge : 1; + unsigned int polyMode : 1; + unsigned int freeCompClip : 1; + unsigned int freeSourceClip : 1; + unsigned int clientClipType : 2; + unsigned int componentAlpha : 1; + unsigned int compositeClipSource : 1; + unsigned int unused : 21; + + struct pixman_image *alphaMap; + FbPoint alphaOrigin; + + FbPoint clipOrigin; + void *clientClip; + + unsigned long dither; + + unsigned long stateChanges; + unsigned long serialNumber; + + pixman_region16_t *pCompositeClip; + pixman_region16_t *pSourceClip; + + pixman_transform_t *transform; + + pixman_filter_t filter; + pixman_fixed16_16_t *filter_params; + int filter_nparams; + + int owns_pixels; +}; + +#endif /* _ICIMAGE_H_ */ + +#ifndef _IC_MIPICT_H_ +#define _IC_MIPICT_H_ + +#define IC_MAX_INDEXED 256 /* XXX depth must be <= 8 */ + +#if IC_MAX_INDEXED <= 256 +typedef uint8_t FbIndexType; +#endif + +/* XXX: We're not supporting indexed operations, right? */ +typedef struct _FbIndexed { + int color; + uint32_t rgba[IC_MAX_INDEXED]; + FbIndexType ent[32768]; +} FbIndexedRec, *FbIndexedPtr; + +#define FbCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \ + (((s) >> 6) & 0x03e0) | \ + (((s) >> 9) & 0x7c00)) +#define FbIndexToEnt15(icf,rgb15) ((icf)->ent[rgb15]) +#define FbIndexToEnt24(icf,rgb24) FbIndexToEnt15(icf,FbCvtR8G8B8to15(rgb24)) + +#define FbIndexToEntY24(icf,rgb24) ((icf)->ent[CvtR8G8B8toY15(rgb24)]) + +/* +pixman_private int +FbCreatePicture (PicturePtr pPicture); +*/ + +pixman_private void +pixman_image_init (pixman_image_t *image); + +pixman_private void +pixman_image_destroyClip (pixman_image_t *image); + +/* +pixman_private void +FbValidatePicture (PicturePtr pPicture, + Mask mask); +*/ + + +/* XXX: What should this be? +pixman_private int +FbClipPicture (pixman_region16_t *region, + pixman_image_t *image, + int16_t xReg, + int16_t yReg, + int16_t xPict, + int16_t yPict); +*/ + +pixman_private int +FbComputeCompositeRegion (pixman_region16_t *region, + pixman_image_t *iSrc, + pixman_image_t *iMask, + pixman_image_t *iDst, + int16_t xSrc, + int16_t ySrc, + int16_t xMask, + int16_t yMask, + int16_t xDst, + int16_t yDst, + uint16_t width, + uint16_t height); + +int +miIsSolidAlpha (pixman_image_t *src); + +/* +pixman_private int +FbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats); +*/ + +/* +pixman_private void +FbGlyphs (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + int16_t xSrc, + int16_t ySrc, + int nlist, + GlyphListPtr list, + GlyphPtr *glyphs); +*/ + +/* +pixman_private void +pixman_compositeRects (pixman_operator_t op, + PicturePtr pDst, + xRenderColor *color, + int nRect, + xRectangle *rects); +*/ + +pixman_private pixman_image_t * +FbCreateAlphaPicture (pixman_image_t *dst, + pixman_format_t *format, + uint16_t width, + uint16_t height); + +typedef void (*CompositeFunc) (pixman_operator_t op, + pixman_image_t *iSrc, + pixman_image_t *iMask, + pixman_image_t *iDst, + int16_t xSrc, + int16_t ySrc, + int16_t xMask, + int16_t yMask, + int16_t xDst, + int16_t yDst, + uint16_t width, + uint16_t height); + +typedef struct _FbCompositeOperand FbCompositeOperand; + +typedef uint32_t (*pixman_compositeFetch)(FbCompositeOperand *op); +typedef void (*pixman_compositeStore) (FbCompositeOperand *op, uint32_t value); + +typedef void (*pixman_compositeStep) (FbCompositeOperand *op); +typedef void (*pixman_compositeSet) (FbCompositeOperand *op, int x, int y); + +struct _FbCompositeOperand { + union { + struct { + pixman_bits_t *top_line; + int left_offset; + + int start_offset; + pixman_bits_t *line; + uint32_t offset; + FbStride stride; + int bpp; + } drawable; + struct { + int alpha_dx; + int alpha_dy; + } external; + struct { + int top_y; + int left_x; + int start_x; + int x; + int y; + pixman_transform_t *transform; + pixman_filter_t filter; + int repeat; + int width; + int height; + } transform; + } u; + pixman_compositeFetch fetch; + pixman_compositeFetch fetcha; + pixman_compositeStore store; + pixman_compositeStep over; + pixman_compositeStep down; + pixman_compositeSet set; +/* XXX: We're not supporting indexed operations, right? + FbIndexedPtr indexed; +*/ + pixman_region16_t *dst_clip; + pixman_region16_t *src_clip; +}; + +typedef void (*FbCombineFunc) (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); + +typedef struct _FbAccessMap { + uint32_t format_code; + pixman_compositeFetch fetch; + pixman_compositeFetch fetcha; + pixman_compositeStore store; +} FbAccessMap; + +/* iccompose.c */ + +typedef struct _FbCompSrc { + uint32_t value; + uint32_t alpha; +} FbCompSrc; + +pixman_private int +fbBuildCompositeOperand (pixman_image_t *image, + FbCompositeOperand op[4], + int16_t x, + int16_t y, + int transform, + int alpha); + +pixman_private void +pixman_compositeGeneral (pixman_operator_t op, + pixman_image_t *iSrc, + pixman_image_t *iMask, + pixman_image_t *iDst, + int16_t xSrc, + int16_t ySrc, + int16_t xMask, + int16_t yMask, + int16_t xDst, + int16_t yDst, + uint16_t width, + uint16_t height); + +#endif /* _IC_MIPICT_H_ */ diff --git a/pixman/src/icint.h b/pixman/src/icint.h new file mode 100644 index 0000000..8cb37ff --- /dev/null +++ b/pixman/src/icint.h @@ -0,0 +1,1074 @@ +/* + * Copyright © 2003 Carl Worth + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Carl Worth not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Carl Worth makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * CARL WORTH DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL CARL WORTH BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _ICINT_H_ +#define _ICINT_H_ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "pixman.h" + +#include <stdlib.h> +#include <string.h> +#include <limits.h> + +#include "slim_internal.h" + +#ifndef __GNUC__ +#define __inline +#endif + +#if defined(__GNUC__) +#define INLINE __inline__ +#else +#define INLINE +#endif + +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + +/* C89 has implementation-defined behavior for % with negative operands. + C99 has well-defined behavior which is that / with integers rounds toward zero + and a%b is defined so that (a/b)*b + a%b == a. + + The C99 version gives negative remainders rather than the modulus + in [0 .. b-1] that we want. This macro avoids using % with negative + operands to avoid both problems. + + a and b are integers. b > 0. +*/ +#define MOD(a, b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-(a) - 1) % (b) - 1) + +typedef struct _FbPoint { + int16_t x,y ; +} FbPoint; + +typedef unsigned int Mask; + + +#define GXcopy 0x3 +#define GXor 0x7 +#define ClipByChildren 0 +#define PolyEdgeSharp 0 +#define PolyModePrecise 0 +#define CPClipMask (1 << 6) +#define CPLastBit 11 + + +/* Define any names that the server code will be expecting in + * terms of libpixman names. */ + +typedef uint8_t CARD8; +typedef uint16_t CARD16; +typedef uint32_t CARD32; +typedef int16_t INT16; + +typedef int Bool; +#define FALSE 0 +#define TRUE 1 + +typedef pixman_bits_t FbBits; +typedef pixman_image_t* PicturePtr; +typedef pixman_box16_t BoxRec; +typedef pixman_box16_t* BoxPtr; + +typedef pixman_point_fixed_t xPointFixed; +typedef pixman_line_fixed_t xLineFixed; +typedef pixman_trapezoid_t xTrapezoid; +typedef pixman_triangle_t xTriangle; + +/* These few definitions avoid me needing to include servermd.h and misc.h from Xserver/include */ +#ifndef BITMAP_SCANLINE_PAD +#define BITMAP_SCANLINE_PAD 32 +#define LOG2_BITMAP_PAD 5 +#define LOG2_BYTES_PER_SCANLINE_PAD 2 +#endif + +#define LSBFirst 0 +#define MSBFirst 1 + +#ifdef WORDS_BIGENDIAN +# define IMAGE_BYTE_ORDER MSBFirst +# define BITMAP_BIT_ORDER MSBFirst +#else +# define IMAGE_BYTE_ORDER LSBFirst +# define BITMAP_BIT_ORDER LSBFirst +#endif + + +#define MAXSHORT SHRT_MAX +#define MINSHORT SHRT_MIN + +/* XXX: What do we need from here? +#include "picture.h" +*/ + + + +#include "pixman.h" + +/* XXX: Most of this file is straight from fb.h and I imagine we can + drop quite a bit of it. Once the real ic code starts to come + together I can probably figure out what is not needed here. */ + +#define FB_UNIT (1 << FB_SHIFT) +#define FB_HALFUNIT (1 << (FB_SHIFT-1)) +#define FB_MASK (FB_UNIT - 1) +#define FB_ALLONES ((pixman_bits_t) -1) + +/* whether to bother to include 24bpp support */ +#ifndef ICNO24BIT +#define FB_24BIT +#endif + +/* + * Unless otherwise instructed, ic includes code to advertise 24bpp + * windows with 32bpp image format for application compatibility + */ + +#ifdef FB_24BIT +#ifndef ICNO24_32 +#define FB_24_32BIT +#endif +#endif + +#define FB_STIP_SHIFT LOG2_BITMAP_PAD +#define FB_STIP_UNIT (1 << FB_STIP_SHIFT) +#define FB_STIP_MASK (FB_STIP_UNIT - 1) +#define FB_STIP_ALLONES ((FbStip) -1) + +#define FB_STIP_ODDSTRIDE(s) (((s) & (FB_MASK >> FB_STIP_SHIFT)) != 0) +#define FB_STIP_ODDPTR(p) ((((long) (p)) & (FB_MASK >> 3)) != 0) + +#define FbStipStrideToBitsStride(s) (((s) >> (FB_SHIFT - FB_STIP_SHIFT))) +#define FbBitsStrideToStipStride(s) (((s) << (FB_SHIFT - FB_STIP_SHIFT))) + +#define FbFullMask(n) ((n) == FB_UNIT ? FB_ALLONES : ((((FbBits) 1) << n) - 1)) + + +typedef uint32_t FbStip; +typedef int FbStride; + + +#ifdef FB_DEBUG +extern void fbValidateDrawable(DrawablePtr d); +extern void fbInitializeDrawable(DrawablePtr d); +extern void fbSetBits (FbStip *bits, int stride, FbStip data); +#define FB_HEAD_BITS (FbStip) (0xbaadf00d) +#define FB_TAIL_BITS (FbStip) (0xbaddf0ad) +#else +#define fbValidateDrawable(d) +#define fdInitializeDrawable(d) +#endif + +#if BITMAP_BIT_ORDER == LSBFirst +#define FbScrLeft(x,n) ((x) >> (n)) +#define FbScrRight(x,n) ((x) << (n)) +/* #define FbLeftBits(x,n) ((x) & ((((FbBits) 1) << (n)) - 1)) */ +#define FbLeftStipBits(x,n) ((x) & ((((FbStip) 1) << (n)) - 1)) +#define FbStipMoveLsb(x,s,n) (FbStipRight (x,(s)-(n))) +#define FbPatternOffsetBits 0 +#else +#define FbScrLeft(x,n) ((x) << (n)) +#define FbScrRight(x,n) ((x) >> (n)) +/* #define FbLeftBits(x,n) ((x) >> (FB_UNIT - (n))) */ +#define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n))) +#define FbStipMoveLsb(x,s,n) (x) +#define FbPatternOffsetBits (sizeof (FbBits) - 1) +#endif + +#define FbStipLeft(x,n) FbScrLeft(x,n) +#define FbStipRight(x,n) FbScrRight(x,n) + +#define FbRotLeft(x,n) FbScrLeft(x,n) | (n ? FbScrRight(x,FB_UNIT-n) : 0) +#define FbRotRight(x,n) FbScrRight(x,n) | (n ? FbScrLeft(x,FB_UNIT-n) : 0) + +#define FbRotStipLeft(x,n) FbStipLeft(x,n) | (n ? FbStipRight(x,FB_STIP_UNIT-n) : 0) +#define FbRotStipRight(x,n) FbStipRight(x,n) | (n ? FbStipLeft(x,FB_STIP_UNIT-n) : 0) + +#define FbLeftMask(x) ( ((x) & FB_MASK) ? \ + FbScrRight(FB_ALLONES,(x) & FB_MASK) : 0) +#define FbRightMask(x) ( ((FB_UNIT - (x)) & FB_MASK) ? \ + FbScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0) + +#define FbLeftStipMask(x) ( ((x) & FB_STIP_MASK) ? \ + FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) : 0) +#define FbRightStipMask(x) ( ((FB_STIP_UNIT - (x)) & FB_STIP_MASK) ? \ + FbScrLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - (x)) & FB_STIP_MASK) : 0) + +#define FbBitsMask(x,w) (FbScrRight(FB_ALLONES,(x) & FB_MASK) & \ + FbScrLeft(FB_ALLONES,(FB_UNIT - ((x) + (w))) & FB_MASK)) + +#define FbStipMask(x,w) (FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \ + FbStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK)) + + +#define FbMaskBits(x,w,l,n,r) { \ + n = (w); \ + r = FbRightMask((x)+n); \ + l = FbLeftMask(x); \ + if (l) { \ + n -= FB_UNIT - ((x) & FB_MASK); \ + if (n < 0) { \ + n = 0; \ + l &= r; \ + r = 0; \ + } \ + } \ + n >>= FB_SHIFT; \ +} + +#ifdef ICNOPIXADDR +#define FbMaskBitsBytes(x,w,copy,l,lb,n,r,rb) FbMaskBits(x,w,l,n,r) +#define FbDoLeftMaskByteRRop(dst,lb,l,and,xor) { \ + *dst = FbDoMaskRRop(*dst,and,xor,l); \ +} +#define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \ + *dst = FbDoMaskRRop(*dst,and,xor,r); \ +} +#else + +#define FbByteMaskInvalid 0x10 + +#define FbPatternOffset(o,t) ((o) ^ (FbPatternOffsetBits & ~(sizeof (t) - 1))) + +#define FbPtrOffset(p,o,t) ((t *) ((CARD8 *) (p) + (o))) +#define FbSelectPatternPart(xor,o,t) ((xor) >> (FbPatternOffset (o,t) << 3)) +#define FbStorePart(dst,off,t,xor) (*FbPtrOffset(dst,off,t) = \ + FbSelectPart(xor,off,t)) +#ifndef FbSelectPart +#define FbSelectPart(x,o,t) FbSelectPatternPart(x,o,t) +#endif + +#define FbMaskBitsBytes(x,w,copy,l,lb,n,r,rb) { \ + n = (w); \ + lb = 0; \ + rb = 0; \ + r = FbRightMask((x)+n); \ + if (r) { \ + /* compute right byte length */ \ + if ((copy) && (((x) + n) & 7) == 0) { \ + rb = (((x) + n) & FB_MASK) >> 3; \ + } else { \ + rb = FbByteMaskInvalid; \ + } \ + } \ + l = FbLeftMask(x); \ + if (l) { \ + /* compute left byte length */ \ + if ((copy) && ((x) & 7) == 0) { \ + lb = ((x) & FB_MASK) >> 3; \ + } else { \ + lb = FbByteMaskInvalid; \ + } \ + /* subtract out the portion painted by leftMask */ \ + n -= FB_UNIT - ((x) & FB_MASK); \ + if (n < 0) { \ + if (lb != FbByteMaskInvalid) { \ + if (rb == FbByteMaskInvalid) { \ + lb = FbByteMaskInvalid; \ + } else if (rb) { \ + lb |= (rb - lb) << (FB_SHIFT - 3); \ + rb = 0; \ + } \ + } \ + n = 0; \ + l &= r; \ + r = 0; \ + }\ + } \ + n >>= FB_SHIFT; \ +} + +#if FB_SHIFT == 6 +#define FbDoLeftMaskByteRRop6Cases(dst,xor) \ + case (sizeof (FbBits) - 7) | (1 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ + break; \ + case (sizeof (FbBits) - 7) | (2 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD8,xor); \ + break; \ + case (sizeof (FbBits) - 7) | (3 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + break; \ + case (sizeof (FbBits) - 7) | (4 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \ + break; \ + case (sizeof (FbBits) - 7) | (5 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ + break; \ + case (sizeof (FbBits) - 7) | (6 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ + break; \ + case (sizeof (FbBits) - 7): \ + FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \ + break; \ + case (sizeof (FbBits) - 6) | (1 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD8,xor); \ + break; \ + case (sizeof (FbBits) - 6) | (2 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + break; \ + case (sizeof (FbBits) - 6) | (3 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \ + break; \ + case (sizeof (FbBits) - 6) | (4 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ + break; \ + case (sizeof (FbBits) - 6) | (5 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ + break; \ + case (sizeof (FbBits) - 6): \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \ + break; \ + case (sizeof (FbBits) - 5) | (1 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \ + break; \ + case (sizeof (FbBits) - 5) | (2 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \ + break; \ + case (sizeof (FbBits) - 5) | (3 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ + break; \ + case (sizeof (FbBits) - 5) | (4 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ + break; \ + case (sizeof (FbBits) - 5): \ + FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \ + break; \ + case (sizeof (FbBits) - 4) | (1 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \ + break; \ + case (sizeof (FbBits) - 4) | (2 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ + break; \ + case (sizeof (FbBits) - 4) | (3 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ + break; \ + case (sizeof (FbBits) - 4): \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \ + break; + +#define FbDoRightMaskByteRRop6Cases(dst,xor) \ + case 4: \ + FbStorePart(dst,0,CARD32,xor); \ + break; \ + case 5: \ + FbStorePart(dst,0,CARD32,xor); \ + FbStorePart(dst,4,CARD8,xor); \ + break; \ + case 6: \ + FbStorePart(dst,0,CARD32,xor); \ + FbStorePart(dst,4,CARD16,xor); \ + break; \ + case 7: \ + FbStorePart(dst,0,CARD32,xor); \ + FbStorePart(dst,4,CARD16,xor); \ + FbStorePart(dst,6,CARD8,xor); \ + break; +#else +#define FbDoLeftMaskByteRRop6Cases(dst,xor) +#define FbDoRightMaskByteRRop6Cases(dst,xor) +#endif + +#define FbDoLeftMaskByteRRop(dst,lb,l,and,xor) { \ + switch (lb) { \ + FbDoLeftMaskByteRRop6Cases(dst,xor) \ + case (sizeof (FbBits) - 3) | (1 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \ + break; \ + case (sizeof (FbBits) - 3) | (2 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ + break; \ + case (sizeof (FbBits) - 2) | (1 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ + break; \ + case sizeof (FbBits) - 3: \ + FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \ + case sizeof (FbBits) - 2: \ + FbStorePart(dst,sizeof (FbBits) - 2,CARD16,xor); \ + break; \ + case sizeof (FbBits) - 1: \ + FbStorePart(dst,sizeof (FbBits) - 1,CARD8,xor); \ + break; \ + default: \ + *dst = FbDoMaskRRop(*dst, and, xor, l); \ + break; \ + } \ +} + + +#define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \ + switch (rb) { \ + case 1: \ + FbStorePart(dst,0,CARD8,xor); \ + break; \ + case 2: \ + FbStorePart(dst,0,CARD16,xor); \ + break; \ + case 3: \ + FbStorePart(dst,0,CARD16,xor); \ + FbStorePart(dst,2,CARD8,xor); \ + break; \ + FbDoRightMaskByteRRop6Cases(dst,xor) \ + default: \ + *dst = FbDoMaskRRop (*dst, and, xor, r); \ + } \ +} +#endif + +#define FbMaskStip(x,w,l,n,r) { \ + n = (w); \ + r = FbRightStipMask((x)+n); \ + l = FbLeftStipMask(x); \ + if (l) { \ + n -= FB_STIP_UNIT - ((x) & FB_STIP_MASK); \ + if (n < 0) { \ + n = 0; \ + l &= r; \ + r = 0; \ + } \ + } \ + n >>= FB_STIP_SHIFT; \ +} + +/* + * These macros are used to transparently stipple + * in copy mode; the expected usage is with 'n' constant + * so all of the conditional parts collapse into a minimal + * sequence of partial word writes + * + * 'n' is the bytemask of which bytes to store, 'a' is the address + * of the FbBits base unit, 'o' is the offset within that unit + * + * The term "lane" comes from the hardware term "byte-lane" which + */ + +#define FbLaneCase1(n,a,o) ((n) == 0x01 ? \ + (*(CARD8 *) ((a)+FbPatternOffset(o,CARD8)) = \ + fgxor) : 0) +#define FbLaneCase2(n,a,o) ((n) == 0x03 ? \ + (*(CARD16 *) ((a)+FbPatternOffset(o,CARD16)) = \ + fgxor) : \ + ((void)FbLaneCase1((n)&1,a,o), \ + FbLaneCase1((n)>>1,a,(o)+1))) +#define FbLaneCase4(n,a,o) ((n) == 0x0f ? \ + (*(CARD32 *) ((a)+FbPatternOffset(o,CARD32)) = \ + fgxor) : \ + ((void)FbLaneCase2((n)&3,a,o), \ + FbLaneCase2((n)>>2,a,(o)+2))) +#define FbLaneCase8(n,a,o) ((n) == 0x0ff ? (*(FbBits *) ((a)+(o)) = fgxor) : \ + ((void)FbLaneCase4((n)&15,a,o), \ + FbLaneCase4((n)>>4,a,(o)+4))) + +#if FB_SHIFT == 6 +#define FbLaneCase(n,a) FbLaneCase8(n,(CARD8 *) (a),0) +#endif + +#if FB_SHIFT == 5 +#define FbLaneCase(n,a) FbLaneCase4(n,(CARD8 *) (a),0) +#endif + +/* Rotate a filled pixel value to the specified alignement */ +#define FbRot24(p,b) (FbScrRight(p,b) | FbScrLeft(p,24-(b))) +#define FbRot24Stip(p,b) (FbStipRight(p,b) | FbStipLeft(p,24-(b))) + +/* step a filled pixel value to the next/previous FB_UNIT alignment */ +#define FbNext24Pix(p) (FbRot24(p,(24-FB_UNIT%24))) +#define FbPrev24Pix(p) (FbRot24(p,FB_UNIT%24)) +#define FbNext24Stip(p) (FbRot24(p,(24-FB_STIP_UNIT%24))) +#define FbPrev24Stip(p) (FbRot24(p,FB_STIP_UNIT%24)) + +/* step a rotation value to the next/previous rotation value */ +#if FB_UNIT == 64 +#define FbNext24Rot(r) ((r) == 16 ? 0 : (r) + 8) +#define FbPrev24Rot(r) ((r) == 0 ? 16 : (r) - 8) + +#if IMAGE_BYTE_ORDER == MSBFirst +#define FbFirst24Rot(x) (((x) + 8) % 24) +#else +#define FbFirst24Rot(x) ((x) % 24) +#endif + +#endif + +#if FB_UNIT == 32 +#define FbNext24Rot(r) ((r) == 0 ? 16 : (r) - 8) +#define FbPrev24Rot(r) ((r) == 16 ? 0 : (r) + 8) + +#if IMAGE_BYTE_ORDER == MSBFirst +#define FbFirst24Rot(x) (((x) + 16) % 24) +#else +#define FbFirst24Rot(x) ((x) % 24) +#endif +#endif + +#define FbNext24RotStip(r) ((r) == 0 ? 16 : (r) - 8) +#define FbPrev24RotStip(r) ((r) == 16 ? 0 : (r) + 8) + +/* Whether 24-bit specific code is needed for this filled pixel value */ +#define FbCheck24Pix(p) ((p) == FbNext24Pix(p)) + +#define FbGetPixels(icpixels, pointer, _stride_, _bpp_, xoff, yoff) { \ + (pointer) = icpixels->data; \ + (_stride_) = icpixels->stride / sizeof(pixman_bits_t); \ + (_bpp_) = icpixels->bpp; \ + (xoff) = icpixels->x; /* XXX: fb.h had this ifdef'd to constant 0. Why? */ \ + (yoff) = icpixels->y; /* XXX: fb.h had this ifdef'd to constant 0. Why? */ \ +} + +#define FbGetStipPixels(icpixels, pointer, _stride_, _bpp_, xoff, yoff) { \ + (pointer) = (FbStip *) icpixels->data; \ + (_stride_) = icpixels->stride / sizeof(FbStip); \ + (_bpp_) = icpixels->bpp; \ + (xoff) = icpixels->x; \ + (yoff) = icpixels->y; \ +} + +#ifdef FB_OLD_SCREEN +#define BitsPerPixel(d) (\ + ((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \ + (PixmapWidthPaddingInfo[d].padRoundUp+1))) +#endif + +#define FbPowerOfTwo(w) (((w) & ((w) - 1)) == 0) +/* + * Accelerated tiles are power of 2 width <= FB_UNIT + */ +#define FbEvenTile(w) ((w) <= FB_UNIT && FbPowerOfTwo(w)) +/* + * Accelerated stipples are power of 2 width and <= FB_UNIT/dstBpp + * with dstBpp a power of 2 as well + */ +#define FbEvenStip(w,bpp) ((w) * (bpp) <= FB_UNIT && FbPowerOfTwo(w) && FbPowerOfTwo(bpp)) + +/* + * icblt.c + */ +pixman_private void +fbBlt (pixman_bits_t *src, + FbStride srcStride, + int srcX, + + FbBits *dst, + FbStride dstStride, + int dstX, + + int width, + int height, + + int alu, + FbBits pm, + int bpp, + + Bool reverse, + Bool upsidedown); + +pixman_private void +fbBlt24 (pixman_bits_t *srcLine, + FbStride srcStride, + int srcX, + + FbBits *dstLine, + FbStride dstStride, + int dstX, + + int width, + int height, + + int alu, + FbBits pm, + + Bool reverse, + Bool upsidedown); + +pixman_private void +fbBltStip (FbStip *src, + FbStride srcStride, /* in FbStip units, not FbBits units */ + int srcX, + + FbStip *dst, + FbStride dstStride, /* in FbStip units, not FbBits units */ + int dstX, + + int width, + int height, + + int alu, + FbBits pm, + int bpp); + +/* + * icbltone.c + */ +pixman_private void +fbBltOne (FbStip *src, + FbStride srcStride, + int srcX, + FbBits *dst, + FbStride dstStride, + int dstX, + int dstBpp, + + int width, + int height, + + FbBits fgand, + FbBits fbxor, + FbBits bgand, + FbBits bgxor); + +#ifdef FB_24BIT +pixman_private void +fbBltOne24 (FbStip *src, + FbStride srcStride, /* FbStip units per scanline */ + int srcX, /* bit position of source */ + FbBits *dst, + FbStride dstStride, /* FbBits units per scanline */ + int dstX, /* bit position of dest */ + int dstBpp, /* bits per destination unit */ + + int width, /* width in bits of destination */ + int height, /* height in scanlines */ + + FbBits fgand, /* rrop values */ + FbBits fgxor, + FbBits bgand, + FbBits bgxor); +#endif + +/* + * icstipple.c + */ + +pixman_private void +fbTransparentSpan (pixman_bits_t *dst, + pixman_bits_t stip, + pixman_bits_t fgxor, + int n); + +pixman_private void +fbEvenStipple (pixman_bits_t *dst, + FbStride dstStride, + int dstX, + int dstBpp, + + int width, + int height, + + FbStip *stip, + FbStride stipStride, + int stipHeight, + + FbBits fgand, + FbBits fgxor, + FbBits bgand, + FbBits bgxor, + + int xRot, + int yRot); + +pixman_private void +fbOddStipple (pixman_bits_t *dst, + FbStride dstStride, + int dstX, + int dstBpp, + + int width, + int height, + + FbStip *stip, + FbStride stipStride, + int stipWidth, + int stipHeight, + + FbBits fgand, + FbBits fgxor, + FbBits bgand, + FbBits bgxor, + + int xRot, + int yRot); + +pixman_private void +fbStipple (pixman_bits_t *dst, + FbStride dstStride, + int dstX, + int dstBpp, + + int width, + int height, + + FbStip *stip, + FbStride stipStride, + int stipWidth, + int stipHeight, + Bool even, + + FbBits fgand, + FbBits fgxor, + FbBits bgand, + FbBits bgxor, + + int xRot, + int yRot); + +/* XXX: Is depth redundant here? */ +struct pixman_format { + int format_code; + int depth; + int red, redMask; + int green, greenMask; + int blue, blueMask; + int alpha, alphaMask; +}; + +typedef struct _FbPixels { + pixman_bits_t *data; + unsigned int width; + unsigned int height; + unsigned int depth; + unsigned int bpp; + unsigned int stride; + int x; + int y; + unsigned int refcnt; +} FbPixels; + +/* XXX: This is to avoid including colormap.h from the server includes */ +typedef uint32_t Pixel; + +/* icutil.c */ +pixman_private pixman_bits_t +fbReplicatePixel (Pixel p, int bpp); + +/* fbtrap.c */ + +pixman_private void +fbRasterizeTrapezoid (pixman_image_t *pMask, + const pixman_trapezoid_t *pTrap, + int x_off, + int y_off); + +/* XXX: This is to avoid including gc.h from the server includes */ +/* clientClipType field in GC */ +#define CT_NONE 0 +#define CT_PIXMAP 1 +#define CT_REGION 2 +#define CT_UNSORTED 6 +#define CT_YSORTED 10 +#define CT_YXSORTED 14 +#define CT_YXBANDED 18 + +#include "icimage.h" + +/* iccolor.c */ + +/* GCC 3.4 supports a "population count" builtin, which on many targets is + implemented with a single instruction. There is a fallback definition + in libgcc in case a target does not have one, which should be just as + good as the static function below. */ +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# if __INT_MIN__ == 0x7fffffff +# define _FbOnes(mask) __builtin_popcount(mask) +# else +# define _FbOnes(mask) __builtin_popcountl((mask) & 0xffffffff) +# endif +#else +# define ICINT_NEED_IC_ONES +int +_FbOnes(unsigned long mask); +#endif + +/* icformat.c */ + +pixman_private void +pixman_format_init (pixman_format_t *format, int format_code); + +/* icimage.c */ + +pixman_private pixman_image_t * +pixman_image_createForPixels (FbPixels *pixels, + pixman_format_t *format); + +/* icpixels.c */ + +pixman_private FbPixels * +FbPixelsCreate (int width, int height, int depth); + +pixman_private FbPixels * +FbPixelsCreateForData (pixman_bits_t *data, int width, int height, int depth, int bpp, int stride); + +pixman_private void +FbPixelsDestroy (FbPixels *pixels); + +/* ictransform.c */ + +pixman_private int +pixman_transform_point (pixman_transform_t *transform, + pixman_vector_t *vector); + +/* Avoid unnessecary PLT entries. */ + +slim_hidden_proto(pixman_image_create) +slim_hidden_proto(pixman_color_to_pixel) +slim_hidden_proto(pixman_format_init) +slim_hidden_proto(pixman_image_destroy) +slim_hidden_proto(pixman_fill_rectangles) +slim_hidden_proto(pixman_image_set_component_alpha) +slim_hidden_proto(pixman_image_set_repeat) +slim_hidden_proto(pixman_composite) + + +#include "icrop.h" + +/* XXX: For now, I'm just wholesale pasting Xserver/render/picture.h here: */ +#ifndef _PICTURE_H_ +#define _PICTURE_H_ + +typedef struct _DirectFormat *DirectFormatPtr; +typedef struct _PictFormat *PictFormatPtr; + +/* + * While the protocol is generous in format support, the + * sample implementation allows only packed RGB and GBR + * representations for data to simplify software rendering, + */ +#define PICT_FORMAT(bpp,type,a,r,g,b) (((bpp) << 24) | \ + ((type) << 16) | \ + ((a) << 12) | \ + ((r) << 8) | \ + ((g) << 4) | \ + ((b))) + +/* + * gray/color formats use a visual index instead of argb + */ +#define PICT_VISFORMAT(bpp,type,vi) (((bpp) << 24) | \ + ((type) << 16) | \ + ((vi))) + +#define PICT_FORMAT_BPP(f) (((f) >> 24) ) +#define PICT_FORMAT_TYPE(f) (((f) >> 16) & 0xff) +#define PICT_FORMAT_A(f) (((f) >> 12) & 0x0f) +#define PICT_FORMAT_R(f) (((f) >> 8) & 0x0f) +#define PICT_FORMAT_G(f) (((f) >> 4) & 0x0f) +#define PICT_FORMAT_B(f) (((f) ) & 0x0f) +#define PICT_FORMAT_RGB(f) (((f) ) & 0xfff) +#define PICT_FORMAT_VIS(f) (((f) ) & 0xffff) + +#define PICT_TYPE_OTHER 0 +#define PICT_TYPE_A 1 +#define PICT_TYPE_ARGB 2 +#define PICT_TYPE_ABGR 3 +#define PICT_TYPE_COLOR 4 +#define PICT_TYPE_GRAY 5 + +#define PICT_FORMAT_COLOR(f) (PICT_FORMAT_TYPE(f) & 2) + +/* 32bpp formats */ +#define PICT_a8r8g8b8 PICT_FORMAT(32,PICT_TYPE_ARGB,8,8,8,8) +#define PICT_x8r8g8b8 PICT_FORMAT(32,PICT_TYPE_ARGB,0,8,8,8) +#define PICT_a8b8g8r8 PICT_FORMAT(32,PICT_TYPE_ABGR,8,8,8,8) +#define PICT_x8b8g8r8 PICT_FORMAT(32,PICT_TYPE_ABGR,0,8,8,8) + +/* 24bpp formats */ +#define PICT_r8g8b8 PICT_FORMAT(24,PICT_TYPE_ARGB,0,8,8,8) +#define PICT_b8g8r8 PICT_FORMAT(24,PICT_TYPE_ABGR,0,8,8,8) + +/* 16bpp formats */ +#define PICT_r5g6b5 PICT_FORMAT(16,PICT_TYPE_ARGB,0,5,6,5) +#define PICT_b5g6r5 PICT_FORMAT(16,PICT_TYPE_ABGR,0,5,6,5) + +#define PICT_a1r5g5b5 PICT_FORMAT(16,PICT_TYPE_ARGB,1,5,5,5) +#define PICT_x1r5g5b5 PICT_FORMAT(16,PICT_TYPE_ARGB,0,5,5,5) +#define PICT_a1b5g5r5 PICT_FORMAT(16,PICT_TYPE_ABGR,1,5,5,5) +#define PICT_x1b5g5r5 PICT_FORMAT(16,PICT_TYPE_ABGR,0,5,5,5) +#define PICT_a4r4g4b4 PICT_FORMAT(16,PICT_TYPE_ARGB,4,4,4,4) +#define PICT_x4r4g4b4 PICT_FORMAT(16,PICT_TYPE_ARGB,0,4,4,4) +#define PICT_a4b4g4r4 PICT_FORMAT(16,PICT_TYPE_ABGR,4,4,4,4) +#define PICT_x4b4g4r4 PICT_FORMAT(16,PICT_TYPE_ABGR,0,4,4,4) + +/* 8bpp formats */ +#define PICT_a8 PICT_FORMAT(8,PICT_TYPE_A,8,0,0,0) +#define PICT_r3g3b2 PICT_FORMAT(8,PICT_TYPE_ARGB,0,3,3,2) +#define PICT_b2g3r3 PICT_FORMAT(8,PICT_TYPE_ABGR,0,3,3,2) +#define PICT_a2r2g2b2 PICT_FORMAT(8,PICT_TYPE_ARGB,2,2,2,2) +#define PICT_a2b2g2r2 PICT_FORMAT(8,PICT_TYPE_ABGR,2,2,2,2) + +#define PICT_c8 PICT_FORMAT(8,PICT_TYPE_COLOR,0,0,0,0) +#define PICT_g8 PICT_FORMAT(8,PICT_TYPE_GRAY,0,0,0,0) + +/* 4bpp formats */ +#define PICT_a4 PICT_FORMAT(4,PICT_TYPE_A,4,0,0,0) +#define PICT_r1g2b1 PICT_FORMAT(4,PICT_TYPE_ARGB,0,1,2,1) +#define PICT_b1g2r1 PICT_FORMAT(4,PICT_TYPE_ABGR,0,1,2,1) +#define PICT_a1r1g1b1 PICT_FORMAT(4,PICT_TYPE_ARGB,1,1,1,1) +#define PICT_a1b1g1r1 PICT_FORMAT(4,PICT_TYPE_ABGR,1,1,1,1) + +#define PICT_c4 PICT_FORMAT(4,PICT_TYPE_COLOR,0,0,0,0) +#define PICT_g4 PICT_FORMAT(4,PICT_TYPE_GRAY,0,0,0,0) + +/* 1bpp formats */ +#define PICT_a1 PICT_FORMAT(1,PICT_TYPE_A,1,0,0,0) + +#define PICT_g1 PICT_FORMAT(1,PICT_TYPE_GRAY,0,0,0,0) + +/* + * For dynamic indexed visuals (GrayScale and PseudoColor), these control the + * selection of colors allocated for drawing to Pictures. The default + * policy depends on the size of the colormap: + * + * Size Default Policy + * ---------------------------- + * < 64 PolicyMono + * < 256 PolicyGray + * 256 PolicyColor (only on PseudoColor) + * + * The actual allocation code lives in miindex.c, and so is + * austensibly server dependent, but that code does: + * + * PolicyMono Allocate no additional colors, use black and white + * PolicyGray Allocate 13 gray levels (11 cells used) + * PolicyColor Allocate a 4x4x4 cube and 13 gray levels (71 cells used) + * PolicyAll Allocate as big a cube as possible, fill with gray (all) + * + * Here's a picture to help understand how many colors are + * actually allocated (this is just the gray ramp): + * + * gray level + * all 0000 1555 2aaa 4000 5555 6aaa 8000 9555 aaaa bfff d555 eaaa ffff + * b/w 0000 ffff + * 4x4x4 5555 aaaa + * extra 1555 2aaa 4000 6aaa 8000 9555 bfff d555 eaaa + * + * The default colormap supplies two gray levels (black/white), the + * 4x4x4 cube allocates another two and nine more are allocated to fill + * in the 13 levels. When the 4x4x4 cube is not allocated, a total of + * 11 cells are allocated. + */ + +#define PictureCmapPolicyInvalid -1 +#define PictureCmapPolicyDefault 0 +#define PictureCmapPolicyMono 1 +#define PictureCmapPolicyGray 2 +#define PictureCmapPolicyColor 3 +#define PictureCmapPolicyAll 4 + +extern int PictureCmapPolicy pixman_private; + +int PictureParseCmapPolicy (const char *name); + +/* Fixed point updates from Carl Worth, USC, Information Sciences Institute */ + +#ifdef WIN32 +typedef __int64 xFixed_32_32; +#else +# if defined(__alpha__) || defined(__alpha) || \ + defined(ia64) || defined(__ia64__) || \ + defined(__sparc64__) || \ + defined(__s390x__) || \ + defined(x86_64) || defined (__x86_64__) +typedef long xFixed_32_32; +# else +# if defined(__GNUC__) && \ + ((__GNUC__ > 2) || \ + ((__GNUC__ == 2) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ > 7))) +__extension__ +# endif +typedef long long int xFixed_32_32; +# endif +#endif + +typedef xFixed_32_32 xFixed_48_16; +typedef uint32_t xFixed_1_31; +typedef uint32_t xFixed_1_16; +typedef int32_t xFixed_16_16; + +/* + * An unadorned "xFixed" is the same as xFixed_16_16, + * (since it's quite common in the code) + */ +typedef xFixed_16_16 xFixed; +#define XFIXED_BITS 16 + +#define xFixedToInt(f) (int) ((f) >> XFIXED_BITS) +#define IntToxFixed(i) ((xFixed) (i) << XFIXED_BITS) +#define xFixedE ((xFixed) 1) +#define xFixed1 (IntToxFixed(1)) +#define xFixed1MinusE (xFixed1 - xFixedE) +#define xFixedFrac(f) ((f) & xFixed1MinusE) +#define xFixedFloor(f) ((f) & ~xFixed1MinusE) +#define xFixedCeil(f) xFixedFloor((f) + xFixed1MinusE) + +#define xFixedFraction(f) ((f) & xFixed1MinusE) +#define xFixedMod2(f) ((f) & (xFixed1 | xFixed1MinusE)) + +/* whether 't' is a well defined not obviously empty trapezoid */ +#define xTrapezoidValid(t) ((t)->left.p1.y != (t)->left.p2.y && \ + (t)->right.p1.y != (t)->right.p2.y && \ + (int) ((t)->bottom - (t)->top) > 0) + +/* + * Standard NTSC luminance conversions: + * + * y = r * 0.299 + g * 0.587 + b * 0.114 + * + * Approximate this for a bit more speed: + * + * y = (r * 153 + g * 301 + b * 58) / 512 + * + * This gives 17 bits of luminance; to get 15 bits, lop the low two + */ + +#define CvtR8G8B8toY15(s) (((((s) >> 16) & 0xff) * 153 + \ + (((s) >> 8) & 0xff) * 301 + \ + (((s) ) & 0xff) * 58) >> 2) + +#endif /* _PICTURE_H_ */ + +#endif /* _ICINT_H_ */ diff --git a/pixman/src/icpixels.c b/pixman/src/icpixels.c new file mode 100644 index 0000000..b5e12a2 --- /dev/null +++ b/pixman/src/icpixels.c @@ -0,0 +1,117 @@ +/* + * $Id: icpixels.c,v 1.9 2005/06/25 03:13:19 jrmuizel Exp $ + * + * Copyright © 1998 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "pixman-xserver-compat.h" + +static void +FbPixelsInit (FbPixels *pixels, pixman_bits_t *buf, int width, int height, int depth, int bpp, int stride); + +static unsigned int +pixman_bits_per_pixel (unsigned int depth); + +static unsigned int +pixman_bits_per_pixel (unsigned int depth) +{ + if (depth > 8) + if (depth > 16) + return 32; + else + return 16; + else + if (depth > 4) + return 8; + else if (depth > 1) + return 4; + else + return 1; +} + +FbPixels * +FbPixelsCreate (int width, int height, int depth) +{ + FbPixels *pixels; + pixman_bits_t *buf; + unsigned int buf_size; + unsigned int bpp; + unsigned int stride; + unsigned int adjust; + unsigned int base; + + bpp = pixman_bits_per_pixel (depth); + stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (pixman_bits_t); + buf_size = height * stride; + base = sizeof (FbPixels); + adjust = 0; + if (base & 7) + adjust = 8 - (base & 7); + buf_size += adjust; + + pixels = malloc(base + buf_size); + if (!pixels) + return NULL; + + buf = (pixman_bits_t *) ((char *)pixels + base + adjust); + + FbPixelsInit (pixels, buf, width, height, depth, bpp, stride); + + return pixels; +} + +FbPixels * +FbPixelsCreateForData (pixman_bits_t *data, int width, int height, int depth, int bpp, int stride) +{ + FbPixels *pixels; + + pixels = malloc (sizeof (FbPixels)); + if (pixels == NULL) + return NULL; + + FbPixelsInit (pixels, data, width, height, depth, bpp, stride); + + return pixels; +} + +static void +FbPixelsInit (FbPixels *pixels, pixman_bits_t *buf, int width, int height, int depth, int bpp, int stride) +{ + pixels->data = buf; + pixels->width = width; + pixels->height = height; + pixels->depth = depth; + pixels->bpp = bpp; + pixels->stride = stride; + pixels->x = 0; + pixels->y = 0; + pixels->refcnt = 1; +} + +void +FbPixelsDestroy (FbPixels *pixels) +{ + if(--pixels->refcnt) + return; + + free(pixels); +} + diff --git a/pixman/src/icrect.c b/pixman/src/icrect.c new file mode 100644 index 0000000..9530679 --- /dev/null +++ b/pixman/src/icrect.c @@ -0,0 +1,367 @@ +/* + * Copyright © 2000 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "icint.h" + +typedef void (*FillFunc) (pixman_image_t *dst, + int16_t xDst, + int16_t yDst, + uint16_t width, + uint16_t height, + pixman_bits_t *pixel); + + +static void +pixman_fill_rect_1bpp (pixman_image_t *dst, + int16_t xDst, + int16_t yDst, + uint16_t width, + uint16_t height, + pixman_bits_t *pixel) +{ + uint32_t value = *pixel ? 0xffffffff : 0; + char *line; + + line = (char *)dst->pixels->data + + yDst * dst->pixels->stride; + + if ((width + xDst - 1) / 32 == xDst / 32) { + uint32_t mask = 0; + int pos = xDst / 32; + int i; + + for (i = xDst; i < width; i++) +#if BITMAP_BIT_ORDER == MSBFirst + mask |= 1 << (0x1f - i); +#else + mask |= 1 << i; +#endif + + while (height-- > 0) { + uint32_t *cur = (uint32_t *) line; + cur [pos] = (cur [pos] & ~mask) | (value & mask); + line += dst->pixels->stride; + } + } else { + uint32_t smask = 0, emask = 0; + int end = ((xDst + width) / 32); + int i; + + if (xDst % 32) + for (i = (xDst % 32); i < 32; i++) +#if BITMAP_BIT_ORDER == MSBFirst + smask |= 1 << (0x1f - i); +#else + smask |= 1 << i; +#endif + + if ((width + xDst) % 32) + for (i = 0; i < (width + xDst) % 32; i++) +#if BITMAP_BIT_ORDER == MSBFirst + emask |= 1 << (0x1f - i); +#else + emask |= 1 << i; +#endif + + while (height-- > 0) { + uint32_t *cur = (uint32_t *) line; + int start = (xDst / 32); + + if (smask) { + cur [start] = (cur [start] & ~smask) | (value & smask); + start++; + } + + if (emask) + cur [end] = (cur [end] & ~emask) | (value & emask); + + if (end > start) + memset (cur + start, value, (end - start) * 4); + line += dst->pixels->stride; + } + } +} + +static void +pixman_fill_rect_8bpp (pixman_image_t *dst, + int16_t xDst, + int16_t yDst, + uint16_t width, + uint16_t height, + pixman_bits_t *pixel) +{ + char *line; + + line = (char *)dst->pixels->data + + xDst + yDst * dst->pixels->stride; + while (height-- > 0) { + memset (line, *(char *)pixel, width); + line += dst->pixels->stride; + } +} + +static void +pixman_fill_rect_32bpp (pixman_image_t *dst, + int16_t xDst, + int16_t yDst, + uint16_t width, + uint16_t height, + pixman_bits_t *pixel) +{ + uint32_t int_pixel; + char *line; + char *data; + int w; + + line = (char *)dst->pixels->data + + xDst * 4 + yDst * dst->pixels->stride; + + int_pixel = *(uint32_t *)pixel; + while (height-- > 0) { + data = line; + w = width; + while (w-- > 0) { + *(uint32_t *)data = int_pixel; + data += 4; + } + line += dst->pixels->stride; + } +} + +static void +pixman_fill_rect_general (pixman_image_t *dst, + int16_t xDst, + int16_t yDst, + uint16_t width, + uint16_t height, + pixman_bits_t *pixel) +{ + int pixel_size; + char *line; + char *data; + int w; + + pixel_size = dst->pixels->bpp >> 3; + + line = (char *)dst->pixels->data + + xDst * pixel_size + yDst * dst->pixels->stride; + + while (height-- > 0) { + data = line; + w = width; + while (w-- > 0) { + memcpy (data, pixel, pixel_size); + data += pixel_size; + } + line += dst->pixels->stride; + } +} + + +static void +pixman_color_rects (pixman_image_t *dst, + pixman_image_t *clipPict, + pixman_color_t *color, + int nRect, + pixman_rectangle_t *rects, + int xoff, + int yoff) +{ + pixman_bits_t pixel; + pixman_region16_t *clip; + pixman_region16_t *rects_as_region; + pixman_box16_t *clipped_rects; + int i, n_clipped_rects; + FillFunc func; + + pixman_color_to_pixel (&dst->image_format, + color, + &pixel); + + /* offset to the right place on the destination image */ + xoff -= dst->pixels->x; + yoff -= dst->pixels->y; + + clip = pixman_region_create(); + pixman_region_union_rect (clip, clip, + dst->pixels->x, dst->pixels->y, + dst->pixels->width, dst->pixels->height); + + pixman_region_intersect (clip, clip, clipPict->pCompositeClip); + if (clipPict->alphaMap) + { + pixman_region_translate (clip, + -clipPict->alphaOrigin.x, + -clipPict->alphaOrigin.y); + pixman_region_intersect (clip, clip, clipPict->alphaMap->pCompositeClip); + pixman_region_translate (clip, + clipPict->alphaOrigin.x, + clipPict->alphaOrigin.y); + } + + if (xoff || yoff) + { + for (i = 0; i < nRect; i++) + { + rects[i].x -= xoff; + rects[i].y -= yoff; + } + } + + rects_as_region = pixman_region_create (); + for (i = 0; i < nRect; i++) + { + pixman_region_union_rect (rects_as_region, rects_as_region, + rects[i].x, rects[i].y, + rects[i].width, rects[i].height); + } + + pixman_region_intersect (rects_as_region, rects_as_region, clip); + pixman_region_destroy (clip); + + n_clipped_rects = pixman_region_num_rects (rects_as_region); + clipped_rects = pixman_region_rects (rects_as_region); + + if (dst->pixels->bpp == 8) + func = pixman_fill_rect_8bpp; + else if (dst->pixels->bpp == 32) + func = pixman_fill_rect_32bpp; + else if (dst->pixels->bpp == 1) + func = pixman_fill_rect_1bpp; + else + func = pixman_fill_rect_general; + + for (i = 0; i < n_clipped_rects; i++) { + (*func) (dst, + clipped_rects[i].x1, + clipped_rects[i].y1, + clipped_rects[i].x2 - clipped_rects[i].x1, + clipped_rects[i].y2 - clipped_rects[i].y1, + &pixel); + } + + pixman_region_destroy (rects_as_region); + + if (xoff || yoff) + { + for (i = 0; i < nRect; i++) + { + rects[i].x += xoff; + rects[i].y += yoff; + } + } +} + +void pixman_fill_rectangle (pixman_operator_t op, + pixman_image_t *dst, + const pixman_color_t *color, + int x, + int y, + unsigned int width, + unsigned int height) +{ + pixman_rectangle_t rect; + + rect.x = x; + rect.y = y; + rect.width = width; + rect.height = height; + + pixman_fill_rectangles (op, dst, color, &rect, 1); +} + +void +pixman_fill_rectangles (pixman_operator_t op, + pixman_image_t *dst, + const pixman_color_t *color, + const pixman_rectangle_t *rects, + int nRects) +{ + pixman_color_t color_s = *color; + + if (color_s.alpha == 0xffff) + { + if (op == PIXMAN_OPERATOR_OVER) + op = PIXMAN_OPERATOR_SRC; + } + if (op == PIXMAN_OPERATOR_CLEAR) + color_s.red = color_s.green = color_s.blue = color_s.alpha = 0; + + if (op == PIXMAN_OPERATOR_SRC || op == PIXMAN_OPERATOR_CLEAR) + { + /* We cast away the constness of rects here, because pixman_color_rects + temporarily modifies it */ + pixman_color_rects (dst, dst, &color_s, nRects, (pixman_rectangle_t *)rects, 0, 0); + if (dst->alphaMap) + pixman_color_rects (dst->alphaMap, dst, + &color_s, nRects, (pixman_rectangle_t *)rects, + dst->alphaOrigin.x, + dst->alphaOrigin.y); + } + else + { + pixman_format_t rgbaFormat; + FbPixels *pixels; + pixman_image_t *src; + pixman_bits_t pixel; + + pixman_format_init (&rgbaFormat, PICT_a8r8g8b8); + + pixels = FbPixelsCreate (1, 1, rgbaFormat.depth); + if (!pixels) + goto bail1; + + pixman_color_to_pixel (&rgbaFormat, &color_s, &pixel); + + /* XXX: Originally, fb had the following: + + (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &one); + + I haven't checked to see what I might be breaking with a + trivial assignment instead. + */ + pixels->data[0] = pixel; + + src = pixman_image_createForPixels (pixels, &rgbaFormat); + if (!src) + goto bail2; + + pixman_image_set_repeat (src, 1); + + while (nRects--) + { + pixman_composite (op, src, 0, dst, 0, 0, 0, 0, + rects->x, + rects->y, + rects->width, + rects->height); + rects++; + } + + pixman_image_destroy (src); +bail2: + FbPixelsDestroy (pixels); +bail1: + ; + } +} +slim_hidden_def(pixman_fill_rectangles); diff --git a/pixman/src/icrop.h b/pixman/src/icrop.h new file mode 100644 index 0000000..8f17547 --- /dev/null +++ b/pixman/src/icrop.h @@ -0,0 +1,137 @@ +/* + * Id: $ + * + * Copyright © 1998 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _ICROP_H_ +#define _ICROP_H_ + +typedef struct _mergeRopBits { + FbBits ca1, cx1, ca2, cx2; +} FbMergeRopRec, *FbMergeRopPtr; + +extern const FbMergeRopRec FbMergeRopBits[16] pixman_private; + +#define FbDeclareMergeRop() FbBits _ca1, _cx1, _ca2, _cx2; +#define FbDeclarePrebuiltMergeRop() FbBits _cca, _ccx; + +#define FbInitializeMergeRop(alu,pm) {\ + const FbMergeRopRec *_bits; \ + _bits = &FbMergeRopBits[alu]; \ + _ca1 = _bits->ca1 & pm; \ + _cx1 = _bits->cx1 | ~pm; \ + _ca2 = _bits->ca2 & pm; \ + _cx2 = _bits->cx2 & pm; \ +} + +#define FbDestInvarientRop(alu,pm) ((pm) == FB_ALLONES && \ + (((alu) >> 1 & 5) == ((alu) & 5))) + +#define FbDestInvarientMergeRop() (_ca1 == 0 && _cx1 == 0) + +/* AND has higher precedence than XOR */ + +#define FbDoMergeRop(src, dst) \ + (((dst) & (((src) & _ca1) ^ _cx1)) ^ (((src) & _ca2) ^ _cx2)) + +#define FbDoDestInvarientMergeRop(src) (((src) & _ca2) ^ _cx2) + +#define FbDoMaskMergeRop(src, dst, mask) \ + (((dst) & ((((src) & _ca1) ^ _cx1) | ~(mask))) ^ ((((src) & _ca2) ^ _cx2) & (mask))) + +#define FbDoLeftMaskByteMergeRop(dst, src, lb, l) { \ + FbBits __xor = ((src) & _ca2) ^ _cx2; \ + FbDoLeftMaskByteRRop(dst,lb,l,((src) & _ca1) ^ _cx1,__xor); \ +} + +#define FbDoRightMaskByteMergeRop(dst, src, rb, r) { \ + FbBits __xor = ((src) & _ca2) ^ _cx2; \ + FbDoRightMaskByteRRop(dst,rb,r,((src) & _ca1) ^ _cx1,__xor); \ +} + +#define FbDoRRop(dst, and, xor) (((dst) & (and)) ^ (xor)) + +#define FbDoMaskRRop(dst, and, xor, mask) \ + (((dst) & ((and) | ~(mask))) ^ (xor & mask)) + +/* + * Take a single bit (0 or 1) and generate a full mask + */ +#define fbFillFromBit(b,t) (~((t) ((b) & 1)-1)) + +#define fbXorT(rop,fg,pm,t) ((((fg) & fbFillFromBit((rop) >> 1,t)) | \ + (~(fg) & fbFillFromBit((rop) >> 3,t))) & (pm)) + +#define fbAndT(rop,fg,pm,t) ((((fg) & fbFillFromBit (rop ^ (rop>>1),t)) | \ + (~(fg) & fbFillFromBit((rop>>2) ^ (rop>>3),t))) | \ + ~(pm)) + +#define fbXor(rop,fg,pm) fbXorT(rop,fg,pm,FbBits) + +#define fbAnd(rop,fg,pm) fbAndT(rop,fg,pm,FbBits) + +#define fbXorStip(rop,fg,pm) fbXorT(rop,fg,pm,FbStip) + +#define fbAndStip(rop,fg,pm) fbAndT(rop,fg,pm,FbStip) + +/* + * Stippling operations; + */ + +/* half of table */ +extern const pixman_bits_t fbStipple16Bits[256] pixman_private; +#define FbStipple16Bits(b) \ + (fbStipple16Bits[(b)&0xff] | fbStipple16Bits[(b) >> 8] << FB_HALFUNIT) + +pixman_private const pixman_bits_t * +fbStippleTable(int bits); + +#define FbStippleRRop(dst, b, fa, fx, ba, bx) \ + (FbDoRRop(dst, fa, fx) & b) | (FbDoRRop(dst, ba, bx) & ~b) + +#define FbStippleRRopMask(dst, b, fa, fx, ba, bx, m) \ + (FbDoMaskRRop(dst, fa, fx, m) & (b)) | (FbDoMaskRRop(dst, ba, bx, m) & ~(b)) + +#define FbDoLeftMaskByteStippleRRop(dst, b, fa, fx, ba, bx, lb, l) { \ + FbBits __xor = ((fx) & (b)) | ((bx) & ~(b)); \ + FbDoLeftMaskByteRRop(dst, lb, l, ((fa) & (b)) | ((ba) & ~(b)), __xor); \ +} + +#define FbDoRightMaskByteStippleRRop(dst, b, fa, fx, ba, bx, rb, r) { \ + FbBits __xor = ((fx) & (b)) | ((bx) & ~(b)); \ + FbDoRightMaskByteRRop(dst, rb, r, ((fa) & (b)) | ((ba) & ~(b)), __xor); \ +} + +#define FbOpaqueStipple(b, fg, bg) (((fg) & (b)) | ((bg) & ~(b))) + +/* + * Compute rop for using tile code for 1-bit dest stipples; modifies + * existing rop to flip depending on pixel values + */ +#define FbStipple1RopPick(alu,b) (((alu) >> (2 - (((b) & 1) << 1))) & 3) + +#define FbOpaqueStipple1Rop(alu,fg,bg) (FbStipple1RopPick(alu,fg) | \ + (FbStipple1RopPick(alu,bg) << 2)) + +#define FbStipple1Rop(alu,fg) (FbStipple1RopPick(alu,fg) | 4) + +#endif diff --git a/pixman/src/icstipple.c b/pixman/src/icstipple.c new file mode 100644 index 0000000..e077cbb --- /dev/null +++ b/pixman/src/icstipple.c @@ -0,0 +1,79 @@ +/* + * Id: $ + * + * Copyright © 1998 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "pixman-xserver-compat.h" + +#ifndef ICNOPIXADDR +/* + * This is a slight abuse of the preprocessor to generate repetitive + * code, the idea is to generate code for each case of a copy-mode + * transparent stipple + */ +#define LaneCases1(c,a) case c: \ + while (n--) { (void)FbLaneCase(c,a); a++; } \ + break +#define LaneCases2(c,a) LaneCases1(c,a); LaneCases1(c+1,a) +#define LaneCases4(c,a) LaneCases2(c,a); LaneCases2(c+2,a) +#define LaneCases8(c,a) LaneCases4(c,a); LaneCases4(c+4,a) +#define LaneCases16(c,a) LaneCases8(c,a); LaneCases8(c+8,a) +#define LaneCases32(c,a) LaneCases16(c,a); LaneCases16(c+16,a) +#define LaneCases64(c,a) LaneCases32(c,a); LaneCases32(c+32,a) +#define LaneCases128(c,a) LaneCases64(c,a); LaneCases64(c+64,a) +#define LaneCases256(c,a) LaneCases128(c,a); LaneCases128(c+128,a) + +#if FB_SHIFT == 6 +#define LaneCases(a) LaneCases256(0,a) +#endif + +#if FB_SHIFT == 5 +#define LaneCases(a) LaneCases16(0,a) +#endif + +/* + * Repeat a transparent stipple across a scanline n times + */ + +void +fbTransparentSpan (FbBits *dst, + FbBits stip, + FbBits fgxor, + int n) +{ + FbStip s; + + s = ((FbStip) (stip ) & 0x01); + s |= ((FbStip) (stip >> 8) & 0x02); + s |= ((FbStip) (stip >> 16) & 0x04); + s |= ((FbStip) (stip >> 24) & 0x08); +#if FB_SHIFT > 5 + s |= ((FbStip) (stip >> 32) & 0x10); + s |= ((FbStip) (stip >> 40) & 0x20); + s |= ((FbStip) (stip >> 48) & 0x40); + s |= ((FbStip) (stip >> 56) & 0x80); +#endif + switch (s) { + LaneCases(dst); + } +} +#endif diff --git a/pixman/src/ictransform.c b/pixman/src/ictransform.c new file mode 100644 index 0000000..982f929 --- /dev/null +++ b/pixman/src/ictransform.c @@ -0,0 +1,64 @@ +/* + * Copyright © 2000 SuSE, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of SuSE not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. SuSE makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Keith Packard, SuSE, Inc. + */ + +#include "icint.h" + +#define MAX_FIXED_48_16 ((xFixed_48_16) 0x7fffffff) +#define MIN_FIXED_48_16 (-((xFixed_48_16) 1 << 31)) + +int +pixman_transform_point (pixman_transform_t *transform, + pixman_vector_t *vector) +{ + pixman_vector_t result; + int i, j; + xFixed_32_32 partial; + xFixed_48_16 v; + + for (j = 0; j < 3; j++) + { + v = 0; + for (i = 0; i < 3; i++) + { + partial = ((xFixed_48_16) transform->matrix[j][i] * + (xFixed_48_16) vector->vector[i]); + v += partial >> 16; + } + if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16) + return 0; + result.vector[j] = (xFixed) v; + } + if (!result.vector[2]) + return 0; + for (j = 0; j < 2; j++) + { + partial = (xFixed_48_16) result.vector[j] << 16; + v = partial / result.vector[2]; + if (v > MAX_FIXED_48_16 || v < MIN_FIXED_48_16) + return 0; + vector->vector[j] = (xFixed) v; + } + vector->vector[2] = xFixed1; + return 1; +} + diff --git a/pixman/src/ictrap.c b/pixman/src/ictrap.c new file mode 100644 index 0000000..91eec33 --- /dev/null +++ b/pixman/src/ictrap.c @@ -0,0 +1,212 @@ +/* + * $Id: ictrap.c,v 1.26 2005/06/25 03:13:19 jrmuizel Exp $ + * + * Copyright © 2002 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "icint.h" + +pixman_image_t * +FbCreateAlphaPicture (pixman_image_t *dst, + pixman_format_t *format, + uint16_t width, + uint16_t height) +{ + pixman_image_t *image; + int own_format = 0; + + if (width > 32767 || height > 32767) + return 0; + + if (!format) + { + own_format = 1; + if (dst->polyEdge == PolyEdgeSharp) + format = pixman_format_create (PIXMAN_FORMAT_NAME_A1); + else + format = pixman_format_create (PIXMAN_FORMAT_NAME_A8); + if (!format) + return 0; + } + + image = pixman_image_create (format, width, height); + + if (own_format) + pixman_format_destroy (format); + + /* XXX: Is this a reasonable way to clear the image? Would + probably be preferable to use pixman_image_fill_rectangle once such a + beast exists. */ + memset (image->pixels->data, 0, height * image->pixels->stride); + + return image; +} + +static pixman_fixed16_16_t +pixman_line_fixed_x (const pixman_line_fixed_t *l, pixman_fixed16_16_t y, int ceil) +{ + pixman_fixed16_16_t dx = l->p2.x - l->p1.x; + xFixed_32_32 ex = (xFixed_32_32) (y - l->p1.y) * dx; + pixman_fixed16_16_t dy = l->p2.y - l->p1.y; + if (ceil) + ex += (dy - 1); + return l->p1.x + (pixman_fixed16_16_t) (ex / dy); +} + +static void +pixman_trapezoid_bounds (int ntrap, const pixman_trapezoid_t *traps, pixman_box16_t *box) +{ + box->y1 = MAXSHORT; + box->y2 = MINSHORT; + box->x1 = MAXSHORT; + box->x2 = MINSHORT; + for (; ntrap; ntrap--, traps++) + { + int16_t x1, y1, x2, y2; + + if (!xTrapezoidValid(traps)) + continue; + y1 = xFixedToInt (traps->top); + if (y1 < box->y1) + box->y1 = y1; + + y2 = xFixedToInt (xFixedCeil (traps->bottom)); + if (y2 > box->y2) + box->y2 = y2; + + x1 = xFixedToInt (MIN (pixman_line_fixed_x (&traps->left, traps->top, 0), + pixman_line_fixed_x (&traps->left, traps->bottom, 0))); + if (x1 < box->x1) + box->x1 = x1; + + x2 = xFixedToInt (xFixedCeil (MAX (pixman_line_fixed_x (&traps->right, traps->top, 1), + pixman_line_fixed_x (&traps->right, traps->bottom, 1)))); + if (x2 > box->x2) + box->x2 = x2; + } +} + +/* XXX: There are failure cases in this function. Don't we need to + * propagate the errors out? + */ +void +pixman_composite_trapezoids (pixman_operator_t op, + pixman_image_t *src, + pixman_image_t *dst, + int xSrc, + int ySrc, + const pixman_trapezoid_t *traps, + int ntraps) +{ + pixman_image_t *image = NULL; + pixman_box16_t traps_bounds, dst_bounds, bounds; + pixman_region16_t *traps_region, *dst_region; + int16_t xDst, yDst; + int16_t xRel, yRel; + pixman_format_t *format; + + if (ntraps == 0) + return; + + /* + * Check for solid alpha add + */ + if (op == PIXMAN_OPERATOR_ADD && miIsSolidAlpha (src)) + { + for (; ntraps; ntraps--, traps++) + fbRasterizeTrapezoid (dst, traps, 0, 0); + return; + } + + xDst = traps[0].left.p1.x >> 16; + yDst = traps[0].left.p1.y >> 16; + + pixman_trapezoid_bounds (ntraps, traps, &traps_bounds); + + traps_region = pixman_region_create_simple (&traps_bounds); + + /* XXX: If the image has a clip region set, we should really be + * fetching it here instead, but it looks like we don't yet expose + * a pixman_image_get_clip_region function. */ + dst_bounds.x1 = 0; + dst_bounds.y1 = 0; + dst_bounds.x2 = pixman_image_get_width (dst); + dst_bounds.y2 = pixman_image_get_height (dst); + + dst_region = pixman_region_create_simple (&dst_bounds); + + pixman_region_intersect (traps_region, traps_region, dst_region); + + bounds = *(pixman_region_extents (traps_region)); + + pixman_region_destroy (traps_region); + pixman_region_destroy (dst_region); + + if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2) + return; + + format = pixman_format_create (PIXMAN_FORMAT_NAME_A8); + if (!format) + return; + + image = FbCreateAlphaPicture (dst, format, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + if (!image) + { + pixman_format_destroy (format); + return; + } + + for (; ntraps; ntraps--, traps++) + { + if (!xTrapezoidValid(traps)) + continue; + fbRasterizeTrapezoid (image, traps, + -bounds.x1, -bounds.y1); + } + + xRel = bounds.x1 + xSrc - xDst; + yRel = bounds.y1 + ySrc - yDst; + pixman_composite (op, src, image, dst, + xRel, yRel, 0, 0, bounds.x1, bounds.y1, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + pixman_image_destroy (image); + + pixman_format_destroy (format); +} + +void +pixman_add_trapezoids (pixman_image_t *dst, + int x_off, + int y_off, + const pixman_trapezoid_t *traps, + int ntraps) +{ + for (; ntraps; ntraps--, traps++) + { + if (!xTrapezoidValid (traps)) + continue; + + fbRasterizeTrapezoid (dst, traps, x_off, y_off); + } +} diff --git a/pixman/src/ictri.c b/pixman/src/ictri.c new file mode 100644 index 0000000..27deb3c --- /dev/null +++ b/pixman/src/ictri.c @@ -0,0 +1,362 @@ +/* + * Copyright © 2002 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "icint.h" + +static void +pixman_point_fixed_bounds (int npoint, const pixman_point_fixed_t *points, pixman_box16_t *bounds) +{ + bounds->x1 = xFixedToInt (points->x); + bounds->x2 = xFixedToInt (xFixedCeil (points->x)); + bounds->y1 = xFixedToInt (points->y); + bounds->y2 = xFixedToInt (xFixedCeil (points->y)); + points++; + npoint--; + while (npoint-- > 0) + { + int x1 = xFixedToInt (points->x); + int x2 = xFixedToInt (xFixedCeil (points->x)); + int y1 = xFixedToInt (points->y); + int y2 = xFixedToInt (xFixedCeil (points->y)); + + if (x1 < bounds->x1) + bounds->x1 = x1; + else if (x2 > bounds->x2) + bounds->x2 = x2; + if (y1 < bounds->y1) + bounds->y1 = y1; + else if (y2 > bounds->y2) + bounds->y2 = y2; + points++; + } +} + +static void +pixman_triangle_bounds (int ntri, const pixman_triangle_t *tris, pixman_box16_t *bounds) +{ + pixman_point_fixed_bounds (ntri * 3, (pixman_point_fixed_t *) tris, bounds); +} + +static void +FbRasterizeTriangle (pixman_image_t *image, + const pixman_triangle_t *tri, + int x_off, + int y_off) +{ + const pixman_point_fixed_t *top, *left, *right, *t; + pixman_trapezoid_t trap[2]; + + top = &tri->p1; + left = &tri->p2; + right = &tri->p3; + if (left->y < top->y) { + t = left; left = top; top = t; + } + if (right->y < top->y) { + t = right; right = top; top = t; + } + /* XXX: This code is broken, left and right must be determined by + comparing the angles of the two edges, (eg. we can only compare + X coordinates if we've already intersected each edge with the + same Y coordinate) */ + if (right->x < left->x) { + t = right; right = left; left = t; + } + + /* + * Two cases: + * + * + + + * / \ / \ + * / \ / \ + * / + + \ + * / -- -- \ + * / -- -- \ + * / --- --- \ + * +-- --+ + */ + + trap[0].top = top->y; + + trap[0].left.p1.x = top->x; + trap[0].left.p1.y = trap[0].top; + trap[0].left.p2.x = left->x; + trap[0].left.p2.y = left->y; + + trap[0].right.p1 = trap[0].left.p1; + trap[0].right.p2.x = right->x; + trap[0].right.p2.y = right->y; + + if (right->y < left->y) + { + trap[0].bottom = trap[0].right.p2.y; + + trap[1].top = trap[0].bottom; + trap[1].bottom = trap[0].left.p2.y; + + trap[1].left = trap[0].left; + trap[1].right.p1 = trap[0].right.p2; + trap[1].right.p2 = trap[0].left.p2; + } + else + { + trap[0].bottom = trap[0].left.p2.y; + + trap[1].top = trap[0].bottom; + trap[1].bottom = trap[0].right.p2.y; + + trap[1].right = trap[0].right; + trap[1].left.p1 = trap[0].left.p2; + trap[1].left.p2 = trap[0].right.p2; + } + if (trap[0].top != trap[0].bottom) + fbRasterizeTrapezoid (image, &trap[0], x_off, y_off); + if (trap[1].top != trap[1].bottom) + fbRasterizeTrapezoid (image, &trap[1], x_off, y_off); +} + +void +pixman_composite_triangles (pixman_operator_t op, + pixman_image_t *src, + pixman_image_t *dst, + int xSrc, + int ySrc, + const pixman_triangle_t *tris, + int ntris) +{ + pixman_box16_t bounds; + pixman_image_t *image = NULL; + int xDst, yDst; + int xRel, yRel; + pixman_format_t *format; + + xDst = tris[0].p1.x >> 16; + yDst = tris[0].p1.y >> 16; + + format = pixman_format_create (PIXMAN_FORMAT_NAME_A8); + + if (format) + { + pixman_triangle_bounds (ntris, tris, &bounds); + if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) + return; + image = FbCreateAlphaPicture (dst, + format, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + if (!image) + return; + } + for (; ntris; ntris--, tris++) + { + if (!format) + { + pixman_triangle_bounds (1, tris, &bounds); + if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) + continue; + image = FbCreateAlphaPicture (dst, + format, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + if (!image) + break; + } + FbRasterizeTriangle (image, tris, -bounds.x1, -bounds.y1); + if (!format) + { + xRel = bounds.x1 + xSrc - xDst; + yRel = bounds.y1 + ySrc - yDst; + pixman_composite (op, src, image, dst, + xRel, yRel, 0, 0, bounds.x1, bounds.y1, + bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); + pixman_image_destroy (image); + } + /* XXX adjust xSrc and ySrc */ + } + if (format) + { + xRel = bounds.x1 + xSrc - xDst; + yRel = bounds.y1 + ySrc - yDst; + pixman_composite (op, src, image, dst, + xRel, yRel, 0, 0, bounds.x1, bounds.y1, + bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); + pixman_image_destroy (image); + } + + pixman_format_destroy (format); +} + +void +pixman_composite_tri_strip (pixman_operator_t op, + pixman_image_t *src, + pixman_image_t *dst, + int xSrc, + int ySrc, + const pixman_point_fixed_t *points, + int npoints) +{ + pixman_triangle_t tri; + pixman_box16_t bounds; + pixman_image_t *image = NULL; + int xDst, yDst; + int xRel, yRel; + pixman_format_t *format; + + xDst = points[0].x >> 16; + yDst = points[0].y >> 16; + + format = pixman_format_create (PIXMAN_FORMAT_NAME_A8); + + if (npoints < 3) + return; + if (format) + { + pixman_point_fixed_bounds (npoints, points, &bounds); + if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) + return; + image = FbCreateAlphaPicture (dst, + format, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + if (!image) + return; + } + for (; npoints >= 3; npoints--, points++) + { + tri.p1 = points[0]; + tri.p2 = points[1]; + tri.p3 = points[2]; + if (!format) + { + pixman_triangle_bounds (1, &tri, &bounds); + if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) + continue; + image = FbCreateAlphaPicture (dst, + format, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + if (!image) + continue; + } + FbRasterizeTriangle (image, &tri, -bounds.x1, -bounds.y1); + if (!format) + { + xRel = bounds.x1 + xSrc - xDst; + yRel = bounds.y1 + ySrc - yDst; + pixman_composite (op, src, image, dst, + xRel, yRel, 0, 0, bounds.x1, bounds.y1, + bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); + pixman_image_destroy (image); + } + } + if (format) + { + xRel = bounds.x1 + xSrc - xDst; + yRel = bounds.y1 + ySrc - yDst; + pixman_composite (op, src, image, dst, + xRel, yRel, 0, 0, bounds.x1, bounds.y1, + bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); + pixman_image_destroy (image); + } + + pixman_format_destroy (format); +} + +void +pixman_composite_tri_fan (pixman_operator_t op, + pixman_image_t *src, + pixman_image_t *dst, + int xSrc, + int ySrc, + const pixman_point_fixed_t *points, + int npoints) +{ + pixman_triangle_t tri; + pixman_box16_t bounds; + pixman_image_t *image = NULL; + const pixman_point_fixed_t *first; + int xDst, yDst; + int xRel, yRel; + pixman_format_t *format; + + xDst = points[0].x >> 16; + yDst = points[0].y >> 16; + + format = pixman_format_create (PIXMAN_FORMAT_NAME_A8); + + if (npoints < 3) + return; + if (format) + { + pixman_point_fixed_bounds (npoints, points, &bounds); + if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) + return; + image = FbCreateAlphaPicture (dst, + format, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + if (!image) + return; + } + first = points++; + npoints--; + for (; npoints >= 2; npoints--, points++) + { + tri.p1 = *first; + tri.p2 = points[0]; + tri.p3 = points[1]; + if (!format) + { + pixman_triangle_bounds (1, &tri, &bounds); + if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) + continue; + image = FbCreateAlphaPicture (dst, + format, + bounds.x2 - bounds.x1, + bounds.y2 - bounds.y1); + if (!image) + continue; + } + FbRasterizeTriangle (image, &tri, -bounds.x1, -bounds.y1); + if (!format) + { + xRel = bounds.x1 + xSrc - xDst; + yRel = bounds.y1 + ySrc - yDst; + pixman_composite (op, src, image, dst, + xRel, yRel, 0, 0, bounds.x1, bounds.y1, + bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); + pixman_image_destroy (image); + } + } + if (format) + { + xRel = bounds.x1 + xSrc - xDst; + yRel = bounds.y1 + ySrc - yDst; + pixman_composite (op, src, image, dst, + xRel, yRel, 0, 0, bounds.x1, bounds.y1, + bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); + pixman_image_destroy (image); + } + + pixman_format_destroy (format); +} + diff --git a/pixman/src/icutil.c b/pixman/src/icutil.c new file mode 100644 index 0000000..f6119df --- /dev/null +++ b/pixman/src/icutil.c @@ -0,0 +1,286 @@ +/* + * Id: $ + * + * Copyright © 1998 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "pixman-xserver-compat.h" + +pixman_bits_t +fbReplicatePixel (Pixel p, int bpp) +{ + pixman_bits_t b = p; + + b &= FbFullMask (bpp); + while (bpp < FB_UNIT) + { + b |= b << bpp; + bpp <<= 1; + } + return b; +} + +#define O 0 +#define I FB_ALLONES + +const FbMergeRopRec FbMergeRopBits[16] = { + { O,O,O,O }, /* clear 0x0 0 */ + { I,O,O,O }, /* and 0x1 src AND dst */ + { I,O,I,O }, /* andReverse 0x2 src AND NOT dst */ + { O,O,I,O }, /* copy 0x3 src */ + { I,I,O,O }, /* andInverted 0x4 NOT src AND dst */ + { O,I,O,O }, /* noop 0x5 dst */ + { O,I,I,O }, /* xor 0x6 src XOR dst */ + { I,I,I,O }, /* or 0x7 src OR dst */ + { I,I,I,I }, /* nor 0x8 NOT src AND NOT dst */ + { O,I,I,I }, /* equiv 0x9 NOT src XOR dst */ + { O,I,O,I }, /* invert 0xa NOT dst */ + { I,I,O,I }, /* orReverse 0xb src OR NOT dst */ + { O,O,I,I }, /* copyInverted 0xc NOT src */ + { I,O,I,I }, /* orInverted 0xd NOT src OR dst */ + { I,O,O,I }, /* nand 0xe NOT src OR NOT dst */ + { O,O,O,I }, /* set 0xf 1 */ +}; + +/* + * Stipple masks are independent of bit/byte order as long + * as bitorder == byteorder. FB doesn't handle the case + * where these differ + */ +#define BitsMask(x,w) ((FB_ALLONES << ((x) & FB_MASK)) & \ + (FB_ALLONES >> ((FB_UNIT - ((x) + (w))) & FB_MASK))) + +#define Mask(x,w) BitsMask((x)*(w),(w)) + + +#define SelMask(b,n,w) ((((b) >> n) & 1) * Mask(n,w)) + +#define C1(b,w) \ + (SelMask(b,0,w)) + +#define C2(b,w) \ + (SelMask(b,0,w) | \ + SelMask(b,1,w)) + +#define C4(b,w) \ + (SelMask(b,0,w) | \ + SelMask(b,1,w) | \ + SelMask(b,2,w) | \ + SelMask(b,3,w)) + +#define C8(b,w) \ + (SelMask(b,0,w) | \ + SelMask(b,1,w) | \ + SelMask(b,2,w) | \ + SelMask(b,3,w) | \ + SelMask(b,4,w) | \ + SelMask(b,5,w) | \ + SelMask(b,6,w) | \ + SelMask(b,7,w)) + +#if FB_UNIT == 16 +#define fbStipple16Bits 0 +#define fbStipple8Bits 0 +static const pixman_bits_t fbStipple4Bits[16] = { + C4( 0,4), C4( 1,4), C4( 2,4), C4( 3,4), C4( 4,4), C4( 5,4), + C4( 6,4), C4( 7,4), C4( 8,4), C4( 9,4), C4( 10,4), C4( 11,4), + C4( 12,4), C4( 13,4), C4( 14,4), C4( 15,4),}; +static const pixman_bits_t fbStipple2Bits[4] = { + C2( 0,8), C2( 1,8), C2( 2,8), C2( 3,8), +}; +static const pixman_bits_t fbStipple1Bits[2] = { + C1( 0,16), C1( 1,16), +}; +#endif +#if FB_UNIT == 32 +#define fbStipple16Bits 0 +static const pixman_bits_t fbStipple8Bits[256] = { + C8( 0,4), C8( 1,4), C8( 2,4), C8( 3,4), C8( 4,4), C8( 5,4), + C8( 6,4), C8( 7,4), C8( 8,4), C8( 9,4), C8( 10,4), C8( 11,4), + C8( 12,4), C8( 13,4), C8( 14,4), C8( 15,4), C8( 16,4), C8( 17,4), + C8( 18,4), C8( 19,4), C8( 20,4), C8( 21,4), C8( 22,4), C8( 23,4), + C8( 24,4), C8( 25,4), C8( 26,4), C8( 27,4), C8( 28,4), C8( 29,4), + C8( 30,4), C8( 31,4), C8( 32,4), C8( 33,4), C8( 34,4), C8( 35,4), + C8( 36,4), C8( 37,4), C8( 38,4), C8( 39,4), C8( 40,4), C8( 41,4), + C8( 42,4), C8( 43,4), C8( 44,4), C8( 45,4), C8( 46,4), C8( 47,4), + C8( 48,4), C8( 49,4), C8( 50,4), C8( 51,4), C8( 52,4), C8( 53,4), + C8( 54,4), C8( 55,4), C8( 56,4), C8( 57,4), C8( 58,4), C8( 59,4), + C8( 60,4), C8( 61,4), C8( 62,4), C8( 63,4), C8( 64,4), C8( 65,4), + C8( 66,4), C8( 67,4), C8( 68,4), C8( 69,4), C8( 70,4), C8( 71,4), + C8( 72,4), C8( 73,4), C8( 74,4), C8( 75,4), C8( 76,4), C8( 77,4), + C8( 78,4), C8( 79,4), C8( 80,4), C8( 81,4), C8( 82,4), C8( 83,4), + C8( 84,4), C8( 85,4), C8( 86,4), C8( 87,4), C8( 88,4), C8( 89,4), + C8( 90,4), C8( 91,4), C8( 92,4), C8( 93,4), C8( 94,4), C8( 95,4), + C8( 96,4), C8( 97,4), C8( 98,4), C8( 99,4), C8(100,4), C8(101,4), + C8(102,4), C8(103,4), C8(104,4), C8(105,4), C8(106,4), C8(107,4), + C8(108,4), C8(109,4), C8(110,4), C8(111,4), C8(112,4), C8(113,4), + C8(114,4), C8(115,4), C8(116,4), C8(117,4), C8(118,4), C8(119,4), + C8(120,4), C8(121,4), C8(122,4), C8(123,4), C8(124,4), C8(125,4), + C8(126,4), C8(127,4), C8(128,4), C8(129,4), C8(130,4), C8(131,4), + C8(132,4), C8(133,4), C8(134,4), C8(135,4), C8(136,4), C8(137,4), + C8(138,4), C8(139,4), C8(140,4), C8(141,4), C8(142,4), C8(143,4), + C8(144,4), C8(145,4), C8(146,4), C8(147,4), C8(148,4), C8(149,4), + C8(150,4), C8(151,4), C8(152,4), C8(153,4), C8(154,4), C8(155,4), + C8(156,4), C8(157,4), C8(158,4), C8(159,4), C8(160,4), C8(161,4), + C8(162,4), C8(163,4), C8(164,4), C8(165,4), C8(166,4), C8(167,4), + C8(168,4), C8(169,4), C8(170,4), C8(171,4), C8(172,4), C8(173,4), + C8(174,4), C8(175,4), C8(176,4), C8(177,4), C8(178,4), C8(179,4), + C8(180,4), C8(181,4), C8(182,4), C8(183,4), C8(184,4), C8(185,4), + C8(186,4), C8(187,4), C8(188,4), C8(189,4), C8(190,4), C8(191,4), + C8(192,4), C8(193,4), C8(194,4), C8(195,4), C8(196,4), C8(197,4), + C8(198,4), C8(199,4), C8(200,4), C8(201,4), C8(202,4), C8(203,4), + C8(204,4), C8(205,4), C8(206,4), C8(207,4), C8(208,4), C8(209,4), + C8(210,4), C8(211,4), C8(212,4), C8(213,4), C8(214,4), C8(215,4), + C8(216,4), C8(217,4), C8(218,4), C8(219,4), C8(220,4), C8(221,4), + C8(222,4), C8(223,4), C8(224,4), C8(225,4), C8(226,4), C8(227,4), + C8(228,4), C8(229,4), C8(230,4), C8(231,4), C8(232,4), C8(233,4), + C8(234,4), C8(235,4), C8(236,4), C8(237,4), C8(238,4), C8(239,4), + C8(240,4), C8(241,4), C8(242,4), C8(243,4), C8(244,4), C8(245,4), + C8(246,4), C8(247,4), C8(248,4), C8(249,4), C8(250,4), C8(251,4), + C8(252,4), C8(253,4), C8(254,4), C8(255,4), +}; +static const pixman_bits_t fbStipple4Bits[16] = { + C4( 0,8), C4( 1,8), C4( 2,8), C4( 3,8), C4( 4,8), C4( 5,8), + C4( 6,8), C4( 7,8), C4( 8,8), C4( 9,8), C4( 10,8), C4( 11,8), + C4( 12,8), C4( 13,8), C4( 14,8), C4( 15,8),}; +static const pixman_bits_t fbStipple2Bits[4] = { + C2( 0,16), C2( 1,16), C2( 2,16), C2( 3,16), +}; +static const pixman_bits_t fbStipple1Bits[2] = { + C1( 0,32), C1( 1,32), +}; +#endif +#if FB_UNIT == 64 +const pixman_bits_t fbStipple16Bits[256] = { + C8( 0,4), C8( 1,4), C8( 2,4), C8( 3,4), C8( 4,4), C8( 5,4), + C8( 6,4), C8( 7,4), C8( 8,4), C8( 9,4), C8( 10,4), C8( 11,4), + C8( 12,4), C8( 13,4), C8( 14,4), C8( 15,4), C8( 16,4), C8( 17,4), + C8( 18,4), C8( 19,4), C8( 20,4), C8( 21,4), C8( 22,4), C8( 23,4), + C8( 24,4), C8( 25,4), C8( 26,4), C8( 27,4), C8( 28,4), C8( 29,4), + C8( 30,4), C8( 31,4), C8( 32,4), C8( 33,4), C8( 34,4), C8( 35,4), + C8( 36,4), C8( 37,4), C8( 38,4), C8( 39,4), C8( 40,4), C8( 41,4), + C8( 42,4), C8( 43,4), C8( 44,4), C8( 45,4), C8( 46,4), C8( 47,4), + C8( 48,4), C8( 49,4), C8( 50,4), C8( 51,4), C8( 52,4), C8( 53,4), + C8( 54,4), C8( 55,4), C8( 56,4), C8( 57,4), C8( 58,4), C8( 59,4), + C8( 60,4), C8( 61,4), C8( 62,4), C8( 63,4), C8( 64,4), C8( 65,4), + C8( 66,4), C8( 67,4), C8( 68,4), C8( 69,4), C8( 70,4), C8( 71,4), + C8( 72,4), C8( 73,4), C8( 74,4), C8( 75,4), C8( 76,4), C8( 77,4), + C8( 78,4), C8( 79,4), C8( 80,4), C8( 81,4), C8( 82,4), C8( 83,4), + C8( 84,4), C8( 85,4), C8( 86,4), C8( 87,4), C8( 88,4), C8( 89,4), + C8( 90,4), C8( 91,4), C8( 92,4), C8( 93,4), C8( 94,4), C8( 95,4), + C8( 96,4), C8( 97,4), C8( 98,4), C8( 99,4), C8(100,4), C8(101,4), + C8(102,4), C8(103,4), C8(104,4), C8(105,4), C8(106,4), C8(107,4), + C8(108,4), C8(109,4), C8(110,4), C8(111,4), C8(112,4), C8(113,4), + C8(114,4), C8(115,4), C8(116,4), C8(117,4), C8(118,4), C8(119,4), + C8(120,4), C8(121,4), C8(122,4), C8(123,4), C8(124,4), C8(125,4), + C8(126,4), C8(127,4), C8(128,4), C8(129,4), C8(130,4), C8(131,4), + C8(132,4), C8(133,4), C8(134,4), C8(135,4), C8(136,4), C8(137,4), + C8(138,4), C8(139,4), C8(140,4), C8(141,4), C8(142,4), C8(143,4), + C8(144,4), C8(145,4), C8(146,4), C8(147,4), C8(148,4), C8(149,4), + C8(150,4), C8(151,4), C8(152,4), C8(153,4), C8(154,4), C8(155,4), + C8(156,4), C8(157,4), C8(158,4), C8(159,4), C8(160,4), C8(161,4), + C8(162,4), C8(163,4), C8(164,4), C8(165,4), C8(166,4), C8(167,4), + C8(168,4), C8(169,4), C8(170,4), C8(171,4), C8(172,4), C8(173,4), + C8(174,4), C8(175,4), C8(176,4), C8(177,4), C8(178,4), C8(179,4), + C8(180,4), C8(181,4), C8(182,4), C8(183,4), C8(184,4), C8(185,4), + C8(186,4), C8(187,4), C8(188,4), C8(189,4), C8(190,4), C8(191,4), + C8(192,4), C8(193,4), C8(194,4), C8(195,4), C8(196,4), C8(197,4), + C8(198,4), C8(199,4), C8(200,4), C8(201,4), C8(202,4), C8(203,4), + C8(204,4), C8(205,4), C8(206,4), C8(207,4), C8(208,4), C8(209,4), + C8(210,4), C8(211,4), C8(212,4), C8(213,4), C8(214,4), C8(215,4), + C8(216,4), C8(217,4), C8(218,4), C8(219,4), C8(220,4), C8(221,4), + C8(222,4), C8(223,4), C8(224,4), C8(225,4), C8(226,4), C8(227,4), + C8(228,4), C8(229,4), C8(230,4), C8(231,4), C8(232,4), C8(233,4), + C8(234,4), C8(235,4), C8(236,4), C8(237,4), C8(238,4), C8(239,4), + C8(240,4), C8(241,4), C8(242,4), C8(243,4), C8(244,4), C8(245,4), + C8(246,4), C8(247,4), C8(248,4), C8(249,4), C8(250,4), C8(251,4), + C8(252,4), C8(253,4), C8(254,4), C8(255,4), +}; +static const pixman_bits_t fbStipple8Bits[256] = { + C8( 0,8), C8( 1,8), C8( 2,8), C8( 3,8), C8( 4,8), C8( 5,8), + C8( 6,8), C8( 7,8), C8( 8,8), C8( 9,8), C8( 10,8), C8( 11,8), + C8( 12,8), C8( 13,8), C8( 14,8), C8( 15,8), C8( 16,8), C8( 17,8), + C8( 18,8), C8( 19,8), C8( 20,8), C8( 21,8), C8( 22,8), C8( 23,8), + C8( 24,8), C8( 25,8), C8( 26,8), C8( 27,8), C8( 28,8), C8( 29,8), + C8( 30,8), C8( 31,8), C8( 32,8), C8( 33,8), C8( 34,8), C8( 35,8), + C8( 36,8), C8( 37,8), C8( 38,8), C8( 39,8), C8( 40,8), C8( 41,8), + C8( 42,8), C8( 43,8), C8( 44,8), C8( 45,8), C8( 46,8), C8( 47,8), + C8( 48,8), C8( 49,8), C8( 50,8), C8( 51,8), C8( 52,8), C8( 53,8), + C8( 54,8), C8( 55,8), C8( 56,8), C8( 57,8), C8( 58,8), C8( 59,8), + C8( 60,8), C8( 61,8), C8( 62,8), C8( 63,8), C8( 64,8), C8( 65,8), + C8( 66,8), C8( 67,8), C8( 68,8), C8( 69,8), C8( 70,8), C8( 71,8), + C8( 72,8), C8( 73,8), C8( 74,8), C8( 75,8), C8( 76,8), C8( 77,8), + C8( 78,8), C8( 79,8), C8( 80,8), C8( 81,8), C8( 82,8), C8( 83,8), + C8( 84,8), C8( 85,8), C8( 86,8), C8( 87,8), C8( 88,8), C8( 89,8), + C8( 90,8), C8( 91,8), C8( 92,8), C8( 93,8), C8( 94,8), C8( 95,8), + C8( 96,8), C8( 97,8), C8( 98,8), C8( 99,8), C8(100,8), C8(101,8), + C8(102,8), C8(103,8), C8(104,8), C8(105,8), C8(106,8), C8(107,8), + C8(108,8), C8(109,8), C8(110,8), C8(111,8), C8(112,8), C8(113,8), + C8(114,8), C8(115,8), C8(116,8), C8(117,8), C8(118,8), C8(119,8), + C8(120,8), C8(121,8), C8(122,8), C8(123,8), C8(124,8), C8(125,8), + C8(126,8), C8(127,8), C8(128,8), C8(129,8), C8(130,8), C8(131,8), + C8(132,8), C8(133,8), C8(134,8), C8(135,8), C8(136,8), C8(137,8), + C8(138,8), C8(139,8), C8(140,8), C8(141,8), C8(142,8), C8(143,8), + C8(144,8), C8(145,8), C8(146,8), C8(147,8), C8(148,8), C8(149,8), + C8(150,8), C8(151,8), C8(152,8), C8(153,8), C8(154,8), C8(155,8), + C8(156,8), C8(157,8), C8(158,8), C8(159,8), C8(160,8), C8(161,8), + C8(162,8), C8(163,8), C8(164,8), C8(165,8), C8(166,8), C8(167,8), + C8(168,8), C8(169,8), C8(170,8), C8(171,8), C8(172,8), C8(173,8), + C8(174,8), C8(175,8), C8(176,8), C8(177,8), C8(178,8), C8(179,8), + C8(180,8), C8(181,8), C8(182,8), C8(183,8), C8(184,8), C8(185,8), + C8(186,8), C8(187,8), C8(188,8), C8(189,8), C8(190,8), C8(191,8), + C8(192,8), C8(193,8), C8(194,8), C8(195,8), C8(196,8), C8(197,8), + C8(198,8), C8(199,8), C8(200,8), C8(201,8), C8(202,8), C8(203,8), + C8(204,8), C8(205,8), C8(206,8), C8(207,8), C8(208,8), C8(209,8), + C8(210,8), C8(211,8), C8(212,8), C8(213,8), C8(214,8), C8(215,8), + C8(216,8), C8(217,8), C8(218,8), C8(219,8), C8(220,8), C8(221,8), + C8(222,8), C8(223,8), C8(224,8), C8(225,8), C8(226,8), C8(227,8), + C8(228,8), C8(229,8), C8(230,8), C8(231,8), C8(232,8), C8(233,8), + C8(234,8), C8(235,8), C8(236,8), C8(237,8), C8(238,8), C8(239,8), + C8(240,8), C8(241,8), C8(242,8), C8(243,8), C8(244,8), C8(245,8), + C8(246,8), C8(247,8), C8(248,8), C8(249,8), C8(250,8), C8(251,8), + C8(252,8), C8(253,8), C8(254,8), C8(255,8), +}; +static const pixman_bits_t fbStipple4Bits[16] = { + C4( 0,16), C4( 1,16), C4( 2,16), C4( 3,16), C4( 4,16), C4( 5,16), + C4( 6,16), C4( 7,16), C4( 8,16), C4( 9,16), C4( 10,16), C4( 11,16), + C4( 12,16), C4( 13,16), C4( 14,16), C4( 15,16),}; +static const pixman_bits_t fbStipple2Bits[4] = { + C2( 0,32), C2( 1,32), C2( 2,32), C2( 3,32), +}; +#define fbStipple1Bits 0 +#endif + +const pixman_bits_t * +fbStippleTable(int bits) +{ + switch (bits) { + case 1: + return fbStipple1Bits; + case 2: + return fbStipple2Bits; + case 4: + return fbStipple4Bits; + case 8: + return fbStipple8Bits; + } + return 0; +} diff --git a/pixman/src/pixman-remap.h b/pixman/src/pixman-remap.h new file mode 100644 index 0000000..4ca80a8 --- /dev/null +++ b/pixman/src/pixman-remap.h @@ -0,0 +1,302 @@ +#define fb16Lane _cairo_pixman_16_lane +#define fb32Lane _cairo_pixman_32_lane +#define fb8Lane _cairo_pixman_8_lane +#define fbAccessMap _cairo_pixman_access_map +#define fbBlt _cairo_pixman_blt +#define fbBlt24 _cairo_pixman_blt24 +#define fbBlt24Line _cairo_pixman_blt24_line +#define fbBltOne _cairo_pixman_blt_one +#define fbBltOne24 _cairo_pixman_blt_one24 +#define fbBltStip _cairo_pixman_blt_stip +#define fbBuildCompositeOperand _cairo_pixman_build_composite_operand +#define fbCombineAddC _cairo_pixman_combine_add_c +#define fbCombineAddU _cairo_pixman_combine_add_u +#define fbCombineAtopC _cairo_pixman_combine_atop_c +#define fbCombineAtopReverseC _cairo_pixman_combine_atop_reverse_c +#define fbCombineAtopReverseU _cairo_pixman_combine_atop_reverse_u +#define fbCombineAtopU _cairo_pixman_combine_atop_u +#define fbCombineClear _cairo_pixman_combine_clear +#define fbCombineConjointAtopC _cairo_pixman_combine_conjoint_atop_c +#define fbCombineConjointAtopReverseC _cairo_pixman_combine_conjoint_atop_reverse_c +#define fbCombineConjointAtopReverseU _cairo_pixman_combine_conjoint_atop_reverse_u +#define fbCombineConjointAtopU _cairo_pixman_combine_conjoint_atop_u +#define fbCombineConjointGeneralC _cairo_pixman_combine_conjoint_general_c +#define fbCombineConjointGeneralU _cairo_pixman_combine_conjoint_general_u +#define fbCombineConjointInC _cairo_pixman_combine_conjoint_in_c +#define fbCombineConjointInPart _cairo_pixman_combine_conjoint_in_part +#define fbCombineConjointInReverseC _cairo_pixman_combine_conjoint_in_reverse_c +#define fbCombineConjointInReverseU _cairo_pixman_combine_conjoint_in_reverse_u +#define fbCombineConjointInU _cairo_pixman_combine_conjoint_in_u +#define fbCombineConjointOutC _cairo_pixman_combine_conjoint_out_c +#define fbCombineConjointOutPart _cairo_pixman_combine_conjoint_out_part +#define fbCombineConjointOutReverseC _cairo_pixman_combine_conjoint_out_reverse_c +#define fbCombineConjointOutReverseU _cairo_pixman_combine_conjoint_out_reverse_u +#define fbCombineConjointOutU _cairo_pixman_combine_conjoint_out_u +#define fbCombineConjointOverC _cairo_pixman_combine_conjoint_over_c +#define fbCombineConjointOverReverseC _cairo_pixman_combine_conjoint_over_reverse_c +#define fbCombineConjointOverReverseU _cairo_pixman_combine_conjoint_over_reverse_u +#define fbCombineConjointOverU _cairo_pixman_combine_conjoint_over_u +#define fbCombineConjointXorC _cairo_pixman_combine_conjoint_xor_c +#define fbCombineConjointXorU _cairo_pixman_combine_conjoint_xor_u +#define fbCombineDisjointAtopC _cairo_pixman_combine_disjoint_atop_c +#define fbCombineDisjointAtopReverseC _cairo_pixman_combine_disjoint_atop_reverse_c +#define fbCombineDisjointAtopReverseU _cairo_pixman_combine_disjoint_atop_reverse_u +#define fbCombineDisjointAtopU _cairo_pixman_combine_disjoint_atop_u +#define fbCombineDisjointGeneralC _cairo_pixman_combine_disjoint_general_c +#define fbCombineDisjointGeneralU _cairo_pixman_combine_disjoint_general_u +#define fbCombineDisjointInC _cairo_pixman_combine_disjoint_in_c +#define fbCombineDisjointInPart _cairo_pixman_combine_disjoint_in_part +#define fbCombineDisjointInReverseC _cairo_pixman_combine_disjoint_in_reverse_c +#define fbCombineDisjointInReverseU _cairo_pixman_combine_disjoint_in_reverse_u +#define fbCombineDisjointInU _cairo_pixman_combine_disjoint_in_u +#define fbCombineDisjointOutC _cairo_pixman_combine_disjoint_out_c +#define fbCombineDisjointOutPart _cairo_pixman_combine_disjoint_out_part +#define fbCombineDisjointOutReverseC _cairo_pixman_combine_disjoint_out_reverse_c +#define fbCombineDisjointOutReverseU _cairo_pixman_combine_disjoint_out_reverse_u +#define fbCombineDisjointOutU _cairo_pixman_combine_disjoint_out_u +#define fbCombineDisjointOverC _cairo_pixman_combine_disjoint_over_c +#define fbCombineDisjointOverReverseC _cairo_pixman_combine_disjoint_over_reverse_c +#define fbCombineDisjointOverReverseU _cairo_pixman_combine_disjoint_over_reverse_u +#define fbCombineDisjointOverU _cairo_pixman_combine_disjoint_over_u +#define fbCombineDisjointXorC _cairo_pixman_combine_disjoint_xor_c +#define fbCombineDisjointXorU _cairo_pixman_combine_disjoint_xor_u +#define fbCombineDst _cairo_pixman_combine_dst +#define fbCombineFuncC _cairo_pixman_combine_func_c +#define fbCombineFuncU _cairo_pixman_combine_func_u +#define fbCombineInC _cairo_pixman_combine_in_c +#define fbCombineInReverseC _cairo_pixman_combine_in_reverse_c +#define fbCombineInReverseU _cairo_pixman_combine_in_reverse_u +#define fbCombineInU _cairo_pixman_combine_in_u +#define fbCombineMaskAlphaC _cairo_pixman_combine_mask_alpha_c +#define fbCombineMaskAlphaU _cairo_pixman_combine_mask_alpha_u +#define fbCombineMaskC _cairo_pixman_combine_mask_c +#define fbCombineMaskU _cairo_pixman_combine_mask_u +#define fbCombineMaskValueC _cairo_pixman_combine_mask_value_c +#define fbCombineOutC _cairo_pixman_combine_out_c +#define fbCombineOutReverseC _cairo_pixman_combine_out_reverse_c +#define fbCombineOutReverseU _cairo_pixman_combine_out_reverse_u +#define fbCombineOutU _cairo_pixman_combine_out_u +#define fbCombineOverC _cairo_pixman_combine_over_c +#define fbCombineOverReverseC _cairo_pixman_combine_over_reverse_c +#define fbCombineOverReverseU _cairo_pixman_combine_over_reverse_u +#define fbCombineOverU _cairo_pixman_combine_over_u +#define fbCombineSaturateC _cairo_pixman_combine_saturate_c +#define fbCombineSaturateU _cairo_pixman_combine_saturate_u +#define fbCombineSrcC _cairo_pixman_combine_src_c +#define fbCombineSrcU _cairo_pixman_combine_src_u +#define fbCombineXorC _cairo_pixman_combine_xor_c +#define fbCombineXorU _cairo_pixman_combine_xor_u +#define fbCompositeSolidMask_nx1xn _cairo_pixman_composite_solid_mask_nx1xn +#define fbCompositeSolidMask_nx8888x0565 _cairo_pixman_composite_solid_mask_nx8888x0565 +#define fbCompositeSolidMask_nx8888x0565C _cairo_pixman_composite_solid_mask_nx8888x0565_c +#define fbCompositeSolidMask_nx8888x8888C _cairo_pixman_composite_solid_mask_nx8888x8888_c +#define fbCompositeSolidMask_nx8x0565 _cairo_pixman_composite_solid_mask_nx8x0565 +#define fbCompositeSolidMask_nx8x0888 _cairo_pixman_composite_solid_mask_nx8x0888 +#define fbCompositeSolidMask_nx8x8888 _cairo_pixman_composite_solid_mask_nx8x8888 +#define fbCompositeSrc_0565x0565 _cairo_pixman_composite_src_0565x0565 +#define fbCompositeSrc_8888x0565 _cairo_pixman_composite_src_8888x0565 +#define fbCompositeSrc_8888x0888 _cairo_pixman_composite_src_8888x0888 +#define fbCompositeSrc_8888x8888 _cairo_pixman_composite_src_8888x8888 +#define fbCompositeSrcAdd_1000x1000 _cairo_pixman_composite_src_add_1000x1000 +#define fbCompositeSrcAdd_8000x8000 _cairo_pixman_composite_src_add_8000x8000 +#define fbCompositeSrcAdd_8888x8888 _cairo_pixman_composite_src_add_8888x8888 +#define fbCompositeSrcSrc_nxn _cairo_pixman_composite_src_src_nxn +#define fbCompositeTrans_0565xnx0565 _cairo_pixman_composite_trans_0565xnx0565 +#define fbCompositeTrans_0888xnx0888 _cairo_pixman_composite_trans_0888xnx0888 +#define FbComputeCompositeRegion _cairo_pixman_compute_composite_region +#define FbCreateAlphaPicture _cairo_pixman_create_alpha_picture +#define fbFetch_a1 _cairo_pixman_fetch_a1 +#define fbFetch_a1b1g1r1 _cairo_pixman_fetch_a1b1g1r1 +#define fbFetch_a1b5g5r5 _cairo_pixman_fetch_a1b5g5r5 +#define fbFetch_a1r1g1b1 _cairo_pixman_fetch_a1r1g1b1 +#define fbFetch_a1r5g5b5 _cairo_pixman_fetch_a1r5g5b5 +#define fbFetch_a2r2g2b2 _cairo_pixman_fetch_a2r2g2b2 +#define fbFetch_a4 _cairo_pixman_fetch_a4 +#define fbFetch_a4b4g4r4 _cairo_pixman_fetch_a4b4g4r4 +#define fbFetch_a4r4g4b4 _cairo_pixman_fetch_a4r4g4b4 +#define fbFetch_a8 _cairo_pixman_fetch_a8 +#define fbFetch_a8b8g8r8 _cairo_pixman_fetch_a8b8g8r8 +#define fbFetch_a8r8g8b8 _cairo_pixman_fetch_a8r8g8b8 +#define fbFetcha_a1 _cairo_pixman_fetcha_a1 +#define fbFetcha_a4 _cairo_pixman_fetcha_a4 +#define fbFetcha_a8 _cairo_pixman_fetcha_a8 +#define fbFetcha_external _cairo_pixman_fetcha_external +#define fbFetcha_transform _cairo_pixman_fetcha_transform +#define fbFetch_b1g2r1 _cairo_pixman_fetch_b1g2r1 +#define fbFetch_b2g3r3 _cairo_pixman_fetch_b2g3r3 +#define fbFetch_b5g6r5 _cairo_pixman_fetch_b5g6r5 +#define fbFetch_b8g8r8 _cairo_pixman_fetch_b8g8r8 +#define fbFetch_external _cairo_pixman_fetch_external +#define fbFetch_r1g2b1 _cairo_pixman_fetch_r1g2b1 +#define fbFetch_r3g3b2 _cairo_pixman_fetch_r3g3b2 +#define fbFetch_r5g6b5 _cairo_pixman_fetch_r5g6b5 +#define fbFetch_r8g8b8 _cairo_pixman_fetch_r8g8b8 +#define fbFetch_transform _cairo_pixman_fetch_transform +#define fbFetch_x1b5g5r5 _cairo_pixman_fetch_x1b5g5r5 +#define fbFetch_x1r5g5b5 _cairo_pixman_fetch_x1r5g5b5 +#define fbFetch_x4b4g4r4 _cairo_pixman_fetch_x4b4g4r4 +#define fbFetch_x4r4g4b4 _cairo_pixman_fetch_x4r4g4b4 +#define fbFetch_x8b8g8r8 _cairo_pixman_fetch_x8b8g8r8 +#define fbFetch_x8r8g8b8 _cairo_pixman_fetch_x8r8g8b8 +#define FbFillColor _cairo_pixman_fill_color +#define fbIn _cairo_pixman_in +#define fbIn24 _cairo_pixman_in24 +#define fbLaneTable _cairo_pixman_lane_table +#define FbMergeRopBits _cairo_pixman_merge_rop_bits +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +#else +#define _FbOnes _cairo_pixman_ones +#endif +#define fbOver _cairo_pixman_over +#define fbOver24 _cairo_pixman_over24 +#define FbPixelsCreate _cairo_pixman_pixels_create +#define FbPixelsCreateForData _cairo_pixman_pixels_create_for_data +#define FbPixelsDestroy _cairo_pixman_pixels_destroy +#define FbPixelsInit _cairo_pixman_pixels_init +#define fbRasterizeEdges _cairo_pixman_rasterize_edges +#define fbRasterizeEdges1 _cairo_pixman_rasterize_edges1 +#define fbRasterizeEdges4 _cairo_pixman_rasterize_edges4 +#define fbRasterizeEdges8 _cairo_pixman_rasterize_edges8 +#define fbRasterizeTrapezoid _cairo_pixman_rasterize_trapezoid +#define FbRasterizeTriangle _cairo_pixman_rasterize_triangle +#define fbReplicatePixel _cairo_pixman_replicate_pixel +#define fbSet _cairo_pixman_set +#define fbSet_external _cairo_pixman_set_external +#define fbSet_transform _cairo_pixman_set_transform +#define fbStepDown _cairo_pixman_step_down +#define fbStepDown_external _cairo_pixman_step_down_external +#define fbStepDown_transform _cairo_pixman_step_down_transform +#define fbStepOver _cairo_pixman_step_over +#define fbStepOver_external _cairo_pixman_step_over_external +#define fbStepOver_transform _cairo_pixman_step_over_transform +#define fbStipple1Bits _cairo_pixman_stipple1_bits +#define fbStipple24Bits _cairo_pixman_stipple24_bits +#define fbStipple2Bits _cairo_pixman_stipple2_bits +#define fbStipple4Bits _cairo_pixman_stipple4_bits +#define fbStipple8Bits _cairo_pixman_stipple8_bits +#define fbStippleTable _cairo_pixman_stipple_table +#define fbStore_a1 _cairo_pixman_store_a1 +#define fbStore_a1b1g1r1 _cairo_pixman_store_a1b1g1r1 +#define fbStore_a1b5g5r5 _cairo_pixman_store_a1b5g5r5 +#define fbStore_a1r1g1b1 _cairo_pixman_store_a1r1g1b1 +#define fbStore_a1r5g5b5 _cairo_pixman_store_a1r5g5b5 +#define fbStore_a2r2g2b2 _cairo_pixman_store_a2r2g2b2 +#define fbStore_a4 _cairo_pixman_store_a4 +#define fbStore_a4b4g4r4 _cairo_pixman_store_a4b4g4r4 +#define fbStore_a4r4g4b4 _cairo_pixman_store_a4r4g4b4 +#define fbStore_a8 _cairo_pixman_store_a8 +#define fbStore_a8b8g8r8 _cairo_pixman_store_a8b8g8r8 +#define fbStore_a8r8g8b8 _cairo_pixman_store_a8r8g8b8 +#define fbStore_b1g2r1 _cairo_pixman_store_b1g2r1 +#define fbStore_b2g3r3 _cairo_pixman_store_b2g3r3 +#define fbStore_b5g6r5 _cairo_pixman_store_b5g6r5 +#define fbStore_b8g8r8 _cairo_pixman_store_b8g8r8 +#define fbStore_external _cairo_pixman_store_external +#define fbStore_r1g2b1 _cairo_pixman_store_r1g2b1 +#define fbStore_r3g3b2 _cairo_pixman_store_r3g3b2 +#define fbStore_r5g6b5 _cairo_pixman_store_r5g6b5 +#define fbStore_r8g8b8 _cairo_pixman_store_r8g8b8 +#define fbStore_x1b5g5r5 _cairo_pixman_store_x1b5g5r5 +#define fbStore_x1r5g5b5 _cairo_pixman_store_x1r5g5b5 +#define fbStore_x4b4g4r4 _cairo_pixman_store_x4b4g4r4 +#define fbStore_x4r4g4b4 _cairo_pixman_store_x4r4g4b4 +#define fbStore_x8b8g8r8 _cairo_pixman_store_x8b8g8r8 +#define fbStore_x8r8g8b8 _cairo_pixman_store_x8r8g8b8 +#define fbTransparentSpan _cairo_pixman_transparent_span +#define INT_pixman_color_to_pixel _cairo_pixman_color_to_pixel +#define INT_pixman_composite _cairo_pixman_composite +#define pixman_fill_rectangles _cairo_pixman_fill_rectangles +#define pixman_format_init _cairo_pixman_format_init +#define pixman_image_create _cairo_pixman_image_create +#define pixman_image_destroy _cairo_pixman_image_destroy +#define pixman_image_set_component_alpha _cairo_pixman_image_set_component_alpha +#define pixman_image_set_repeat _cairo_pixman_image_set_repeat +#define pixman_region_copy _cairo_pixman_region_copy +#define pixman_region_create_simple _cairo_pixman_region_create_simple +#define pixman_region_union _cairo_pixman_region_union +#define miIsSolidAlpha _cairo_pixman_is_solid_alpha +#define pixman_add_trapezoids _cairo_pixman_add_trapezoids +#define pixman_bits_per_pixel _cairo_pixman_bits_per_pixel +#define pixman_break _cairo_pixman_break +#define pixman_brokendata _cairo_pixman_brokendata +#define pixman_brokenregion _cairo_pixman_brokenregion +#define pixman_coalesce _cairo_pixman_coalesce +#define pixman_color_rects _cairo_pixman_color_rects +#define pixman_color_to_pixel _cairo_pixman_color_to_pixel +#define pixman_composite _cairo_pixman_composite +#define pixman_compositeGeneral _cairo_pixman_composite_general +#define pixman_composite_trapezoids _cairo_pixman_composite_trapezoids +#define pixman_composite_triangles _cairo_pixman_composite_triangles +#define pixman_composite_tri_fan _cairo_pixman_composite_tri_fan +#define pixman_composite_tri_strip _cairo_pixman_composite_tri_strip +#define pixman_fill_rect_32bpp _cairo_pixman_fill_rect_32bpp +#define pixman_fill_rect_8bpp _cairo_pixman_fill_rect_8bpp +#define pixman_fill_rectangle _cairo_pixman_fill_rectangle +#define pixman_fill_rectangles _cairo_pixman_fill_rectangles +#define pixman_fill_rect_general _cairo_pixman_fill_rect_general +#define pixman_format_create _cairo_pixman_format_create +#define pixman_format_create_masks _cairo_pixman_format_create_masks +#define pixman_format_destroy _cairo_pixman_format_destroy +#define pixman_format_get_masks _cairo_pixman_format_get_masks +#define pixman_format_init _cairo_pixman_format_init +#define pixman_image_create _cairo_pixman_image_create +#define pixman_image_create_for_data _cairo_pixman_image_create_for_data +#define pixman_image_createForPixels _cairo_pixman_image_create_for_pixels +#define pixman_image_destroy _cairo_pixman_image_destroy +#define pixman_image_destroyClip _cairo_pixman_image_destroy_clip +#define pixman_image_get_data _cairo_pixman_image_get_data +#define pixman_image_get_depth _cairo_pixman_image_get_depth +#define pixman_image_get_format _cairo_pixman_image_get_format +#define pixman_image_get_height _cairo_pixman_image_get_height +#define pixman_image_get_stride _cairo_pixman_image_get_stride +#define pixman_image_get_width _cairo_pixman_image_get_width +#define pixman_image_init _cairo_pixman_image_init +#define pixman_image_set_clip_region _cairo_pixman_image_set_clip_region +#define pixman_image_set_component_alpha _cairo_pixman_image_set_component_alpha +#define pixman_image_set_filter _cairo_pixman_image_set_filter +#define pixman_image_set_repeat _cairo_pixman_image_set_repeat +#define pixman_image_set_transform _cairo_pixman_image_set_transform +#define pixman_init _cairo_pixman_init +#define pixman_line_fixed_x _cairo_pixman_line_fixed_x +#define pixman_op _cairo_pixman_op +#define pixman_pixel_to_color _cairo_pixman_pixel_to_color +#define pixman_point_fixed_bounds _cairo_pixman_point_fixed_bounds +#define pixman_rect_alloc _cairo_pixman_rect_alloc +#define pixman_region_append _cairo_pixman_region_append +#define pixman_region_contains_point _cairo_pixman_region_contains_point +#define pixman_region_contains_rectangle _cairo_pixman_region_contains_rectangle +#define pixman_region_copy _cairo_pixman_region_copy +#define pixman_region_create _cairo_pixman_region_create +#define pixman_region_create_simple _cairo_pixman_region_create_simple +#define pixman_region_destroy _cairo_pixman_region_destroy +#define pixman_region_empty _cairo_pixman_region_empty +#define pixman_region_emptyBox _cairo_pixman_region_empty_box +#define pixman_region_emptyData _cairo_pixman_region_empty_data +#define pixman_region_extents _cairo_pixman_region_extents +#define pixman_region_intersect _cairo_pixman_region_intersect +#define pixman_region_intersectO _cairo_pixman_region_intersect_o +#define pixman_region_inverse _cairo_pixman_region_inverse +#define pixman_region_not_empty _cairo_pixman_region_not_empty +#define pixman_region_num_rects _cairo_pixman_region_num_rects +#define pixman_region_rects _cairo_pixman_region_rects +#define pixman_region_reset _cairo_pixman_region_reset +#define pixman_region_subtract _cairo_pixman_region_subtract +#define pixman_region_subtractO _cairo_pixman_region_subtract_o +#define pixman_region_translate _cairo_pixman_region_translate +#define pixman_region_union _cairo_pixman_region_union +#define pixman_region_unionO _cairo_pixman_region_union_o +#define pixman_region_union_rect _cairo_pixman_region_union_rect +#define pixman_region_validate _cairo_pixman_region_validate +#define pixman_set_extents _cairo_pixman_set_extents +#define pixman_transform_point _cairo_pixman_transform_point +#define pixman_trapezoid_bounds _cairo_pixman_trapezoid_bounds +#define pixman_triangle_bounds _cairo_pixman_triangle_bounds +#define pixman_uninit _cairo_pixman_uninit +#define QuickSortRects _cairo_pixman_quick_sort_rects +#define QuickSortSpans _cairo_pixman_quick_sort_spans +#define RenderEdgeInit _cairo_pixman_render_edge_init +#define _RenderEdgeMultiInit _cairo_pixman_render_edge_multi_init +#define RenderEdgeStep _cairo_pixman_render_edge_step +#define RenderLineFixedEdgeInit _cairo_pixman_render_line_fixed_edge_init +#define RenderSampleCeilY _cairo_pixman_render_sample_ceil_y +#define RenderSampleFloorY _cairo_pixman_render_sample_floor_y diff --git a/pixman/src/pixman-xserver-compat.h b/pixman/src/pixman-xserver-compat.h new file mode 100644 index 0000000..46e2825 --- /dev/null +++ b/pixman/src/pixman-xserver-compat.h @@ -0,0 +1,126 @@ +/* + * Copyright © 2005 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of Red Hat, + * Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Red Hat, Inc. makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Carl Worth, Red Hat, Inc. + */ + +#ifndef _PIXMAN_XSERVER_COMPAT_H_ +#define _PIXMAN_XSERVER_COMPAT_H_ + +/* This is a compatibility header file, designed to make it easier to + * synchronize files between libpixman and the xserver repository. + * + * Of course, long-term we would instead like to have the X server + * depend on libpixman to eliminate the code duplication. But for now, + * we at least make it easy to share files. + * + * The libpixman code base regards the xserver repository as canonical + * for any shared files, so changes should be pushed up there. Then, + * to merge changes back down into libpixman, the process should be to + * simply copy the file and to replace the block of include directives + * with: + * + * #include "pixman-xserver-compat.h" + */ + +/* First, include the primary internal header file for libpixman. */ + +#include "icint.h" + +/* Then, define any names that the server code will be expecting in + * terms of libpixman names. */ +/* +typedef uint8_t CARD8; +typedef uint16_t CARD16; +typedef int16_t INT16; + +typedef int Bool; +#define FALSE 0 +#define TRUE 1 + +typedef pixman_bits_t FbBits; +typedef pixman_image_t* PicturePtr; +typedef pixman_box16_t BoxRec; +typedef pixman_box16_t* BoxPtr; + +typedef pixman_point_fixed_t xPointFixed; +typedef pixman_line_fixed_t xLineFixed; +typedef pixman_trapezoid_t xTrapezoid; +typedef pixman_triangle_t xTriangle; +*/ +#define RENDER 1 +/* +#define FB_SHIFT IC_SHIFT +#define FB_MASK IC_MASK +#define FB_ALLONES IC_ALLONES +*/ +//#define FbMaskBits IcMaskBits + +/* XXX: We changed some function and field names which makes for some + * ugly hacks... */ +#define pDrawable pixels +#define fbGetDrawable(pDrawable, buf, outstride, outbpp, xoff, yoff) { \ + (buf) = (pDrawable)->data; \ + (outstride) = ((int) pDrawable->stride) / sizeof (pixman_bits_t); \ + (outbpp) = (pDrawable)->bpp; \ + (xoff) = 0; \ + (yoff) = 0; \ +} + +/* Extended repeat attributes included in 0.10 */ +#define RepeatNone 0 +#define RepeatNormal 1 +#define RepeatPad 2 +#define RepeatReflect 3 + +typedef pixman_vector_t PictVector; +typedef pixman_vector_t* PictVectorPtr; + +#define miIndexedPtr FbIndexedPtr +#define miIndexToEnt24 FbIndexToEnt24 +#define miIndexToEntY24 FbIndexToEntY24 + +#define MAX_FIXED_48_16 ((xFixed_48_16) 0x7fffffff) +#define MIN_FIXED_48_16 (-((xFixed_48_16) 1 << 31)) + +/* Then, include any header files that have been copied directly + * from xserver. */ + +#include "renderedge.h" + +/* And finally, this one prototype must come after the include of + * renderedge.h, so it can't live alongside the other prototypes in + * the horrible mess that is icint.h. + */ + +pixman_private void +fbRasterizeEdges (pixman_bits_t *buf, + int bpp, + int width, + int stride, + RenderEdge *l, + RenderEdge *r, + pixman_fixed16_16_t t, + pixman_fixed16_16_t b); + + +#endif diff --git a/pixman/src/pixman.h b/pixman/src/pixman.h new file mode 100644 index 0000000..a62cca9 --- /dev/null +++ b/pixman/src/pixman.h @@ -0,0 +1,478 @@ +#ifndef _PIXMAN_H_ +#define _PIXMAN_H_ + + +/* pixman.h - a merge of pixregion.h and ic.h */ + + +/* from pixregion.h */ + + +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ +/* $Id: pixman.h,v 1.22 2005/08/10 19:36:51 cworth Exp $ */ + +/* libic.h */ + +/* + * Copyright © 1998 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + + +#if defined (__SVR4) && defined (__sun) +# include <sys/int_types.h> +#else +# if defined (__OpenBSD__) || defined (_AIX) +# include <inttypes.h> +# else +# include <stdint.h> +# endif +#endif + +#include "pixman-remap.h" + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +/* pixregion.h */ + +typedef struct pixman_region16 pixman_region16_t; + +typedef struct pixman_box16 { + short x1, y1, x2, y2; +} pixman_box16_t; + +typedef enum { + PIXMAN_REGION_STATUS_FAILURE, + PIXMAN_REGION_STATUS_SUCCESS +} pixman_region_status_t; + +/* creation/destruction */ + +pixman_region16_t * +pixman_region_create (void); + +pixman_region16_t * +pixman_region_create_simple (pixman_box16_t *extents); + +void +pixman_region_destroy (pixman_region16_t *region); + +/* manipulation */ + +void +pixman_region_translate (pixman_region16_t *region, int x, int y); + +pixman_region_status_t +pixman_region_copy (pixman_region16_t *dest, pixman_region16_t *source); + +pixman_region_status_t +pixman_region_intersect (pixman_region16_t *newReg, pixman_region16_t *reg1, pixman_region16_t *reg2); + +pixman_region_status_t +pixman_region_union (pixman_region16_t *newReg, pixman_region16_t *reg1, pixman_region16_t *reg2); + +pixman_region_status_t +pixman_region_union_rect(pixman_region16_t *dest, pixman_region16_t *source, + int x, int y, unsigned int width, unsigned int height); + +pixman_region_status_t +pixman_region_subtract (pixman_region16_t *regD, pixman_region16_t *regM, pixman_region16_t *regS); + +pixman_region_status_t +pixman_region_inverse (pixman_region16_t *newReg, pixman_region16_t *reg1, pixman_box16_t *invRect); + +/* XXX: Need to fix this so it doesn't depend on an X data structure +pixman_region16_t * +RectsTopixman_region16_t (int nrects, xRectanglePtr prect, int ctype); +*/ + +/* querying */ + +/* XXX: These should proably be combined: pixman_region_get_rects? */ +int +pixman_region_num_rects (pixman_region16_t *region); + +pixman_box16_t * +pixman_region_rects (pixman_region16_t *region); + +/* XXX: Change to an enum */ +#define rgnOUT 0 +#define rgnIN 1 +#define rgnPART 2 + +int +pixman_region_contains_point (pixman_region16_t *region, int x, int y, pixman_box16_t *box); + +int +pixman_region_contains_rectangle (pixman_region16_t *pixman_region16_t, pixman_box16_t *prect); + +int +pixman_region_not_empty (pixman_region16_t *region); + +pixman_box16_t * +pixman_region_extents (pixman_region16_t *region); + +/* mucking around */ + +/* WARNING: calling pixman_region_append may leave dest as an invalid + region. Follow-up with pixman_region_validate to fix it up. */ +pixman_region_status_t +pixman_region_append (pixman_region16_t *dest, pixman_region16_t *region); + +pixman_region_status_t +pixman_region_validate (pixman_region16_t *badreg, int *pOverlap); + +/* Unclassified functionality + * XXX: Do all of these need to be exported? + */ + +void +pixman_region_reset (pixman_region16_t *region, pixman_box16_t *pBox); + +void +pixman_region_empty (pixman_region16_t *region); + + +/* ic.h */ + + +/* icformat.c */ +typedef enum pixman_operator { + PIXMAN_OPERATOR_CLEAR, + PIXMAN_OPERATOR_SRC, + PIXMAN_OPERATOR_DST, + PIXMAN_OPERATOR_OVER, + PIXMAN_OPERATOR_OVER_REVERSE, + PIXMAN_OPERATOR_IN, + PIXMAN_OPERATOR_IN_REVERSE, + PIXMAN_OPERATOR_OUT, + PIXMAN_OPERATOR_OUT_REVERSE, + PIXMAN_OPERATOR_ATOP, + PIXMAN_OPERATOR_ATOP_REVERSE, + PIXMAN_OPERATOR_XOR, + PIXMAN_OPERATOR_ADD, + PIXMAN_OPERATOR_SATURATE +} pixman_operator_t; + +typedef enum pixman_format_name { + PIXMAN_FORMAT_NAME_ARGB32, + PIXMAN_FORMAT_NAME_RGB24, + PIXMAN_FORMAT_NAME_A8, + PIXMAN_FORMAT_NAME_A1 +} pixman_format_name_t; + +typedef struct pixman_format pixman_format_t; + +pixman_format_t * +pixman_format_create (pixman_format_name_t name); + +pixman_format_t * +pixman_format_create_masks (int bpp, + int alpha_mask, + int red_mask, + int green_mask, + int blue_mask); + +void +pixman_format_destroy (pixman_format_t *format); + +void +pixman_format_get_masks (pixman_format_t *format, + int *bpp, + int *alpha_mask, + int *red_mask, + int *green_mask, + int *blue_mask); + +/* icimage.c */ + +typedef struct pixman_image pixman_image_t; + +pixman_image_t * +pixman_image_create (pixman_format_t *format, + int width, + int height); + +/* + * This single define controls the basic size of data manipulated + * by this software; it must be log2(sizeof (pixman_bits_t) * 8) + */ + +/* We use a 32-bit size on all platforms, (even those with native 64 + * bit types). This is consistent with the code currently in the X + * server, so it goes through much more well-tested code paths, (we + * saw rendering bugs when we tried IC_SHIFT==6 and uint64_t for + * pixman_bits_t on 64-bit platofrms). In addition, Keith says that + * his testing indicates that using 32-bits everywhere is a + * performance win in any case, (presumably due to 32-bit datapaths + * between the processor and the video card). +*/ +#ifndef IC_SHIFT +#define IC_SHIFT 5 +#define FB_SHIFT IC_SHIFT +typedef uint32_t pixman_bits_t; +#endif + +pixman_image_t * +pixman_image_create_for_data (pixman_bits_t *data, + pixman_format_t *format, + int width, int height, + int bpp, int stride); + +void +pixman_image_destroy (pixman_image_t *image); + +int +pixman_image_set_clip_region (pixman_image_t *image, + pixman_region16_t *region); + +typedef int32_t pixman_fixed16_16_t; + +typedef struct pixman_point_fixed { + pixman_fixed16_16_t x, y; +} pixman_point_fixed_t; + +typedef struct pixman_line_fixed { + pixman_point_fixed_t p1, p2; +} pixman_line_fixed_t; + +/* XXX: It's goofy that pixman_rectangle_t has integers while all the other + datatypes have fixed-point values. (Though by design, + pixman_fill_rectangles is designed to fill only whole pixels) */ +typedef struct pixman_rectangle { + short x, y; + unsigned short width, height; +} pixman_rectangle_t; + +typedef struct pixman_triangle { + pixman_point_fixed_t p1, p2, p3; +} pixman_triangle_t; + +typedef struct pixman_trapezoid { + pixman_fixed16_16_t top, bottom; + pixman_line_fixed_t left, right; +} pixman_trapezoid_t; + +typedef struct pixman_vector { + pixman_fixed16_16_t vector[3]; +} pixman_vector_t; + +typedef struct pixman_transform { + pixman_fixed16_16_t matrix[3][3]; +} pixman_transform_t; + +typedef enum { + PIXMAN_FILTER_FAST, + PIXMAN_FILTER_GOOD, + PIXMAN_FILTER_BEST, + PIXMAN_FILTER_NEAREST, + PIXMAN_FILTER_BILINEAR +} pixman_filter_t; + +void +pixman_image_set_component_alpha (pixman_image_t *image, + int component_alpha); + +int +pixman_image_set_transform (pixman_image_t *image, + pixman_transform_t *transform); + +void +pixman_image_set_repeat (pixman_image_t *image, + int repeat); + +void +pixman_image_set_filter (pixman_image_t *image, + pixman_filter_t filter); + +int +pixman_image_get_width (pixman_image_t *image); + +int +pixman_image_get_height (pixman_image_t *image); + +int +pixman_image_get_stride (pixman_image_t *image); + +int +pixman_image_get_depth (pixman_image_t *image); + +pixman_format_t * +pixman_image_get_format (pixman_image_t *image); + +pixman_bits_t * +pixman_image_get_data (pixman_image_t *image); + +/* iccolor.c */ + +/* XXX: Do we really need a struct here? Only pixman_rectangle_t uses this. */ +typedef struct pixman_color { + unsigned short red; + unsigned short green; + unsigned short blue; + unsigned short alpha; +} pixman_color_t; + +void +pixman_color_to_pixel (const pixman_format_t *format, + const pixman_color_t *color, + pixman_bits_t *pixel); + +void +pixman_pixel_to_color (const pixman_format_t *format, + pixman_bits_t pixel, + pixman_color_t *color); + +/* icrect.c */ + +void +pixman_fill_rectangle (pixman_operator_t op, + pixman_image_t *dst, + const pixman_color_t *color, + int x, + int y, + unsigned int width, + unsigned int height); + +void +pixman_fill_rectangles (pixman_operator_t op, + pixman_image_t *dst, + const pixman_color_t *color, + const pixman_rectangle_t *rects, + int nRects); + +/* ictrap.c */ + +void +pixman_composite_trapezoids (pixman_operator_t op, + pixman_image_t *src, + pixman_image_t *dst, + int xSrc, + int ySrc, + const pixman_trapezoid_t *traps, + int ntrap); + +void +pixman_add_trapezoids (pixman_image_t *dst, + int x_off, + int y_off, + const pixman_trapezoid_t *traps, + int ntraps); + +/* ictri.c */ + +void +pixman_composite_triangles (pixman_operator_t op, + pixman_image_t *src, + pixman_image_t *dst, + int xSrc, + int ySrc, + const pixman_triangle_t *tris, + int ntris); + +void +pixman_composite_tri_strip (pixman_operator_t op, + pixman_image_t *src, + pixman_image_t *dst, + int xSrc, + int ySrc, + const pixman_point_fixed_t *points, + int npoints); + + +void +pixman_composite_tri_fan (pixman_operator_t op, + pixman_image_t *src, + pixman_image_t *dst, + int xSrc, + int ySrc, + const pixman_point_fixed_t *points, + int npoints); + +/* ic.c */ + +void +pixman_composite (pixman_operator_t op, + pixman_image_t *iSrc, + pixman_image_t *iMask, + pixman_image_t *iDst, + int xSrc, + int ySrc, + int xMask, + int yMask, + int xDst, + int yDst, + int width, + int height); + + + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* _PIXMAN_H_ */ diff --git a/pixman/src/pixregion.c b/pixman/src/pixregion.c new file mode 100644 index 0000000..37505d9 --- /dev/null +++ b/pixman/src/pixregion.c @@ -0,0 +1,2547 @@ +/*********************************************************** + +Copyright 1987, 1988, 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987, 1988, 1989 by +Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ + +#include <stdlib.h> +#include <limits.h> +#include <string.h> + +#include "pixregionint.h" +#include "slim_internal.h" + +#if defined (__GNUC__) && !defined (NO_INLINES) +#define INLINE __inline +#else +#define INLINE +#endif + +#undef assert +#ifdef DEBUG +#define assert(expr) {if (!(expr)) \ + FatalError("Assertion failed file %s, line %d: expr\n", \ + __FILE__, __LINE__); } +#else +#define assert(expr) +#endif + +#define good(reg) assert(pixman_region16_valid(reg)) + +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MAX(a,b) ((a) > (b) ? (a) : (b)) + +static pixman_box16_t pixman_region_emptyBox = {0, 0, 0, 0}; +static pixman_region16_data_t pixman_region_emptyData = {0, 0}; + +static pixman_region16_data_t pixman_brokendata = {0, 0}; +static pixman_region16_t pixman_brokenregion = { { 0, 0, 0, 0 }, &pixman_brokendata }; + +static pixman_region_status_t +pixman_break (pixman_region16_t *pReg); + +static void +pixman_init (pixman_region16_t *region, pixman_box16_t *rect); + +static void +pixman_uninit (pixman_region16_t *region); + +slim_hidden_proto(pixman_region_create_simple) +slim_hidden_proto(pixman_region_copy) +slim_hidden_proto(pixman_region_union) + +/* + * The functions in this file implement the Region abstraction used extensively + * throughout the X11 sample server. A Region is simply a set of disjoint + * (non-overlapping) rectangles, plus an "extent" rectangle which is the + * smallest single rectangle that contains all the non-overlapping rectangles. + * + * A Region is implemented as a "y-x-banded" array of rectangles. This array + * imposes two degrees of order. First, all rectangles are sorted by top side + * y coordinate first (y1), and then by left side x coordinate (x1). + * + * Furthermore, the rectangles are grouped into "bands". Each rectangle in a + * band has the same top y coordinate (y1), and each has the same bottom y + * coordinate (y2). Thus all rectangles in a band differ only in their left + * and right side (x1 and x2). Bands are implicit in the array of rectangles: + * there is no separate list of band start pointers. + * + * The y-x band representation does not minimize rectangles. In particular, + * if a rectangle vertically crosses a band (the rectangle has scanlines in + * the y1 to y2 area spanned by the band), then the rectangle may be broken + * down into two or more smaller rectangles stacked one atop the other. + * + * ----------- ----------- + * | | | | band 0 + * | | -------- ----------- -------- + * | | | | in y-x banded | | | | band 1 + * | | | | form is | | | | + * ----------- | | ----------- -------- + * | | | | band 2 + * -------- -------- + * + * An added constraint on the rectangles is that they must cover as much + * horizontal area as possible: no two rectangles within a band are allowed + * to touch. + * + * Whenever possible, bands will be merged together to cover a greater vertical + * distance (and thus reduce the number of rectangles). Two bands can be merged + * only if the bottom of one touches the top of the other and they have + * rectangles in the same places (of the same width, of course). + * + * Adam de Boor wrote most of the original region code. Joel McCormack + * substantially modified or rewrote most of the core arithmetic routines, and + * added pixman_region_validate in order to support several speed improvements to + * pixman_region_validateTree. Bob Scheifler changed the representation to be more + * compact when empty or a single rectangle, and did a bunch of gratuitous + * reformatting. Carl Worth did further gratuitous reformatting while re-merging + * the server and client region code into libpixregion. + */ + +/* true iff two Boxes overlap */ +#define EXTENTCHECK(r1,r2) \ + (!( ((r1)->x2 <= (r2)->x1) || \ + ((r1)->x1 >= (r2)->x2) || \ + ((r1)->y2 <= (r2)->y1) || \ + ((r1)->y1 >= (r2)->y2) ) ) + +/* true iff (x,y) is in Box */ +#define INBOX(r,x,y) \ + ( ((r)->x2 > x) && \ + ((r)->x1 <= x) && \ + ((r)->y2 > y) && \ + ((r)->y1 <= y) ) + +/* true iff Box r1 contains Box r2 */ +#define SUBSUMES(r1,r2) \ + ( ((r1)->x1 <= (r2)->x1) && \ + ((r1)->x2 >= (r2)->x2) && \ + ((r1)->y1 <= (r2)->y1) && \ + ((r1)->y2 >= (r2)->y2) ) + +#define allocData(n) malloc(PIXREGION_SZOF(n)) +#define freeData(reg) if ((reg)->data && (reg)->data->size) free((reg)->data) + +#define RECTALLOC_BAIL(pReg,n,bail) \ +if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \ + if (!pixman_rect_alloc(pReg, n)) { goto bail; } + +#define RECTALLOC(pReg,n) \ +if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \ + if (!pixman_rect_alloc(pReg, n)) { return PIXMAN_REGION_STATUS_FAILURE; } + +#define ADDRECT(pNextRect,nx1,ny1,nx2,ny2) \ +{ \ + pNextRect->x1 = nx1; \ + pNextRect->y1 = ny1; \ + pNextRect->x2 = nx2; \ + pNextRect->y2 = ny2; \ + pNextRect++; \ +} + +#define NEWRECT(pReg,pNextRect,nx1,ny1,nx2,ny2) \ +{ \ + if (!(pReg)->data || ((pReg)->data->numRects == (pReg)->data->size))\ + { \ + if (!pixman_rect_alloc(pReg, 1)) \ + return PIXMAN_REGION_STATUS_FAILURE; \ + pNextRect = PIXREGION_TOP(pReg); \ + } \ + ADDRECT(pNextRect,nx1,ny1,nx2,ny2); \ + pReg->data->numRects++; \ + assert(pReg->data->numRects<=pReg->data->size); \ +} + + +#define DOWNSIZE(reg,numRects) \ +if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \ +{ \ + pixman_region16_data_t * NewData; \ + NewData = (pixman_region16_data_t *)realloc((reg)->data, PIXREGION_SZOF(numRects)); \ + if (NewData) \ + { \ + NewData->size = (numRects); \ + (reg)->data = NewData; \ + } \ +} + + +#ifdef DEBUG +int +pixman_region16_print(rgn) + pixman_region16_t * rgn; +{ + int num, size; + int i; + pixman_box16_t * rects; + + num = PIXREGION_NUM_RECTS(rgn); + size = PIXREGION_SIZE(rgn); + rects = PIXREGION_RECTS(rgn); + ErrorF("num: %d size: %d\n", num, size); + ErrorF("extents: %d %d %d %d\n", + rgn->extents.x1, rgn->extents.y1, rgn->extents.x2, rgn->extents.y2); + for (i = 0; i < num; i++) + ErrorF("%d %d %d %d \n", + rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2); + ErrorF("\n"); + return(num); +} + + +pixman_region_status_t +pixman_region16_tsEqual(reg1, reg2) + pixman_region16_t * reg1; + pixman_region16_t * reg2; +{ + int i; + pixman_box16_t * rects1, rects2; + + if (reg1->extents.x1 != reg2->extents.x1) return PIXMAN_REGION_STATUS_FAILURE; + if (reg1->extents.x2 != reg2->extents.x2) return PIXMAN_REGION_STATUS_FAILURE; + if (reg1->extents.y1 != reg2->extents.y1) return PIXMAN_REGION_STATUS_FAILURE; + if (reg1->extents.y2 != reg2->extents.y2) return PIXMAN_REGION_STATUS_FAILURE; + if (PIXREGION_NUM_RECTS(reg1) != PIXREGION_NUM_RECTS(reg2)) return PIXMAN_REGION_STATUS_FAILURE; + + rects1 = PIXREGION_RECTS(reg1); + rects2 = PIXREGION_RECTS(reg2); + for (i = 0; i != PIXREGION_NUM_RECTS(reg1); i++) { + if (rects1[i].x1 != rects2[i].x1) return PIXMAN_REGION_STATUS_FAILURE; + if (rects1[i].x2 != rects2[i].x2) return PIXMAN_REGION_STATUS_FAILURE; + if (rects1[i].y1 != rects2[i].y1) return PIXMAN_REGION_STATUS_FAILURE; + if (rects1[i].y2 != rects2[i].y2) return PIXMAN_REGION_STATUS_FAILURE; + } + return PIXMAN_REGION_STATUS_SUCCESS; +} + +pixman_region_status_t +pixman_region16_valid(reg) + pixman_region16_t * reg; +{ + int i, numRects; + + if ((reg->extents.x1 > reg->extents.x2) || + (reg->extents.y1 > reg->extents.y2)) + return PIXMAN_REGION_STATUS_FAILURE; + numRects = PIXREGION_NUM_RECTS(reg); + if (!numRects) + return ((reg->extents.x1 == reg->extents.x2) && + (reg->extents.y1 == reg->extents.y2) && + (reg->data->size || (reg->data == &pixman_region_emptyData))); + else if (numRects == 1) + return (!reg->data); + else + { + pixman_box16_t * pboxP, pboxN; + pixman_box16_t box; + + pboxP = PIXREGION_RECTS(reg); + box = *pboxP; + box.y2 = pboxP[numRects-1].y2; + pboxN = pboxP + 1; + for (i = numRects; --i > 0; pboxP++, pboxN++) + { + if ((pboxN->x1 >= pboxN->x2) || + (pboxN->y1 >= pboxN->y2)) + return PIXMAN_REGION_STATUS_FAILURE; + if (pboxN->x1 < box.x1) + box.x1 = pboxN->x1; + if (pboxN->x2 > box.x2) + box.x2 = pboxN->x2; + if ((pboxN->y1 < pboxP->y1) || + ((pboxN->y1 == pboxP->y1) && + ((pboxN->x1 < pboxP->x2) || (pboxN->y2 != pboxP->y2)))) + return PIXMAN_REGION_STATUS_FAILURE; + } + return ((box.x1 == reg->extents.x1) && + (box.x2 == reg->extents.x2) && + (box.y1 == reg->extents.y1) && + (box.y2 == reg->extents.y2)); + } +} + +#endif /* DEBUG */ + + +/* Create a new empty region */ +pixman_region16_t * +pixman_region_create (void) +{ + return pixman_region_create_simple (NULL); +} + +/***************************************************************** + * pixman_region_create_simple (extents) + * This routine creates a pixman_region16_t for a simple + * rectangular region. + *****************************************************************/ +pixman_region16_t * +pixman_region_create_simple (pixman_box16_t *extents) +{ + pixman_region16_t *region; + + region = malloc (sizeof (pixman_region16_t)); + if (region == NULL) + return &pixman_brokenregion; + + pixman_init (region, extents); + + return region; +} +slim_hidden_def(pixman_region_create_simple); + +/***************************************************************** + * RegionInit(pReg, rect, size) + * Outer region rect is statically allocated. + *****************************************************************/ + +static void +pixman_init(pixman_region16_t *region, pixman_box16_t *extents) +{ + if (extents) + { + region->extents = *extents; + region->data = NULL; + } + else + { + region->extents = pixman_region_emptyBox; + region->data = &pixman_region_emptyData; + } +} + +static void +pixman_uninit (pixman_region16_t *region) +{ + good (region); + freeData (region); +} + +void +pixman_region_destroy (pixman_region16_t *region) +{ + pixman_uninit (region); + + if (region != &pixman_brokenregion) + free (region); +} + +int +pixman_region_num_rects (pixman_region16_t *region) +{ + return PIXREGION_NUM_RECTS (region); +} + +pixman_box16_t * +pixman_region_rects (pixman_region16_t *region) +{ + return PIXREGION_RECTS (region); +} + +static pixman_region_status_t +pixman_break (pixman_region16_t *region) +{ + freeData (region); + region->extents = pixman_region_emptyBox; + region->data = &pixman_brokendata; + return PIXMAN_REGION_STATUS_FAILURE; +} + +static pixman_region_status_t +pixman_rect_alloc(pixman_region16_t * region, int n) +{ + pixman_region16_data_t *data; + + if (!region->data) + { + n++; + region->data = allocData(n); + if (!region->data) + return pixman_break (region); + region->data->numRects = 1; + *PIXREGION_BOXPTR(region) = region->extents; + } + else if (!region->data->size) + { + region->data = allocData(n); + if (!region->data) + return pixman_break (region); + region->data->numRects = 0; + } + else + { + if (n == 1) + { + n = region->data->numRects; + if (n > 500) /* XXX pick numbers out of a hat */ + n = 250; + } + n += region->data->numRects; + data = (pixman_region16_data_t *)realloc(region->data, PIXREGION_SZOF(n)); + if (!data) + return pixman_break (region); + region->data = data; + } + region->data->size = n; + return PIXMAN_REGION_STATUS_SUCCESS; +} + +pixman_region_status_t +pixman_region_copy(pixman_region16_t *dst, pixman_region16_t *src) +{ + good(dst); + good(src); + if (dst == src) + return PIXMAN_REGION_STATUS_SUCCESS; + dst->extents = src->extents; + if (!src->data || !src->data->size) + { + freeData(dst); + dst->data = src->data; + return PIXMAN_REGION_STATUS_SUCCESS; + } + if (!dst->data || (dst->data->size < src->data->numRects)) + { + freeData(dst); + dst->data = allocData(src->data->numRects); + if (!dst->data) + return pixman_break (dst); + dst->data->size = src->data->numRects; + } + dst->data->numRects = src->data->numRects; + memmove((char *)PIXREGION_BOXPTR(dst),(char *)PIXREGION_BOXPTR(src), + dst->data->numRects * sizeof(pixman_box16_t)); + return PIXMAN_REGION_STATUS_SUCCESS; +} +slim_hidden_def(pixman_region_copy); + + +/*====================================================================== + * Generic Region Operator + *====================================================================*/ + +/*- + *----------------------------------------------------------------------- + * pixman_coalesce -- + * Attempt to merge the boxes in the current band with those in the + * previous one. We are guaranteed that the current band extends to + * the end of the rects array. Used only by pixman_op. + * + * Results: + * The new index for the previous band. + * + * Side Effects: + * If coalescing takes place: + * - rectangles in the previous band will have their y2 fields + * altered. + * - region->data->numRects will be decreased. + * + *----------------------------------------------------------------------- + */ +INLINE static int +pixman_coalesce ( + pixman_region16_t * region, /* Region to coalesce */ + int prevStart, /* Index of start of previous band */ + int curStart) /* Index of start of current band */ +{ + pixman_box16_t * pPrevBox; /* Current box in previous band */ + pixman_box16_t * pCurBox; /* Current box in current band */ + int numRects; /* Number rectangles in both bands */ + int y2; /* Bottom of current band */ + /* + * Figure out how many rectangles are in the band. + */ + numRects = curStart - prevStart; + assert(numRects == region->data->numRects - curStart); + + if (!numRects) return curStart; + + /* + * The bands may only be coalesced if the bottom of the previous + * matches the top scanline of the current. + */ + pPrevBox = PIXREGION_BOX(region, prevStart); + pCurBox = PIXREGION_BOX(region, curStart); + if (pPrevBox->y2 != pCurBox->y1) return curStart; + + /* + * Make sure the bands have boxes in the same places. This + * assumes that boxes have been added in such a way that they + * cover the most area possible. I.e. two boxes in a band must + * have some horizontal space between them. + */ + y2 = pCurBox->y2; + + do { + if ((pPrevBox->x1 != pCurBox->x1) || (pPrevBox->x2 != pCurBox->x2)) { + return (curStart); + } + pPrevBox++; + pCurBox++; + numRects--; + } while (numRects); + + /* + * The bands may be merged, so set the bottom y of each box + * in the previous band to the bottom y of the current band. + */ + numRects = curStart - prevStart; + region->data->numRects -= numRects; + do { + pPrevBox--; + pPrevBox->y2 = y2; + numRects--; + } while (numRects); + return prevStart; +} + + +/* Quicky macro to avoid trivial reject procedure calls to pixman_coalesce */ + +#define Coalesce(newReg, prevBand, curBand) \ + if (curBand - prevBand == newReg->data->numRects - curBand) { \ + prevBand = pixman_coalesce(newReg, prevBand, curBand); \ + } else { \ + prevBand = curBand; \ + } + +/*- + *----------------------------------------------------------------------- + * pixman_region_appendNonO -- + * Handle a non-overlapping band for the union and subtract operations. + * Just adds the (top/bottom-clipped) rectangles into the region. + * Doesn't have to check for subsumption or anything. + * + * Results: + * None. + * + * Side Effects: + * region->data->numRects is incremented and the rectangles overwritten + * with the rectangles we're passed. + * + *----------------------------------------------------------------------- + */ + +INLINE static pixman_region_status_t +pixman_region_appendNonO ( + pixman_region16_t * region, + pixman_box16_t * r, + pixman_box16_t * rEnd, + int y1, + int y2) +{ + pixman_box16_t * pNextRect; + int newRects; + + newRects = rEnd - r; + + assert(y1 < y2); + assert(newRects != 0); + + /* Make sure we have enough space for all rectangles to be added */ + RECTALLOC(region, newRects); + pNextRect = PIXREGION_TOP(region); + region->data->numRects += newRects; + do { + assert(r->x1 < r->x2); + ADDRECT(pNextRect, r->x1, y1, r->x2, y2); + r++; + } while (r != rEnd); + + return PIXMAN_REGION_STATUS_SUCCESS; +} + +#define FindBand(r, rBandEnd, rEnd, ry1) \ +{ \ + ry1 = r->y1; \ + rBandEnd = r+1; \ + while ((rBandEnd != rEnd) && (rBandEnd->y1 == ry1)) { \ + rBandEnd++; \ + } \ +} + +#define AppendRegions(newReg, r, rEnd) \ +{ \ + int newRects; \ + if ((newRects = rEnd - r)) { \ + RECTALLOC(newReg, newRects); \ + memmove((char *)PIXREGION_TOP(newReg),(char *)r, \ + newRects * sizeof(pixman_box16_t)); \ + newReg->data->numRects += newRects; \ + } \ +} + +/*- + *----------------------------------------------------------------------- + * pixman_op -- + * Apply an operation to two regions. Called by pixman_region_union, pixman_region_inverse, + * pixman_region_subtract, pixman_region_intersect.... Both regions MUST have at least one + * rectangle, and cannot be the same object. + * + * Results: + * PIXMAN_REGION_STATUS_SUCCESS if successful. + * + * Side Effects: + * The new region is overwritten. + * pOverlap set to PIXMAN_REGION_STATUS_SUCCESS if overlapFunc ever returns PIXMAN_REGION_STATUS_SUCCESS. + * + * Notes: + * The idea behind this function is to view the two regions as sets. + * Together they cover a rectangle of area that this function divides + * into horizontal bands where points are covered only by one region + * or by both. For the first case, the nonOverlapFunc is called with + * each the band and the band's upper and lower extents. For the + * second, the overlapFunc is called to process the entire band. It + * is responsible for clipping the rectangles in the band, though + * this function provides the boundaries. + * At the end of each band, the new region is coalesced, if possible, + * to reduce the number of rectangles in the region. + * + *----------------------------------------------------------------------- + */ + +typedef pixman_region_status_t (*OverlapProcPtr)( + pixman_region16_t *region, + pixman_box16_t *r1, + pixman_box16_t *r1End, + pixman_box16_t *r2, + pixman_box16_t *r2End, + short y1, + short y2, + int *pOverlap); + +static pixman_region_status_t +pixman_op( + pixman_region16_t * newReg, /* Place to store result */ + pixman_region16_t * reg1, /* First region in operation */ + pixman_region16_t * reg2, /* 2d region in operation */ + OverlapProcPtr overlapFunc, /* Function to call for over- + * lapping bands */ + int appendNon1, /* Append non-overlapping bands */ + /* in region 1 ? */ + int appendNon2, /* Append non-overlapping bands */ + /* in region 2 ? */ + int *pOverlap) +{ + pixman_box16_t * r1; /* Pointer into first region */ + pixman_box16_t * r2; /* Pointer into 2d region */ + pixman_box16_t * r1End; /* End of 1st region */ + pixman_box16_t * r2End; /* End of 2d region */ + short ybot; /* Bottom of intersection */ + short ytop; /* Top of intersection */ + pixman_region16_data_t * oldData; /* Old data for newReg */ + int prevBand; /* Index of start of + * previous band in newReg */ + int curBand; /* Index of start of current + * band in newReg */ + pixman_box16_t * r1BandEnd; /* End of current band in r1 */ + pixman_box16_t * r2BandEnd; /* End of current band in r2 */ + short top; /* Top of non-overlapping band */ + short bot; /* Bottom of non-overlapping band*/ + int r1y1; /* Temps for r1->y1 and r2->y1 */ + int r2y1; + int newSize; + int numRects; + + /* + * Break any region computed from a broken region + */ + if (PIXREGION_NAR (reg1) || PIXREGION_NAR(reg2)) + return pixman_break (newReg); + + /* + * Initialization: + * set r1, r2, r1End and r2End appropriately, save the rectangles + * of the destination region until the end in case it's one of + * the two source regions, then mark the "new" region empty, allocating + * another array of rectangles for it to use. + */ + + r1 = PIXREGION_RECTS(reg1); + newSize = PIXREGION_NUM_RECTS(reg1); + r1End = r1 + newSize; + numRects = PIXREGION_NUM_RECTS(reg2); + r2 = PIXREGION_RECTS(reg2); + r2End = r2 + numRects; + assert(r1 != r1End); + assert(r2 != r2End); + + oldData = (pixman_region16_data_t *)NULL; + if (((newReg == reg1) && (newSize > 1)) || + ((newReg == reg2) && (numRects > 1))) + { + oldData = newReg->data; + newReg->data = &pixman_region_emptyData; + } + /* guess at new size */ + if (numRects > newSize) + newSize = numRects; + newSize <<= 1; + if (!newReg->data) + newReg->data = &pixman_region_emptyData; + else if (newReg->data->size) + newReg->data->numRects = 0; + if (newSize > newReg->data->size) + if (!pixman_rect_alloc(newReg, newSize)) + return PIXMAN_REGION_STATUS_FAILURE; + + /* + * Initialize ybot. + * In the upcoming loop, ybot and ytop serve different functions depending + * on whether the band being handled is an overlapping or non-overlapping + * band. + * In the case of a non-overlapping band (only one of the regions + * has points in the band), ybot is the bottom of the most recent + * intersection and thus clips the top of the rectangles in that band. + * ytop is the top of the next intersection between the two regions and + * serves to clip the bottom of the rectangles in the current band. + * For an overlapping band (where the two regions intersect), ytop clips + * the top of the rectangles of both regions and ybot clips the bottoms. + */ + + ybot = MIN(r1->y1, r2->y1); + + /* + * prevBand serves to mark the start of the previous band so rectangles + * can be coalesced into larger rectangles. qv. pixman_coalesce, above. + * In the beginning, there is no previous band, so prevBand == curBand + * (curBand is set later on, of course, but the first band will always + * start at index 0). prevBand and curBand must be indices because of + * the possible expansion, and resultant moving, of the new region's + * array of rectangles. + */ + prevBand = 0; + + do { + /* + * This algorithm proceeds one source-band (as opposed to a + * destination band, which is determined by where the two regions + * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the + * rectangle after the last one in the current band for their + * respective regions. + */ + assert(r1 != r1End); + assert(r2 != r2End); + + FindBand(r1, r1BandEnd, r1End, r1y1); + FindBand(r2, r2BandEnd, r2End, r2y1); + + /* + * First handle the band that doesn't intersect, if any. + * + * Note that attention is restricted to one band in the + * non-intersecting region at once, so if a region has n + * bands between the current position and the next place it overlaps + * the other, this entire loop will be passed through n times. + */ + if (r1y1 < r2y1) { + if (appendNon1) { + top = MAX(r1y1, ybot); + bot = MIN(r1->y2, r2y1); + if (top != bot) { + curBand = newReg->data->numRects; + pixman_region_appendNonO(newReg, r1, r1BandEnd, top, bot); + Coalesce(newReg, prevBand, curBand); + } + } + ytop = r2y1; + } else if (r2y1 < r1y1) { + if (appendNon2) { + top = MAX(r2y1, ybot); + bot = MIN(r2->y2, r1y1); + if (top != bot) { + curBand = newReg->data->numRects; + pixman_region_appendNonO(newReg, r2, r2BandEnd, top, bot); + Coalesce(newReg, prevBand, curBand); + } + } + ytop = r1y1; + } else { + ytop = r1y1; + } + + /* + * Now see if we've hit an intersecting band. The two bands only + * intersect if ybot > ytop + */ + ybot = MIN(r1->y2, r2->y2); + if (ybot > ytop) { + curBand = newReg->data->numRects; + (* overlapFunc)(newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot, + pOverlap); + Coalesce(newReg, prevBand, curBand); + } + + /* + * If we've finished with a band (y2 == ybot) we skip forward + * in the region to the next band. + */ + if (r1->y2 == ybot) r1 = r1BandEnd; + if (r2->y2 == ybot) r2 = r2BandEnd; + + } while (r1 != r1End && r2 != r2End); + + /* + * Deal with whichever region (if any) still has rectangles left. + * + * We only need to worry about banding and coalescing for the very first + * band left. After that, we can just group all remaining boxes, + * regardless of how many bands, into one final append to the list. + */ + + if ((r1 != r1End) && appendNon1) { + /* Do first nonOverlap1Func call, which may be able to coalesce */ + FindBand(r1, r1BandEnd, r1End, r1y1); + curBand = newReg->data->numRects; + pixman_region_appendNonO(newReg, r1, r1BandEnd, MAX(r1y1, ybot), r1->y2); + Coalesce(newReg, prevBand, curBand); + /* Just append the rest of the boxes */ + AppendRegions(newReg, r1BandEnd, r1End); + + } else if ((r2 != r2End) && appendNon2) { + /* Do first nonOverlap2Func call, which may be able to coalesce */ + FindBand(r2, r2BandEnd, r2End, r2y1); + curBand = newReg->data->numRects; + pixman_region_appendNonO(newReg, r2, r2BandEnd, MAX(r2y1, ybot), r2->y2); + Coalesce(newReg, prevBand, curBand); + /* Append rest of boxes */ + AppendRegions(newReg, r2BandEnd, r2End); + } + + if (oldData) + free(oldData); + + if (!(numRects = newReg->data->numRects)) + { + freeData(newReg); + newReg->data = &pixman_region_emptyData; + } + else if (numRects == 1) + { + newReg->extents = *PIXREGION_BOXPTR(newReg); + freeData(newReg); + newReg->data = (pixman_region16_data_t *)NULL; + } + else + { + DOWNSIZE(newReg, numRects); + } + + return PIXMAN_REGION_STATUS_SUCCESS; +} + +/*- + *----------------------------------------------------------------------- + * pixman_set_extents -- + * Reset the extents of a region to what they should be. Called by + * pixman_region_subtract and pixman_region_intersect as they can't figure it out along the + * way or do so easily, as pixman_region_union can. + * + * Results: + * None. + * + * Side Effects: + * The region's 'extents' structure is overwritten. + * + *----------------------------------------------------------------------- + */ +static void +pixman_set_extents (pixman_region16_t *region) +{ + pixman_box16_t *box, *boxEnd; + + if (!region->data) + return; + if (!region->data->size) + { + region->extents.x2 = region->extents.x1; + region->extents.y2 = region->extents.y1; + return; + } + + box = PIXREGION_BOXPTR(region); + boxEnd = PIXREGION_END(region); + + /* + * Since box is the first rectangle in the region, it must have the + * smallest y1 and since boxEnd is the last rectangle in the region, + * it must have the largest y2, because of banding. Initialize x1 and + * x2 from box and boxEnd, resp., as good things to initialize them + * to... + */ + region->extents.x1 = box->x1; + region->extents.y1 = box->y1; + region->extents.x2 = boxEnd->x2; + region->extents.y2 = boxEnd->y2; + + assert(region->extents.y1 < region->extents.y2); + while (box <= boxEnd) { + if (box->x1 < region->extents.x1) + region->extents.x1 = box->x1; + if (box->x2 > region->extents.x2) + region->extents.x2 = box->x2; + box++; + }; + + assert(region->extents.x1 < region->extents.x2); +} + +/*====================================================================== + * Region Intersection + *====================================================================*/ +/*- + *----------------------------------------------------------------------- + * pixman_region_intersectO -- + * Handle an overlapping band for pixman_region_intersect. + * + * Results: + * PIXMAN_REGION_STATUS_SUCCESS if successful. + * + * Side Effects: + * Rectangles may be added to the region. + * + *----------------------------------------------------------------------- + */ +/*ARGSUSED*/ +static pixman_region_status_t +pixman_region_intersectO ( + pixman_region16_t * region, + pixman_box16_t * r1, + pixman_box16_t * r1End, + pixman_box16_t * r2, + pixman_box16_t * r2End, + short y1, + short y2, + int *pOverlap) +{ + int x1; + int x2; + pixman_box16_t * pNextRect; + + pNextRect = PIXREGION_TOP(region); + + assert(y1 < y2); + assert(r1 != r1End && r2 != r2End); + + do { + x1 = MAX(r1->x1, r2->x1); + x2 = MIN(r1->x2, r2->x2); + + /* + * If there's any overlap between the two rectangles, add that + * overlap to the new region. + */ + if (x1 < x2) + NEWRECT(region, pNextRect, x1, y1, x2, y2); + + /* + * Advance the pointer(s) with the leftmost right side, since the next + * rectangle on that list may still overlap the other region's + * current rectangle. + */ + if (r1->x2 == x2) { + r1++; + } + if (r2->x2 == x2) { + r2++; + } + } while ((r1 != r1End) && (r2 != r2End)); + + return PIXMAN_REGION_STATUS_SUCCESS; +} + + +pixman_region_status_t +pixman_region_intersect(newReg, reg1, reg2) + pixman_region16_t * newReg; /* destination Region */ + pixman_region16_t * reg1; + pixman_region16_t * reg2; /* source regions */ +{ + good(reg1); + good(reg2); + good(newReg); + /* check for trivial reject */ + if (PIXREGION_NIL(reg1) || PIXREGION_NIL(reg2) || + !EXTENTCHECK(®1->extents, ®2->extents)) + { + /* Covers about 20% of all cases */ + freeData(newReg); + newReg->extents.x2 = newReg->extents.x1; + newReg->extents.y2 = newReg->extents.y1; + if (PIXREGION_NAR(reg1) || PIXREGION_NAR(reg2)) + { + newReg->data = &pixman_brokendata; + return PIXMAN_REGION_STATUS_FAILURE; + } + else + newReg->data = &pixman_region_emptyData; + } + else if (!reg1->data && !reg2->data) + { + /* Covers about 80% of cases that aren't trivially rejected */ + newReg->extents.x1 = MAX(reg1->extents.x1, reg2->extents.x1); + newReg->extents.y1 = MAX(reg1->extents.y1, reg2->extents.y1); + newReg->extents.x2 = MIN(reg1->extents.x2, reg2->extents.x2); + newReg->extents.y2 = MIN(reg1->extents.y2, reg2->extents.y2); + freeData(newReg); + newReg->data = (pixman_region16_data_t *)NULL; + } + else if (!reg2->data && SUBSUMES(®2->extents, ®1->extents)) + { + return pixman_region_copy(newReg, reg1); + } + else if (!reg1->data && SUBSUMES(®1->extents, ®2->extents)) + { + return pixman_region_copy(newReg, reg2); + } + else if (reg1 == reg2) + { + return pixman_region_copy(newReg, reg1); + } + else + { + /* General purpose intersection */ + int overlap; /* result ignored */ + if (!pixman_op(newReg, reg1, reg2, pixman_region_intersectO, PIXMAN_REGION_STATUS_FAILURE, PIXMAN_REGION_STATUS_FAILURE, + &overlap)) + return PIXMAN_REGION_STATUS_FAILURE; + pixman_set_extents(newReg); + } + + good(newReg); + return(PIXMAN_REGION_STATUS_SUCCESS); +} + +#define MERGERECT(r) \ +{ \ + if (r->x1 <= x2) { \ + /* Merge with current rectangle */ \ + if (r->x1 < x2) *pOverlap = PIXMAN_REGION_STATUS_SUCCESS; \ + if (x2 < r->x2) x2 = r->x2; \ + } else { \ + /* Add current rectangle, start new one */ \ + NEWRECT(region, pNextRect, x1, y1, x2, y2); \ + x1 = r->x1; \ + x2 = r->x2; \ + } \ + r++; \ +} + +/*====================================================================== + * Region Union + *====================================================================*/ + +/*- + *----------------------------------------------------------------------- + * pixman_region_unionO -- + * Handle an overlapping band for the union operation. Picks the + * left-most rectangle each time and merges it into the region. + * + * Results: + * PIXMAN_REGION_STATUS_SUCCESS if successful. + * + * Side Effects: + * region is overwritten. + * pOverlap is set to PIXMAN_REGION_STATUS_SUCCESS if any boxes overlap. + * + *----------------------------------------------------------------------- + */ +static pixman_region_status_t +pixman_region_unionO ( + pixman_region16_t *region, + pixman_box16_t *r1, + pixman_box16_t *r1End, + pixman_box16_t *r2, + pixman_box16_t *r2End, + short y1, + short y2, + int *pOverlap) +{ + pixman_box16_t * pNextRect; + int x1; /* left and right side of current union */ + int x2; + + assert (y1 < y2); + assert(r1 != r1End && r2 != r2End); + + pNextRect = PIXREGION_TOP(region); + + /* Start off current rectangle */ + if (r1->x1 < r2->x1) + { + x1 = r1->x1; + x2 = r1->x2; + r1++; + } + else + { + x1 = r2->x1; + x2 = r2->x2; + r2++; + } + while (r1 != r1End && r2 != r2End) + { + if (r1->x1 < r2->x1) MERGERECT(r1) else MERGERECT(r2); + } + + /* Finish off whoever (if any) is left */ + if (r1 != r1End) + { + do + { + MERGERECT(r1); + } while (r1 != r1End); + } + else if (r2 != r2End) + { + do + { + MERGERECT(r2); + } while (r2 != r2End); + } + + /* Add current rectangle */ + NEWRECT(region, pNextRect, x1, y1, x2, y2); + + return PIXMAN_REGION_STATUS_SUCCESS; +} + +/* Convenience function for performing union of region with a single rectangle */ +pixman_region_status_t +pixman_region_union_rect(pixman_region16_t *dest, pixman_region16_t *source, + int x, int y, unsigned int width, unsigned int height) +{ + pixman_region16_t region; + + if (!width || !height) + return PIXMAN_REGION_STATUS_SUCCESS; + region.data = NULL; + region.extents.x1 = x; + region.extents.y1 = y; + region.extents.x2 = x + width; + region.extents.y2 = y + height; + + return pixman_region_union (dest, source, ®ion); +} + +pixman_region_status_t +pixman_region_union(pixman_region16_t *newReg, pixman_region16_t *reg1, pixman_region16_t *reg2) +{ + int overlap; /* result ignored */ + + /* Return PIXMAN_REGION_STATUS_SUCCESS if some overlap between reg1, reg2 */ + good(reg1); + good(reg2); + good(newReg); + /* checks all the simple cases */ + + /* + * Region 1 and 2 are the same + */ + if (reg1 == reg2) + { + return pixman_region_copy(newReg, reg1); + } + + /* + * Region 1 is empty + */ + if (PIXREGION_NIL(reg1)) + { + if (PIXREGION_NAR(reg1)) + return pixman_break (newReg); + if (newReg != reg2) + return pixman_region_copy(newReg, reg2); + return PIXMAN_REGION_STATUS_SUCCESS; + } + + /* + * Region 2 is empty + */ + if (PIXREGION_NIL(reg2)) + { + if (PIXREGION_NAR(reg2)) + return pixman_break (newReg); + if (newReg != reg1) + return pixman_region_copy(newReg, reg1); + return PIXMAN_REGION_STATUS_SUCCESS; + } + + /* + * Region 1 completely subsumes region 2 + */ + if (!reg1->data && SUBSUMES(®1->extents, ®2->extents)) + { + if (newReg != reg1) + return pixman_region_copy(newReg, reg1); + return PIXMAN_REGION_STATUS_SUCCESS; + } + + /* + * Region 2 completely subsumes region 1 + */ + if (!reg2->data && SUBSUMES(®2->extents, ®1->extents)) + { + if (newReg != reg2) + return pixman_region_copy(newReg, reg2); + return PIXMAN_REGION_STATUS_SUCCESS; + } + + if (!pixman_op(newReg, reg1, reg2, pixman_region_unionO, PIXMAN_REGION_STATUS_SUCCESS, PIXMAN_REGION_STATUS_SUCCESS, &overlap)) + return PIXMAN_REGION_STATUS_FAILURE; + + newReg->extents.x1 = MIN(reg1->extents.x1, reg2->extents.x1); + newReg->extents.y1 = MIN(reg1->extents.y1, reg2->extents.y1); + newReg->extents.x2 = MAX(reg1->extents.x2, reg2->extents.x2); + newReg->extents.y2 = MAX(reg1->extents.y2, reg2->extents.y2); + good(newReg); + return PIXMAN_REGION_STATUS_SUCCESS; +} +slim_hidden_def(pixman_region_union); + + +/*====================================================================== + * Batch Rectangle Union + *====================================================================*/ + +/*- + *----------------------------------------------------------------------- + * pixman_region_append -- + * + * "Append" the rgn rectangles onto the end of dstrgn, maintaining + * knowledge of YX-banding when it's easy. Otherwise, dstrgn just + * becomes a non-y-x-banded random collection of rectangles, and not + * yet a true region. After a sequence of appends, the caller must + * call pixman_region_validate to ensure that a valid region is constructed. + * + * Results: + * PIXMAN_REGION_STATUS_SUCCESS if successful. + * + * Side Effects: + * dstrgn is modified if rgn has rectangles. + * + */ +pixman_region_status_t +pixman_region_append(dstrgn, rgn) + pixman_region16_t * dstrgn; + pixman_region16_t * rgn; +{ + int numRects, dnumRects, size; + pixman_box16_t *new, *old; + int prepend; + + if (PIXREGION_NAR(rgn)) + return pixman_break (dstrgn); + + if (!rgn->data && (dstrgn->data == &pixman_region_emptyData)) + { + dstrgn->extents = rgn->extents; + dstrgn->data = (pixman_region16_data_t *)NULL; + return PIXMAN_REGION_STATUS_SUCCESS; + } + + numRects = PIXREGION_NUM_RECTS(rgn); + if (!numRects) + return PIXMAN_REGION_STATUS_SUCCESS; + prepend = PIXMAN_REGION_STATUS_FAILURE; + size = numRects; + dnumRects = PIXREGION_NUM_RECTS(dstrgn); + if (!dnumRects && (size < 200)) + size = 200; /* XXX pick numbers out of a hat */ + RECTALLOC(dstrgn, size); + old = PIXREGION_RECTS(rgn); + if (!dnumRects) + dstrgn->extents = rgn->extents; + else if (dstrgn->extents.x2 > dstrgn->extents.x1) + { + pixman_box16_t *first, *last; + + first = old; + last = PIXREGION_BOXPTR(dstrgn) + (dnumRects - 1); + if ((first->y1 > last->y2) || + ((first->y1 == last->y1) && (first->y2 == last->y2) && + (first->x1 > last->x2))) + { + if (rgn->extents.x1 < dstrgn->extents.x1) + dstrgn->extents.x1 = rgn->extents.x1; + if (rgn->extents.x2 > dstrgn->extents.x2) + dstrgn->extents.x2 = rgn->extents.x2; + dstrgn->extents.y2 = rgn->extents.y2; + } + else + { + first = PIXREGION_BOXPTR(dstrgn); + last = old + (numRects - 1); + if ((first->y1 > last->y2) || + ((first->y1 == last->y1) && (first->y2 == last->y2) && + (first->x1 > last->x2))) + { + prepend = PIXMAN_REGION_STATUS_SUCCESS; + if (rgn->extents.x1 < dstrgn->extents.x1) + dstrgn->extents.x1 = rgn->extents.x1; + if (rgn->extents.x2 > dstrgn->extents.x2) + dstrgn->extents.x2 = rgn->extents.x2; + dstrgn->extents.y1 = rgn->extents.y1; + } + else + dstrgn->extents.x2 = dstrgn->extents.x1; + } + } + if (prepend) + { + new = PIXREGION_BOX(dstrgn, numRects); + if (dnumRects == 1) + *new = *PIXREGION_BOXPTR(dstrgn); + else + memmove((char *)new,(char *)PIXREGION_BOXPTR(dstrgn), + dnumRects * sizeof(pixman_box16_t)); + new = PIXREGION_BOXPTR(dstrgn); + } + else + new = PIXREGION_BOXPTR(dstrgn) + dnumRects; + if (numRects == 1) + *new = *old; + else + memmove((char *)new, (char *)old, numRects * sizeof(pixman_box16_t)); + dstrgn->data->numRects += numRects; + return PIXMAN_REGION_STATUS_SUCCESS; +} + + +#define ExchangeRects(a, b) \ +{ \ + pixman_box16_t t; \ + t = rects[a]; \ + rects[a] = rects[b]; \ + rects[b] = t; \ +} + +static void +QuickSortRects( + pixman_box16_t rects[], + int numRects) +{ + int y1; + int x1; + int i, j; + pixman_box16_t *r; + + /* Always called with numRects > 1 */ + + do + { + if (numRects == 2) + { + if (rects[0].y1 > rects[1].y1 || + (rects[0].y1 == rects[1].y1 && rects[0].x1 > rects[1].x1)) + ExchangeRects(0, 1); + return; + } + + /* Choose partition element, stick in location 0 */ + ExchangeRects(0, numRects >> 1); + y1 = rects[0].y1; + x1 = rects[0].x1; + + /* Partition array */ + i = 0; + j = numRects; + do + { + r = &(rects[i]); + do + { + r++; + i++; + } while (i != numRects && + (r->y1 < y1 || (r->y1 == y1 && r->x1 < x1))); + r = &(rects[j]); + do + { + r--; + j--; + } while (y1 < r->y1 || (y1 == r->y1 && x1 < r->x1)); + if (i < j) + ExchangeRects(i, j); + } while (i < j); + + /* Move partition element back to middle */ + ExchangeRects(0, j); + + /* Recurse */ + if (numRects-j-1 > 1) + QuickSortRects(&rects[j+1], numRects-j-1); + numRects = j; + } while (numRects > 1); +} + +/*- + *----------------------------------------------------------------------- + * pixman_region_validate -- + * + * Take a ``region'' which is a non-y-x-banded random collection of + * rectangles, and compute a nice region which is the union of all the + * rectangles. + * + * Results: + * PIXMAN_REGION_STATUS_SUCCESS if successful. + * + * Side Effects: + * The passed-in ``region'' may be modified. + * pOverlap set to PIXMAN_REGION_STATUS_SUCCESS if any retangles overlapped, else PIXMAN_REGION_STATUS_FAILURE; + * + * Strategy: + * Step 1. Sort the rectangles into ascending order with primary key y1 + * and secondary key x1. + * + * Step 2. Split the rectangles into the minimum number of proper y-x + * banded regions. This may require horizontally merging + * rectangles, and vertically coalescing bands. With any luck, + * this step in an identity tranformation (ala the Box widget), + * or a coalescing into 1 box (ala Menus). + * + * Step 3. Merge the separate regions down to a single region by calling + * pixman_region_union. Maximize the work each pixman_region_union call does by using + * a binary merge. + * + *----------------------------------------------------------------------- + */ + +pixman_region_status_t +pixman_region_validate(badreg, pOverlap) + pixman_region16_t * badreg; + int *pOverlap; +{ + /* Descriptor for regions under construction in Step 2. */ + typedef struct { + pixman_region16_t reg; + int prevBand; + int curBand; + } RegionInfo; + + int numRects; /* Original numRects for badreg */ + RegionInfo *ri; /* Array of current regions */ + int numRI; /* Number of entries used in ri */ + int sizeRI; /* Number of entries available in ri */ + int i; /* Index into rects */ + int j; /* Index into ri */ + RegionInfo *rit; /* &ri[j] */ + pixman_region16_t * reg; /* ri[j].reg */ + pixman_box16_t * box; /* Current box in rects */ + pixman_box16_t * riBox; /* Last box in ri[j].reg */ + pixman_region16_t * hreg; /* ri[j_half].reg */ + int ret = PIXMAN_REGION_STATUS_SUCCESS; + + *pOverlap = PIXMAN_REGION_STATUS_FAILURE; + if (!badreg->data) + { + good(badreg); + return PIXMAN_REGION_STATUS_SUCCESS; + } + numRects = badreg->data->numRects; + if (!numRects) + { + if (PIXREGION_NAR(badreg)) + return PIXMAN_REGION_STATUS_FAILURE; + good(badreg); + return PIXMAN_REGION_STATUS_SUCCESS; + } + if (badreg->extents.x1 < badreg->extents.x2) + { + if ((numRects) == 1) + { + freeData(badreg); + badreg->data = (pixman_region16_data_t *) NULL; + } + else + { + DOWNSIZE(badreg, numRects); + } + good(badreg); + return PIXMAN_REGION_STATUS_SUCCESS; + } + + /* Step 1: Sort the rects array into ascending (y1, x1) order */ + QuickSortRects(PIXREGION_BOXPTR(badreg), numRects); + + /* Step 2: Scatter the sorted array into the minimum number of regions */ + + /* Set up the first region to be the first rectangle in badreg */ + /* Note that step 2 code will never overflow the ri[0].reg rects array */ + ri = (RegionInfo *) malloc(4 * sizeof(RegionInfo)); + if (!ri) + return pixman_break (badreg); + sizeRI = 4; + numRI = 1; + ri[0].prevBand = 0; + ri[0].curBand = 0; + ri[0].reg = *badreg; + box = PIXREGION_BOXPTR(&ri[0].reg); + ri[0].reg.extents = *box; + ri[0].reg.data->numRects = 1; + + /* Now scatter rectangles into the minimum set of valid regions. If the + next rectangle to be added to a region would force an existing rectangle + in the region to be split up in order to maintain y-x banding, just + forget it. Try the next region. If it doesn't fit cleanly into any + region, make a new one. */ + + for (i = numRects; --i > 0;) + { + box++; + /* Look for a region to append box to */ + for (j = numRI, rit = ri; --j >= 0; rit++) + { + reg = &rit->reg; + riBox = PIXREGION_END(reg); + + if (box->y1 == riBox->y1 && box->y2 == riBox->y2) + { + /* box is in same band as riBox. Merge or append it */ + if (box->x1 <= riBox->x2) + { + /* Merge it with riBox */ + if (box->x1 < riBox->x2) *pOverlap = PIXMAN_REGION_STATUS_SUCCESS; + if (box->x2 > riBox->x2) riBox->x2 = box->x2; + } + else + { + RECTALLOC_BAIL(reg, 1, bail); + *PIXREGION_TOP(reg) = *box; + reg->data->numRects++; + } + goto NextRect; /* So sue me */ + } + else if (box->y1 >= riBox->y2) + { + /* Put box into new band */ + if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2; + if (reg->extents.x1 > box->x1) reg->extents.x1 = box->x1; + Coalesce(reg, rit->prevBand, rit->curBand); + rit->curBand = reg->data->numRects; + RECTALLOC_BAIL(reg, 1, bail); + *PIXREGION_TOP(reg) = *box; + reg->data->numRects++; + goto NextRect; + } + /* Well, this region was inappropriate. Try the next one. */ + } /* for j */ + + /* Uh-oh. No regions were appropriate. Create a new one. */ + if (sizeRI == numRI) + { + /* Oops, allocate space for new region information */ + sizeRI <<= 1; + rit = (RegionInfo *) realloc(ri, sizeRI * sizeof(RegionInfo)); + if (!rit) + goto bail; + ri = rit; + rit = &ri[numRI]; + } + numRI++; + rit->prevBand = 0; + rit->curBand = 0; + rit->reg.extents = *box; + rit->reg.data = (pixman_region16_data_t *)NULL; + if (!pixman_rect_alloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */ + goto bail; +NextRect: ; + } /* for i */ + + /* Make a final pass over each region in order to Coalesce and set + extents.x2 and extents.y2 */ + + for (j = numRI, rit = ri; --j >= 0; rit++) + { + reg = &rit->reg; + riBox = PIXREGION_END(reg); + reg->extents.y2 = riBox->y2; + if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2; + Coalesce(reg, rit->prevBand, rit->curBand); + if (reg->data->numRects == 1) /* keep unions happy below */ + { + freeData(reg); + reg->data = (pixman_region16_data_t *)NULL; + } + } + + /* Step 3: Union all regions into a single region */ + while (numRI > 1) + { + int half = numRI/2; + for (j = numRI & 1; j < (half + (numRI & 1)); j++) + { + reg = &ri[j].reg; + hreg = &ri[j+half].reg; + if (!pixman_op(reg, reg, hreg, pixman_region_unionO, PIXMAN_REGION_STATUS_SUCCESS, PIXMAN_REGION_STATUS_SUCCESS, pOverlap)) + ret = PIXMAN_REGION_STATUS_FAILURE; + if (hreg->extents.x1 < reg->extents.x1) + reg->extents.x1 = hreg->extents.x1; + if (hreg->extents.y1 < reg->extents.y1) + reg->extents.y1 = hreg->extents.y1; + if (hreg->extents.x2 > reg->extents.x2) + reg->extents.x2 = hreg->extents.x2; + if (hreg->extents.y2 > reg->extents.y2) + reg->extents.y2 = hreg->extents.y2; + freeData(hreg); + } + numRI -= half; + } + *badreg = ri[0].reg; + free(ri); + good(badreg); + return ret; +bail: + for (i = 0; i < numRI; i++) + freeData(&ri[i].reg); + free (ri); + return pixman_break (badreg); +} + +/* XXX: Need to fix this to not use any X data structure +pixman_region16_t * +pixman_region_rectsToRegion(nrects, prect, ctype) + int nrects; + xRectangle *prect; + int ctype; +{ + pixman_region16_t * region; + pixman_region16_data_t * pData; + pixman_box16_t * box; + int i; + int x1, y1, x2, y2; + + region = pixman_region_create(NullBox, 0); + if (PIXREGION_NAR (region)) + return region; + if (!nrects) + return region; + if (nrects == 1) + { + x1 = prect->x; + y1 = prect->y; + if ((x2 = x1 + (int) prect->width) > SHRT_MAX) + x2 = SHRT_MAX; + if ((y2 = y1 + (int) prect->height) > SHRT_MAX) + y2 = SHRT_MAX; + if (x1 != x2 && y1 != y2) + { + region->extents.x1 = x1; + region->extents.y1 = y1; + region->extents.x2 = x2; + region->extents.y2 = y2; + region->data = (pixman_region16_data_t *)NULL; + } + return region; + } + pData = allocData(nrects); + if (!pData) + { + pixman_break (region); + return region; + } + box = (pixman_box16_t *) (pData + 1); + for (i = nrects; --i >= 0; prect++) + { + x1 = prect->x; + y1 = prect->y; + if ((x2 = x1 + (int) prect->width) > SHRT_MAX) + x2 = SHRT_MAX; + if ((y2 = y1 + (int) prect->height) > SHRT_MAX) + y2 = SHRT_MAX; + if (x1 != x2 && y1 != y2) + { + box->x1 = x1; + box->y1 = y1; + box->x2 = x2; + box->y2 = y2; + box++; + } + } + if (box != (pixman_box16_t *) (pData + 1)) + { + pData->size = nrects; + pData->numRects = box - (pixman_box16_t *) (pData + 1); + region->data = pData; + if (ctype != CT_YXBANDED) + { + int overlap; + region->extents.x1 = region->extents.x2 = 0; + pixman_region_validate(region, &overlap); + } + else + pixman_set_extents(region); + good(region); + } + else + { + free (pData); + } + return region; +} +*/ + +/*====================================================================== + * Region Subtraction + *====================================================================*/ + + +/*- + *----------------------------------------------------------------------- + * pixman_region_subtractO -- + * Overlapping band subtraction. x1 is the left-most point not yet + * checked. + * + * Results: + * PIXMAN_REGION_STATUS_SUCCESS if successful. + * + * Side Effects: + * region may have rectangles added to it. + * + *----------------------------------------------------------------------- + */ +/*ARGSUSED*/ +static pixman_region_status_t +pixman_region_subtractO ( + pixman_region16_t * region, + pixman_box16_t * r1, + pixman_box16_t * r1End, + pixman_box16_t * r2, + pixman_box16_t * r2End, + short y1, + short y2, + int *pOverlap) +{ + pixman_box16_t * pNextRect; + int x1; + + x1 = r1->x1; + + assert(y1<y2); + assert(r1 != r1End && r2 != r2End); + + pNextRect = PIXREGION_TOP(region); + + do + { + if (r2->x2 <= x1) + { + /* + * Subtrahend entirely to left of minuend: go to next subtrahend. + */ + r2++; + } + else if (r2->x1 <= x1) + { + /* + * Subtrahend preceeds minuend: nuke left edge of minuend. + */ + x1 = r2->x2; + if (x1 >= r1->x2) + { + /* + * Minuend completely covered: advance to next minuend and + * reset left fence to edge of new minuend. + */ + r1++; + if (r1 != r1End) + x1 = r1->x1; + } + else + { + /* + * Subtrahend now used up since it doesn't extend beyond + * minuend + */ + r2++; + } + } + else if (r2->x1 < r1->x2) + { + /* + * Left part of subtrahend covers part of minuend: add uncovered + * part of minuend to region and skip to next subtrahend. + */ + assert(x1<r2->x1); + NEWRECT(region, pNextRect, x1, y1, r2->x1, y2); + + x1 = r2->x2; + if (x1 >= r1->x2) + { + /* + * Minuend used up: advance to new... + */ + r1++; + if (r1 != r1End) + x1 = r1->x1; + } + else + { + /* + * Subtrahend used up + */ + r2++; + } + } + else + { + /* + * Minuend used up: add any remaining piece before advancing. + */ + if (r1->x2 > x1) + NEWRECT(region, pNextRect, x1, y1, r1->x2, y2); + r1++; + if (r1 != r1End) + x1 = r1->x1; + } + } while ((r1 != r1End) && (r2 != r2End)); + + + /* + * Add remaining minuend rectangles to region. + */ + while (r1 != r1End) + { + assert(x1<r1->x2); + NEWRECT(region, pNextRect, x1, y1, r1->x2, y2); + r1++; + if (r1 != r1End) + x1 = r1->x1; + } + return PIXMAN_REGION_STATUS_SUCCESS; +} + +/*- + *----------------------------------------------------------------------- + * pixman_region_subtract -- + * Subtract regS from regM and leave the result in regD. + * S stands for subtrahend, M for minuend and D for difference. + * + * Results: + * PIXMAN_REGION_STATUS_SUCCESS if successful. + * + * Side Effects: + * regD is overwritten. + * + *----------------------------------------------------------------------- + */ +pixman_region_status_t +pixman_region_subtract(regD, regM, regS) + pixman_region16_t * regD; + pixman_region16_t * regM; + pixman_region16_t * regS; +{ + int overlap; /* result ignored */ + + good(regM); + good(regS); + good(regD); + /* check for trivial rejects */ + if (PIXREGION_NIL(regM) || PIXREGION_NIL(regS) || + !EXTENTCHECK(®M->extents, ®S->extents)) + { + if (PIXREGION_NAR (regS)) + return pixman_break (regD); + return pixman_region_copy(regD, regM); + } + else if (regM == regS) + { + freeData(regD); + regD->extents.x2 = regD->extents.x1; + regD->extents.y2 = regD->extents.y1; + regD->data = &pixman_region_emptyData; + return PIXMAN_REGION_STATUS_SUCCESS; + } + + /* Add those rectangles in region 1 that aren't in region 2, + do yucky substraction for overlaps, and + just throw away rectangles in region 2 that aren't in region 1 */ + if (!pixman_op(regD, regM, regS, pixman_region_subtractO, PIXMAN_REGION_STATUS_SUCCESS, PIXMAN_REGION_STATUS_FAILURE, &overlap)) + return PIXMAN_REGION_STATUS_FAILURE; + + /* + * Can't alter RegD's extents before we call pixman_op because + * it might be one of the source regions and pixman_op depends + * on the extents of those regions being unaltered. Besides, this + * way there's no checking against rectangles that will be nuked + * due to coalescing, so we have to examine fewer rectangles. + */ + pixman_set_extents(regD); + good(regD); + return PIXMAN_REGION_STATUS_SUCCESS; +} + +/*====================================================================== + * Region Inversion + *====================================================================*/ + +/*- + *----------------------------------------------------------------------- + * pixman_region_inverse -- + * Take a region and a box and return a region that is everything + * in the box but not in the region. The careful reader will note + * that this is the same as subtracting the region from the box... + * + * Results: + * PIXMAN_REGION_STATUS_SUCCESS. + * + * Side Effects: + * newReg is overwritten. + * + *----------------------------------------------------------------------- + */ +pixman_region_status_t +pixman_region_inverse(newReg, reg1, invRect) + pixman_region16_t * newReg; /* Destination region */ + pixman_region16_t * reg1; /* Region to invert */ + pixman_box16_t * invRect; /* Bounding box for inversion */ +{ + pixman_region16_t invReg; /* Quick and dirty region made from the + * bounding box */ + int overlap; /* result ignored */ + + good(reg1); + good(newReg); + /* check for trivial rejects */ + if (PIXREGION_NIL(reg1) || !EXTENTCHECK(invRect, ®1->extents)) + { + if (PIXREGION_NAR(reg1)) + return pixman_break (newReg); + newReg->extents = *invRect; + freeData(newReg); + newReg->data = (pixman_region16_data_t *)NULL; + return PIXMAN_REGION_STATUS_SUCCESS; + } + + /* Add those rectangles in region 1 that aren't in region 2, + do yucky substraction for overlaps, and + just throw away rectangles in region 2 that aren't in region 1 */ + invReg.extents = *invRect; + invReg.data = (pixman_region16_data_t *)NULL; + if (!pixman_op(newReg, &invReg, reg1, pixman_region_subtractO, PIXMAN_REGION_STATUS_SUCCESS, PIXMAN_REGION_STATUS_FAILURE, &overlap)) + return PIXMAN_REGION_STATUS_FAILURE; + + /* + * Can't alter newReg's extents before we call pixman_op because + * it might be one of the source regions and pixman_op depends + * on the extents of those regions being unaltered. Besides, this + * way there's no checking against rectangles that will be nuked + * due to coalescing, so we have to examine fewer rectangles. + */ + pixman_set_extents(newReg); + good(newReg); + return PIXMAN_REGION_STATUS_SUCCESS; +} + +/* + * RectIn(region, rect) + * This routine takes a pointer to a region and a pointer to a box + * and determines if the box is outside/inside/partly inside the region. + * + * The idea is to travel through the list of rectangles trying to cover the + * passed box with them. Anytime a piece of the rectangle isn't covered + * by a band of rectangles, partOut is set PIXMAN_REGION_STATUS_SUCCESS. Any time a rectangle in + * the region covers part of the box, partIn is set PIXMAN_REGION_STATUS_SUCCESS. The process ends + * when either the box has been completely covered (we reached a band that + * doesn't overlap the box, partIn is PIXMAN_REGION_STATUS_SUCCESS and partOut is false), the + * box has been partially covered (partIn == partOut == PIXMAN_REGION_STATUS_SUCCESS -- because of + * the banding, the first time this is true we know the box is only + * partially in the region) or is outside the region (we reached a band + * that doesn't overlap the box at all and partIn is false) + */ + +int +pixman_region_contains_rectangle(region, prect) + pixman_region16_t * region; + pixman_box16_t * prect; +{ + int x; + int y; + pixman_box16_t * pbox; + pixman_box16_t * pboxEnd; + int partIn, partOut; + int numRects; + + good(region); + numRects = PIXREGION_NUM_RECTS(region); + /* useful optimization */ + if (!numRects || !EXTENTCHECK(®ion->extents, prect)) + return(rgnOUT); + + if (numRects == 1) + { + /* We know that it must be rgnIN or rgnPART */ + if (SUBSUMES(®ion->extents, prect)) + return(rgnIN); + else + return(rgnPART); + } + + partOut = PIXMAN_REGION_STATUS_FAILURE; + partIn = PIXMAN_REGION_STATUS_FAILURE; + + /* (x,y) starts at upper left of rect, moving to the right and down */ + x = prect->x1; + y = prect->y1; + + /* can stop when both partOut and partIn are PIXMAN_REGION_STATUS_SUCCESS, or we reach prect->y2 */ + for (pbox = PIXREGION_BOXPTR(region), pboxEnd = pbox + numRects; + pbox != pboxEnd; + pbox++) + { + + if (pbox->y2 <= y) + continue; /* getting up to speed or skipping remainder of band */ + + if (pbox->y1 > y) + { + partOut = PIXMAN_REGION_STATUS_SUCCESS; /* missed part of rectangle above */ + if (partIn || (pbox->y1 >= prect->y2)) + break; + y = pbox->y1; /* x guaranteed to be == prect->x1 */ + } + + if (pbox->x2 <= x) + continue; /* not far enough over yet */ + + if (pbox->x1 > x) + { + partOut = PIXMAN_REGION_STATUS_SUCCESS; /* missed part of rectangle to left */ + if (partIn) + break; + } + + if (pbox->x1 < prect->x2) + { + partIn = PIXMAN_REGION_STATUS_SUCCESS; /* definitely overlap */ + if (partOut) + break; + } + + if (pbox->x2 >= prect->x2) + { + y = pbox->y2; /* finished with this band */ + if (y >= prect->y2) + break; + x = prect->x1; /* reset x out to left again */ + } + else + { + /* + * Because boxes in a band are maximal width, if the first box + * to overlap the rectangle doesn't completely cover it in that + * band, the rectangle must be partially out, since some of it + * will be uncovered in that band. partIn will have been set true + * by now... + */ + partOut = PIXMAN_REGION_STATUS_SUCCESS; + break; + } + } + + return(partIn ? ((y < prect->y2) ? rgnPART : rgnIN) : rgnOUT); +} + +/* pixman_region_translate (region, x, y) + translates in place +*/ + +void +pixman_region_translate (pixman_region16_t * region, int x, int y) +{ + int x1, x2, y1, y2; + int nbox; + pixman_box16_t * pbox; + + good(region); + region->extents.x1 = x1 = region->extents.x1 + x; + region->extents.y1 = y1 = region->extents.y1 + y; + region->extents.x2 = x2 = region->extents.x2 + x; + region->extents.y2 = y2 = region->extents.y2 + y; + if (((x1 - SHRT_MIN)|(y1 - SHRT_MIN)|(SHRT_MAX - x2)|(SHRT_MAX - y2)) >= 0) + { + if (region->data && (nbox = region->data->numRects)) + { + for (pbox = PIXREGION_BOXPTR(region); nbox--; pbox++) + { + pbox->x1 += x; + pbox->y1 += y; + pbox->x2 += x; + pbox->y2 += y; + } + } + return; + } + if (((x2 - SHRT_MIN)|(y2 - SHRT_MIN)|(SHRT_MAX - x1)|(SHRT_MAX - y1)) <= 0) + { + region->extents.x2 = region->extents.x1; + region->extents.y2 = region->extents.y1; + freeData(region); + region->data = &pixman_region_emptyData; + return; + } + if (x1 < SHRT_MIN) + region->extents.x1 = SHRT_MIN; + else if (x2 > SHRT_MAX) + region->extents.x2 = SHRT_MAX; + if (y1 < SHRT_MIN) + region->extents.y1 = SHRT_MIN; + else if (y2 > SHRT_MAX) + region->extents.y2 = SHRT_MAX; + if (region->data && (nbox = region->data->numRects)) + { + pixman_box16_t * pboxout; + + for (pboxout = pbox = PIXREGION_BOXPTR(region); nbox--; pbox++) + { + pboxout->x1 = x1 = pbox->x1 + x; + pboxout->y1 = y1 = pbox->y1 + y; + pboxout->x2 = x2 = pbox->x2 + x; + pboxout->y2 = y2 = pbox->y2 + y; + if (((x2 - SHRT_MIN)|(y2 - SHRT_MIN)| + (SHRT_MAX - x1)|(SHRT_MAX - y1)) <= 0) + { + region->data->numRects--; + continue; + } + if (x1 < SHRT_MIN) + pboxout->x1 = SHRT_MIN; + else if (x2 > SHRT_MAX) + pboxout->x2 = SHRT_MAX; + if (y1 < SHRT_MIN) + pboxout->y1 = SHRT_MIN; + else if (y2 > SHRT_MAX) + pboxout->y2 = SHRT_MAX; + pboxout++; + } + if (pboxout != pbox) + { + if (region->data->numRects == 1) + { + region->extents = *PIXREGION_BOXPTR(region); + freeData(region); + region->data = (pixman_region16_data_t *)NULL; + } + else + pixman_set_extents(region); + } + } +} + +/* XXX: Do we need this? +static pixman_region_status_t +pixman_region16_data_copy(pixman_region16_t * dst, pixman_region16_t * src) +{ + good(dst); + good(src); + if (dst->data) + return PIXMAN_REGION_STATUS_SUCCESS; + if (dst == src) + return PIXMAN_REGION_STATUS_SUCCESS; + if (!src->data || !src->data->size) + { + freeData(dst); + dst->data = (pixman_region16_data_t *)NULL; + return PIXMAN_REGION_STATUS_SUCCESS; + } + if (!dst->data || (dst->data->size < src->data->numRects)) + { + freeData(dst); + dst->data = allocData(src->data->numRects); + if (!dst->data) + return pixman_break (dst); + } + dst->data->size = src->data->size; + dst->data->numRects = src->data->numRects; + return PIXMAN_REGION_STATUS_SUCCESS; +} +*/ + +void +pixman_region_reset(pixman_region16_t *region, pixman_box16_t *box) +{ + good(region); + assert(box->x1<=box->x2); + assert(box->y1<=box->y2); + region->extents = *box; + freeData(region); + region->data = (pixman_region16_data_t *)NULL; +} + +int +pixman_region_contains_point(region, x, y, box) + pixman_region16_t * region; + int x, y; + pixman_box16_t * box; /* "return" value */ +{ + pixman_box16_t *pbox, *pboxEnd; + int numRects; + + good(region); + numRects = PIXREGION_NUM_RECTS(region); + if (!numRects || !INBOX(®ion->extents, x, y)) + return(PIXMAN_REGION_STATUS_FAILURE); + if (numRects == 1) + { + *box = region->extents; + return(PIXMAN_REGION_STATUS_SUCCESS); + } + for (pbox = PIXREGION_BOXPTR(region), pboxEnd = pbox + numRects; + pbox != pboxEnd; + pbox++) + { + if (y >= pbox->y2) + continue; /* not there yet */ + if ((y < pbox->y1) || (x < pbox->x1)) + break; /* missed it */ + if (x >= pbox->x2) + continue; /* not there yet */ + *box = *pbox; + return(PIXMAN_REGION_STATUS_SUCCESS); + } + return(PIXMAN_REGION_STATUS_FAILURE); +} + +int +pixman_region_not_empty(region) + pixman_region16_t * region; +{ + good(region); + return(!PIXREGION_NIL(region)); +} + +/* XXX: Do we need this? +static int +pixman_region16_broken(pixman_region16_t * region) +{ + good(region); + return (PIXREGION_NAR(region)); +} +*/ + +void +pixman_region_empty(region) + pixman_region16_t * region; +{ + good(region); + freeData(region); + region->extents.x2 = region->extents.x1; + region->extents.y2 = region->extents.y1; + region->data = &pixman_region_emptyData; +} + +pixman_box16_t * +pixman_region_extents(region) + pixman_region16_t * region; +{ + good(region); + return(®ion->extents); +} + +#define ExchangeSpans(a, b) \ +{ \ + pixman_region16_point_t tpt; \ + int tw; \ + \ + tpt = spans[a]; spans[a] = spans[b]; spans[b] = tpt; \ + tw = widths[a]; widths[a] = widths[b]; widths[b] = tw; \ +} + +/* ||| I should apply the merge sort code to rectangle sorting above, and see + if mapping time can be improved. But right now I've been at work 12 hours, + so forget it. +*/ + +static void QuickSortSpans( + pixman_region16_point_t spans[], + int widths[], + int numSpans) +{ + int y; + int i, j, m; + pixman_region16_point_t *r; + + /* Always called with numSpans > 1 */ + /* Sorts only by y, doesn't bother to sort by x */ + + do + { + if (numSpans < 9) + { + /* Do insertion sort */ + int yprev; + + yprev = spans[0].y; + i = 1; + do + { /* while i != numSpans */ + y = spans[i].y; + if (yprev > y) + { + /* spans[i] is out of order. Move into proper location. */ + pixman_region16_point_t tpt; + int tw, k; + + for (j = 0; y >= spans[j].y; j++) {} + tpt = spans[i]; + tw = widths[i]; + for (k = i; k != j; k--) + { + spans[k] = spans[k-1]; + widths[k] = widths[k-1]; + } + spans[j] = tpt; + widths[j] = tw; + y = spans[i].y; + } /* if out of order */ + yprev = y; + i++; + } while (i != numSpans); + return; + } + + /* Choose partition element, stick in location 0 */ + m = numSpans / 2; + if (spans[m].y > spans[0].y) ExchangeSpans(m, 0); + if (spans[m].y > spans[numSpans-1].y) ExchangeSpans(m, numSpans-1); + if (spans[m].y > spans[0].y) ExchangeSpans(m, 0); + y = spans[0].y; + + /* Partition array */ + i = 0; + j = numSpans; + do + { + r = &(spans[i]); + do + { + r++; + i++; + } while (i != numSpans && r->y < y); + r = &(spans[j]); + do + { + r--; + j--; + } while (y < r->y); + if (i < j) + ExchangeSpans(i, j); + } while (i < j); + + /* Move partition element back to middle */ + ExchangeSpans(0, j); + + /* Recurse */ + if (numSpans-j-1 > 1) + QuickSortSpans(&spans[j+1], &widths[j+1], numSpans-j-1); + numSpans = j; + } while (numSpans > 1); +} + +#define NextBand() \ +{ \ + clipy1 = pboxBandStart->y1; \ + clipy2 = pboxBandStart->y2; \ + pboxBandEnd = pboxBandStart + 1; \ + while (pboxBandEnd != pboxLast && pboxBandEnd->y1 == clipy1) { \ + pboxBandEnd++; \ + } \ + for (; ppt != pptLast && ppt->y < clipy1; ppt++, pwidth++) {} \ +} + +/* + Clip a list of scanlines to a region. The caller has allocated the + space. FSorted is non-zero if the scanline origins are in ascending + order. + returns the number of new, clipped scanlines. +*/ + +#ifdef XXX_DO_WE_NEED_THIS +static int +pixman_region16_clip_spans( + pixman_region16_t *prgnDst, + pixman_region16_point_t *ppt, + int *pwidth, + int nspans, + pixman_region16_point_t *pptNew, + int *pwidthNew, + int fSorted) +{ + pixman_region16_point_t *pptLast; + int *pwidthNewStart; /* the vengeance of Xerox! */ + int y, x1, x2; + int numRects; + + good(prgnDst); + pptLast = ppt + nspans; + pwidthNewStart = pwidthNew; + + if (!prgnDst->data) + { + /* Do special fast code with clip boundaries in registers(?) */ + /* It doesn't pay much to make use of fSorted in this case, + so we lump everything together. */ + + int clipx1, clipx2, clipy1, clipy2; + + clipx1 = prgnDst->extents.x1; + clipy1 = prgnDst->extents.y1; + clipx2 = prgnDst->extents.x2; + clipy2 = prgnDst->extents.y2; + + for (; ppt != pptLast; ppt++, pwidth++) + { + y = ppt->y; + x1 = ppt->x; + if (clipy1 <= y && y < clipy2) + { + x2 = x1 + *pwidth; + if (x1 < clipx1) x1 = clipx1; + if (x2 > clipx2) x2 = clipx2; + if (x1 < x2) + { + /* part of span in clip rectangle */ + pptNew->x = x1; + pptNew->y = y; + *pwidthNew = x2 - x1; + pptNew++; + pwidthNew++; + } + } + } /* end for */ + + } + else if ((numRects = prgnDst->data->numRects)) + { + /* Have to clip against many boxes */ + pixman_box16_t *pboxBandStart, *pboxBandEnd; + pixman_box16_t *pbox; + pixman_box16_t *pboxLast; + int clipy1, clipy2; + + /* In this case, taking advantage of sorted spans gains more than + the sorting costs. */ + if ((! fSorted) && (nspans > 1)) + QuickSortSpans(ppt, pwidth, nspans); + + pboxBandStart = PIXREGION_BOXPTR(prgnDst); + pboxLast = pboxBandStart + numRects; + + NextBand(); + + for (; ppt != pptLast; ) + { + y = ppt->y; + if (y < clipy2) + { + /* span is in the current band */ + pbox = pboxBandStart; + x1 = ppt->x; + x2 = x1 + *pwidth; + do + { /* For each box in band */ + int newx1, newx2; + + newx1 = x1; + newx2 = x2; + if (newx1 < pbox->x1) newx1 = pbox->x1; + if (newx2 > pbox->x2) newx2 = pbox->x2; + if (newx1 < newx2) + { + /* Part of span in clip rectangle */ + pptNew->x = newx1; + pptNew->y = y; + *pwidthNew = newx2 - newx1; + pptNew++; + pwidthNew++; + } + pbox++; + } while (pbox != pboxBandEnd); + ppt++; + pwidth++; + } + else + { + /* Move to next band, adjust ppt as needed */ + pboxBandStart = pboxBandEnd; + if (pboxBandStart == pboxLast) + break; /* We're completely done */ + NextBand(); + } + } + } + return (pwidthNew - pwidthNewStart); +} + +/* find the band in a region with the most rectangles */ +static int +pixman_region16_find_max_band(pixman_region16_t * prgn) +{ + int nbox; + pixman_box16_t * pbox; + int nThisBand; + int nMaxBand = 0; + short yThisBand; + + good(prgn); + nbox = PIXREGION_NUM_RECTS(prgn); + pbox = PIXREGION_RECTS(prgn); + + while(nbox > 0) + { + yThisBand = pbox->y1; + nThisBand = 0; + while((nbox > 0) && (pbox->y1 == yThisBand)) + { + nbox--; + pbox++; + nThisBand++; + } + if (nThisBand > nMaxBand) + nMaxBand = nThisBand; + } + return (nMaxBand); +} +#endif /* XXX_DO_WE_NEED_THIS */ diff --git a/pixman/src/pixregionint.h b/pixman/src/pixregionint.h new file mode 100644 index 0000000..162ecc3 --- /dev/null +++ b/pixman/src/pixregionint.h @@ -0,0 +1,83 @@ +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +******************************************************************/ +/* $Id: pixregionint.h,v 1.7 2004/04/16 15:32:53 cworth Exp $ */ + +#ifndef _PIXREGIONINT_H_ +#define _PIXREGIONINT_H_ + +#include "pixman.h" + +typedef struct pixman_region16_data { + long size; + long numRects; + /* XXX: And why, exactly, do we have this bogus struct definition? */ +/* pixman_box16_t rects[size]; in memory but not explicitly declared */ +} pixman_region16_data_t; + +struct pixman_region16 { + pixman_box16_t extents; + pixman_region16_data_t *data; +}; + +typedef struct pixman_region16_point { + int x, y; +} pixman_region16_point_t; + +#define PIXREGION_NIL(reg) ((reg)->data && !(reg)->data->numRects) +/* not a region */ +#define PIXREGION_NAR(reg) ((reg)->data == &pixman_brokendata) +#define PIXREGION_NUM_RECTS(reg) ((reg)->data ? (reg)->data->numRects : 1) +#define PIXREGION_SIZE(reg) ((reg)->data ? (reg)->data->size : 0) +#define PIXREGION_RECTS(reg) ((reg)->data ? (pixman_box16_t *)((reg)->data + 1) \ + : &(reg)->extents) +#define PIXREGION_BOXPTR(reg) ((pixman_box16_t *)((reg)->data + 1)) +#define PIXREGION_BOX(reg,i) (&PIXREGION_BOXPTR(reg)[i]) +#define PIXREGION_TOP(reg) PIXREGION_BOX(reg, (reg)->data->numRects) +#define PIXREGION_END(reg) PIXREGION_BOX(reg, (reg)->data->numRects - 1) +#define PIXREGION_SZOF(n) (sizeof(pixman_region16_data_t) + ((n) * sizeof(pixman_box16_t))) + +#endif /* _PIXREGIONINT_H_ */ diff --git a/pixman/src/renderedge.c b/pixman/src/renderedge.c new file mode 100644 index 0000000..576528b --- /dev/null +++ b/pixman/src/renderedge.c @@ -0,0 +1,197 @@ +/* + * $Id: renderedge.c,v 1.2 2005/01/21 18:26:28 cworth Exp $ + * + * Copyright © 2004 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "pixman-xserver-compat.h" + +/* + * Compute the smallest value no less than y which is on a + * grid row + */ + +xFixed +RenderSampleCeilY (xFixed y, int n) +{ + xFixed f = xFixedFrac(y); + xFixed i = xFixedFloor(y); + + f = ((f + Y_FRAC_FIRST(n)) / STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n); + if (f > Y_FRAC_LAST(n)) + { + f = Y_FRAC_FIRST(n); + i += xFixed1; + } + return (i | f); +} + +#define _div(a,b) ((a) >= 0 ? (a) / (b) : -((-(a) + (b) - 1) / (b))) + +/* + * Compute the largest value no greater than y which is on a + * grid row + */ +xFixed +RenderSampleFloorY (xFixed y, int n) +{ + xFixed f = xFixedFrac(y); + xFixed i = xFixedFloor (y); + + f = _div(f - Y_FRAC_FIRST(n), STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n); + if (f < Y_FRAC_FIRST(n)) + { + f = Y_FRAC_LAST(n); + i -= xFixed1; + } + return (i | f); +} + +/* + * Step an edge by any amount (including negative values) + */ +void +RenderEdgeStep (RenderEdge *e, int n) +{ + xFixed_48_16 ne; + + e->x += n * e->stepx; + + ne = e->e + n * (xFixed_48_16) e->dx; + + if (n >= 0) + { + if (ne > 0) + { + int nx = (ne + e->dy - 1) / e->dy; + e->e = ne - nx * (xFixed_48_16) e->dy; + e->x += nx * e->signdx; + } + } + else + { + if (ne <= -e->dy) + { + int nx = (-ne) / e->dy; + e->e = ne + nx * (xFixed_48_16) e->dy; + e->x -= nx * e->signdx; + } + } +} + +/* + * A private routine to initialize the multi-step + * elements of an edge structure + */ +static void +_RenderEdgeMultiInit (RenderEdge *e, int n, xFixed *stepx_p, xFixed *dx_p) +{ + xFixed stepx; + xFixed_48_16 ne; + + ne = n * (xFixed_48_16) e->dx; + stepx = n * e->stepx; + if (ne > 0) + { + int nx = ne / e->dy; + ne -= nx * e->dy; + stepx += nx * e->signdx; + } + *dx_p = ne; + *stepx_p = stepx; +} + +/* + * Initialize one edge structure given the line endpoints and a + * starting y value + */ +void +RenderEdgeInit (RenderEdge *e, + int n, + xFixed y_start, + xFixed x_top, + xFixed y_top, + xFixed x_bot, + xFixed y_bot) +{ + xFixed dx, dy; + + e->x = x_top; + e->e = 0; + dx = x_bot - x_top; + dy = y_bot - y_top; + e->dy = dy; + if (dy) + { + if (dx >= 0) + { + e->signdx = 1; + e->stepx = dx / dy; + e->dx = dx % dy; + e->e = -dy; + } + else + { + e->signdx = -1; + e->stepx = -(-dx / dy); + e->dx = -dx % dy; + e->e = 0; + } + + _RenderEdgeMultiInit (e, STEP_Y_SMALL(n), &e->stepx_small, &e->dx_small); + _RenderEdgeMultiInit (e, STEP_Y_BIG(n), &e->stepx_big, &e->dx_big); + } + RenderEdgeStep (e, y_start - y_top); +} + +/* + * Initialize one edge structure given a line, starting y value + * and a pixel offset for the line + */ +void +RenderLineFixedEdgeInit (RenderEdge *e, + int n, + xFixed y, + const xLineFixed *line, + int x_off, + int y_off) +{ + xFixed x_off_fixed = IntToxFixed(x_off); + xFixed y_off_fixed = IntToxFixed(y_off); + const xPointFixed *top, *bot; + + if (line->p1.y <= line->p2.y) + { + top = &line->p1; + bot = &line->p2; + } + else + { + top = &line->p2; + bot = &line->p1; + } + RenderEdgeInit (e, n, y, + top->x + x_off_fixed, + top->y + y_off_fixed, + bot->x + x_off_fixed, + bot->y + y_off_fixed); +} + diff --git a/pixman/src/renderedge.h b/pixman/src/renderedge.h new file mode 100644 index 0000000..1b74734 --- /dev/null +++ b/pixman/src/renderedge.h @@ -0,0 +1,159 @@ +/* + * $Id: renderedge.h,v 1.3 2005/02/21 21:29:22 cworth Exp $ + * + * Copyright © 2004 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _RENDEREDGE_H_ +#define _RENDEREDGE_H_ + +#include "pixman-xserver-compat.h" + +/* Here is a drawing of the sample grid for the 4-bit alpha case, + along with indications of the various defined terms: + + STEP_Y_SMALL +┌─────┬─────┬─────┐ ↓ +│•••••│•••••│•••••│ ─── ⟵── Y_FRAC_FIRST +│•••••│•••••│•••••│ ─── +│•••••│•••••│•••••│ ↑ ⟵── Y_FRAC_LAST +├─────┼─────┼─────┤ +│•••••│•••••│•••••│ +│•••••│•••••│•••••│ ↓ +│•••••│•••••│•••••│ ─── +├─────┼─────┼─────┤ STEP_Y_BIG +│•••••│•••••│•••••│ ─── +│•••••│•••••│•••••│ ↑ +│•••••│•••••│•••••│ +└─────┴─────┴─────┘ + │ │ ││ ⟶│ │⟵STEP_X_BIG + │ │⟶││⟵STEP_X_SMALL + │ │ + │ └ X_FRAC_LAST + │ + └ X_FRAC_FIRST + +N = 4 (# of bits of alpha) +MAX_ALPHA = 15 (# of samples per pixel) +N_X_FRAC = 5 (# of sample columns per pixel) +N_Y_FRAC = 3 (# of sample rows per column) +STEP_X_SMALL (distance between sample columns within a pixel) +STEP_X_BIG (distance between sample columns across pixel boundaries) +STEP_Y_SMALL (distance between sample rows within a pixel) +STEP_Y_BIG (distance between sample rows across pixel boundaries) +X_FRAC_FIRST (sub-pixel position of first sample column in pixel) +X_FRAC_LAST (sub-pixel position of last sample column in pixel) +Y_FRAC_FIRST (sub-pixel position of first sample row in pixel) +Y_FRAC_LAST (sub-pixel position of last sample row pixel) + +*/ + +#define MAX_ALPHA(n) ((1 << (n)) - 1) +#define N_Y_FRAC(n) ((n) == 1 ? 1 : (1 << ((n)/2)) - 1) +#define N_X_FRAC(n) ((1 << ((n)/2)) + 1) + +#define STEP_Y_SMALL(n) (xFixed1 / N_Y_FRAC(n)) +#define STEP_Y_BIG(n) (xFixed1 - (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n)) + +#define Y_FRAC_FIRST(n) (STEP_Y_SMALL(n) / 2) +#define Y_FRAC_LAST(n) (Y_FRAC_FIRST(n) + (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n)) + +#define STEP_X_SMALL(n) (xFixed1 / N_X_FRAC(n)) +#define STEP_X_BIG(n) (xFixed1 - (N_X_FRAC(n) - 1) * STEP_X_SMALL(n)) + +#define X_FRAC_FIRST(n) (STEP_X_SMALL(n) / 2) +#define X_FRAC_LAST(n) (X_FRAC_FIRST(n) + (N_X_FRAC(n) - 1) * STEP_X_SMALL(n)) + +#define RenderSamplesX(x,n) ((n) == 1 ? 0 : (xFixedFrac (x) + X_FRAC_FIRST(n)) / STEP_X_SMALL(n)) + +/* + * An edge structure. This represents a single polygon edge + * and can be quickly stepped across small or large gaps in the + * sample grid + */ + +typedef struct { + xFixed x; + xFixed e; + xFixed stepx; + xFixed signdx; + xFixed dy; + xFixed dx; + + xFixed stepx_small; + xFixed stepx_big; + xFixed dx_small; + xFixed dx_big; +} RenderEdge; + +/* + * Step across a small sample grid gap + */ +#define RenderEdgeStepSmall(edge) { \ + (edge)->x += (edge)->stepx_small; \ + (edge)->e += (edge)->dx_small; \ + if ((edge)->e > 0) \ + { \ + (edge)->e -= (edge)->dy; \ + (edge)->x += (edge)->signdx; \ + } \ +} + +/* + * Step across a large sample grid gap + */ +#define RenderEdgeStepBig(edge) { \ + (edge)->x += (edge)->stepx_big; \ + (edge)->e += (edge)->dx_big; \ + if ((edge)->e > 0) \ + { \ + (edge)->e -= (edge)->dy; \ + (edge)->x += (edge)->signdx; \ + } \ +} + +xFixed +RenderSampleCeilY (xFixed y, int bpp); + +xFixed +RenderSampleFloorY (xFixed y, int bpp); + +void +RenderEdgeStep (RenderEdge *e, int n); + +void +RenderEdgeInit (RenderEdge *e, + int bpp, + xFixed y_start, + xFixed x_top, + xFixed y_top, + xFixed x_bot, + xFixed y_bot); + +void +RenderLineFixedEdgeInit (RenderEdge *e, + int bpp, + xFixed y, + const pixman_line_fixed_t *line, + int x_off, + int y_off); + +#endif /* _RENDEREDGE_H_ */ diff --git a/pixman/src/slim_internal.h b/pixman/src/slim_internal.h new file mode 100644 index 0000000..5c1e5cf --- /dev/null +++ b/pixman/src/slim_internal.h @@ -0,0 +1,100 @@ +/* slim - Shared Library Interface Macros + * + * Copyright © 2003 Richard Henderson + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of Richard Henderson + * not be used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Richard Henderson makes no representations about the suitability of this + * software for any purpose. It is provided "as is" without express + * or implied warranty. + * + * RICHARD HENDERSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL RICHARD HENDERSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Richard Henderson <rth@twiddle.net> + */ + +#ifndef _SLIM_INTERNAL_H_ +#define _SLIM_INTERNAL_H_ 1 + +/* This macro marks a symbol as STV_HIDDEN, which prevents it from being + added to the dynamic symbol table of the shared library. This prevents + users of the library from knowingly or unknowingly accessing library + internals that may change in future releases. It also allows the + compiler to generate slightly more efficient code in some cases. + + The macro should be placed either immediately before the return type in + a function declaration: + + pixman_private int + somefunction(void); + + or after a data name, + + extern int somedata pixman_private; + + The ELF visibility attribute did not exist before gcc 3.3. */ +/* ??? Not marked with "slim" because that makes it look too much + like the function name instead of just an attribute. */ + +#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) +#define pixman_private __attribute__((__visibility__("hidden"))) +#else +#define pixman_private +#endif + +/* The following macros are used for PLT bypassing. First of all, + you need to have the function prototyped somewhere, say in foo.h: + + int foo (int __bar); + + If calls to foo within libfoo.so should always go to foo defined + in libfoo.so, then in fooint.h you add: + + slim_hidden_proto (foo) + + and after the foo function definition: + + int foo (int __bar) + { + return __bar; + } + slim_hidden_def (foo); + + This works by arranging for the C symbol "foo" to be renamed to + "INT_foo" at the assembly level, which is marked pixman_private. + We then create another symbol at the same address (an alias) with + the C symbol "EXT_foo", which is renamed to "foo" at the assembly + level. */ + +#if __GNUC__ >= 3 && defined(__ELF__) +# define slim_hidden_proto(name) slim_hidden_proto1(name, INT_##name) +# define slim_hidden_def(name) slim_hidden_def1(name, INT_##name) +# define slim_hidden_proto1(name, internal) \ + extern __typeof (name) name \ + __asm__ (slim_hidden_asmname (internal)) \ + pixman_private; +# define slim_hidden_def1(name, internal) \ + extern __typeof (name) EXT_##name __asm__(slim_hidden_asmname(name)) \ + __attribute__((__alias__(slim_hidden_asmname(internal)))) +# define slim_hidden_ulp slim_hidden_ulp1(__USER_LABEL_PREFIX__) +# define slim_hidden_ulp1(x) slim_hidden_ulp2(x) +# define slim_hidden_ulp2(x) #x +# define slim_hidden_asmname(name) slim_hidden_asmname1(name) +# define slim_hidden_asmname1(name) slim_hidden_ulp #name +#else +# define slim_hidden_proto(name) +# define slim_hidden_def(name) +#endif + +#endif /* _SLIM_INTERNAL_H_ */ diff --git a/src/Makefile.am b/src/Makefile.am index 16cbb1c..b802110 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -85,12 +85,18 @@ libcairo_la_SOURCES = \ cairo-arc-private.h \ cairo-array.c \ cairo-cache.c \ + cairo-clip.c \ + cairo-clip-private.h \ cairo-color.c \ + cairo-debug.c \ + cairo-debug.h \ cairo-fixed.c \ cairo-font.c \ cairo-font-options.c \ cairo-gstate.c \ cairo-gstate-private.h \ + cairo-hash.c \ + cairo-hash-private.h \ cairo-hull.c \ cairo-image-surface.c \ cairo-matrix.c \ @@ -129,9 +135,9 @@ libcairo_la_SOURCES = \ libcairo_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined -INCLUDES = -I$(srcdir) $(CAIRO_CFLAGS) +INCLUDES = -I$(srcdir) -I$(top_srcdir)/pixman/src $(CAIRO_CFLAGS) -libcairo_la_LIBADD = $(CAIRO_LIBS) +libcairo_la_LIBADD = $(top_builddir)/pixman/src/libpixman.la $(CAIRO_LIBS) install-data-local: @if test -f "$(DESTDIR)$(includedir)/cairo.h" || test -f "$(DESTDIR)$(includedir)/cairo-features.h" ; then \ diff --git a/src/Makefile.in b/src/Makefile.in index a6f8f5d..17ff393 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -62,14 +62,16 @@ am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(cairoincludedir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = -libcairo_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +libcairo_la_DEPENDENCIES = $(top_builddir)/pixman/src/libpixman.la \ + $(am__DEPENDENCIES_1) am__libcairo_la_SOURCES_DIST = cairo.c cairo.h cairo-private.h \ cairo-arc.c cairo-arc-private.h cairo-array.c cairo-cache.c \ - cairo-color.c cairo-fixed.c cairo-font.c cairo-font-options.c \ - cairo-gstate.c cairo-gstate-private.h cairo-hull.c \ - cairo-image-surface.c cairo-matrix.c cairo-path.c \ - cairo-path-bounds.c cairo-path-data.c \ - cairo-path-data-private.h cairo-path-fill.c \ + cairo-clip.c cairo-clip-private.h cairo-color.c cairo-debug.c \ + cairo-debug.h cairo-fixed.c cairo-font.c cairo-font-options.c \ + cairo-gstate.c cairo-gstate-private.h cairo-hash.c \ + cairo-hash-private.h cairo-hull.c cairo-image-surface.c \ + cairo-matrix.c cairo-path.c cairo-path-bounds.c \ + cairo-path-data.c cairo-path-data-private.h cairo-path-fill.c \ cairo-path-fixed-private.h cairo-path-stroke.c cairo-pen.c \ cairo-polygon.c cairo-slope.c cairo-spline.c cairo-surface.c \ cairo-traps.c cairo-pattern.c cairo-unicode.c \ @@ -99,8 +101,9 @@ am__libcairo_la_SOURCES_DIST = cairo.c cairo.h cairo-private.h \ @CAIRO_HAS_WIN32_FONT_TRUE@am__objects_12 = cairo-win32-font.lo am__objects_13 = $(am__objects_11) $(am__objects_12) am_libcairo_la_OBJECTS = cairo.lo cairo-arc.lo cairo-array.lo \ - cairo-cache.lo cairo-color.lo cairo-fixed.lo cairo-font.lo \ - cairo-font-options.lo cairo-gstate.lo cairo-hull.lo \ + cairo-cache.lo cairo-clip.lo cairo-color.lo cairo-debug.lo \ + cairo-fixed.lo cairo-font.lo cairo-font-options.lo \ + cairo-gstate.lo cairo-hash.lo cairo-hull.lo \ cairo-image-surface.lo cairo-matrix.lo cairo-path.lo \ cairo-path-bounds.lo cairo-path-data.lo cairo-path-fill.lo \ cairo-path-stroke.lo cairo-pen.lo cairo-polygon.lo \ @@ -168,6 +171,10 @@ CAIRO_HAS_XCB_SURFACE_TRUE = @CAIRO_HAS_XCB_SURFACE_TRUE@ CAIRO_HAS_XLIB_SURFACE_FALSE = @CAIRO_HAS_XLIB_SURFACE_FALSE@ CAIRO_HAS_XLIB_SURFACE_TRUE = @CAIRO_HAS_XLIB_SURFACE_TRUE@ CAIRO_LIBS = @CAIRO_LIBS@ +CAIRO_VERSION_MAJOR = @CAIRO_VERSION_MAJOR@ +CAIRO_VERSION_MICRO = @CAIRO_VERSION_MICRO@ +CAIRO_VERSION_MINOR = @CAIRO_VERSION_MINOR@ +CAIRO_VERSION_OTHER = @CAIRO_VERSION_OTHER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -208,6 +215,8 @@ GLITZ_REQUIRES = @GLITZ_REQUIRES@ GLITZ_SURFACE_FEATURE = @GLITZ_SURFACE_FEATURE@ GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@ GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ +HAVE_PTHREAD_FALSE = @HAVE_PTHREAD_FALSE@ +HAVE_PTHREAD_TRUE = @HAVE_PTHREAD_TRUE@ HTML_DIR = @HTML_DIR@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -233,8 +242,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PDF_LIBS = @PDF_LIBS@ PDF_SURFACE_FEATURE = @PDF_SURFACE_FEATURE@ -PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ -PIXMAN_LIBS = @PIXMAN_LIBS@ +PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PNG_CFLAGS = @PNG_CFLAGS@ PNG_FUNCTIONS_FEATURE = @PNG_FUNCTIONS_FEATURE@ @@ -349,12 +357,18 @@ libcairo_la_SOURCES = \ cairo-arc-private.h \ cairo-array.c \ cairo-cache.c \ + cairo-clip.c \ + cairo-clip-private.h \ cairo-color.c \ + cairo-debug.c \ + cairo-debug.h \ cairo-fixed.c \ cairo-font.c \ cairo-font-options.c \ cairo-gstate.c \ cairo-gstate-private.h \ + cairo-hash.c \ + cairo-hash-private.h \ cairo-hull.c \ cairo-image-surface.c \ cairo-matrix.c \ @@ -392,8 +406,8 @@ libcairo_la_SOURCES = \ cairoint.h libcairo_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined -INCLUDES = -I$(srcdir) $(CAIRO_CFLAGS) -libcairo_la_LIBADD = $(CAIRO_LIBS) +INCLUDES = -I$(srcdir) -I$(top_srcdir)/pixman/src $(CAIRO_CFLAGS) +libcairo_la_LIBADD = $(top_builddir)/pixman/src/libpixman.la $(CAIRO_LIBS) all: all-am .SUFFIXES: @@ -469,7 +483,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-array.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-atsui-font.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-cache.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-clip.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-color.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-debug.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-fixed.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-font-options.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-font-subset.Plo@am__quote@ @@ -477,6 +493,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-ft-font.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-glitz-surface.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-gstate.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-hash.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-hull.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-image-surface.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-matrix.Plo@am__quote@ diff --git a/src/cairo-arc-private.h b/src/cairo-arc-private.h index 1cd41cc..633fbfa 100644 --- a/src/cairo-arc-private.h +++ b/src/cairo-arc-private.h @@ -38,7 +38,7 @@ #include "cairoint.h" -void +cairo_private void _cairo_arc_path (cairo_t *cr, double xc, double yc, @@ -46,7 +46,7 @@ _cairo_arc_path (cairo_t *cr, double angle1, double angle2); -void +cairo_private void _cairo_arc_path_negative (cairo_t *cr, double xc, double yc, diff --git a/src/cairo-arc.c b/src/cairo-arc.c index e653fcd..e9f3599 100644 --- a/src/cairo-arc.c +++ b/src/cairo-arc.c @@ -34,8 +34,6 @@ * Carl D. Worth <cworth@cworth.org> */ -#include <math.h> - #include "cairo-arc-private.h" /* Spline deviation from the circle in radius would be given by: diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c index 990a231..69e3752 100644 --- a/src/cairo-atsui-font.c +++ b/src/cairo-atsui-font.c @@ -105,12 +105,11 @@ CreateSizedCopyOfStyle(ATSUStyle inStyle, cairo_matrix_t *scale) static cairo_status_t -_cairo_atsui_font_create(const char *family, - cairo_font_slant_t slant, - cairo_font_weight_t weight, - const cairo_matrix_t *font_matrix, - const cairo_matrix_t *ctm, - cairo_scaled_font_t **font_out) +_cairo_atsui_font_create_toy(cairo_toy_font_face_t *toy_face, + const cairo_matrix_t *font_matrix, + const cairo_matrix_t *ctm, + const cairo_font_options_t *options, + cairo_scaled_font_t **font_out) { cairo_atsui_font_t *font = NULL; ATSUStyle style; @@ -118,11 +117,11 @@ _cairo_atsui_font_create(const char *family, OSStatus err; Boolean isItalic, isBold; cairo_matrix_t scale; + const char *family = toy_face->family; err = ATSUCreateStyle(&style); - - switch (weight) { + switch (toy_face->weight) { case CAIRO_FONT_WEIGHT_BOLD: isBold = true; break; @@ -132,7 +131,7 @@ _cairo_atsui_font_create(const char *family, break; } - switch (slant) { + switch (toy_face->slant) { case CAIRO_FONT_SLANT_ITALIC: isItalic = true; break; @@ -188,7 +187,7 @@ _cairo_atsui_font_create(const char *family, font = malloc(sizeof(cairo_atsui_font_t)); - _cairo_scaled_font_init(&font->base, font_matrix, ctm, + _cairo_scaled_font_init(&font->base, toy_face, font_matrix, ctm, options, &cairo_atsui_scaled_font_backend); cairo_matrix_multiply(&scale, font_matrix, ctm); @@ -213,9 +212,8 @@ _cairo_atsui_font_create(const char *family, return CAIRO_STATUS_SUCCESS; } - static void -_cairo_atsui_font_destroy_font(void *abstract_font) +_cairo_atsui_font_fini(void *abstract_font) { cairo_atsui_font_t *font = abstract_font; @@ -690,8 +688,8 @@ _cairo_atsui_font_glyph_path(void *abstract_font, } const cairo_scaled_font_backend_t cairo_atsui_scaled_font_backend = { - _cairo_atsui_font_create, - _cairo_atsui_font_destroy_font, + _cairo_atsui_font_create_toy, + _cairo_atsui_font_fini, _cairo_atsui_font_font_extents, _cairo_atsui_font_text_to_glyphs, _cairo_atsui_font_glyph_extents, diff --git a/src/cairo-clip-private.h b/src/cairo-clip-private.h new file mode 100644 index 0000000..23eb78c --- /dev/null +++ b/src/cairo-clip-private.h @@ -0,0 +1,123 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2005 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is Red Hat, Inc. + * + * Contributor(s): + * Kristian Høgsberg <krh@redhat.com> + */ + +#ifndef CAIRO_CLIP_PRIVATE_H +#define CAIRO_CLIP_PRIVATE_H + +#include "cairo-path-fixed-private.h" + +enum _cairo_clip_mode { + CAIRO_CLIP_MODE_PATH, + CAIRO_CLIP_MODE_REGION, + CAIRO_CLIP_MODE_MASK +}; + +struct _cairo_clip_path { + unsigned int ref_count; + cairo_path_fixed_t path; + cairo_fill_rule_t fill_rule; + double tolerance; + cairo_antialias_t antialias; + cairo_clip_path_t *prev; +}; + +struct _cairo_clip { + cairo_clip_mode_t mode; + + /* + * Mask-based clipping for cases where the backend + * clipping isn't sufficiently able. + * + * The rectangle here represents the + * portion of the destination surface that this + * clip surface maps to, it does not + * represent the extents of the clip region or + * clip paths + */ + cairo_surface_t *surface; + cairo_rectangle_t surface_rect; + /* + * Surface clip serial number to store + * in the surface when this clip is set + */ + unsigned int serial; + /* + * A clip region that can be placed in the surface + */ + pixman_region16_t *region; + /* + * If the surface supports path clipping, we store the list of + * clipping paths that has been set here as a linked list. + */ + cairo_clip_path_t *path; +}; + +cairo_private void +_cairo_clip_init (cairo_clip_t *clip, cairo_surface_t *target); + +cairo_private void +_cairo_clip_fini (cairo_clip_t *clip); + +cairo_private void +_cairo_clip_init_copy (cairo_clip_t *clip, cairo_clip_t *other); + +cairo_private cairo_status_t +_cairo_clip_reset (cairo_clip_t *clip); + +cairo_private cairo_status_t +_cairo_clip_clip (cairo_clip_t *clip, + cairo_path_fixed_t *path, + cairo_fill_rule_t fill_rule, + double tolerance, + cairo_antialias_t antialias, + cairo_surface_t *target); + +cairo_private cairo_status_t +_cairo_clip_intersect_to_rectangle (cairo_clip_t *clip, + cairo_rectangle_t *rectangle); + +cairo_private cairo_status_t +_cairo_clip_intersect_to_region (cairo_clip_t *clip, + pixman_region16_t *region); + +cairo_private cairo_status_t +_cairo_clip_combine_to_surface (cairo_clip_t *clip, + cairo_operator_t operator, + cairo_surface_t *dst, + int dst_x, + int dst_y, + const cairo_rectangle_t *extents); + +#endif /* CAIRO_CLIP_PRIVATE_H */ diff --git a/src/cairo-clip.c b/src/cairo-clip.c new file mode 100644 index 0000000..d479da8 --- /dev/null +++ b/src/cairo-clip.c @@ -0,0 +1,466 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2002 University of Southern California + * Copyright © 2005 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is University of Southern + * California. + * + * Contributor(s): + * Carl D. Worth <cworth@cworth.org> + * Kristian Høgsberg <krh@redhat.com> + */ + +#include "cairoint.h" +#include "cairo-clip-private.h" + +static cairo_clip_path_t * +_cairo_clip_path_reference (cairo_clip_path_t *clip_path); + +static void +_cairo_clip_path_destroy (cairo_clip_path_t *clip_path); + +/* Creates a region from a cairo_rectangle_t */ +static cairo_status_t +_region_new_from_rect (cairo_rectangle_t *rect, + pixman_region16_t **region) +{ + *region = pixman_region_create (); + if (pixman_region_union_rect (*region, *region, + rect->x, rect->y, + rect->width, rect->height) != PIXMAN_REGION_STATUS_SUCCESS) { + pixman_region_destroy (*region); + return CAIRO_STATUS_NO_MEMORY; + } + + return CAIRO_STATUS_SUCCESS; +} + +/* Gets the bounding box of a region as a cairo_rectangle_t */ +static void +_region_rect_extents (pixman_region16_t *region, + cairo_rectangle_t *rect) +{ + pixman_box16_t *region_extents = pixman_region_extents (region); + + rect->x = region_extents->x1; + rect->y = region_extents->y1; + rect->width = region_extents->x2 - region_extents->x1; + rect->height = region_extents->y2 - region_extents->y1; +} + +void +_cairo_clip_init (cairo_clip_t *clip, cairo_surface_t *target) +{ + clip->mode = _cairo_surface_get_clip_mode (target); + clip->region = NULL; + clip->surface = NULL; + clip->serial = 0; + clip->path = NULL; +} + +void +_cairo_clip_fini (cairo_clip_t *clip) +{ + if (clip->surface) + cairo_surface_destroy (clip->surface); + clip->surface = NULL; + + if (clip->path) + _cairo_clip_path_destroy (clip->path); + clip->path = NULL; + + if (clip->region) + pixman_region_destroy (clip->region); + clip->region = NULL; + clip->serial = 0; +} + +void +_cairo_clip_init_copy (cairo_clip_t *clip, cairo_clip_t *other) +{ + if (other->region) { + clip->region = pixman_region_create (); + pixman_region_copy (clip->region, other->region); + } + + cairo_surface_reference (other->surface); + clip->surface = other->surface; + _cairo_clip_path_reference (other->path); + clip->path = other->path; +} + +cairo_status_t +_cairo_clip_reset (cairo_clip_t *clip) +{ + /* destroy any existing clip-region artifacts */ + if (clip->surface) + cairo_surface_destroy (clip->surface); + clip->surface = NULL; + + if (clip->region) + pixman_region_destroy (clip->region); + clip->region = NULL; + + if (clip->path) + _cairo_clip_path_destroy (clip->path); + clip->path = NULL; + + clip->serial = 0; + + return CAIRO_STATUS_SUCCESS; +} + +cairo_status_t +_cairo_clip_intersect_to_rectangle (cairo_clip_t *clip, + cairo_rectangle_t *rectangle) +{ + if (clip->path) { + /* Intersect path extents here. */ + } + + if (clip->region) { + pixman_region16_t *intersection; + cairo_status_t status; + pixman_region_status_t pixman_status; + + status = _region_new_from_rect (rectangle, &intersection); + if (status) + return status; + + pixman_status = pixman_region_intersect (intersection, + clip->region, + intersection); + if (pixman_status == PIXMAN_REGION_STATUS_SUCCESS) + _region_rect_extents (intersection, rectangle); + else + status = CAIRO_STATUS_NO_MEMORY; + + pixman_region_destroy (intersection); + + if (status) + return status; + } + + if (clip->surface) + _cairo_rectangle_intersect (rectangle, &clip->surface_rect); + + return CAIRO_STATUS_SUCCESS; +} + +cairo_status_t +_cairo_clip_intersect_to_region (cairo_clip_t *clip, + pixman_region16_t *region) +{ + if (clip->path) { + /* Intersect clip path into region. */ + } + + if (clip->region) + pixman_region_intersect (region, clip->region, region); + + if (clip->surface) { + pixman_region16_t *clip_rect; + pixman_region_status_t pixman_status; + cairo_status_t status; + + status = _region_new_from_rect (&clip->surface_rect, &clip_rect); + if (status) + return status; + + pixman_status = pixman_region_intersect (region, + clip_rect, + region); + if (pixman_status != PIXMAN_REGION_STATUS_SUCCESS) + status = CAIRO_STATUS_NO_MEMORY; + + pixman_region_destroy (clip_rect); + + if (status) + return status; + } + + return CAIRO_STATUS_SUCCESS; +} + +/* Combines the region of clip->surface given by extents in + * device backend coordinates into the given temporary surface, + * which has its origin at dst_x, dst_y in backend coordinates + */ +cairo_status_t +_cairo_clip_combine_to_surface (cairo_clip_t *clip, + cairo_operator_t operator, + cairo_surface_t *dst, + int dst_x, + int dst_y, + const cairo_rectangle_t *extents) +{ + cairo_pattern_union_t pattern; + cairo_status_t status; + + _cairo_pattern_init_for_surface (&pattern.surface, clip->surface); + + status = _cairo_surface_composite (operator, + &pattern.base, + NULL, + dst, + extents->x - clip->surface_rect.x, + extents->y - clip->surface_rect.y, + 0, 0, + extents->x - dst_x, + extents->y - dst_y, + extents->width, extents->height); + + _cairo_pattern_fini (&pattern.base); + + return status; +} + +static cairo_status_t +_cairo_clip_intersect_path (cairo_clip_t *clip, + cairo_path_fixed_t *path, + cairo_fill_rule_t fill_rule, + double tolerance, + cairo_antialias_t antialias, + cairo_surface_t *target) +{ + cairo_clip_path_t *clip_path; + cairo_status_t status; + + if (clip->mode != CAIRO_CLIP_MODE_PATH) + return CAIRO_INT_STATUS_UNSUPPORTED; + + clip_path = malloc (sizeof (cairo_clip_path_t)); + if (clip_path == NULL) + return CAIRO_STATUS_NO_MEMORY; + + status = _cairo_path_fixed_init_copy (&clip_path->path, path); + if (status) + return status; + + clip_path->ref_count = 1; + clip_path->fill_rule = fill_rule; + clip_path->tolerance = tolerance; + clip_path->antialias = antialias; + clip_path->prev = clip->path; + clip->path = clip_path; + clip->serial = _cairo_surface_allocate_clip_serial (target); + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_clip_path_t * +_cairo_clip_path_reference (cairo_clip_path_t *clip_path) +{ + if (clip_path == NULL) + return NULL; + + clip_path->ref_count++; + + return clip_path; +} + +static void +_cairo_clip_path_destroy (cairo_clip_path_t *clip_path) +{ + if (clip_path == NULL) + return; + + clip_path->ref_count--; + if (clip_path->ref_count) + return; + + _cairo_path_fixed_fini (&clip_path->path); + _cairo_clip_path_destroy (clip_path->prev); + free (clip_path); +} + +static cairo_status_t +_cairo_clip_intersect_region (cairo_clip_t *clip, + cairo_traps_t *traps, + cairo_surface_t *target) +{ + pixman_region16_t *region; + cairo_status_t status; + + if (clip->mode != CAIRO_CLIP_MODE_REGION) + return CAIRO_INT_STATUS_UNSUPPORTED; + + status = _cairo_traps_extract_region (traps, ®ion); + if (status) + return status; + + if (region == NULL) + return CAIRO_INT_STATUS_UNSUPPORTED; + + status = CAIRO_STATUS_SUCCESS; + if (clip->region == NULL) { + clip->region = region; + } else { + pixman_region16_t *intersection = pixman_region_create(); + + if (pixman_region_intersect (intersection, + clip->region, region) + == PIXMAN_REGION_STATUS_SUCCESS) { + pixman_region_destroy (clip->region); + clip->region = intersection; + } else { + status = CAIRO_STATUS_NO_MEMORY; + } + pixman_region_destroy (region); + } + + clip->serial = _cairo_surface_allocate_clip_serial (target); + + return status; +} + +static cairo_status_t +_cairo_clip_intersect_mask (cairo_clip_t *clip, + cairo_traps_t *traps, + cairo_antialias_t antialias, + cairo_surface_t *target) +{ + cairo_pattern_union_t pattern; + cairo_box_t extents; + cairo_rectangle_t surface_rect; + cairo_surface_t *surface; + cairo_status_t status; + + /* Represent the clip as a mask surface. We create a new surface + * the size of the intersection of the old mask surface and the + * extents of the new clip path. */ + + _cairo_traps_extents (traps, &extents); + _cairo_box_round_to_rectangle (&extents, &surface_rect); + + if (clip->surface != NULL) + _cairo_rectangle_intersect (&surface_rect, &clip->surface_rect); + + surface = _cairo_surface_create_similar_solid (target, + CAIRO_CONTENT_ALPHA, + surface_rect.width, + surface_rect.height, + CAIRO_COLOR_WHITE); + if (surface->status) + return CAIRO_STATUS_NO_MEMORY; + + /* Render the new clipping path into the new mask surface. */ + + _cairo_traps_translate (traps, -surface_rect.x, -surface_rect.y); + _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE); + + status = _cairo_surface_composite_trapezoids (CAIRO_OPERATOR_IN, + &pattern.base, + surface, + antialias, + 0, 0, + 0, 0, + surface_rect.width, + surface_rect.height, + traps->traps, + traps->num_traps); + + _cairo_pattern_fini (&pattern.base); + + if (status) { + cairo_surface_destroy (surface); + return status; + } + + /* If there was a clip surface already, combine it with the new + * mask surface using the IN operator, so we get the intersection + * of the old and new clipping paths. */ + + if (clip->surface != NULL) { + _cairo_pattern_init_for_surface (&pattern.surface, clip->surface); + + status = _cairo_surface_composite (CAIRO_OPERATOR_IN, + &pattern.base, + NULL, + surface, + surface_rect.x - clip->surface_rect.x, + surface_rect.y - clip->surface_rect.y, + 0, 0, + 0, 0, + surface_rect.width, + surface_rect.height); + + _cairo_pattern_fini (&pattern.base); + + if (status) { + cairo_surface_destroy (surface); + return status; + } + + cairo_surface_destroy (clip->surface); + } + + clip->surface = surface; + clip->surface_rect = surface_rect; + clip->serial = _cairo_surface_allocate_clip_serial (target); + + return status; +} + +cairo_status_t +_cairo_clip_clip (cairo_clip_t *clip, + cairo_path_fixed_t *path, + cairo_fill_rule_t fill_rule, + double tolerance, + cairo_antialias_t antialias, + cairo_surface_t *target) +{ + cairo_status_t status; + cairo_traps_t traps; + + status = _cairo_clip_intersect_path (clip, + path, fill_rule, tolerance, + antialias, target); + if (status != CAIRO_INT_STATUS_UNSUPPORTED) + return status; + + _cairo_traps_init (&traps); + status = _cairo_path_fixed_fill_to_traps (path, + fill_rule, + tolerance, + &traps); + if (status) + goto bail; + + status = _cairo_clip_intersect_region (clip, &traps, target); + if (status != CAIRO_INT_STATUS_UNSUPPORTED) + goto bail; + + status = _cairo_clip_intersect_mask (clip, &traps, antialias, target); + + bail: + _cairo_traps_fini (&traps); + + return status; +} diff --git a/src/cairo-color.c b/src/cairo-color.c index beb4a34..e202af2 100644 --- a/src/cairo-color.c +++ b/src/cairo-color.c @@ -89,29 +89,19 @@ _cairo_color_init_rgb (cairo_color_t *color, _cairo_color_init_rgba (color, red, green, blue, 1.0); } +/* We multiply colors by (0x10000 - epsilon), such that we get a uniform + * range even for 0xffff. In other words, (1.0 - epsilon) would convert + * to 0xffff, not 0xfffe. + */ +#define CAIRO_COLOR_ONE_MINUS_EPSILON (65536.0 - 1e-5) -/* XXX: The calculation of: - - channel * 0xffff - - isn't really what we want since: - - (1.0 - epsilon) * 0xffff = 0xfffe - - In other words, given an input range of [0.0, 1.0], we have an - infinitely small range tha maps to the output value 0xffff, - (while having large, uniformly sized input ranges for all - other output values). This is undesirable, particularly when - we want to do optimizations for "opaque" colors specfied as - floating-point. -*/ static void _cairo_color_compute_shorts (cairo_color_t *color) { - color->red_short = color->red * color->alpha * 0xffff; - color->green_short = color->green * color->alpha * 0xffff; - color->blue_short = color->blue * color->alpha * 0xffff; - color->alpha_short = color->alpha * 0xffff; + color->red_short = color->red * color->alpha * CAIRO_COLOR_ONE_MINUS_EPSILON; + color->green_short = color->green * color->alpha * CAIRO_COLOR_ONE_MINUS_EPSILON; + color->blue_short = color->blue * color->alpha * CAIRO_COLOR_ONE_MINUS_EPSILON; + color->alpha_short = color->alpha * CAIRO_COLOR_ONE_MINUS_EPSILON; } void diff --git a/src/cairo-debug.c b/src/cairo-debug.c new file mode 100644 index 0000000..31eefc5 --- /dev/null +++ b/src/cairo-debug.c @@ -0,0 +1,73 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2005 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is Red Hat, Inc. + * + * Contributor(s): + * Carl D. Worth <cworth@cworth.org> + */ + +#include "cairoint.h" + +/** + * cairo_debug_reset_static_data: + * + * Resets all static data within cairo to its original state, + * (ie. identical to the state at the time of program invocation). For + * example, all caches within cairo will be flushed empty. + * + * This function is intended to be useful when using memory-checking + * tools such as valgrind. When valgrind's memcheck analyzes a + * cairo-using program without a call to cairo_debug_reset_static_data, + * it will report all data reachable via cairo's static objects as + * "still reachable". Calling cairo_debug_reset_static_data just prior + * to program termination will make it easier to get squeaky clean + * reports from valgrind. + * + * WARNING: It is only safe to call this function when there are no + * active cairo objects remaining, (ie. the appropriate destroy + * functions have been called as necessary). If there are active cairo + * objects, this call is likely to cause a crash, (eg. an assertion + * failure due to a hash table being destroyed when non-empty). + **/ +void +cairo_debug_reset_static_data (void) +{ +#if CAIRO_HAS_XLIB_SURFACE + _cairo_xlib_surface_reset_static_data (); + _cairo_xlib_screen_reset_static_data (); +#endif + + _cairo_font_reset_static_data (); + +#if CAIRO_HAS_FT_FONT + _cairo_ft_font_reset_static_data (); +#endif +} + diff --git a/src/cairo-debug.h b/src/cairo-debug.h new file mode 100644 index 0000000..1dab2c7 --- /dev/null +++ b/src/cairo-debug.h @@ -0,0 +1,48 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2005 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is Red Hat, Inc. + * + * Contributor(s): + * Carl D. Worth <cworth@cworth.org> + */ + +#ifndef CAIRO_DEBUG_H +#define CAIRO_DEBUG_H + +#include <cairo-features.h> + +CAIRO_BEGIN_DECLS + +void +cairo_debug_reset_static_data (void); + +CAIRO_END_DECLS + +#endif /* CAIRO_H */ diff --git a/src/cairo-features.h b/src/cairo-features.h index 74f08b0..144fa28 100644 --- a/src/cairo-features.h +++ b/src/cairo-features.h @@ -37,6 +37,20 @@ #ifndef CAIRO_FEATURES_H #define CAIRO_FEATURES_H +#ifdef __cplusplus +# define CAIRO_BEGIN_DECLS extern "C" { +# define CAIRO_END_DECLS } +#else +# define CAIRO_BEGIN_DECLS +# define CAIRO_END_DECLS +#endif + +#define CAIRO_VERSION_MAJOR 0 +#define CAIRO_VERSION_MINOR 9 +#define CAIRO_VERSION_MICRO 2 + +#define CAIRO_VERSION_STRING "0.9.2" + #define CAIRO_HAS_PS_SURFACE 1 #define CAIRO_HAS_PDF_SURFACE 1 diff --git a/src/cairo-features.h.in b/src/cairo-features.h.in index 8065be3..d4c6fa7 100644 --- a/src/cairo-features.h.in +++ b/src/cairo-features.h.in @@ -37,6 +37,20 @@ #ifndef CAIRO_FEATURES_H #define CAIRO_FEATURES_H +#ifdef __cplusplus +# define CAIRO_BEGIN_DECLS extern "C" { +# define CAIRO_END_DECLS } +#else +# define CAIRO_BEGIN_DECLS +# define CAIRO_END_DECLS +#endif + +#define CAIRO_VERSION_MAJOR @CAIRO_VERSION_MAJOR@ +#define CAIRO_VERSION_MINOR @CAIRO_VERSION_MINOR@ +#define CAIRO_VERSION_MICRO @CAIRO_VERSION_MICRO@ + +#define CAIRO_VERSION_STRING "@CAIRO_VERSION_MAJOR@.@CAIRO_VERSION_MINOR@.@CAIRO_VERSION_MICRO@" + @PS_SURFACE_FEATURE@ @PDF_SURFACE_FEATURE@ diff --git a/src/cairo-font-subset.c b/src/cairo-font-subset.c index e3a2784..bd113f9 100644 --- a/src/cairo-font-subset.c +++ b/src/cairo-font-subset.c @@ -71,6 +71,10 @@ struct cairo_pdf_ft_font { cairo_status_t status; }; +static int +cairo_pdf_ft_font_use_glyph (void *abstract_font, int glyph); + + #define ARRAY_LENGTH(a) ( (sizeof (a)) / (sizeof ((a)[0])) ) #define SFNT_VERSION 0x00010000 @@ -134,6 +138,7 @@ _cairo_font_subset_destroy (cairo_font_subset_t *font) cairo_font_subset_t * _cairo_font_subset_create (cairo_unscaled_font_t *unscaled_font) { + cairo_ft_unscaled_font_t *ft_unscaled_font; FT_Face face; cairo_pdf_ft_font_t *font; unsigned long size; @@ -143,7 +148,9 @@ _cairo_font_subset_create (cairo_unscaled_font_t *unscaled_font) if (! _cairo_unscaled_font_is_ft (unscaled_font)) return NULL; - face = _cairo_ft_unscaled_font_lock_face (unscaled_font); + ft_unscaled_font = (cairo_ft_unscaled_font_t *) unscaled_font; + + face = _cairo_ft_unscaled_font_lock_face (ft_unscaled_font); /* We currently only support freetype truetype fonts. */ size = 0; @@ -155,8 +162,7 @@ _cairo_font_subset_create (cairo_unscaled_font_t *unscaled_font) if (font == NULL) return NULL; - font->base.unscaled_font = unscaled_font; - _cairo_unscaled_font_reference (unscaled_font); + font->base.unscaled_font = _cairo_unscaled_font_reference (unscaled_font); font->base.backend = &cairo_pdf_ft_font_backend; _cairo_array_init (&font->output, sizeof (char)); @@ -193,7 +199,7 @@ _cairo_font_subset_create (cairo_unscaled_font_t *unscaled_font) if (font->base.widths == NULL) goto fail5; - _cairo_ft_unscaled_font_unlock_face (unscaled_font); + _cairo_ft_unscaled_font_unlock_face (ft_unscaled_font); font->status = CAIRO_STATUS_SUCCESS; @@ -310,6 +316,62 @@ cairo_pdf_ft_font_write_generic_table (cairo_pdf_ft_font_t *font, return 0; } + +typedef struct composite_glyph composite_glyph_t; +struct composite_glyph { + unsigned short flags; + unsigned short index; + unsigned short args[7]; /* 1 to 7 arguments depending on value of flags */ +}; + +typedef struct glyph_data glyph_data_t; +struct glyph_data { + short num_contours; + char data[8]; + composite_glyph_t glyph; +}; + +/* composite_glyph_t flags */ +#define ARG_1_AND_2_ARE_WORDS 0x0001 +#define WE_HAVE_A_SCALE 0x0008 +#define MORE_COMPONENTS 0x0020 +#define WE_HAVE_AN_X_AND_Y_SCALE 0x0040 +#define WE_HAVE_A_TWO_BY_TWO 0x0080 + +static void +cairo_pdf_ft_font_remap_composite_glyph (cairo_pdf_ft_font_t *font, + unsigned char *buffer) +{ + glyph_data_t *glyph_data; + composite_glyph_t *composite_glyph; + int num_args; + int has_more_components; + unsigned short flags; + unsigned short index; + + glyph_data = (glyph_data_t *) buffer; + if ((short)be16_to_cpu (glyph_data->num_contours) >= 0) + return; + + composite_glyph = &glyph_data->glyph; + do { + flags = be16_to_cpu (composite_glyph->flags); + has_more_components = flags & MORE_COMPONENTS; + index = cairo_pdf_ft_font_use_glyph (font, be16_to_cpu (composite_glyph->index)); + composite_glyph->index = cpu_to_be16 (index); + num_args = 1; + if (flags & ARG_1_AND_2_ARE_WORDS) + num_args += 1; + if (flags & WE_HAVE_A_SCALE) + num_args += 1; + else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) + num_args += 2; + else if (flags & WE_HAVE_A_TWO_BY_TWO) + num_args += 3; + composite_glyph = (composite_glyph_t *) &(composite_glyph->args[num_args]); + } while (has_more_components); +} + static int cairo_pdf_ft_font_write_glyf_table (cairo_pdf_ft_font_t *font, unsigned long tag) @@ -357,8 +419,10 @@ cairo_pdf_ft_font_write_glyf_table (cairo_pdf_ft_font_t *font, buffer = cairo_pdf_ft_font_write (font, NULL, size); if (buffer == NULL) break; - FT_Load_Sfnt_Table (font->face, TTAG_glyf, begin, buffer, &size); - /* FIXME: remap composite glyphs */ + if (size != 0) { + FT_Load_Sfnt_Table (font->face, TTAG_glyf, begin, buffer, &size); + cairo_pdf_ft_font_remap_composite_glyph (font, buffer); + } } font->glyphs[i].location = @@ -513,10 +577,14 @@ struct table { }; static const table_t truetype_tables[] = { + /* As we write out the glyf table we remap composite glyphs. + * Remapping composite glyphs will reference the sub glyphs the + * composite glyph is made up of. That needs to be done first so + * we have all the glyphs in the subset before going further. */ + { TTAG_glyf, cairo_pdf_ft_font_write_glyf_table }, { TTAG_cmap, cairo_pdf_ft_font_write_cmap_table }, { TTAG_cvt, cairo_pdf_ft_font_write_generic_table }, { TTAG_fpgm, cairo_pdf_ft_font_write_generic_table }, - { TTAG_glyf, cairo_pdf_ft_font_write_glyf_table }, { TTAG_head, cairo_pdf_ft_font_write_head_table }, { TTAG_hhea, cairo_pdf_ft_font_write_hhea_table }, { TTAG_hmtx, cairo_pdf_ft_font_write_hmtx_table }, @@ -589,11 +657,18 @@ static cairo_status_t cairo_pdf_ft_font_generate (void *abstract_font, const char **data, unsigned long *length) { + cairo_ft_unscaled_font_t *ft_unscaled_font; cairo_pdf_ft_font_t *font = abstract_font; unsigned long start, end, next, checksum, *checksum_location; int i; - font->face = _cairo_ft_unscaled_font_lock_face (font->base.unscaled_font); + /* XXX: It would be cleaner to do something besides this cast + * here. Perhaps cairo_pdf_ft_font_t should just have the + * cairo_ft_unscaled_font_t rather than having the generic + * cairo_unscaled_font_t in the base class? */ + ft_unscaled_font = (cairo_ft_unscaled_font_t *) font->base.unscaled_font; + + font->face = _cairo_ft_unscaled_font_lock_face (ft_unscaled_font); if (cairo_pdf_ft_font_write_offset_table (font)) goto fail; @@ -622,7 +697,7 @@ cairo_pdf_ft_font_generate (void *abstract_font, *length = _cairo_array_num_elements (&font->output); fail: - _cairo_ft_unscaled_font_unlock_face (font->base.unscaled_font); + _cairo_ft_unscaled_font_unlock_face (ft_unscaled_font); font->face = NULL; return font->status; diff --git a/src/cairo-font.c b/src/cairo-font.c index 9645f3d..913eb95 100644 --- a/src/cairo-font.c +++ b/src/cairo-font.c @@ -42,15 +42,16 @@ /* Forward declare so we can use it as an arbitrary backend for * _cairo_font_face_nil. */ -static const cairo_font_face_backend_t _cairo_simple_font_face_backend; +static const cairo_font_face_backend_t _cairo_toy_font_face_backend; /* cairo_font_face_t */ const cairo_font_face_t _cairo_font_face_nil = { + { 0 }, /* hash_entry */ CAIRO_STATUS_NO_MEMORY, /* status */ -1, /* ref_count */ { 0, 0, 0, NULL }, /* user_data */ - &_cairo_simple_font_face_backend + &_cairo_toy_font_face_backend }; void @@ -72,17 +73,21 @@ _cairo_font_face_init (cairo_font_face_t *font_face, * Increases the reference count on @font_face by one. This prevents * @font_face from being destroyed until a matching call to * cairo_font_face_destroy() is made. + * + * Return value: the referenced #cairo_font_face_t. **/ -void +cairo_font_face_t * cairo_font_face_reference (cairo_font_face_t *font_face) { if (font_face == NULL) - return; + return NULL; if (font_face->ref_count == (unsigned int)-1) - return; + return font_face; font_face->ref_count++; + + return font_face; } /** @@ -121,7 +126,7 @@ cairo_font_face_destroy (cairo_font_face_t *font_face) /** * cairo_font_face_status: - * @surface: a #cairo_font_face_t + * @font_face: a #cairo_font_face_t * * Checks whether an error has previously occurred for this * font face @@ -184,234 +189,124 @@ cairo_font_face_set_user_data (cairo_font_face_t *font_face, key, user_data, destroy); } -/* cairo_simple_font_face_t - simple family/slant/weight font faces used for - * the built-in font API - */ - -typedef struct _cairo_simple_font_face cairo_simple_font_face_t; - -struct _cairo_simple_font_face { - cairo_font_face_t base; - char *family; - cairo_font_slant_t slant; - cairo_font_weight_t weight; -}; +static const cairo_font_face_backend_t _cairo_toy_font_face_backend; -/* We maintain a global cache from family/weight/slant => cairo_font_face_t - * for cairo_simple_font_t. The primary purpose of this cache is to provide - * unique cairo_font_face_t values so that our cache from - * cairo_font_face_t => cairo_scaled_font_t works. For this reason, we don't need - * this cache to keep font faces alive; we just add them to the cache and - * remove them again when freed. +static int +_cairo_toy_font_face_keys_equal (void *key_a, + void *key_b); + +/* We maintain a hash table from family/weight/slant => + * cairo_font_face_t for cairo_toy_font_t. The primary purpose of + * this mapping is to provide unique cairo_font_face_t values so that + * our cache and mapping from cairo_font_face_t => cairo_scaled_font_t + * works. Once the corresponding cairo_font_face_t objects fall out of + * downstream caches, we don't need them in this hash table anymore. */ -typedef struct { - cairo_cache_entry_base_t base; - const char *family; - cairo_font_slant_t slant; - cairo_font_weight_t weight; -} cairo_simple_cache_key_t; - -typedef struct { - cairo_simple_cache_key_t key; - cairo_simple_font_face_t *font_face; -} cairo_simple_cache_entry_t; +static cairo_hash_table_t *cairo_toy_font_face_hash_table = NULL; -static const cairo_cache_backend_t _cairo_simple_font_cache_backend; - -CAIRO_MUTEX_DECLARE(_global_simple_cache_mutex); - -static void -_lock_global_simple_cache (void) -{ - CAIRO_MUTEX_LOCK (_global_simple_cache_mutex); -} - -static void -_unlock_global_simple_cache (void) -{ - CAIRO_MUTEX_UNLOCK (_global_simple_cache_mutex); -} +CAIRO_MUTEX_DECLARE (cairo_toy_font_face_hash_table_mutex); -static cairo_cache_t * -_get_global_simple_cache (void) +static cairo_hash_table_t * +_cairo_toy_font_face_hash_table_lock (void) { - static cairo_cache_t *global_simple_cache = NULL; + CAIRO_MUTEX_LOCK (cairo_toy_font_face_hash_table_mutex); - if (global_simple_cache == NULL) + if (cairo_toy_font_face_hash_table == NULL) { - global_simple_cache = malloc (sizeof (cairo_cache_t)); - if (!global_simple_cache) - goto FAIL; + cairo_toy_font_face_hash_table = + _cairo_hash_table_create (_cairo_toy_font_face_keys_equal); - if (_cairo_cache_init (global_simple_cache, - &_cairo_simple_font_cache_backend, - 0)) /* No memory limit */ - goto FAIL; + if (cairo_toy_font_face_hash_table == NULL) { + CAIRO_MUTEX_UNLOCK (cairo_toy_font_face_hash_table_mutex); + return NULL; + } } - return global_simple_cache; - - FAIL: - if (global_simple_cache) - free (global_simple_cache); - global_simple_cache = NULL; - return NULL; -} - -static unsigned long -_cairo_simple_font_cache_hash (void *cache, void *key) -{ - cairo_simple_cache_key_t *k = (cairo_simple_cache_key_t *) key; - unsigned long hash; - /* 1607 and 1451 are just a couple random primes. */ - hash = _cairo_hash_string (k->family); - hash += ((unsigned long) k->slant) * 1607; - hash += ((unsigned long) k->weight) * 1451; - - return hash; + return cairo_toy_font_face_hash_table; } -static int -_cairo_simple_font_cache_keys_equal (void *cache, - void *k1, - void *k2) +static void +_cairo_toy_font_face_hash_table_unlock (void) { - cairo_simple_cache_key_t *a; - cairo_simple_cache_key_t *b; - a = (cairo_simple_cache_key_t *) k1; - b = (cairo_simple_cache_key_t *) k2; - - return strcmp (a->family, b->family) == 0 && - a->slant == b->slant && - a->weight == b->weight; + CAIRO_MUTEX_UNLOCK (cairo_toy_font_face_hash_table_mutex); } -static cairo_simple_font_face_t * -_cairo_simple_font_face_create_from_cache_key (cairo_simple_cache_key_t *key) +/** + * _cairo_toy_font_face_init_key: + * + * Initialize those portions of cairo_toy_font_face_t needed to use + * it as a hash table key, including the hash code buried away in + * font_face->base.hash_entry. No memory allocation is performed here + * so that no fini call is needed. We do this to make it easier to use + * an automatic cairo_toy_font_face_t variable as a key. + **/ +static void +_cairo_toy_font_face_init_key (cairo_toy_font_face_t *key, + const char *family, + cairo_font_slant_t slant, + cairo_font_weight_t weight) { - cairo_simple_font_face_t *simple_face; - - simple_face = malloc (sizeof (cairo_simple_font_face_t)); - if (!simple_face) - return NULL; - - simple_face->family = strdup (key->family); - if (!simple_face->family) { - free (simple_face); - return NULL; - } + unsigned long hash; - simple_face->slant = key->slant; - simple_face->weight = key->weight; + key->family = family; + key->owns_family = FALSE; - _cairo_font_face_init (&simple_face->base, &_cairo_simple_font_face_backend); + key->slant = slant; + key->weight = weight; - return simple_face; + /* 1607 and 1451 are just a couple of arbitrary primes. */ + hash = _cairo_hash_string (family); + hash += ((unsigned long) slant) * 1607; + hash += ((unsigned long) weight) * 1451; + + key->base.hash_entry.hash = hash; } static cairo_status_t -_cairo_simple_font_cache_create_entry (void *cache, - void *key, - void **return_entry) +_cairo_toy_font_face_init (cairo_toy_font_face_t *font_face, + const char *family, + cairo_font_slant_t slant, + cairo_font_weight_t weight) { - cairo_simple_cache_key_t *k = (cairo_simple_cache_key_t *) key; - cairo_simple_cache_entry_t *entry; + char *family_copy; - entry = malloc (sizeof (cairo_simple_cache_entry_t)); - if (entry == NULL) + family_copy = strdup (family); + if (family_copy == NULL) return CAIRO_STATUS_NO_MEMORY; - entry->font_face = _cairo_simple_font_face_create_from_cache_key (k); - if (!entry->font_face) { - free (entry); - return CAIRO_STATUS_NO_MEMORY; - } - - entry->key.base.memory = 0; - entry->key.family = entry->font_face->family; - entry->key.slant = entry->font_face->slant; - entry->key.weight = entry->font_face->weight; - - *return_entry = entry; + _cairo_toy_font_face_init_key (font_face, family_copy, + slant, weight); + font_face->owns_family = TRUE; + + _cairo_font_face_init (&font_face->base, &_cairo_toy_font_face_backend); return CAIRO_STATUS_SUCCESS; } -/* Entries are never spontaneously destroyed; but only when - * we remove them from the cache specifically. We free entry->font_face - * in the code that removes the entry from the cache - */ static void -_cairo_simple_font_cache_destroy_entry (void *cache, - void *entry) -{ - cairo_simple_cache_entry_t *e = (cairo_simple_cache_entry_t *) entry; - - free (e); -} - -static void -_cairo_simple_font_cache_destroy_cache (void *cache) +_cairo_toy_font_face_fini (cairo_toy_font_face_t *font_face) { - free (cache); + /* We assert here that we own font_face->family before casting + * away the const qualifer. */ + assert (font_face->owns_family); + free ((char*) font_face->family); } -static const cairo_cache_backend_t _cairo_simple_font_cache_backend = { - _cairo_simple_font_cache_hash, - _cairo_simple_font_cache_keys_equal, - _cairo_simple_font_cache_create_entry, - _cairo_simple_font_cache_destroy_entry, - _cairo_simple_font_cache_destroy_cache -}; - -static void -_cairo_simple_font_face_destroy (void *abstract_face) -{ - cairo_simple_font_face_t *simple_face = abstract_face; - cairo_cache_t *cache; - cairo_simple_cache_key_t key; - - if (simple_face == NULL) - return; - - _lock_global_simple_cache (); - cache = _get_global_simple_cache (); - assert (cache); - - key.family = simple_face->family; - key.slant = simple_face->slant; - key.weight = simple_face->weight; - - _cairo_cache_remove (cache, &key); - - _unlock_global_simple_cache (); - - free (simple_face->family); -} - -static cairo_status_t -_cairo_simple_font_face_create_font (void *abstract_face, - const cairo_matrix_t *font_matrix, - const cairo_matrix_t *ctm, - const cairo_font_options_t *options, - cairo_scaled_font_t **scaled_font) +static int +_cairo_toy_font_face_keys_equal (void *key_a, + void *key_b) { - const cairo_scaled_font_backend_t * backend = CAIRO_SCALED_FONT_BACKEND_DEFAULT; + cairo_toy_font_face_t *face_a = key_a; + cairo_toy_font_face_t *face_b = key_b; - cairo_simple_font_face_t *simple_face = abstract_face; - - return backend->create (simple_face->family, simple_face->slant, simple_face->weight, - font_matrix, ctm, options, scaled_font); + return (strcmp (face_a->family, face_b->family) == 0 && + face_a->slant == face_b->slant && + face_a->weight == face_b->weight); } -static const cairo_font_face_backend_t _cairo_simple_font_face_backend = { - _cairo_simple_font_face_destroy, - _cairo_simple_font_face_create_font, -}; - /** - * _cairo_simple_font_face_create: + * _cairo_toy_font_face_create: * @family: a font family name, encoded in UTF-8 * @slant: the slant for the font * @weight: the weight for the font @@ -424,49 +319,108 @@ static const cairo_font_face_backend_t _cairo_simple_font_face_backend = { * cairo_font_face_destroy() **/ cairo_font_face_t * -_cairo_simple_font_face_create (const char *family, - cairo_font_slant_t slant, - cairo_font_weight_t weight) +_cairo_toy_font_face_create (const char *family, + cairo_font_slant_t slant, + cairo_font_weight_t weight) { - cairo_simple_cache_entry_t *entry; - cairo_simple_cache_key_t key; - cairo_cache_t *cache; cairo_status_t status; - cairo_bool_t created_entry; + cairo_toy_font_face_t key, *font_face; + cairo_hash_table_t *hash_table; + + hash_table = _cairo_toy_font_face_hash_table_lock (); + if (hash_table == NULL) + goto UNWIND; - key.family = family; - key.slant = slant; - key.weight = weight; + _cairo_toy_font_face_init_key (&key, family, slant, weight); - _lock_global_simple_cache (); - cache = _get_global_simple_cache (); - if (cache == NULL) { - _unlock_global_simple_cache (); - _cairo_error (CAIRO_STATUS_NO_MEMORY); - return (cairo_font_face_t *)&_cairo_font_face_nil; + /* Return existing font_face if it exists in the hash table. */ + if (_cairo_hash_table_lookup (hash_table, + &key.base.hash_entry, + (cairo_hash_entry_t **) &font_face)) + { + _cairo_toy_font_face_hash_table_unlock (); + return cairo_font_face_reference (&font_face->base); } - status = _cairo_cache_lookup (cache, &key, (void **) &entry, &created_entry); - if (status == CAIRO_STATUS_SUCCESS && !created_entry) - cairo_font_face_reference (&entry->font_face->base); + + /* Otherwise create it and insert into hash table. */ + font_face = malloc (sizeof (cairo_toy_font_face_t)); + if (font_face == NULL) + goto UNWIND_HASH_TABLE_LOCK; + + status = _cairo_toy_font_face_init (font_face, family, slant, weight); + if (status) + goto UNWIND_FONT_FACE_MALLOC; + + status = _cairo_hash_table_insert (hash_table, &font_face->base.hash_entry); + if (status) + goto UNWIND_FONT_FACE_INIT; + + _cairo_toy_font_face_hash_table_unlock (); + + return &font_face->base; + + UNWIND_FONT_FACE_INIT: + UNWIND_FONT_FACE_MALLOC: + free (font_face); + UNWIND_HASH_TABLE_LOCK: + _cairo_toy_font_face_hash_table_unlock (); + UNWIND: + return (cairo_font_face_t*) &_cairo_font_face_nil; +} + +static void +_cairo_toy_font_face_destroy (void *abstract_face) +{ + cairo_toy_font_face_t *font_face = abstract_face; + cairo_hash_table_t *hash_table; + + if (font_face == NULL) + return; + + hash_table = _cairo_toy_font_face_hash_table_lock (); + /* All created objects must have been mapped in the hash table. */ + assert (hash_table != NULL); + + _cairo_hash_table_remove (hash_table, &font_face->base.hash_entry); - _unlock_global_simple_cache (); - if (status) { - _cairo_error (status); - return (cairo_font_face_t *)&_cairo_font_face_nil; - } + _cairo_toy_font_face_hash_table_unlock (); + + _cairo_toy_font_face_fini (font_face); +} - return &entry->font_face->base; +static cairo_status_t +_cairo_toy_font_face_scaled_font_create (void *abstract_font_face, + const cairo_matrix_t *font_matrix, + const cairo_matrix_t *ctm, + const cairo_font_options_t *options, + cairo_scaled_font_t **scaled_font) +{ + cairo_toy_font_face_t *font_face = abstract_font_face; + const cairo_scaled_font_backend_t * backend = CAIRO_SCALED_FONT_BACKEND_DEFAULT; + + return backend->create_toy (font_face, + font_matrix, ctm, options, scaled_font); } +static const cairo_font_face_backend_t _cairo_toy_font_face_backend = { + _cairo_toy_font_face_destroy, + _cairo_toy_font_face_scaled_font_create +}; + /* cairo_scaled_font_t */ static const cairo_scaled_font_t _cairo_scaled_font_nil = { + { 0 }, /* hash_entry */ CAIRO_STATUS_NO_MEMORY, /* status */ -1, /* ref_count */ + NULL, /* font_face */ { 1., 0., 0., 1., 0, 0}, /* font_matrix */ { 1., 0., 0., 1., 0, 0}, /* ctm */ { 1., 0., 0., 1., 0, 0}, /* scale */ - NULL, /* font_face */ + { CAIRO_ANTIALIAS_DEFAULT, /* options */ + CAIRO_SUBPIXEL_ORDER_DEFAULT, + CAIRO_HINT_STYLE_DEFAULT, + CAIRO_HINT_METRICS_DEFAULT} , CAIRO_SCALED_FONT_BACKEND_DEFAULT, }; @@ -497,7 +451,7 @@ _cairo_scaled_font_set_error (cairo_scaled_font_t *scaled_font, /** * cairo_scaled_font_status: - * @surface: a #cairo_scaled_font_t + * @scaled_font: a #cairo_scaled_font_t * * Checks whether an error has previously occurred for this * scaled_font. @@ -511,105 +465,106 @@ cairo_scaled_font_status (cairo_scaled_font_t *scaled_font) return scaled_font->status; } -/* Here we keep a cache from cairo_font_face_t/matrix/ctm => cairo_scaled_font_t. +/* Here we keep a unique mapping from + * cairo_font_face_t/matrix/ctm/options => cairo_scaled_font_t. + * + * Here are the things that we want to map: * - * The implementation is messy because we want + * a) All otherwise referenced cairo_scaled_font_t's + * b) Some number of not otherwise referenced cairo_scaled_font_t's * - * - All otherwise referenced cairo_scaled_font_t's to be in the cache - * - Some number of not otherwise referenced cairo_scaled_font_t's + * The implementation uses a hash table which covers (a) + * completely. Then, for (b) we have an array of otherwise + * unreferenced fonts (holdovers) which are expired in + * least-recently-used order. * - * For this reason, we actually use *two* caches ... a finite size - * cache that references the cairo_scaled_font_t as a first level (the outer - * cache), then an infinite size cache as the second level (the inner - * cache). A single cache could be used at the cost of complicating - * cairo-cache.c + * The cairo_scaled_font_create code gets to treat this like a regular + * hash table. All of the magic for the little holdover cache is in + * cairo_scaled_font_reference and cairo_scaled_font_destroy. */ -/* This defines the size of the outer cache ... that is, the number +/* This defines the size of the holdover array ... that is, the number * of scaled fonts we keep around even when not otherwise referenced */ -#define MAX_CACHED_FONTS 24 - -typedef struct { - cairo_cache_entry_base_t base; - cairo_font_face_t *font_face; - const cairo_matrix_t *font_matrix; - const cairo_matrix_t *ctm; - cairo_font_options_t options; -} cairo_font_cache_key_t; - -typedef struct { - cairo_font_cache_key_t key; - cairo_scaled_font_t *scaled_font; -} cairo_font_cache_entry_t; +#define CAIRO_SCALED_FONT_MAX_HOLDOVERS 24 + +typedef struct _cairo_scaled_font_map { + cairo_hash_table_t *hash_table; + cairo_scaled_font_t *holdovers[CAIRO_SCALED_FONT_MAX_HOLDOVERS]; + int num_holdovers; +} cairo_scaled_font_map_t; -static const cairo_cache_backend_t _cairo_outer_font_cache_backend; -static const cairo_cache_backend_t _cairo_inner_font_cache_backend; +static cairo_scaled_font_map_t *cairo_scaled_font_map = NULL; -CAIRO_MUTEX_DECLARE(_global_font_cache_mutex); +CAIRO_MUTEX_DECLARE (cairo_scaled_font_map_mutex); -static void -_lock_global_font_cache (void) -{ - CAIRO_MUTEX_LOCK (_global_font_cache_mutex); -} +static int +_cairo_scaled_font_keys_equal (void *abstract_key_a, void *abstract_key_b); -static void -_unlock_global_font_cache (void) +static cairo_scaled_font_map_t * +_cairo_scaled_font_map_lock (void) { - CAIRO_MUTEX_UNLOCK (_global_font_cache_mutex); -} + CAIRO_MUTEX_LOCK (cairo_scaled_font_map_mutex); -static cairo_cache_t * -_get_outer_font_cache (void) -{ - static cairo_cache_t *outer_font_cache = NULL; - - if (outer_font_cache == NULL) + if (cairo_scaled_font_map == NULL) { - outer_font_cache = malloc (sizeof (cairo_cache_t)); - if (!outer_font_cache) - goto FAIL; + cairo_scaled_font_map = malloc (sizeof (cairo_scaled_font_map_t)); + if (cairo_scaled_font_map == NULL) + goto CLEANUP_MUTEX_LOCK; - if (_cairo_cache_init (outer_font_cache, - &_cairo_outer_font_cache_backend, - MAX_CACHED_FONTS)) - goto FAIL; + cairo_scaled_font_map->hash_table = + _cairo_hash_table_create (_cairo_scaled_font_keys_equal); + + if (cairo_scaled_font_map->hash_table == NULL) + goto CLEANUP_SCALED_FONT_MAP; + + cairo_scaled_font_map->num_holdovers = 0; } - return outer_font_cache; - FAIL: - if (outer_font_cache) - free (outer_font_cache); - outer_font_cache = NULL; + return cairo_scaled_font_map; + + CLEANUP_SCALED_FONT_MAP: + free (cairo_scaled_font_map); + CLEANUP_MUTEX_LOCK: + CAIRO_MUTEX_UNLOCK (cairo_scaled_font_map_mutex); return NULL; } -static cairo_cache_t * -_get_inner_font_cache (void) +static void +_cairo_scaled_font_map_unlock (void) +{ + CAIRO_MUTEX_UNLOCK (cairo_scaled_font_map_mutex); +} + +static void +_cairo_scaled_font_map_destroy (void) { - static cairo_cache_t *inner_font_cache = NULL; + int i; + cairo_scaled_font_map_t *font_map = cairo_scaled_font_map; + cairo_scaled_font_t *scaled_font; - if (inner_font_cache == NULL) - { - inner_font_cache = malloc (sizeof (cairo_cache_t)); - if (!inner_font_cache) - goto FAIL; + if (font_map == NULL) + return; - if (_cairo_cache_init (inner_font_cache, - &_cairo_inner_font_cache_backend, - MAX_CACHED_FONTS)) - goto FAIL; + CAIRO_MUTEX_UNLOCK (cairo_scaled_font_map_mutex); + + for (i = 0; i < font_map->num_holdovers; i++) { + scaled_font = font_map->holdovers[i]; + /* We should only get here through the reset_static_data path + * and there had better not be any active references at that + * point. */ + assert (scaled_font->ref_count == 0); + _cairo_hash_table_remove (font_map->hash_table, + &scaled_font->hash_entry); + _cairo_scaled_font_fini (scaled_font); + free (scaled_font); } - return inner_font_cache; - FAIL: - if (inner_font_cache) - free (inner_font_cache); - inner_font_cache = NULL; - return NULL; -} + _cairo_hash_table_destroy (font_map->hash_table); + free (cairo_scaled_font_map); + cairo_scaled_font_map = NULL; +} /* Fowler / Noll / Vo (FNV) Hash (http://www.isthe.com/chongo/tech/comp/fnv/) * @@ -632,174 +587,85 @@ _hash_bytes_fnv (unsigned char *buffer, return hval; } -static unsigned long -_cairo_font_cache_hash (void *cache, void *key) + +static void +_cairo_scaled_font_init_key (cairo_scaled_font_t *scaled_font, + cairo_font_face_t *font_face, + const cairo_matrix_t *font_matrix, + const cairo_matrix_t *ctm, + const cairo_font_options_t *options) { - cairo_font_cache_key_t *k = (cairo_font_cache_key_t *) key; uint32_t hash = FNV1_32_INIT; - /* We do a bytewise hash on the font matrices */ - hash = _hash_bytes_fnv ((unsigned char *)(&k->font_matrix->xx), + scaled_font->status = CAIRO_STATUS_SUCCESS; + scaled_font->font_face = font_face; + scaled_font->font_matrix = *font_matrix; + scaled_font->ctm = *ctm; + scaled_font->options = *options; + + /* We do a bytewise hash on the font matrices, ignoring the + * translation values. */ + hash = _hash_bytes_fnv ((unsigned char *)(&scaled_font->font_matrix.xx), sizeof(double) * 4, hash); - hash = _hash_bytes_fnv ((unsigned char *)(&k->ctm->xx), + hash = _hash_bytes_fnv ((unsigned char *)(&scaled_font->ctm.xx), sizeof(double) * 4, hash); - return (hash ^ - (unsigned long)k->font_face ^ - cairo_font_options_hash (&k->options)); + hash ^= (unsigned long) scaled_font->font_face; + + hash ^= cairo_font_options_hash (&scaled_font->options); + + scaled_font->hash_entry.hash = hash; } -static int -_cairo_font_cache_keys_equal (void *cache, - void *k1, - void *k2) +static cairo_bool_t +_cairo_scaled_font_keys_equal (void *abstract_key_a, void *abstract_key_b) { - cairo_font_cache_key_t *a; - cairo_font_cache_key_t *b; - a = (cairo_font_cache_key_t *) k1; - b = (cairo_font_cache_key_t *) k2; - - return (a->font_face == b->font_face && - memcmp ((unsigned char *)(&a->font_matrix->xx), - (unsigned char *)(&b->font_matrix->xx), + cairo_scaled_font_t *key_a = abstract_key_a; + cairo_scaled_font_t *key_b = abstract_key_b; + + return (key_a->font_face == key_b->font_face && + memcmp ((unsigned char *)(&key_a->font_matrix.xx), + (unsigned char *)(&key_b->font_matrix.xx), sizeof(double) * 4) == 0 && - memcmp ((unsigned char *)(&a->ctm->xx), - (unsigned char *)(&b->ctm->xx), + memcmp ((unsigned char *)(&key_a->ctm.xx), + (unsigned char *)(&key_b->ctm.xx), sizeof(double) * 4) == 0 && - cairo_font_options_equal (&a->options, &b->options)); + cairo_font_options_equal (&key_a->options, &key_b->options)); } -/* The cache lookup failed in the outer cache, so we pull - * the font from the inner cache (if that in turns fails, - * it will create the font - */ -static cairo_status_t -_cairo_outer_font_cache_create_entry (void *cache, - void *key, - void **return_entry) +void +_cairo_scaled_font_init (cairo_scaled_font_t *scaled_font, + cairo_font_face_t *font_face, + const cairo_matrix_t *font_matrix, + const cairo_matrix_t *ctm, + const cairo_font_options_t *options, + const cairo_scaled_font_backend_t *backend) { - cairo_font_cache_entry_t *entry; - cairo_font_cache_entry_t *inner_entry; - cairo_bool_t created_entry; - cairo_status_t status; - - entry = malloc (sizeof (cairo_font_cache_entry_t)); - if (entry == NULL) - return CAIRO_STATUS_NO_MEMORY; - - cache = _get_inner_font_cache (); - if (cache == NULL) { - _unlock_global_font_cache (); - return CAIRO_STATUS_NO_MEMORY; - } - - status = _cairo_cache_lookup (cache, key, (void **) &inner_entry, &created_entry); - if (status) { - free (entry); - return status; - } - - entry->scaled_font = inner_entry->scaled_font; - if (!created_entry) - cairo_scaled_font_reference (entry->scaled_font); - - entry->key.base.memory = 1; - entry->key.font_face = entry->scaled_font->font_face; - entry->key.font_matrix = &entry->scaled_font->font_matrix; - entry->key.ctm = &entry->scaled_font->ctm; - entry->key.options = ((cairo_font_cache_key_t *) key)->options; - - *return_entry = entry; + scaled_font->ref_count = 1; - return CAIRO_STATUS_SUCCESS; -} + _cairo_scaled_font_init_key (scaled_font, font_face, + font_matrix, ctm, options); -static void -_cairo_outer_font_cache_destroy_entry (void *cache, - void *entry) -{ - cairo_font_cache_entry_t *e = (cairo_font_cache_entry_t *) entry; + cairo_font_face_reference (font_face); - cairo_scaled_font_destroy (e->scaled_font); + cairo_matrix_multiply (&scaled_font->scale, + &scaled_font->font_matrix, + &scaled_font->ctm); - free (e); + scaled_font->backend = backend; } -/* Called when the lookup fails in the inner cache as well; there - * is no existing font, so we have to create one. - */ -static cairo_status_t -_cairo_inner_font_cache_create_entry (void *cache, - void *key, - void **return_entry) +void +_cairo_scaled_font_fini (cairo_scaled_font_t *scaled_font) { - cairo_font_cache_key_t *k = (cairo_font_cache_key_t *) key; - cairo_font_cache_entry_t *entry; - cairo_status_t status; - - entry = malloc (sizeof (cairo_font_cache_entry_t)); - if (entry == NULL) - return CAIRO_STATUS_NO_MEMORY; - - status = k->font_face->backend->create_font (k->font_face, - k->font_matrix, - k->ctm, - &k->options, - &entry->scaled_font); - if (status) { - free (entry); - return status; - } - - entry->scaled_font->font_face = k->font_face; - cairo_font_face_reference (k->font_face); - - entry->key.base.memory = 0; - entry->key.font_face = k->font_face; - entry->key.font_matrix = &entry->scaled_font->font_matrix; - entry->key.ctm = &entry->scaled_font->ctm; - entry->key.options = k->options; - - *return_entry = entry; - - return CAIRO_STATUS_SUCCESS; -} + if (scaled_font->font_face) + cairo_font_face_destroy (scaled_font->font_face); -/* Entries in the inner font cache are never spontaneously destroyed; - * but only when we remove them from the cache specifically. We free - * entry->scaled_font in the code that removes the entry from the cache - */ -static void -_cairo_inner_font_cache_destroy_entry (void *cache, - void *entry) -{ - free (entry); + scaled_font->backend->fini (scaled_font); } -static void -_cairo_font_cache_destroy_cache (void *cache) -{ - free (cache); -} - -static const cairo_cache_backend_t _cairo_outer_font_cache_backend = { - _cairo_font_cache_hash, - _cairo_font_cache_keys_equal, - _cairo_outer_font_cache_create_entry, - _cairo_outer_font_cache_destroy_entry, - _cairo_font_cache_destroy_cache -}; - -static const cairo_cache_backend_t _cairo_inner_font_cache_backend = { - _cairo_font_cache_hash, - _cairo_font_cache_keys_equal, - _cairo_inner_font_cache_create_entry, - _cairo_inner_font_cache_destroy_entry, - _cairo_font_cache_destroy_cache -}; - /** * cairo_scaled_font_create: * @font_face: a #cairo_font_face_t @@ -826,54 +692,149 @@ cairo_scaled_font_create (cairo_font_face_t *font_face, const cairo_matrix_t *ctm, const cairo_font_options_t *options) { - cairo_font_cache_entry_t *entry; - cairo_font_cache_key_t key; - cairo_cache_t *cache; cairo_status_t status; + cairo_scaled_font_map_t *font_map; + cairo_scaled_font_t key, *scaled_font = NULL; - if (font_face->status) - return (cairo_scaled_font_t*) &_cairo_scaled_font_nil; - - key.font_face = font_face; - key.font_matrix = font_matrix; - key.ctm = ctm; - key.options = *options; + font_map = _cairo_scaled_font_map_lock (); + if (font_map == NULL) + goto UNWIND; - _lock_global_font_cache (); - cache = _get_outer_font_cache (); - if (cache == NULL) { - _unlock_global_font_cache (); - _cairo_error (CAIRO_STATUS_NO_MEMORY); - return (cairo_scaled_font_t*) &_cairo_scaled_font_nil; + _cairo_scaled_font_init_key (&key, font_face, + font_matrix, ctm, options); + + /* Return existing scaled_font if it exists in the hash table. */ + if (_cairo_hash_table_lookup (font_map->hash_table, &key.hash_entry, + (cairo_hash_entry_t**) &scaled_font)) + { + _cairo_scaled_font_map_unlock (); + return cairo_scaled_font_reference (scaled_font); } - - status = _cairo_cache_lookup (cache, &key, (void **) &entry, NULL); - if (status == CAIRO_STATUS_SUCCESS) - cairo_scaled_font_reference (entry->scaled_font); - - _unlock_global_font_cache (); - if (status) { - _cairo_error (status); - return (cairo_scaled_font_t*) &_cairo_scaled_font_nil; + + /* Otherwise create it and insert it into the hash table. */ + status = font_face->backend->scaled_font_create (font_face, font_matrix, + ctm, options, &scaled_font); + if (status) + goto UNWIND_FONT_MAP_LOCK; + + status = _cairo_hash_table_insert (font_map->hash_table, + &scaled_font->hash_entry); + if (status) + goto UNWIND_SCALED_FONT_CREATE; + + _cairo_scaled_font_map_unlock (); + + return scaled_font; + +UNWIND_SCALED_FONT_CREATE: + /* We can't call _cairo_scaled_font_destroy here since it expects + * that the font has already been successfully inserted into the + * hash table. */ + _cairo_scaled_font_fini (scaled_font); + free (scaled_font); +UNWIND_FONT_MAP_LOCK: + _cairo_scaled_font_map_unlock (); +UNWIND: + return NULL; +} + +/** + * cairo_scaled_font_reference: + * @scaled_font: a #cairo_scaled_font_t, (may be NULL in which case + * this function does nothing) + * + * Increases the reference count on @scaled_font by one. This prevents + * @scaled_font from being destroyed until a matching call to + * cairo_scaled_font_destroy() is made. + **/ +cairo_scaled_font_t * +cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font) +{ + if (scaled_font == NULL) + return NULL; + + if (scaled_font->ref_count == (unsigned int)-1) + return scaled_font; + + /* If the original reference count is 0, then this font must have + * been found in font_map->holdovers, (which means this caching is + * actually working). So now we remove it from the holdovers + * array. */ + if (scaled_font->ref_count == 0) { + cairo_scaled_font_map_t *font_map; + int i; + + font_map = _cairo_scaled_font_map_lock (); + { + for (i = 0; i < font_map->num_holdovers; i++) + if (font_map->holdovers[i] == scaled_font) + break; + assert (i < font_map->num_holdovers); + + font_map->num_holdovers--; + memmove (&font_map->holdovers[i], + &font_map->holdovers[i+1], + (font_map->num_holdovers - i) * sizeof (cairo_scaled_font_t*)); + } + _cairo_scaled_font_map_unlock (); } - - return entry->scaled_font; + + scaled_font->ref_count++; + + return scaled_font; } +/** + * cairo_scaled_font_destroy: + * @scaled_font: a #cairo_scaled_font_t + * + * Decreases the reference count on @font by one. If the result + * is zero, then @font and all associated resources are freed. + * See cairo_scaled_font_reference(). + **/ void -_cairo_scaled_font_init (cairo_scaled_font_t *scaled_font, - const cairo_matrix_t *font_matrix, - const cairo_matrix_t *ctm, - const cairo_scaled_font_backend_t *backend) +cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font) { - scaled_font->status = CAIRO_STATUS_SUCCESS; + cairo_scaled_font_map_t *font_map; - scaled_font->font_matrix = *font_matrix; - scaled_font->ctm = *ctm; - cairo_matrix_multiply (&scaled_font->scale, &scaled_font->font_matrix, &scaled_font->ctm); - - scaled_font->ref_count = 1; - scaled_font->backend = backend; + if (scaled_font == NULL) + return; + + if (scaled_font->ref_count == (unsigned int)-1) + return; + + if (--(scaled_font->ref_count) > 0) + return; + + font_map = _cairo_scaled_font_map_lock (); + assert (font_map != NULL); + { + /* Rather than immediately destroying this object, we put it into + * the font_map->holdovers array in case it will get used again + * soon. To make room for it, we do actually destroy the + * least-recently-used holdover. + */ + if (font_map->num_holdovers == CAIRO_SCALED_FONT_MAX_HOLDOVERS) { + cairo_scaled_font_t *lru; + + lru = font_map->holdovers[0]; + assert (lru->ref_count == 0); + + _cairo_hash_table_remove (font_map->hash_table, &lru->hash_entry); + + _cairo_scaled_font_fini (lru); + free (lru); + + font_map->num_holdovers--; + memmove (&font_map->holdovers[0], + &font_map->holdovers[1], + font_map->num_holdovers * sizeof (cairo_scaled_font_t*)); + } + + font_map->holdovers[font_map->num_holdovers] = scaled_font; + font_map->num_holdovers++; + } + _cairo_scaled_font_map_unlock (); } cairo_status_t @@ -992,13 +953,15 @@ _cairo_unscaled_font_init (cairo_unscaled_font_t *unscaled_font, unscaled_font->backend = backend; } -void +cairo_unscaled_font_t * _cairo_unscaled_font_reference (cairo_unscaled_font_t *unscaled_font) { if (unscaled_font == NULL) - return; + return NULL; unscaled_font->ref_count++; + + return unscaled_font; } void @@ -1015,83 +978,14 @@ _cairo_unscaled_font_destroy (cairo_unscaled_font_t *unscaled_font) free (unscaled_font); } - - /* Public font API follows. */ /** - * cairo_scaled_font_reference: - * @scaled_font: a #cairo_scaled_font_t, (may be NULL in which case - * this function does nothing) - * - * Increases the reference count on @scaled_font by one. This prevents - * @scaled_font from being destroyed until a matching call to - * cairo_scaled_font_destroy() is made. - **/ -void -cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font) -{ - if (scaled_font == NULL) - return; - - if (scaled_font->ref_count == (unsigned int)-1) - return; - - scaled_font->ref_count++; -} - -/** - * cairo_scaled_font_destroy: - * @scaled_font: a #cairo_scaled_font_t - * - * Decreases the reference count on @font by one. If the result - * is zero, then @font and all associated resources are freed. - * See cairo_scaled_font_reference(). - **/ -void -cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font) -{ - cairo_font_cache_key_t key; - cairo_cache_t *cache; - - if (scaled_font == NULL) - return; - - if (scaled_font->ref_count == (unsigned int)-1) - return; - - if (--(scaled_font->ref_count) > 0) - return; - - if (scaled_font->font_face) { - _lock_global_font_cache (); - cache = _get_inner_font_cache (); - assert (cache); - - key.font_face = scaled_font->font_face; - key.font_matrix = &scaled_font->font_matrix; - key.ctm = &scaled_font->ctm; - - _cairo_cache_remove (cache, &key); - _unlock_global_font_cache (); - - cairo_font_face_destroy (scaled_font->font_face); - } - - scaled_font->backend->destroy (scaled_font); - - free (scaled_font); -} - -/** * cairo_scaled_font_extents: * @scaled_font: a #cairo_scaled_font_t * @extents: a #cairo_font_extents_t which to store the retrieved extents. * * Gets the metrics for a #cairo_scaled_font_t. - * - * Return value: %CAIRO_STATUS_SUCCESS on success. Otherwise, an - * error such as %CAIRO_STATUS_NO_MEMORY. **/ void cairo_scaled_font_extents (cairo_scaled_font_t *scaled_font, @@ -1344,8 +1238,10 @@ _cairo_lock_global_image_glyph_cache() void _cairo_unlock_global_image_glyph_cache() { - _cairo_cache_shrink_to (_global_image_glyph_cache, - CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT); + if (_global_image_glyph_cache) { + _cairo_cache_shrink_to (_global_image_glyph_cache, + CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT); + } CAIRO_MUTEX_UNLOCK (_global_image_glyph_cache_mutex); } @@ -1372,3 +1268,19 @@ _cairo_get_global_image_glyph_cache () _global_image_glyph_cache = NULL; return NULL; } + +void +_cairo_font_reset_static_data (void) +{ + _cairo_scaled_font_map_destroy (); + + _cairo_lock_global_image_glyph_cache(); + _cairo_cache_destroy (_global_image_glyph_cache); + _global_image_glyph_cache = NULL; + _cairo_unlock_global_image_glyph_cache(); + + CAIRO_MUTEX_LOCK (cairo_toy_font_face_hash_table_mutex); + _cairo_hash_table_destroy (cairo_toy_font_face_hash_table); + cairo_toy_font_face_hash_table = NULL; + CAIRO_MUTEX_UNLOCK (cairo_toy_font_face_hash_table_mutex); +} diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index afe80df..e1bcdd7 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -76,31 +76,31 @@ * factors so that hinting works right */ -typedef struct { +typedef struct _cairo_ft_font_transform { double x_scale, y_scale; double shape[2][2]; -} ft_font_transform_t; +} cairo_ft_font_transform_t; /* * We create an object that corresponds to a single font on the disk; * (identified by a filename/id pair) these are shared between all - * fonts using that file. For cairo_ft_scaled_font_create_for_ft_face(), we + * fonts using that file. For cairo_ft_font_face_create_for_ft_face(), we * just create a one-off version with a permanent face value. */ -typedef struct _ft_font_face ft_font_face_t; +typedef struct _cairo_ft_font_face cairo_ft_font_face_t; -typedef struct { +struct _cairo_ft_unscaled_font { cairo_unscaled_font_t base; - cairo_bool_t from_face; /* from cairo_ft_scaled_font_create_for_ft_face()? */ + cairo_bool_t from_face; /* from cairo_ft_font_face_create_for_ft_face()? */ FT_Face face; /* provided or cached face */ /* only set if from_face is false */ char *filename; int id; - /* We temporarily scale the unscaled font as neede */ + /* We temporarily scale the unscaled font as needed */ cairo_bool_t have_scale; cairo_matrix_t current_scale; double x_scale; /* Extracted X scale factor */ @@ -109,286 +109,377 @@ typedef struct { int lock; /* count of how many times this font has been locked */ - ft_font_face_t *faces; /* Linked list of faces for this font */ -} ft_unscaled_font_t; + cairo_ft_font_face_t *faces; /* Linked list of faces for this font */ +}; + +static int +_cairo_ft_unscaled_font_keys_equal (void *key_a, + void *key_b); + +static void +_cairo_ft_unscaled_font_fini (cairo_ft_unscaled_font_t *unscaled); -struct _ft_font_face { +struct _cairo_ft_font_face { cairo_font_face_t base; - ft_unscaled_font_t *unscaled; + cairo_ft_unscaled_font_t *unscaled; int load_flags; - ft_font_face_t *next_face; + cairo_ft_font_face_t *next; }; const cairo_unscaled_font_backend_t cairo_ft_unscaled_font_backend; -static ft_unscaled_font_t * -_ft_unscaled_font_create_from_face (FT_Face face) -{ - ft_unscaled_font_t *unscaled = malloc (sizeof(ft_unscaled_font_t)); - if (!unscaled) - return NULL; - - unscaled->from_face = 1; - unscaled->face = face; +/* + * We maintain a hash table to map file/id => cairo_ft_unscaled_font_t. + * The hash table itself isn't limited in size. However, we limit the + * number of FT_Face objects we keep around; when we've exceeeded that + * limit and need to create a new FT_Face, we dump the FT_Face from a + * random cairo_ft_unscaled_font_t which has an unlocked FT_Face, (if + * there are any). + */ - unscaled->filename = NULL; - unscaled->id = 0; - - unscaled->have_scale = 0; - unscaled->lock = 0; +typedef struct _cairo_ft_unscaled_font_map { + cairo_hash_table_t *hash_table; + FT_Library ft_library; + int num_open_faces; +} cairo_ft_unscaled_font_map_t; - unscaled->faces = NULL; +static cairo_ft_unscaled_font_map_t *cairo_ft_unscaled_font_map = NULL; - _cairo_unscaled_font_init (&unscaled->base, - &cairo_ft_unscaled_font_backend); - return unscaled; -} +CAIRO_MUTEX_DECLARE(cairo_ft_unscaled_font_map_mutex); -cairo_bool_t -_cairo_unscaled_font_is_ft (cairo_unscaled_font_t *unscaled_font) +static void +_cairo_ft_unscaled_font_map_create (void) { - return unscaled_font->backend == &cairo_ft_unscaled_font_backend; -} + cairo_ft_unscaled_font_map_t *font_map; -static ft_unscaled_font_t * -_ft_unscaled_font_create_from_filename (const char *filename, - int id) -{ - ft_unscaled_font_t *unscaled; - char *new_filename; - - new_filename = strdup (filename); - if (!new_filename) - return NULL; + /* This function is only intended to be called from + * _cairo_ft_unscaled_font_map_lock. So we'll crash if we can + * detect some other call path. */ + assert (cairo_ft_unscaled_font_map == NULL); - unscaled = malloc (sizeof (ft_unscaled_font_t)); - if (!unscaled) { - free (new_filename); - return NULL; - } - - unscaled->from_face = 0; - unscaled->face = NULL; + font_map = malloc (sizeof (cairo_ft_unscaled_font_map_t)); + if (font_map == NULL) + goto FAIL; - unscaled->filename = new_filename; - unscaled->id = id; - - unscaled->have_scale = 0; - unscaled->lock = 0; - - unscaled->faces = NULL; + font_map->hash_table = + _cairo_hash_table_create (_cairo_ft_unscaled_font_keys_equal); - _cairo_unscaled_font_init (&unscaled->base, - &cairo_ft_unscaled_font_backend); - return unscaled; -} + if (font_map->hash_table == NULL) + goto FAIL; -/* - * We keep a global cache from [file/id] => [ft_unscaled_font_t]. This - * hash isn't limited in size. However, we limit the number of - * FT_Face objects we keep around; when we've exceeeded that - * limit and need to create a new FT_Face, we dump the FT_Face from - * a random ft_unscaled_font_t. - */ + if (FT_Init_FreeType (&font_map->ft_library)) + goto FAIL; -typedef struct { - cairo_cache_entry_base_t base; - char *filename; - int id; -} cairo_ft_cache_key_t; + font_map->num_open_faces = 0; -typedef struct { - cairo_ft_cache_key_t key; - ft_unscaled_font_t *unscaled; -} cairo_ft_cache_entry_t; + cairo_ft_unscaled_font_map = font_map; + return; -typedef struct { - cairo_cache_t base; - FT_Library lib; - int n_faces; /* Number of open FT_Face objects */ -} ft_cache_t; +FAIL: + if (font_map) { + if (font_map->hash_table) + _cairo_hash_table_destroy (font_map->hash_table); + free (font_map); + } + cairo_ft_unscaled_font_map = NULL; +} -static unsigned long -_ft_font_cache_hash (void *cache, void *key) +static void +_cairo_ft_unscaled_font_map_destroy (void) { - cairo_ft_cache_key_t *in = (cairo_ft_cache_key_t *) key; - unsigned long hash; + cairo_ft_unscaled_font_t *unscaled; + cairo_ft_unscaled_font_map_t *font_map; + + CAIRO_MUTEX_LOCK (cairo_ft_unscaled_font_map_mutex); + + if (cairo_ft_unscaled_font_map) { + font_map = cairo_ft_unscaled_font_map; + + /* This is rather inefficient, but destroying the hash table + * is something we only do during debugging, (during + * cairo_debug_reset_static_data), when efficiency is not + * relevant. */ + while (1) { + unscaled = _cairo_hash_table_random_entry (font_map->hash_table, + NULL); + if (unscaled == NULL) + break; + _cairo_hash_table_remove (font_map->hash_table, + &unscaled->base.hash_entry); + _cairo_ft_unscaled_font_fini (unscaled); + free (unscaled); + } - /* 1607 is just a random prime. */ - hash = _cairo_hash_string (in->filename); - hash += ((unsigned long) in->id) * 1607; - - return hash; -} + FT_Done_FreeType (font_map->ft_library); -static int -_ft_font_cache_keys_equal (void *cache, - void *k1, - void *k2) -{ - cairo_ft_cache_key_t *a; - cairo_ft_cache_key_t *b; - a = (cairo_ft_cache_key_t *) k1; - b = (cairo_ft_cache_key_t *) k2; + _cairo_hash_table_destroy (font_map->hash_table); + + free (font_map); - return strcmp (a->filename, b->filename) == 0 && - a->id == b->id; + cairo_ft_unscaled_font_map = NULL; + } + + CAIRO_MUTEX_UNLOCK (cairo_ft_unscaled_font_map_mutex); } -static cairo_status_t -_ft_font_cache_create_entry (void *cache, - void *key, - void **return_entry) +static cairo_ft_unscaled_font_map_t * +_cairo_ft_unscaled_font_map_lock (void) { - cairo_ft_cache_key_t *k = key; - cairo_ft_cache_entry_t *entry; + CAIRO_MUTEX_LOCK (cairo_ft_unscaled_font_map_mutex); - entry = malloc (sizeof (cairo_ft_cache_entry_t)); - if (entry == NULL) - return CAIRO_STATUS_NO_MEMORY; + if (cairo_ft_unscaled_font_map == NULL) + { + _cairo_ft_unscaled_font_map_create (); - entry->unscaled = _ft_unscaled_font_create_from_filename (k->filename, - k->id); - if (!entry->unscaled) { - free (entry); - return CAIRO_STATUS_NO_MEMORY; + if (cairo_ft_unscaled_font_map == NULL) { + CAIRO_MUTEX_UNLOCK (cairo_ft_unscaled_font_map_mutex); + return NULL; + } } - - entry->key.base.memory = 0; - entry->key.filename = entry->unscaled->filename; - entry->key.id = entry->unscaled->id; - - *return_entry = entry; - return CAIRO_STATUS_SUCCESS; + return cairo_ft_unscaled_font_map; } -/* Entries are never spontaneously destroyed; but only when - * we remove them from the cache specifically. We free entry->unscaled - * in the code that removes the entry from the cache - */ static void -_ft_font_cache_destroy_entry (void *cache, - void *entry) -{ - cairo_ft_cache_entry_t *e = (cairo_ft_cache_entry_t *) entry; - - free (e); +_cairo_ft_unscaled_font_map_unlock (void) +{ + CAIRO_MUTEX_UNLOCK (cairo_ft_unscaled_font_map_mutex); } -static void -_ft_font_cache_destroy_cache (void *cache) +static void +_cairo_ft_unscaled_font_init_key (cairo_ft_unscaled_font_t *key, + char *filename, + int id) { - ft_cache_t *fc = (ft_cache_t *) cache; + unsigned long hash; - FT_Done_FreeType (fc->lib); - free (fc); + key->filename = filename; + key->id = id; + + /* 1607 is just an arbitrary prime. */ + hash = _cairo_hash_string (filename); + hash += ((unsigned long) id) * 1607; + + key->base.hash_entry.hash = hash; } -static const cairo_cache_backend_t _ft_font_cache_backend = { - _ft_font_cache_hash, - _ft_font_cache_keys_equal, - _ft_font_cache_create_entry, - _ft_font_cache_destroy_entry, - _ft_font_cache_destroy_cache -}; +/** + * _cairo_ft_unscaled_font_init: + * + * Initialize a cairo_ft_unscaled_font_t. + * + * There are two basic flavors of cairo_ft_unscaled_font_t, one + * created from an FT_Face and the other created from a filename/id + * pair. These two flavors are identified as from_face and !from_face. + * + * To initialize a from_face font, pass filename==NULL, id=0 and the + * desired face. + * + * To initialize a !from_face font, pass the filename/id as desired + * and face==NULL. + * + * Note that the code handles these two flavors in very distinct + * ways. For example there is a hash_table mapping + * filename/id->cairo_unscaled_font_t in the !from_face case, but no + * parallel in the from_face case, (where the calling code would have + * to do its own mapping to ensure similar sharing). + **/ +static cairo_status_t +_cairo_ft_unscaled_font_init (cairo_ft_unscaled_font_t *unscaled, + const char *filename, + int id, + FT_Face face) +{ + char *filename_copy = NULL; -static ft_cache_t *_global_ft_cache = NULL; + if (filename) { + filename_copy = strdup (filename); + if (filename_copy == NULL) + return CAIRO_STATUS_NO_MEMORY; + } -CAIRO_MUTEX_DECLARE(_global_ft_cache_mutex); + _cairo_ft_unscaled_font_init_key (unscaled, filename_copy, id); -static void -_lock_global_ft_cache (void) + if (face) { + unscaled->from_face = 1; + unscaled->face = face; + } else { + unscaled->from_face = 0; + unscaled->face = NULL; + } + + unscaled->have_scale = 0; + unscaled->lock = 0; + + unscaled->faces = NULL; + + _cairo_unscaled_font_init (&unscaled->base, + &cairo_ft_unscaled_font_backend); + + return CAIRO_STATUS_SUCCESS; +} + +cairo_bool_t +_cairo_unscaled_font_is_ft (cairo_unscaled_font_t *unscaled_font) { - CAIRO_MUTEX_LOCK(_global_ft_cache_mutex); + return unscaled_font->backend == &cairo_ft_unscaled_font_backend; } static void -_unlock_global_ft_cache (void) +_cairo_ft_unscaled_font_fini (cairo_ft_unscaled_font_t *unscaled) { - CAIRO_MUTEX_UNLOCK(_global_ft_cache_mutex); + if (unscaled->filename) { + free (unscaled->filename); + unscaled->filename = NULL; + } + + if (unscaled->face) { + FT_Done_Face (unscaled->face); + unscaled->face = NULL; + } } -static cairo_cache_t * -_get_global_ft_cache (void) +static int +_cairo_ft_unscaled_font_keys_equal (void *key_a, + void *key_b) { - if (_global_ft_cache == NULL) - { - _global_ft_cache = malloc (sizeof(ft_cache_t)); - if (!_global_ft_cache) - goto FAIL; - - if (_cairo_cache_init (&_global_ft_cache->base, - &_ft_font_cache_backend, - 0)) /* No memory limit */ - goto FAIL; - - if (FT_Init_FreeType (&_global_ft_cache->lib)) - goto FAIL; - _global_ft_cache->n_faces = 0; - } - return &_global_ft_cache->base; + cairo_ft_unscaled_font_t *unscaled_a = key_a; + cairo_ft_unscaled_font_t *unscaled_b = key_b; - FAIL: - if (_global_ft_cache) - free (_global_ft_cache); - _global_ft_cache = NULL; - return NULL; + return (strcmp (unscaled_a->filename, unscaled_b->filename) == 0 && + unscaled_a->id == unscaled_b->id); } -/* Finds or creates a ft_unscaled_font for the filename/id from pattern. - * Returns a new reference to the unscaled font. +/* Finds or creates a cairo_ft_unscaled_font for the filename/id from + * pattern. Returns a new reference to the unscaled font. */ -static ft_unscaled_font_t * -_ft_unscaled_font_get_for_pattern (FcPattern *pattern) +static cairo_ft_unscaled_font_t * +_cairo_ft_unscaled_font_create_for_pattern (FcPattern *pattern) { - cairo_ft_cache_entry_t *entry; - cairo_ft_cache_key_t key; - cairo_cache_t *cache; + cairo_ft_unscaled_font_t key, *unscaled; + cairo_ft_unscaled_font_map_t *font_map; cairo_status_t status; - FcChar8 *filename; - int created_entry; + FcChar8 *fc_filename; + char *filename; + int id; - if (FcPatternGetString (pattern, FC_FILE, 0, &filename) != FcResultMatch) - return NULL; - key.filename = (char *)filename; - - if (FcPatternGetInteger (pattern, FC_INDEX, 0, &key.id) != FcResultMatch) - return NULL; + if (FcPatternGetString (pattern, FC_FILE, 0, &fc_filename) != FcResultMatch) + goto UNWIND; + filename = (char *) fc_filename; + + if (FcPatternGetInteger (pattern, FC_INDEX, 0, &id) != FcResultMatch) + goto UNWIND; - _lock_global_ft_cache (); - cache = _get_global_ft_cache (); - if (cache == NULL) { - _unlock_global_ft_cache (); - return NULL; + font_map = _cairo_ft_unscaled_font_map_lock (); + if (font_map == NULL) + goto UNWIND; + + _cairo_ft_unscaled_font_init_key (&key, filename, id); + + /* Return exsiting unscaled font if it exists in the hash table. */ + if (_cairo_hash_table_lookup (font_map->hash_table, &key.base.hash_entry, + (cairo_hash_entry_t **) &unscaled)) + { + _cairo_ft_unscaled_font_map_unlock (); + _cairo_unscaled_font_reference (&unscaled->base); + return unscaled; } - status = _cairo_cache_lookup (cache, &key, (void **) &entry, &created_entry); - if (status == CAIRO_STATUS_SUCCESS && !created_entry) - _cairo_unscaled_font_reference (&entry->unscaled->base); + /* Otherwise create it and insert into hash table. */ + unscaled = malloc (sizeof (cairo_ft_unscaled_font_t)); + if (unscaled == NULL) + goto UNWIND_FONT_MAP_LOCK; + + status = _cairo_ft_unscaled_font_init (unscaled, filename, id, NULL); + if (status) + goto UNWIND_UNSCALED_MALLOC; - _unlock_global_ft_cache (); + status = _cairo_hash_table_insert (font_map->hash_table, + &unscaled->base.hash_entry); if (status) + goto UNWIND_UNSCALED_FONT_INIT; + + _cairo_ft_unscaled_font_map_unlock (); + + return unscaled; + +UNWIND_UNSCALED_FONT_INIT: + _cairo_ft_unscaled_font_fini (unscaled); +UNWIND_UNSCALED_MALLOC: + free (unscaled); +UNWIND_FONT_MAP_LOCK: + _cairo_ft_unscaled_font_map_unlock (); +UNWIND: + return NULL; +} + +static cairo_ft_unscaled_font_t * +_cairo_ft_unscaled_font_create_from_face (FT_Face face) +{ + cairo_status_t status; + cairo_ft_unscaled_font_t *unscaled; + + unscaled = malloc (sizeof (cairo_ft_unscaled_font_t)); + if (unscaled == NULL) return NULL; - return entry->unscaled; + status = _cairo_ft_unscaled_font_init (unscaled, NULL, 0, face); + if (status) { + free (unscaled); + return NULL; + } + + return unscaled; } -static int +static void +_cairo_ft_unscaled_font_destroy (void *abstract_font) +{ + cairo_ft_unscaled_font_t *unscaled = abstract_font; + + if (unscaled == NULL) + return; + + if (unscaled->from_face) { + /* See comments in _ft_font_face_destroy about the "zombie" state + * for a _ft_font_face. + */ + if (unscaled->faces && !unscaled->faces->unscaled) + cairo_font_face_destroy (&unscaled->faces->base); + } else { + cairo_ft_unscaled_font_map_t *font_map; + + font_map = _cairo_ft_unscaled_font_map_lock (); + /* All created objects must have been mapped in the font map. */ + assert (font_map != NULL); + + _cairo_hash_table_remove (font_map->hash_table, + &unscaled->base.hash_entry); + + _cairo_ft_unscaled_font_map_unlock (); + + _cairo_ft_unscaled_font_fini (unscaled); + } +} + +static cairo_bool_t _has_unlocked_face (void *entry) { - cairo_ft_cache_entry_t *e = entry; + cairo_ft_unscaled_font_t *unscaled = entry; - return (e->unscaled->lock == 0 && e->unscaled->face); + return (unscaled->lock == 0 && unscaled->face); } /* Ensures that an unscaled font has a face object. If we exceed * MAX_OPEN_FACES, try to close some. + * + * This differs from _cairo_ft_scaled_font_lock_face in that it doesn't + * set the scale on the face, but just returns it at the last scale. */ -static FT_Face -_ft_unscaled_font_lock_face (ft_unscaled_font_t *unscaled) +FT_Face +_cairo_ft_unscaled_font_lock_face (cairo_ft_unscaled_font_t *unscaled) { - ft_cache_t *ftcache; + cairo_ft_unscaled_font_map_t *font_map; FT_Face face = NULL; if (unscaled->face) { @@ -396,27 +487,30 @@ _ft_unscaled_font_lock_face (ft_unscaled_font_t *unscaled) return unscaled->face; } + /* If this unscaled font was created from an FT_Face then we just + * returned it above. */ assert (!unscaled->from_face); - _lock_global_ft_cache (); - ftcache = (ft_cache_t *) _get_global_ft_cache (); - assert (ftcache != NULL); + font_map = _cairo_ft_unscaled_font_map_lock (); + assert (font_map != NULL); - while (ftcache->n_faces >= MAX_OPEN_FACES) { - cairo_ft_cache_entry_t *entry; + while (font_map->num_open_faces >= MAX_OPEN_FACES) + { + cairo_ft_unscaled_font_t *entry; - entry = _cairo_cache_random_entry ((cairo_cache_t *)ftcache, _has_unlocked_face); - if (entry) { - FT_Done_Face (entry->unscaled->face); - entry->unscaled->face = NULL; - entry->unscaled->have_scale = 0; - ftcache->n_faces--; - } else { + entry = _cairo_hash_table_random_entry (font_map->hash_table, + _has_unlocked_face); + if (entry == NULL) break; - } + + FT_Done_Face (entry->face); + unscaled->face = NULL; + unscaled->have_scale = 0; + + font_map->num_open_faces--; } - if (FT_New_Face (ftcache->lib, + if (FT_New_Face (font_map->ft_library, unscaled->filename, unscaled->id, &face) != FT_Err_Ok) @@ -424,17 +518,19 @@ _ft_unscaled_font_lock_face (ft_unscaled_font_t *unscaled) unscaled->face = face; unscaled->lock++; - ftcache->n_faces++; + + font_map->num_open_faces++; FAIL: - _unlock_global_ft_cache (); + _cairo_ft_unscaled_font_map_unlock (); + return face; } -/* Unlock unscaled font locked with _ft_unscaled_font_lock_face +/* Unlock unscaled font locked with _cairo_ft_unscaled_font_lock_face */ -static void -_ft_unscaled_font_unlock_face (ft_unscaled_font_t *unscaled) +void +_cairo_ft_unscaled_font_unlock_face (cairo_ft_unscaled_font_t *unscaled) { assert (unscaled->lock > 0); @@ -442,7 +538,7 @@ _ft_unscaled_font_unlock_face (ft_unscaled_font_t *unscaled) } static void -_compute_transform (ft_font_transform_t *sf, +_compute_transform (cairo_ft_font_transform_t *sf, cairo_matrix_t *scale) { cairo_matrix_t normalized = *scale; @@ -476,10 +572,10 @@ _compute_transform (ft_font_transform_t *sf, * scaling to the same size, since changing a FT_Face is expensive. */ static void -_ft_unscaled_font_set_scale (ft_unscaled_font_t *unscaled, - cairo_matrix_t *scale) +_cairo_ft_unscaled_font_set_scale (cairo_ft_unscaled_font_t *unscaled, + cairo_matrix_t *scale) { - ft_font_transform_t sf; + cairo_ft_font_transform_t sf; FT_Matrix mat; FT_UInt pixel_width, pixel_height; FT_Error error; @@ -528,7 +624,11 @@ _ft_unscaled_font_set_scale (ft_unscaled_font_t *unscaled, pixel_width = pixel_height = 0; for (i = 0; i < unscaled->face->num_fixed_sizes; i++) { +#if HAVE_FT_BITMAP_SIZE_Y_PPEM double size = unscaled->face->available_sizes[i].y_ppem / 64.; +#else + double size = unscaled->face->available_sizes[i].height; +#endif double distance = fabs (size - sf.y_scale); if (distance <= min_distance) { @@ -536,11 +636,13 @@ _ft_unscaled_font_set_scale (ft_unscaled_font_t *unscaled, best_i = i; } } +#if HAVE_FT_BITMAP_SIZE_Y_PPEM error = FT_Set_Char_Size (unscaled->face, unscaled->face->available_sizes[best_i].x_ppem, unscaled->face->available_sizes[best_i].y_ppem, 0, 0); - if (error ) + if (error) +#endif error = FT_Set_Pixel_Sizes (unscaled->face, unscaled->face->available_sizes[best_i].width, unscaled->face->available_sizes[best_i].height); @@ -549,43 +651,6 @@ _ft_unscaled_font_set_scale (ft_unscaled_font_t *unscaled, assert (error == 0); } -static void -_cairo_ft_unscaled_font_destroy (void *abstract_font) -{ - ft_unscaled_font_t *unscaled = abstract_font; - - if (unscaled == NULL) - return; - - if (unscaled->from_face) { - /* See comments in _ft_font_face_destroy about the "zombie" state - * for a _ft_font_face. - */ - if (unscaled->faces && !unscaled->faces->unscaled) - cairo_font_face_destroy (&unscaled->faces->base); - } else { - cairo_cache_t *cache; - cairo_ft_cache_key_t key; - - _lock_global_ft_cache (); - cache = _get_global_ft_cache (); - assert (cache); - - key.filename = unscaled->filename; - key.id = unscaled->id; - - _cairo_cache_remove (cache, &key); - - _unlock_global_ft_cache (); - - if (unscaled->filename) - free (unscaled->filename); - - if (unscaled->face) - FT_Done_Face (unscaled->face); - } -} - /* Empirically-derived subpixel filtering values thanks to Keith * Packard and libXft. */ static const int filters[3][3] = { @@ -990,7 +1055,7 @@ _render_glyph_bitmap (FT_Face face, static cairo_status_t _transform_glyph_bitmap (cairo_image_glyph_cache_entry_t *val) { - ft_font_transform_t sf; + cairo_ft_font_transform_t sf; cairo_matrix_t original_to_transformed; cairo_matrix_t transformed_to_original; cairo_image_surface_t *old_image; @@ -1110,21 +1175,21 @@ static cairo_status_t _cairo_ft_unscaled_font_create_glyph (void *abstract_font, cairo_image_glyph_cache_entry_t *val) { - ft_unscaled_font_t *unscaled = abstract_font; + cairo_ft_unscaled_font_t *unscaled = abstract_font; FT_GlyphSlot glyphslot; FT_Face face; FT_Glyph_Metrics *metrics; cairo_status_t status = CAIRO_STATUS_SUCCESS; double x_factor, y_factor; - face = _ft_unscaled_font_lock_face (unscaled); + face = _cairo_ft_unscaled_font_lock_face (unscaled); if (!face) return CAIRO_STATUS_NO_MEMORY; glyphslot = face->glyph; metrics = &glyphslot->metrics; - _ft_unscaled_font_set_scale (unscaled, &val->key.scale); + _cairo_ft_unscaled_font_set_scale (unscaled, &val->key.scale); if (FT_Load_Glyph (face, val->key.index, val->key.flags & ~PRIVATE_FLAGS_MASK) != 0) { status = CAIRO_STATUS_NO_MEMORY; @@ -1203,7 +1268,7 @@ _cairo_ft_unscaled_font_create_glyph (void *abstract_ val->image = NULL; } - _ft_unscaled_font_unlock_face (unscaled); + _cairo_ft_unscaled_font_unlock_face (unscaled); return status; } @@ -1215,11 +1280,10 @@ const cairo_unscaled_font_backend_t cairo_ft_unscaled_font_backend = { /* cairo_ft_scaled_font_t */ -typedef struct { +typedef struct _cairo_ft_scaled_font { cairo_scaled_font_t base; + cairo_ft_unscaled_font_t *unscaled; int load_flags; - cairo_font_options_t options; - ft_unscaled_font_t *unscaled; } cairo_ft_scaled_font_t; const cairo_scaled_font_backend_t cairo_ft_scaled_font_backend; @@ -1370,31 +1434,33 @@ _get_options_load_flags (const cairo_font_options_t *options) } static cairo_scaled_font_t * -_ft_scaled_font_create (ft_unscaled_font_t *unscaled, - const cairo_matrix_t *font_matrix, - const cairo_matrix_t *ctm, - const cairo_font_options_t *options, - int load_flags) +_cairo_ft_scaled_font_create (cairo_ft_unscaled_font_t *unscaled, + cairo_font_face_t *font_face, + const cairo_matrix_t *font_matrix, + const cairo_matrix_t *ctm, + const cairo_font_options_t *options, + int load_flags) { - cairo_ft_scaled_font_t *f = NULL; + cairo_ft_scaled_font_t *scaled_font = NULL; - f = malloc (sizeof(cairo_ft_scaled_font_t)); - if (f == NULL) + scaled_font = malloc (sizeof(cairo_ft_scaled_font_t)); + if (scaled_font == NULL) return NULL; - f->unscaled = unscaled; + _cairo_scaled_font_init (&scaled_font->base, + font_face, + font_matrix, ctm, options, + &cairo_ft_scaled_font_backend); + _cairo_unscaled_font_reference (&unscaled->base); - - f->options = *options; + scaled_font->unscaled = unscaled; if (options->hint_metrics != CAIRO_HINT_METRICS_OFF) load_flags |= PRIVATE_FLAG_HINT_METRICS; - f->load_flags = load_flags; - - _cairo_scaled_font_init (&f->base, font_matrix, ctm, &cairo_ft_scaled_font_backend); + scaled_font->load_flags = load_flags; - return (cairo_scaled_font_t *)f; + return &scaled_font->base; } cairo_bool_t @@ -1404,28 +1470,28 @@ _cairo_scaled_font_is_ft (cairo_scaled_font_t *scaled_font) } static cairo_status_t -_cairo_ft_scaled_font_create (const char *family, - cairo_font_slant_t slant, - cairo_font_weight_t weight, - const cairo_matrix_t *font_matrix, - const cairo_matrix_t *ctm, - const cairo_font_options_t *options, - cairo_scaled_font_t **font) +_cairo_ft_scaled_font_create_toy (cairo_toy_font_face_t *toy_face, + const cairo_matrix_t *font_matrix, + const cairo_matrix_t *ctm, + const cairo_font_options_t *options, + cairo_scaled_font_t **font) { FcPattern *pattern, *resolved; - ft_unscaled_font_t *unscaled; - cairo_scaled_font_t *new_font; + cairo_ft_unscaled_font_t *unscaled; + cairo_scaled_font_t *new_font = NULL; FcResult result; int fcslant; int fcweight; cairo_matrix_t scale; - ft_font_transform_t sf; + cairo_ft_font_transform_t sf; + int load_flags; + unsigned char *family = (unsigned char*) toy_face->family; pattern = FcPatternCreate (); if (!pattern) return CAIRO_STATUS_NO_MEMORY; - switch (weight) + switch (toy_face->weight) { case CAIRO_FONT_WEIGHT_BOLD: fcweight = FC_WEIGHT_BOLD; @@ -1436,7 +1502,7 @@ _cairo_ft_scaled_font_create (const char *family, break; } - switch (slant) + switch (toy_face->slant) { case CAIRO_FONT_SLANT_ITALIC: fcslant = FC_SLANT_ITALIC; @@ -1450,7 +1516,7 @@ _cairo_ft_scaled_font_create (const char *family, break; } - if (!FcPatternAddString (pattern, FC_FAMILY, (unsigned char *) family)) + if (!FcPatternAddString (pattern, FC_FAMILY, family)) goto FREE_PATTERN; if (!FcPatternAddInteger (pattern, FC_SLANT, fcslant)) goto FREE_PATTERN; @@ -1470,36 +1536,35 @@ _cairo_ft_scaled_font_create (const char *family, if (!resolved) goto FREE_PATTERN; - unscaled = _ft_unscaled_font_get_for_pattern (resolved); + unscaled = _cairo_ft_unscaled_font_create_for_pattern (resolved); if (!unscaled) goto FREE_RESOLVED; - - new_font = _ft_scaled_font_create (unscaled, - font_matrix, ctm, - options, _get_pattern_load_flags (pattern)); + + load_flags = _get_pattern_load_flags (pattern); + + new_font = _cairo_ft_scaled_font_create (unscaled, + &toy_face->base, + font_matrix, ctm, + options, load_flags); + _cairo_unscaled_font_destroy (&unscaled->base); + FREE_RESOLVED: FcPatternDestroy (resolved); + + FREE_PATTERN: FcPatternDestroy (pattern); if (new_font) { *font = new_font; return CAIRO_STATUS_SUCCESS; } else { - return CAIRO_STATUS_NO_MEMORY; /* A guess */ + return CAIRO_STATUS_NO_MEMORY; } - - FREE_RESOLVED: - FcPatternDestroy (resolved); - - FREE_PATTERN: - FcPatternDestroy (pattern); - - return CAIRO_STATUS_NO_MEMORY; } static void -_cairo_ft_scaled_font_destroy (void *abstract_font) +_cairo_ft_scaled_font_fini (void *abstract_font) { cairo_ft_scaled_font_t *scaled_font = abstract_font; @@ -1599,19 +1664,20 @@ _cairo_ft_scaled_font_font_extents (void *abstract_font, FT_Face face; FT_Size_Metrics *metrics; - face = _ft_unscaled_font_lock_face (scaled_font->unscaled); + face = _cairo_ft_unscaled_font_lock_face (scaled_font->unscaled); if (!face) return CAIRO_STATUS_NO_MEMORY; metrics = &face->size->metrics; - _ft_unscaled_font_set_scale (scaled_font->unscaled, &scaled_font->base.scale); + _cairo_ft_unscaled_font_set_scale (scaled_font->unscaled, + &scaled_font->base.scale); /* * Get to unscaled metrics so that the upper level can get back to * user space */ - if (scaled_font->options.hint_metrics != CAIRO_HINT_METRICS_OFF) { + if (scaled_font->base.options.hint_metrics != CAIRO_HINT_METRICS_OFF) { double x_factor, y_factor; if (scaled_font->unscaled->x_scale == 0) @@ -1640,7 +1706,7 @@ _cairo_ft_scaled_font_font_extents (void *abstract_font, /* FIXME: this doesn't do vertical layout atm. */ extents->max_y_advance = 0.0; - _ft_unscaled_font_unlock_face (scaled_font->unscaled); + _cairo_ft_unscaled_font_unlock_face (scaled_font->unscaled); return CAIRO_STATUS_SUCCESS; } @@ -1697,7 +1763,7 @@ _cairo_ft_scaled_font_glyph_extents (void *abstract_font, /* XXX: Need to add code here to check the font's FcPattern for FC_VERTICAL_LAYOUT and if set get vertBearingX/Y instead. This will require that - cairo_ft_scaled_font_create_for_ft_face accept an + cairo_ft_font_face_create_for_ft_face accept an FcPattern. */ glyph_min.x = glyphs[i].x + img->extents.x_bearing; glyph_min.y = glyphs[i].y + img->extents.y_bearing; @@ -1793,6 +1859,26 @@ _cairo_ft_scaled_font_glyph_bbox (void *abstract_font, return CAIRO_STATUS_SUCCESS; } +static cairo_format_t +_select_text_mask_format (cairo_bool_t have_a1_glyphs, + cairo_bool_t have_a8_glyphs, + cairo_bool_t have_argb32_glyphs) +{ + if (have_a8_glyphs) + return CAIRO_FORMAT_A8; + + if (have_a1_glyphs && have_argb32_glyphs) + return CAIRO_FORMAT_A8; + + if (have_a1_glyphs) + return CAIRO_FORMAT_A1; + + if (have_argb32_glyphs) + return CAIRO_FORMAT_ARGB32; + + /* when there are no glyphs to draw, just pick something */ + return CAIRO_FORMAT_A8; +} static cairo_status_t _cairo_ft_scaled_font_show_glyphs (void *abstract_font, @@ -1808,12 +1894,16 @@ _cairo_ft_scaled_font_show_glyphs (void *abstract_font, const cairo_glyph_t *glyphs, int num_glyphs) { - cairo_image_glyph_cache_entry_t *img; + cairo_image_glyph_cache_entry_t **entries; cairo_cache_t *cache; cairo_glyph_cache_key_t key; cairo_ft_scaled_font_t *scaled_font = abstract_font; cairo_surface_pattern_t glyph_pattern; - cairo_status_t status; + cairo_surface_t *mask; + cairo_surface_pattern_t mask_pattern; + cairo_format_t mask_format = CAIRO_FORMAT_A1; + cairo_status_t status = CAIRO_STATUS_SUCCESS; + cairo_bool_t have_a1_glyphs, have_a8_glyphs, have_argb32_glyphs; int x, y; int i; @@ -1833,44 +1923,98 @@ _cairo_ft_scaled_font_show_glyphs (void *abstract_font, key.scale = scaled_font->base.scale; key.flags = scaled_font->load_flags; + entries = malloc (num_glyphs * sizeof (cairo_image_glyph_cache_entry_t)); + if (!entries) + goto CLEANUP_CACHE; + + have_a1_glyphs = FALSE; + have_a8_glyphs = FALSE; + have_argb32_glyphs = FALSE; + for (i = 0; i < num_glyphs; i++) { - img = NULL; + entries[i] = NULL; key.index = glyphs[i].index; - if (_cairo_cache_lookup (cache, &key, (void **) &img, NULL) - != CAIRO_STATUS_SUCCESS - || img == NULL - || img->image == NULL) + if (_cairo_cache_lookup (cache, &key, (void **) &entries[i], NULL) != CAIRO_STATUS_SUCCESS) + continue; + + switch (entries[i]->image->format) { + case CAIRO_FORMAT_A1: + have_a1_glyphs = TRUE; + break; + case CAIRO_FORMAT_A8: + have_a8_glyphs = TRUE; + break; + case CAIRO_FORMAT_ARGB32: + have_argb32_glyphs = TRUE; + break; + default: + break; + } + } + + mask_format = _select_text_mask_format (have_a1_glyphs, have_a8_glyphs, have_argb32_glyphs); + + mask = cairo_image_surface_create (mask_format, width, height); + if (!mask) + goto CLEANUP_ENTRIES; + + status = _cairo_surface_fill_rectangle (mask, CAIRO_OPERATOR_SOURCE, + CAIRO_COLOR_TRANSPARENT, + 0, 0, width, height); + if (status) + goto CLEANUP_MASK; + + for (i = 0; i < num_glyphs; i++) + { + if (entries[i] == NULL + || entries[i]->image == NULL) continue; x = (int) floor (glyphs[i].x + 0.5); y = (int) floor (glyphs[i].y + 0.5); - _cairo_pattern_init_for_surface (&glyph_pattern, &(img->image->base)); + _cairo_pattern_init_for_surface (&glyph_pattern, &(entries[i]->image->base)); - status = _cairo_surface_composite (operator, pattern, + status = _cairo_surface_composite (CAIRO_OPERATOR_ADD, pattern, &glyph_pattern.base, - surface, - x + img->size.x, - y + img->size.y, + mask, + x + entries[i]->size.x, + y + entries[i]->size.y, 0, 0, - x + img->size.x, - y + img->size.y, - (double) img->size.width, - (double) img->size.height); + x + entries[i]->size.x - dest_x, + y + entries[i]->size.y - dest_y, + entries[i]->size.width, + entries[i]->size.height); _cairo_pattern_fini (&glyph_pattern.base); - if (status) { - _cairo_unlock_global_image_glyph_cache (); - return status; - } - } + if (status) + goto CLEANUP_MASK; + } + _cairo_pattern_init_for_surface (&mask_pattern, mask); + + status = _cairo_surface_composite (operator, pattern, &mask_pattern.base, + surface, + source_x, source_y, + 0, 0, + dest_x, dest_y, + width, height); + + _cairo_pattern_fini (&mask_pattern.base); + + CLEANUP_MASK: + cairo_surface_destroy (mask); + + CLEANUP_ENTRIES: + free (entries); + + CLEANUP_CACHE: _cairo_unlock_global_image_glyph_cache (); - return CAIRO_STATUS_SUCCESS; + return status; } @@ -2018,26 +2162,26 @@ _cairo_ft_scaled_font_glyph_path (void *abstract_font, } const cairo_scaled_font_backend_t cairo_ft_scaled_font_backend = { - _cairo_ft_scaled_font_create, - _cairo_ft_scaled_font_destroy, + _cairo_ft_scaled_font_create_toy, + _cairo_ft_scaled_font_fini, _cairo_ft_scaled_font_font_extents, _cairo_ft_scaled_font_text_to_glyphs, _cairo_ft_scaled_font_glyph_extents, _cairo_ft_scaled_font_glyph_bbox, _cairo_ft_scaled_font_show_glyphs, _cairo_ft_scaled_font_glyph_path, - _cairo_ft_scaled_font_get_glyph_cache_key, + _cairo_ft_scaled_font_get_glyph_cache_key }; -/* ft_font_face_t */ +/* cairo_ft_font_face_t */ static void -_ft_font_face_destroy (void *abstract_face) +_cairo_ft_font_face_destroy (void *abstract_face) { - ft_font_face_t *font_face = abstract_face; + cairo_ft_font_face_t *font_face = abstract_face; - ft_font_face_t *tmp_face = NULL; - ft_font_face_t *last_face = NULL; + cairo_ft_font_face_t *tmp_face = NULL; + cairo_ft_font_face_t *last_face = NULL; if (font_face == NULL) return; @@ -2058,7 +2202,8 @@ _ft_font_face_destroy (void *abstract_face) if (font_face->unscaled && font_face->unscaled->from_face && - font_face->unscaled->base.ref_count > 1) { + font_face->unscaled->base.ref_count > 1) + { cairo_font_face_reference (&font_face->base); _cairo_unscaled_font_destroy (&font_face->unscaled->base); @@ -2069,12 +2214,15 @@ _ft_font_face_destroy (void *abstract_face) if (font_face->unscaled) { /* Remove face from linked list */ - for (tmp_face = font_face->unscaled->faces; tmp_face; tmp_face = tmp_face->next_face) { + for (tmp_face = font_face->unscaled->faces; + tmp_face; + tmp_face = tmp_face->next) + { if (tmp_face == font_face) { if (last_face) - last_face->next_face = tmp_face->next_face; + last_face->next = tmp_face->next; else - font_face->unscaled->faces = tmp_face->next_face; + font_face->unscaled->faces = tmp_face->next; } last_face = tmp_face; @@ -2086,13 +2234,13 @@ _ft_font_face_destroy (void *abstract_face) } static cairo_status_t -_ft_font_face_create_font (void *abstract_face, - const cairo_matrix_t *font_matrix, - const cairo_matrix_t *ctm, - const cairo_font_options_t *options, - cairo_scaled_font_t **scaled_font) +_cairo_ft_font_face_scaled_font_create (void *abstract_face, + const cairo_matrix_t *font_matrix, + const cairo_matrix_t *ctm, + const cairo_font_options_t *options, + cairo_scaled_font_t **scaled_font) { - ft_font_face_t *font_face = abstract_face; + cairo_ft_font_face_t *font_face = abstract_face; int load_flags; /* The handling of font options is different depending on how the @@ -2109,36 +2257,38 @@ _ft_font_face_create_font (void *abstract_face, else load_flags = font_face->load_flags; - *scaled_font = _ft_scaled_font_create (font_face->unscaled, - font_matrix, ctm, - options, load_flags); + *scaled_font = _cairo_ft_scaled_font_create (font_face->unscaled, + &font_face->base, + font_matrix, ctm, + options, load_flags); if (*scaled_font) return CAIRO_STATUS_SUCCESS; else return CAIRO_STATUS_NO_MEMORY; } -static const cairo_font_face_backend_t _ft_font_face_backend = { - _ft_font_face_destroy, - _ft_font_face_create_font, +static const cairo_font_face_backend_t _cairo_ft_font_face_backend = { + _cairo_ft_font_face_destroy, + _cairo_ft_font_face_scaled_font_create }; static cairo_font_face_t * -_ft_font_face_create (ft_unscaled_font_t *unscaled, - int load_flags) +_cairo_ft_font_face_create (cairo_ft_unscaled_font_t *unscaled, + int load_flags) { - ft_font_face_t *font_face; + cairo_ft_font_face_t *font_face; /* Looked for an existing matching font face */ - for (font_face = unscaled->faces; font_face; font_face = font_face->next_face) { - if (font_face->load_flags == load_flags) { - cairo_font_face_reference (&font_face->base); - return &font_face->base; - } + for (font_face = unscaled->faces; + font_face; + font_face = font_face->next) + { + if (font_face->load_flags == load_flags) + return cairo_font_face_reference (&font_face->base); } /* No match found, create a new one */ - font_face = malloc (sizeof (ft_font_face_t)); + font_face = malloc (sizeof (cairo_ft_font_face_t)); if (!font_face) return NULL; @@ -2147,10 +2297,10 @@ _ft_font_face_create (ft_unscaled_font_t *unscaled, font_face->load_flags = load_flags; - font_face->next_face = unscaled->faces; + font_face->next = unscaled->faces; unscaled->faces = font_face; - _cairo_font_face_init (&font_face->base, &_ft_font_face_backend); + _cairo_font_face_init (&font_face->base, &_cairo_ft_font_face_backend); return &font_face->base; } @@ -2272,16 +2422,17 @@ cairo_ft_font_options_substitute (const cairo_font_options_t *options, cairo_font_face_t * cairo_ft_font_face_create_for_pattern (FcPattern *pattern) { - ft_unscaled_font_t *unscaled; + cairo_ft_unscaled_font_t *unscaled; cairo_font_face_t *font_face; - unscaled = _ft_unscaled_font_get_for_pattern (pattern); + unscaled = _cairo_ft_unscaled_font_create_for_pattern (pattern); if (unscaled == NULL) { _cairo_error (CAIRO_STATUS_NO_MEMORY); return (cairo_font_face_t *)&_cairo_font_face_nil; } - font_face = _ft_font_face_create (unscaled, _get_pattern_load_flags (pattern)); + font_face = _cairo_ft_font_face_create (unscaled, + _get_pattern_load_flags (pattern)); _cairo_unscaled_font_destroy (&unscaled->base); if (font_face) @@ -2321,16 +2472,16 @@ cairo_font_face_t * cairo_ft_font_face_create_for_ft_face (FT_Face face, int load_flags) { - ft_unscaled_font_t *unscaled; + cairo_ft_unscaled_font_t *unscaled; cairo_font_face_t *font_face; - unscaled = _ft_unscaled_font_create_from_face (face); + unscaled = _cairo_ft_unscaled_font_create_from_face (face); if (unscaled == NULL) { _cairo_error (CAIRO_STATUS_NO_MEMORY); return (cairo_font_face_t *)&_cairo_font_face_nil; } - font_face = _ft_font_face_create (unscaled, load_flags); + font_face = _cairo_ft_font_face_create (unscaled, load_flags); _cairo_unscaled_font_destroy (&unscaled->base); if (font_face) { @@ -2379,13 +2530,14 @@ cairo_ft_scaled_font_lock_face (cairo_scaled_font_t *abstract_font) if (scaled_font->base.status) return NULL; - face = _ft_unscaled_font_lock_face (scaled_font->unscaled); + face = _cairo_ft_unscaled_font_lock_face (scaled_font->unscaled); if (face == NULL) { _cairo_scaled_font_set_error (&scaled_font->base, CAIRO_STATUS_NO_MEMORY); return NULL; } - _ft_unscaled_font_set_scale (scaled_font->unscaled, &scaled_font->base.scale); + _cairo_ft_unscaled_font_set_scale (scaled_font->unscaled, + &scaled_font->base.scale); return face; } @@ -2408,7 +2560,7 @@ cairo_ft_scaled_font_unlock_face (cairo_scaled_font_t *abstract_font) if (scaled_font->base.status) return; - _ft_unscaled_font_unlock_face (scaled_font->unscaled); + _cairo_ft_unscaled_font_unlock_face (scaled_font->unscaled); } /* We expose our unscaled font implementation internally for the the @@ -2423,17 +2575,8 @@ _cairo_ft_scaled_font_get_unscaled_font (cairo_scaled_font_t *abstract_font) return &scaled_font->unscaled->base; } -/* This differs from _cairo_ft_scaled_font_lock_face in that it doesn't - * set the scale on the face, but just returns it at the last scale. - */ -FT_Face -_cairo_ft_unscaled_font_lock_face (cairo_unscaled_font_t *unscaled_font) -{ - return _ft_unscaled_font_lock_face ((ft_unscaled_font_t *)unscaled_font); -} - void -_cairo_ft_unscaled_font_unlock_face (cairo_unscaled_font_t *unscaled_font) +_cairo_ft_font_reset_static_data (void) { - _ft_unscaled_font_unlock_face ((ft_unscaled_font_t *)unscaled_font); + _cairo_ft_unscaled_font_map_destroy (); } diff --git a/src/cairo-ft-private.h b/src/cairo-ft-private.h index e92048b..b3931be 100644 --- a/src/cairo-ft-private.h +++ b/src/cairo-ft-private.h @@ -44,10 +44,12 @@ CAIRO_BEGIN_DECLS -cairo_bool_t +typedef struct _cairo_ft_unscaled_font cairo_ft_unscaled_font_t; + +cairo_private cairo_bool_t _cairo_unscaled_font_is_ft (cairo_unscaled_font_t *unscaled_font); -cairo_bool_t +cairo_private cairo_bool_t _cairo_scaled_font_is_ft (cairo_scaled_font_t *scaled_font); /* These functions are needed by the PDF backend, which needs to keep track of the @@ -57,10 +59,10 @@ cairo_private cairo_unscaled_font_t * _cairo_ft_scaled_font_get_unscaled_font (cairo_scaled_font_t *scaled_font); cairo_private FT_Face -_cairo_ft_unscaled_font_lock_face (cairo_unscaled_font_t *unscaled_font); +_cairo_ft_unscaled_font_lock_face (cairo_ft_unscaled_font_t *unscaled); cairo_private void -_cairo_ft_unscaled_font_unlock_face (cairo_unscaled_font_t *unscaled_font); +_cairo_ft_unscaled_font_unlock_face (cairo_ft_unscaled_font_t *unscaled); CAIRO_END_DECLS diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c index 96e9203..018b064 100644 --- a/src/cairo-glitz-surface.c +++ b/src/cairo-glitz-surface.c @@ -349,8 +349,7 @@ _cairo_glitz_surface_clone_similar (void *abstract_surface, if (src->backend == surface->base.backend) { - *clone_out = src; - cairo_surface_reference (src); + *clone_out = cairo_surface_reference (src); return CAIRO_STATUS_SUCCESS; } @@ -937,6 +936,7 @@ static cairo_int_status_t _cairo_glitz_surface_composite_trapezoids (cairo_operator_t op, cairo_pattern_t *pattern, void *abstract_dst, + cairo_antialias_t antialias, int src_x, int src_y, int dst_x, @@ -1610,14 +1610,42 @@ _cairo_glitz_glyph_cache_create_entry (void *abstract_cache, { cairo_glitz_glyph_cache_entry_t *entry; cairo_glyph_cache_key_t *key = abstract_key; - + + cairo_status_t status; + cairo_cache_t *im_cache; + cairo_image_glyph_cache_entry_t *im; + + unsigned long entry_memory = 0; + entry = malloc (sizeof (cairo_glitz_glyph_cache_entry_t)); if (!entry) return CAIRO_STATUS_NO_MEMORY; + _cairo_lock_global_image_glyph_cache (); + + im_cache = _cairo_get_global_image_glyph_cache (); + if (im_cache == NULL) { + _cairo_unlock_global_image_glyph_cache (); + free (entry); + return CAIRO_STATUS_NO_MEMORY; + } + + status = _cairo_cache_lookup (im_cache, key, (void **) (&im), NULL); + if (status != CAIRO_STATUS_SUCCESS || im == NULL) { + _cairo_unlock_global_image_glyph_cache (); + free (entry); + return CAIRO_STATUS_NO_MEMORY; + } + + if (im->image) + entry_memory = im->image->width * im->image->stride; + + _cairo_unlock_global_image_glyph_cache (); + entry->ref_count = 1; entry->key = *key; - entry->area = NULL; + entry->key.base.memory = entry_memory; + entry->area = NULL; entry->locked = FALSE; _cairo_unscaled_font_reference (entry->key.unscaled); @@ -1754,7 +1782,8 @@ _cairo_glitz_cache_glyph (cairo_glitz_glyph_cache_t *cache, entry->size.height > GLYPH_CACHE_MAX_HEIGHT) return CAIRO_STATUS_SUCCESS; - if (!image_entry->image) + if ((entry->size.width == 0 && entry->size.height == 0) || + !image_entry->image) { entry->area = &_empty_area; return CAIRO_STATUS_SUCCESS; diff --git a/src/cairo-gstate-private.h b/src/cairo-gstate-private.h index 0d4d499..489afdb 100644 --- a/src/cairo-gstate-private.h +++ b/src/cairo-gstate-private.h @@ -36,51 +36,13 @@ #ifndef CAIRO_GSTATE_PRIVATE_H #define CAIRO_GSTATE_PRIVATE_H -#include "cairo-path-fixed-private.h" - -struct _cairo_clip_path { - unsigned int ref_count; - cairo_path_fixed_t path; - cairo_fill_rule_t fill_rule; - double tolerance; - cairo_clip_path_t *prev; -}; - -typedef struct _cairo_clip { - cairo_clip_mode_t mode; - - /* - * Mask-based clipping for cases where the backend - * clipping isn't sufficiently able. - * - * The rectangle here represents the - * portion of the destination surface that this - * clip surface maps to, it does not - * represent the extents of the clip region or - * clip paths - */ - cairo_surface_t *surface; - cairo_rectangle_t surface_rect; - /* - * Surface clip serial number to store - * in the surface when this clip is set - */ - unsigned int serial; - /* - * A clip region that can be placed in the surface - */ - pixman_region16_t *region; - /* - * If the surface supports path clipping, we store the list of - * clipping paths that has been set here as a linked list. - */ - cairo_clip_path_t *path; -} cairo_clip_t; +#include "cairo-clip-private.h" struct _cairo_gstate { cairo_operator_t operator; double tolerance; + cairo_antialias_t antialias; /* stroke style */ double line_width; @@ -103,6 +65,7 @@ struct _cairo_gstate { cairo_matrix_t ctm; cairo_matrix_t ctm_inverse; + cairo_matrix_t source_ctm_inverse; /* At the time ->source was set */ cairo_pen_t pen_regular; diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c index ed3359b..a657f15 100644 --- a/src/cairo-gstate.c +++ b/src/cairo-gstate.c @@ -39,6 +39,7 @@ #include "cairoint.h" +#include "cairo-clip-private.h" #include "cairo-gstate-private.h" static cairo_status_t @@ -53,28 +54,16 @@ _cairo_gstate_fini (cairo_gstate_t *gstate); static cairo_status_t _cairo_gstate_clip_and_composite_trapezoids (cairo_gstate_t *gstate, - cairo_pattern_t *src, - cairo_operator_t operator, - cairo_surface_t *dst, - cairo_traps_t *traps); - -static cairo_status_t -_cairo_gstate_ensure_font (cairo_gstate_t *gstate); + cairo_traps_t *traps); static cairo_status_t _cairo_gstate_ensure_font_face (cairo_gstate_t *gstate); -static void -_cairo_gstate_unset_font (cairo_gstate_t *gstate); - -static void -_cairo_rectangle_intersect (cairo_rectangle_t *dest, cairo_rectangle_t *src); - -static void -_cairo_clip_path_reference (cairo_clip_path_t *clip_path); +static cairo_status_t +_cairo_gstate_ensure_scaled_font (cairo_gstate_t *gstate); static void -_cairo_clip_path_destroy (cairo_clip_path_t *clip_path); +_cairo_gstate_unset_scaled_font (cairo_gstate_t *gstate); cairo_gstate_t * _cairo_gstate_create (cairo_surface_t *target) @@ -103,6 +92,7 @@ _cairo_gstate_init (cairo_gstate_t *gstate, gstate->operator = CAIRO_GSTATE_OPERATOR_DEFAULT; gstate->tolerance = CAIRO_GSTATE_TOLERANCE_DEFAULT; + gstate->antialias = CAIRO_ANTIALIAS_DEFAULT; gstate->line_width = CAIRO_GSTATE_LINE_WIDTH_DEFAULT; gstate->line_cap = CAIRO_GSTATE_LINE_CAP_DEFAULT; @@ -124,18 +114,14 @@ _cairo_gstate_init (cairo_gstate_t *gstate, _cairo_font_options_init_default (&gstate->font_options); - gstate->clip.mode = _cairo_surface_get_clip_mode (target); - gstate->clip.region = NULL; - gstate->clip.surface = NULL; - gstate->clip.serial = 0; - gstate->clip.path = NULL; + _cairo_clip_init (&gstate->clip, target); _cairo_gstate_identity_matrix (gstate); + cairo_matrix_init_identity (&gstate->source_ctm_inverse); _cairo_pen_init_empty (&gstate->pen_regular); - gstate->target = target; - cairo_surface_reference (gstate->target); + gstate->target = cairo_surface_reference (target); gstate->source = _cairo_pattern_create_solid (CAIRO_COLOR_BLACK); if (gstate->source->status) @@ -165,10 +151,7 @@ _cairo_gstate_init_copy (cairo_gstate_t *gstate, cairo_gstate_t *other) memcpy (gstate->dash, other->dash, other->num_dashes * sizeof (double)); } - if (other->clip.region) { - gstate->clip.region = pixman_region_create (); - pixman_region_copy (gstate->clip.region, other->clip.region); - } + _cairo_clip_init_copy (&gstate->clip, &other->clip); if (gstate->font_face) cairo_font_face_reference (gstate->font_face); @@ -177,8 +160,6 @@ _cairo_gstate_init_copy (cairo_gstate_t *gstate, cairo_gstate_t *other) cairo_scaled_font_reference (gstate->scaled_font); cairo_surface_reference (gstate->target); - cairo_surface_reference (gstate->clip.surface); - _cairo_clip_path_reference (gstate->clip.path); cairo_pattern_reference (gstate->source); @@ -212,18 +193,7 @@ _cairo_gstate_fini (cairo_gstate_t *gstate) gstate->target = NULL; } - if (gstate->clip.surface) - cairo_surface_destroy (gstate->clip.surface); - gstate->clip.surface = NULL; - - if (gstate->clip.path) - _cairo_clip_path_destroy (gstate->clip.path); - gstate->clip.path = NULL; - - if (gstate->clip.region) - pixman_region_destroy (gstate->clip.region); - gstate->clip.region = NULL; - gstate->clip.serial = 0; + _cairo_clip_fini (&gstate->clip); cairo_pattern_destroy (gstate->source); @@ -343,61 +313,6 @@ _cairo_gstate_end_group (cairo_gstate_t *gstate) } */ -static cairo_status_t -_cairo_gstate_set_clip (cairo_gstate_t *gstate) -{ - cairo_surface_t *surface = gstate->target; - - if (!surface) - return CAIRO_STATUS_NULL_POINTER; - if (gstate->clip.serial == _cairo_surface_get_current_clip_serial (surface)) - return CAIRO_STATUS_SUCCESS; - - if (gstate->clip.path) - return _cairo_surface_set_clip_path (surface, - gstate->clip.path, - gstate->clip.serial); - - if (gstate->clip.region) - return _cairo_surface_set_clip_region (surface, - gstate->clip.region, - gstate->clip.serial); - - return _cairo_surface_reset_clip (surface); -} - -static cairo_status_t -_cairo_gstate_get_clip_extents (cairo_gstate_t *gstate, - cairo_rectangle_t *rectangle) -{ - cairo_status_t status; - - status = _cairo_surface_get_extents (gstate->target, rectangle); - if (status) - return status; - /* check path extents here */ - - if (gstate->clip.region) { - pixman_box16_t *clip_box; - cairo_rectangle_t clip_rect; - - /* get region extents as a box */ - clip_box = pixman_region_extents (gstate->clip.region); - /* convert to a rectangle */ - clip_rect.x = clip_box->x1; - clip_rect.width = clip_box->x2 - clip_box->x1; - clip_rect.y = clip_box->y1; - clip_rect.height = clip_box->y2 - clip_box->y1; - /* intersect with surface extents */ - _cairo_rectangle_intersect (rectangle, &clip_rect); - } - - if (gstate->clip.surface) - _cairo_rectangle_intersect (rectangle, &gstate->clip.surface_rect); - - return CAIRO_STATUS_SUCCESS; -} - cairo_surface_t * _cairo_gstate_get_target (cairo_gstate_t *gstate) { @@ -414,6 +329,7 @@ _cairo_gstate_set_source (cairo_gstate_t *gstate, cairo_pattern_reference (source); cairo_pattern_destroy (gstate->source); gstate->source = source; + gstate->source_ctm_inverse = gstate->ctm_inverse; return CAIRO_STATUS_SUCCESS; } @@ -559,7 +475,7 @@ _cairo_gstate_translate (cairo_gstate_t *gstate, double tx, double ty) { cairo_matrix_t tmp; - _cairo_gstate_unset_font (gstate); + _cairo_gstate_unset_scaled_font (gstate); cairo_matrix_init_translate (&tmp, tx, ty); cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm); @@ -578,7 +494,7 @@ _cairo_gstate_scale (cairo_gstate_t *gstate, double sx, double sy) if (sx == 0 || sy == 0) return CAIRO_STATUS_INVALID_MATRIX; - _cairo_gstate_unset_font (gstate); + _cairo_gstate_unset_scaled_font (gstate); cairo_matrix_init_scale (&tmp, sx, sy); cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm); @@ -594,7 +510,7 @@ _cairo_gstate_rotate (cairo_gstate_t *gstate, double angle) { cairo_matrix_t tmp; - _cairo_gstate_unset_font (gstate); + _cairo_gstate_unset_scaled_font (gstate); cairo_matrix_init_rotate (&tmp, angle); cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm); @@ -611,7 +527,7 @@ _cairo_gstate_transform (cairo_gstate_t *gstate, { cairo_matrix_t tmp; - _cairo_gstate_unset_font (gstate); + _cairo_gstate_unset_scaled_font (gstate); tmp = *matrix; cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm); @@ -628,7 +544,7 @@ _cairo_gstate_set_matrix (cairo_gstate_t *gstate, { cairo_status_t status; - _cairo_gstate_unset_font (gstate); + _cairo_gstate_unset_scaled_font (gstate); gstate->ctm = *matrix; @@ -643,7 +559,7 @@ _cairo_gstate_set_matrix (cairo_gstate_t *gstate, cairo_status_t _cairo_gstate_identity_matrix (cairo_gstate_t *gstate) { - _cairo_gstate_unset_font (gstate); + _cairo_gstate_unset_scaled_font (gstate); cairo_matrix_init_identity (&gstate->ctm); cairo_matrix_init_identity (&gstate->ctm_inverse); @@ -717,11 +633,15 @@ _cairo_gstate_stroke_to_path (cairo_gstate_t *gstate) */ static void -_cairo_gstate_pattern_transform (cairo_gstate_t *gstate, - cairo_pattern_t *pattern) +_cairo_gstate_copy_transformed_pattern (cairo_gstate_t *gstate, + cairo_pattern_t *pattern, + cairo_pattern_t *original, + cairo_matrix_t *ctm_inverse) { - cairo_matrix_t tmp_matrix = gstate->ctm_inverse; - + cairo_matrix_t tmp_matrix = *ctm_inverse; + + _cairo_pattern_init_copy (pattern, original); + if (gstate->target) cairo_matrix_translate (&tmp_matrix, - gstate->target->device_x_offset, @@ -730,6 +650,25 @@ _cairo_gstate_pattern_transform (cairo_gstate_t *gstate, _cairo_pattern_transform (pattern, &tmp_matrix); } +static void +_cairo_gstate_copy_transformed_source (cairo_gstate_t *gstate, + cairo_pattern_t *pattern) +{ + _cairo_gstate_copy_transformed_pattern (gstate, pattern, + gstate->source, + &gstate->source_ctm_inverse); +} + +static void +_cairo_gstate_copy_transformed_mask (cairo_gstate_t *gstate, + cairo_pattern_t *pattern, + cairo_pattern_t *mask) +{ + _cairo_gstate_copy_transformed_pattern (gstate, pattern, + mask, + &gstate->ctm_inverse); +} + cairo_status_t _cairo_gstate_paint (cairo_gstate_t *gstate) { @@ -741,11 +680,14 @@ _cairo_gstate_paint (cairo_gstate_t *gstate) if (gstate->source->status) return gstate->source->status; - status = _cairo_gstate_set_clip (gstate); + status = _cairo_surface_set_clip (gstate->target, &gstate->clip); if (status) return status; - status = _cairo_gstate_get_clip_extents (gstate, &rectangle); + status = _cairo_surface_get_extents (gstate->target, &rectangle); + if (status) + return status; + status = _cairo_clip_intersect_to_rectangle (&gstate->clip, &rectangle); if (status) return status; @@ -757,119 +699,310 @@ _cairo_gstate_paint (cairo_gstate_t *gstate) if (status) return status; - _cairo_gstate_clip_and_composite_trapezoids (gstate, - gstate->source, - gstate->operator, - gstate->target, - &traps); + _cairo_gstate_clip_and_composite_trapezoids (gstate, &traps); _cairo_traps_fini (&traps); return CAIRO_STATUS_SUCCESS; } -/* Combines @gstate->clip_surface using the IN operator with - * the given intermediate surface, which corresponds to the - * rectangle of the destination space given by @extents. +/** + * _cairo_operator_bounded: + * @operator: a #cairo_operator_t + * + * A bounded operator is one where a source or mask pixel + * of zero results in no effect on the destination image. + * + * Unbounded operators often require special handling; if you, for + * example, draw trapezoids with an unbounded operator, the effect + * extends past the bounding box of the trapezoids. + * + * Return value: %TRUE if the operator is bounded + **/ +cairo_bool_t +_cairo_operator_bounded (cairo_operator_t operator) +{ + switch (operator) { + case CAIRO_OPERATOR_OVER: + case CAIRO_OPERATOR_ATOP: + case CAIRO_OPERATOR_DEST: + case CAIRO_OPERATOR_DEST_OVER: + case CAIRO_OPERATOR_DEST_OUT: + case CAIRO_OPERATOR_XOR: + case CAIRO_OPERATOR_ADD: + case CAIRO_OPERATOR_SATURATE: + return TRUE; + case CAIRO_OPERATOR_CLEAR: + case CAIRO_OPERATOR_SOURCE: + case CAIRO_OPERATOR_OUT: + case CAIRO_OPERATOR_IN: + case CAIRO_OPERATOR_DEST_IN: + case CAIRO_OPERATOR_DEST_ATOP: + return FALSE; + } + + ASSERT_NOT_REACHED; + return FALSE; +} + +typedef cairo_status_t (*cairo_draw_func_t) (void *closure, + cairo_operator_t operator, + cairo_pattern_t *src, + cairo_surface_t *dst, + int dst_x, + int dst_y, + const cairo_rectangle_t *extents); + +/* Handles compositing with a clip surface when the operator allows + * us to combine the clip with the mask */ static cairo_status_t -_cairo_gstate_combine_clip_surface (cairo_gstate_t *gstate, - cairo_surface_t *intermediate, - cairo_rectangle_t *extents) +_cairo_gstate_clip_and_composite_with_mask (cairo_clip_t *clip, + cairo_operator_t operator, + cairo_pattern_t *src, + cairo_draw_func_t draw_func, + void *draw_closure, + cairo_surface_t *dst, + const cairo_rectangle_t *extents) { - cairo_pattern_union_t pattern; + cairo_surface_t *intermediate; + cairo_surface_pattern_t intermediate_pattern; cairo_status_t status; - _cairo_pattern_init_for_surface (&pattern.surface, - gstate->clip.surface); + intermediate = cairo_surface_create_similar (clip->surface, + CAIRO_CONTENT_ALPHA, + extents->width, + extents->height); + if (intermediate->status) + return CAIRO_STATUS_NO_MEMORY; + + status = (*draw_func) (draw_closure, CAIRO_OPERATOR_SOURCE, + NULL, intermediate, + extents->x, extents->y, + extents); + if (status) + goto CLEANUP_SURFACE; - status = _cairo_surface_composite (CAIRO_OPERATOR_IN, - &pattern.base, - NULL, - intermediate, - extents->x - gstate->clip.surface_rect.x, - extents->y - gstate->clip.surface_rect.y, - 0, 0, - 0, 0, - extents->width, extents->height); + status = _cairo_clip_combine_to_surface (clip, CAIRO_OPERATOR_IN, + intermediate, + extents->x, extents->y, + extents); + if (status) + goto CLEANUP_SURFACE; - _cairo_pattern_fini (&pattern.base); + _cairo_pattern_init_for_surface (&intermediate_pattern, intermediate); + + status = _cairo_surface_composite (operator, + src, &intermediate_pattern.base, dst, + extents->x, extents->y, + 0, 0, + extents->x, extents->y, + extents->width, extents->height); + + _cairo_pattern_fini (&intermediate_pattern.base); + + CLEANUP_SURFACE: + cairo_surface_destroy (intermediate); return status; } -/* Creates a region from a cairo_rectangle_t */ +/* Handles compositing with a clip surface when the operator allows + * us to combine the clip with the mask + */ static cairo_status_t -_region_new_from_rect (cairo_rectangle_t *rect, - pixman_region16_t **region) -{ - *region = pixman_region_create (); - if (pixman_region_union_rect (*region, *region, - rect->x, rect->y, - rect->width, rect->height) != PIXMAN_REGION_STATUS_SUCCESS) { - pixman_region_destroy (*region); +_cairo_gstate_clip_and_composite_combine (cairo_clip_t *clip, + cairo_operator_t operator, + cairo_pattern_t *src, + cairo_draw_func_t draw_func, + void *draw_closure, + cairo_surface_t *dst, + const cairo_rectangle_t *extents) +{ + cairo_surface_t *intermediate; + cairo_surface_pattern_t dst_pattern; + cairo_surface_pattern_t intermediate_pattern; + cairo_status_t status; + + /* We'd be better off here creating a surface identical in format + * to dst, but we have no way of getting that information. + * A CAIRO_CONTENT_CLONE or something might be useful. + */ + intermediate = cairo_surface_create_similar (dst, + CAIRO_CONTENT_COLOR_ALPHA, + extents->width, + extents->height); + if (intermediate->status) return CAIRO_STATUS_NO_MEMORY; - } - return CAIRO_STATUS_SUCCESS; -} + /* Initialize the intermediate surface from the destination surface + */ + _cairo_pattern_init_for_surface (&dst_pattern, dst); -/* Gets the bounding box of a region as a cairo_rectangle_t */ -static void -_region_rect_extents (pixman_region16_t *region, - cairo_rectangle_t *rect) -{ - pixman_box16_t *region_extents = pixman_region_extents (region); + status = _cairo_surface_composite (CAIRO_OPERATOR_SOURCE, + &dst_pattern.base, NULL, intermediate, + extents->x, extents->y, + 0, 0, + 0, 0, + extents->width, extents->height); - rect->x = region_extents->x1; - rect->y = region_extents->y1; - rect->width = region_extents->x2 - region_extents->x1; - rect->height = region_extents->y2 - region_extents->y1; -} + _cairo_pattern_fini (&dst_pattern.base); -/* Intersects @region with the clipping bounds (both region - * and surface) of @gstate - */ -static cairo_status_t -_cairo_gstate_intersect_clip (cairo_gstate_t *gstate, - pixman_region16_t *region) -{ - if (gstate->clip.region) - pixman_region_intersect (region, gstate->clip.region, region); + if (status) + goto CLEANUP_SURFACE; + + status = (*draw_func) (draw_closure, operator, + src, intermediate, + extents->x, extents->y, + extents); + if (status) + goto CLEANUP_SURFACE; + + /* Combine that with the clip + */ + status = _cairo_clip_combine_to_surface (clip, CAIRO_OPERATOR_DEST_IN, + intermediate, + extents->x, extents->y, + extents); + if (status) + goto CLEANUP_SURFACE; + + /* Punch the clip out of the destination + */ + status = _cairo_clip_combine_to_surface (clip, CAIRO_OPERATOR_DEST_OUT, + dst, + 0, 0, + extents); + if (status) + goto CLEANUP_SURFACE; - if (gstate->clip.surface) { - pixman_region16_t *clip_rect; - cairo_status_t status; + /* Now add the two results together + */ + _cairo_pattern_init_for_surface (&intermediate_pattern, intermediate); - status = _region_new_from_rect (&gstate->clip.surface_rect, &clip_rect); - if (status) - return status; - - if (pixman_region_intersect (region, - clip_rect, - region) != PIXMAN_REGION_STATUS_SUCCESS) - status = CAIRO_STATUS_NO_MEMORY; + status = _cairo_surface_composite (CAIRO_OPERATOR_ADD, + &intermediate_pattern.base, NULL, dst, + 0, 0, + 0, 0, + extents->x, extents->y, + extents->width, extents->height); - pixman_region_destroy (clip_rect); + _cairo_pattern_fini (&intermediate_pattern.base); + + CLEANUP_SURFACE: + cairo_surface_destroy (intermediate); - if (status) - return status; - } + return status; +} - return CAIRO_STATUS_SUCCESS; +static int +_cairo_rectangle_empty (const cairo_rectangle_t *rect) +{ + return rect->width == 0 || rect->height == 0; } +/** + * _cairo_gstate_clip_and_composite: + * @gstate: a #cairo_gstate_t + * @operator: the operator to draw with + * @src: source pattern + * @draw_func: function that can be called to draw with the mask onto a surface. + * @draw_closure: data to pass to @draw_func. + * @dst: destination surface + * @extents: rectangle holding a bounding box for the operation; this + * rectangle will be used as the size for the temporary + * surface. + * + * When there is a surface clip, we typically need to create an intermediate + * surface. This function handles the logic of creating a temporary surface + * drawing to it, then compositing the result onto the target surface. + * + * @draw_func is to called to draw the mask; it will be called no more + * than once. + * + * Return value: %CAIRO_STATUS_SUCCESS if the drawing succeeded. + **/ +static cairo_status_t +_cairo_gstate_clip_and_composite (cairo_clip_t *clip, + cairo_operator_t operator, + cairo_pattern_t *src, + cairo_draw_func_t draw_func, + void *draw_closure, + cairo_surface_t *dst, + const cairo_rectangle_t *extents) +{ + if (_cairo_rectangle_empty (extents)) + /* Nothing to do */ + return CAIRO_STATUS_SUCCESS; + + if (clip->surface) + { + if (_cairo_operator_bounded (operator)) + return _cairo_gstate_clip_and_composite_with_mask (clip, operator, + src, + draw_func, draw_closure, + dst, extents); + else + return _cairo_gstate_clip_and_composite_combine (clip, operator, + src, + draw_func, draw_closure, + dst, extents); + } + else + { + return (*draw_func) (draw_closure, operator, + src, dst, + 0, 0, + extents); + } +} + + static cairo_status_t _get_mask_extents (cairo_gstate_t *gstate, cairo_pattern_t *mask, cairo_rectangle_t *extents) { + cairo_status_t status; + /* * XXX should take mask extents into account, but - * that involves checking the transform... For now, + * that involves checking the transform and + * _cairo_operator_bounded (operator)... For now, * be lazy and just use the destination extents */ - return _cairo_gstate_get_clip_extents (gstate, extents); + status = _cairo_surface_get_extents (gstate->target, extents); + if (status) + return status; + + return _cairo_clip_intersect_to_rectangle (&gstate->clip, extents); +} + +static cairo_status_t +_cairo_gstate_mask_draw_func (void *closure, + cairo_operator_t operator, + cairo_pattern_t *src, + cairo_surface_t *dst, + int dst_x, + int dst_y, + const cairo_rectangle_t *extents) +{ + cairo_pattern_t *mask = closure; + + if (src) + return _cairo_surface_composite (operator, + src, mask, dst, + extents->x, extents->y, + extents->x, extents->y, + extents->x - dst_x, extents->y - dst_y, + extents->width, extents->height); + else + return _cairo_surface_composite (operator, + mask, NULL, dst, + extents->x, extents->y, + 0, 0, /* unused */ + extents->x - dst_x, extents->y - dst_y, + extents->width, extents->height); } cairo_status_t @@ -877,11 +1010,8 @@ _cairo_gstate_mask (cairo_gstate_t *gstate, cairo_pattern_t *mask) { cairo_rectangle_t extents; - cairo_pattern_union_t pattern; - cairo_surface_pattern_t intermediate_pattern; - cairo_pattern_t *effective_mask; + cairo_pattern_union_t source_pattern, mask_pattern; cairo_status_t status; - int mask_x, mask_y; if (mask->status) return mask->status; @@ -889,69 +1019,23 @@ _cairo_gstate_mask (cairo_gstate_t *gstate, if (gstate->source->status) return gstate->source->status; - status = _cairo_gstate_set_clip (gstate); + status = _cairo_surface_set_clip (gstate->target, &gstate->clip); if (status) return status; - _get_mask_extents (gstate, mask, &extents); + _cairo_gstate_copy_transformed_source (gstate, &source_pattern.base); + _cairo_gstate_copy_transformed_mask (gstate, &mask_pattern.base, mask); - if (gstate->clip.surface) { - /* When there is clip surface, we'll need to create a - * temporary surface that combines the clip and mask - */ - cairo_surface_t *intermediate; - - intermediate = cairo_surface_create_similar (gstate->clip.surface, - CAIRO_CONTENT_ALPHA, - extents.width, - extents.height); - if (intermediate->status) - return CAIRO_STATUS_NO_MEMORY; - - status = _cairo_surface_composite (CAIRO_OPERATOR_SOURCE, - mask, NULL, intermediate, - extents.x, extents.y, - 0, 0, - 0, 0, - extents.width, extents.height); - if (status) { - cairo_surface_destroy (intermediate); - return status; - } - - status = _cairo_gstate_combine_clip_surface (gstate, intermediate, &extents); - if (status) { - cairo_surface_destroy (intermediate); - return status; - } - - _cairo_pattern_init_for_surface (&intermediate_pattern, intermediate); - cairo_surface_destroy (intermediate); - - effective_mask = &intermediate_pattern.base; - mask_x = extents.x; - mask_y = extents.y; - - } else { - effective_mask = mask; - mask_x = mask_y = 0; - } - - _cairo_pattern_init_copy (&pattern.base, gstate->source); - _cairo_gstate_pattern_transform (gstate, &pattern.base); - - status = _cairo_surface_composite (gstate->operator, - &pattern.base, - effective_mask, - gstate->target, - extents.x, extents.y, - extents.x - mask_x, extents.y - mask_y, - extents.x, extents.y, - extents.width, extents.height); + _get_mask_extents (gstate, &mask_pattern.base, &extents); + + status = _cairo_gstate_clip_and_composite (&gstate->clip, gstate->operator, + &source_pattern.base, + _cairo_gstate_mask_draw_func, &mask_pattern.base, + gstate->target, + &extents); - if (gstate->clip.surface) - _cairo_pattern_fini (&intermediate_pattern.base); - _cairo_pattern_fini (&pattern.base); + _cairo_pattern_fini (&source_pattern.base); + _cairo_pattern_fini (&mask_pattern.base); return status; } @@ -968,7 +1052,7 @@ _cairo_gstate_stroke (cairo_gstate_t *gstate, cairo_path_fixed_t *path) if (gstate->line_width <= 0.0) return CAIRO_STATUS_SUCCESS; - status = _cairo_gstate_set_clip (gstate); + status = _cairo_surface_set_clip (gstate->target, &gstate->clip); if (status) return status; @@ -982,11 +1066,7 @@ _cairo_gstate_stroke (cairo_gstate_t *gstate, cairo_path_fixed_t *path) return status; } - _cairo_gstate_clip_and_composite_trapezoids (gstate, - gstate->source, - gstate->operator, - gstate->target, - &traps); + _cairo_gstate_clip_and_composite_trapezoids (gstate, &traps); _cairo_traps_fini (&traps); @@ -1035,7 +1115,7 @@ BAIL: * _cairo_rectangle_fixed_round. */ -static void +void _cairo_box_round_to_rectangle (cairo_box_t *box, cairo_rectangle_t *rectangle) { rectangle->x = _cairo_fixed_integer_floor (box->p1.x); @@ -1044,7 +1124,7 @@ _cairo_box_round_to_rectangle (cairo_box_t *box, cairo_rectangle_t *rectangle) rectangle->height = _cairo_fixed_integer_ceil (box->p2.y) - rectangle->y; } -static void +void _cairo_rectangle_intersect (cairo_rectangle_t *dest, cairo_rectangle_t *src) { int x1, y1, x2, y2; @@ -1067,80 +1147,10 @@ _cairo_rectangle_intersect (cairo_rectangle_t *dest, cairo_rectangle_t *src) } } -static int -_cairo_rectangle_empty (cairo_rectangle_t *rect) -{ - return rect->width == 0 || rect->height == 0; -} - -/* Given a region representing a set of trapezoids that will be - * drawn, clip the region according to the gstate and compute - * the overall extents. - */ -static cairo_status_t -_clip_and_compute_extents_region (cairo_gstate_t *gstate, - pixman_region16_t *trap_region, - cairo_rectangle_t *extents) -{ - cairo_status_t status; - - status = _cairo_gstate_intersect_clip (gstate, trap_region); - if (status) - return status; - - _region_rect_extents (trap_region, extents); - - return CAIRO_STATUS_SUCCESS; -} - -/* Given a a set of trapezoids to draw, find a bounding box (non-exact) - * of the trapezoids clipped by the gstate - */ -static cairo_status_t -_clip_and_compute_extents_arbitrary (cairo_gstate_t *gstate, - cairo_traps_t *traps, - cairo_rectangle_t *extents) -{ - cairo_box_t trap_extents; - - _cairo_traps_extents (traps, &trap_extents); - _cairo_box_round_to_rectangle (&trap_extents, extents); - - if (gstate->clip.region) { - pixman_region16_t *intersection; - cairo_status_t status; - - status = _region_new_from_rect (extents, &intersection); - if (status) - return status; - - if (pixman_region_intersect (intersection, - gstate->clip.region, - intersection) == PIXMAN_REGION_STATUS_SUCCESS) - { - _region_rect_extents (intersection, extents); - } - else - { - status = CAIRO_STATUS_NO_MEMORY; - } - - pixman_region_destroy (intersection); - - if (status) - return status; - } - - if (gstate->clip.surface) - _cairo_rectangle_intersect (extents, &gstate->clip.surface_rect); - - return CAIRO_STATUS_SUCCESS; -} - /* Composites a region representing a set of trapezoids. */ static cairo_status_t -_composite_trap_region (cairo_gstate_t *gstate, +_composite_trap_region (cairo_clip_t *clip, cairo_pattern_t *src, cairo_operator_t operator, cairo_surface_t *dst, @@ -1148,7 +1158,6 @@ _composite_trap_region (cairo_gstate_t *gstate, cairo_rectangle_t *extents) { cairo_status_t status; - cairo_pattern_union_t pattern; cairo_pattern_union_t mask; int num_rects = pixman_region_num_rects (trap_region); unsigned int clip_serial; @@ -1157,146 +1166,42 @@ _composite_trap_region (cairo_gstate_t *gstate, return CAIRO_STATUS_SUCCESS; if (num_rects > 1) { - - if (gstate->clip.mode != CAIRO_CLIP_MODE_REGION) + if (clip->mode != CAIRO_CLIP_MODE_REGION) return CAIRO_INT_STATUS_UNSUPPORTED; - clip_serial = _cairo_surface_allocate_clip_serial (gstate->target); - status = _cairo_surface_set_clip_region (gstate->target, + clip_serial = _cairo_surface_allocate_clip_serial (dst); + status = _cairo_surface_set_clip_region (dst, trap_region, clip_serial); if (status) return status; } - _cairo_pattern_init_copy (&pattern.base, src); - _cairo_gstate_pattern_transform (gstate, &pattern.base); - - if (gstate->clip.surface) - _cairo_pattern_init_for_surface (&mask.surface, gstate->clip.surface); + if (clip->surface) + _cairo_pattern_init_for_surface (&mask.surface, clip->surface); - status = _cairo_surface_composite (gstate->operator, - &pattern.base, - gstate->clip.surface ? &mask.base : NULL, + status = _cairo_surface_composite (operator, + src, + clip->surface ? &mask.base : NULL, dst, extents->x, extents->y, - extents->x - (gstate->clip.surface ? gstate->clip.surface_rect.x : 0), - extents->y - (gstate->clip.surface ? gstate->clip.surface_rect.y : 0), + extents->x - (clip->surface ? clip->surface_rect.x : 0), + extents->y - (clip->surface ? clip->surface_rect.y : 0), extents->x, extents->y, extents->width, extents->height); - _cairo_pattern_fini (&pattern.base); - if (gstate->clip.surface) + if (clip->surface) _cairo_pattern_fini (&mask.base); return status; } -static void -translate_traps (cairo_traps_t *traps, int x, int y) -{ - cairo_fixed_t xoff, yoff; - cairo_trapezoid_t *t; - int i; - - /* Ugh. The cairo_composite/(Render) interface doesn't allow - an offset for the trapezoids. Need to manually shift all - the coordinates to align with the offset origin of the - intermediate surface. */ - - xoff = _cairo_fixed_from_int (x); - yoff = _cairo_fixed_from_int (y); - - for (i = 0, t = traps->traps; i < traps->num_traps; i++, t++) { - t->top += yoff; - t->bottom += yoff; - t->left.p1.x += xoff; - t->left.p1.y += yoff; - t->left.p2.x += xoff; - t->left.p2.y += yoff; - t->right.p1.x += xoff; - t->right.p1.y += yoff; - t->right.p2.x += xoff; - t->right.p2.y += yoff; - } -} - -/* Composites a set of trapezoids in the case where we need to create - * an intermediate surface to handle gstate->clip.surface - * - * Warning: This call modifies the coordinates of traps - */ -static cairo_status_t -_composite_traps_intermediate_surface (cairo_gstate_t *gstate, - cairo_pattern_t *src, - cairo_operator_t operator, - cairo_surface_t *dst, - cairo_traps_t *traps, - cairo_rectangle_t *extents) -{ - cairo_pattern_union_t pattern; - cairo_surface_t *intermediate; - cairo_surface_pattern_t intermediate_pattern; - cairo_status_t status; - - translate_traps (traps, -extents->x, -extents->y); - - intermediate = _cairo_surface_create_similar_solid (gstate->clip.surface, - CAIRO_CONTENT_ALPHA, - extents->width, - extents->height, - CAIRO_COLOR_TRANSPARENT); - if (intermediate->status) - return CAIRO_STATUS_NO_MEMORY; - - _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE); - - status = _cairo_surface_composite_trapezoids (CAIRO_OPERATOR_ADD, - &pattern.base, - intermediate, - extents->x, extents->y, - 0, 0, - extents->width, - extents->height, - traps->traps, - traps->num_traps); - _cairo_pattern_fini (&pattern.base); - - if (status) - goto out; - - status = _cairo_gstate_combine_clip_surface (gstate, intermediate, extents); - if (status) - goto out; - - _cairo_pattern_init_for_surface (&intermediate_pattern, intermediate); - _cairo_pattern_init_copy (&pattern.base, src); - _cairo_gstate_pattern_transform (gstate, &pattern.base); - - status = _cairo_surface_composite (operator, - &pattern.base, - &intermediate_pattern.base, - dst, - extents->x, extents->y, - 0, 0, - extents->x, extents->y, - extents->width, extents->height); - - _cairo_pattern_fini (&pattern.base); - _cairo_pattern_fini (&intermediate_pattern.base); - - out: - cairo_surface_destroy (intermediate); - - return status; -} - /* Composites a region representing a set of trapezoids in the * case of a solid source (so we can use * _cairo_surface_fill_rectangles). */ static cairo_status_t -_composite_trap_region_solid (cairo_gstate_t *gstate, +_composite_trap_region_solid (cairo_clip_t *clip, cairo_solid_pattern_t *src, cairo_operator_t operator, cairo_surface_t *dst, @@ -1330,48 +1235,69 @@ _composite_trap_region_solid (cairo_gstate_t *gstate, return status; } -/* Composites a set of trapezoids in the general case where - gstate->clip.surface == NULL - */ +typedef struct { + cairo_traps_t *traps; + cairo_antialias_t antialias; +} cairo_composite_traps_info_t; + static cairo_status_t -_composite_traps (cairo_gstate_t *gstate, - cairo_pattern_t *src, - cairo_operator_t operator, - cairo_surface_t *dst, - cairo_traps_t *traps, - cairo_rectangle_t *extents) -{ +_composite_traps_draw_func (void *closure, + cairo_operator_t operator, + cairo_pattern_t *src, + cairo_surface_t *dst, + int dst_x, + int dst_y, + const cairo_rectangle_t *extents) +{ + cairo_composite_traps_info_t *info = closure; cairo_pattern_union_t pattern; cairo_status_t status; - - _cairo_pattern_init_copy (&pattern.base, src); - _cairo_gstate_pattern_transform (gstate, &pattern.base); - status = _cairo_surface_composite_trapezoids (gstate->operator, - &pattern.base, dst, - extents->x, extents->y, - extents->x, extents->y, - extents->width, - extents->height, - traps->traps, - traps->num_traps); + if (dst_x != 0 || dst_y != 0) + _cairo_traps_translate (info->traps, - dst_x, - dst_y); + _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE); + if (!src) + src = &pattern.base; + + status = _cairo_surface_composite_trapezoids (operator, + src, dst, info->antialias, + extents->x, extents->y, + extents->x - dst_x, extents->y - dst_y, + extents->width, extents->height, + info->traps->traps, + info->traps->num_traps); _cairo_pattern_fini (&pattern.base); return status; } +/* Gets the bounding box of a region as a cairo_rectangle_t */ +static void +_region_rect_extents (pixman_region16_t *region, + cairo_rectangle_t *rect) +{ + pixman_box16_t *region_extents = pixman_region_extents (region); + + rect->x = region_extents->x1; + rect->y = region_extents->y1; + rect->width = region_extents->x2 - region_extents->x1; + rect->height = region_extents->y2 - region_extents->y1; +} + /* Warning: This call modifies the coordinates of traps */ -static cairo_status_t -_cairo_gstate_clip_and_composite_trapezoids (cairo_gstate_t *gstate, - cairo_pattern_t *src, - cairo_operator_t operator, - cairo_surface_t *dst, - cairo_traps_t *traps) +cairo_status_t +_cairo_surface_clip_and_composite_trapezoids (cairo_pattern_t *src, + cairo_operator_t operator, + cairo_surface_t *dst, + cairo_traps_t *traps, + cairo_clip_t *clip, + cairo_antialias_t antialias) { cairo_status_t status; pixman_region16_t *trap_region; cairo_rectangle_t extents; + cairo_composite_traps_info_t traps_info; if (traps->num_traps == 0) return CAIRO_STATUS_SUCCESS; @@ -1380,60 +1306,65 @@ _cairo_gstate_clip_and_composite_trapezoids (cairo_gstate_t *gstate, if (status) return status; - if (trap_region) - status = _clip_and_compute_extents_region (gstate, trap_region, &extents); + if (_cairo_operator_bounded (operator)) + { + if (trap_region) { + status = _cairo_clip_intersect_to_region (clip, trap_region); + _region_rect_extents (trap_region, &extents); + } else { + cairo_box_t trap_extents; + _cairo_traps_extents (traps, &trap_extents); + _cairo_box_round_to_rectangle (&trap_extents, &extents); + status = _cairo_clip_intersect_to_rectangle (clip, &extents); + } + } else - status = _clip_and_compute_extents_arbitrary (gstate, traps, &extents); + { + status = _cairo_surface_get_extents (dst, &extents); + if (status) + return status; + status = _cairo_clip_intersect_to_rectangle (clip, &extents); + if (status) + return status; + } if (status) goto out; - if (_cairo_rectangle_empty (&extents)) - /* Nothing to do */ - goto out; - - if (gstate->clip.surface) { - if (trap_region) { - /* If we are compositing a set of rectangles, we can set them as the - * clip region for the destination surface and use the clip surface - * as the mask. A clip region might not be supported, in which case - * we fall through to the next method - */ - status = _composite_trap_region (gstate, src, operator, dst, - trap_region, &extents); - if (status != CAIRO_INT_STATUS_UNSUPPORTED) - goto out; - } - - /* Handle a clip surface by creating an intermediate surface. */ - status = _composite_traps_intermediate_surface (gstate, src, operator, - dst, traps, &extents); - } else { - /* No clip surface */ - if (trap_region && src->type == CAIRO_PATTERN_SOLID) { - /* Solid rectangles are handled specially */ - status = _composite_trap_region_solid (gstate, (cairo_solid_pattern_t *)src, + if (trap_region && _cairo_operator_bounded (operator)) + { + if (src->type == CAIRO_PATTERN_SOLID && !clip->surface) + { + /* Solid rectangles special case */ + status = _composite_trap_region_solid (clip, (cairo_solid_pattern_t *)src, operator, dst, trap_region); - } else { - if (trap_region) { - /* For a simple rectangle, we can just use composite(), for more - * rectangles, we have to set a clip region. The cost of rasterizing - * trapezoids is pretty high for most backends currently, so it's - * worthwhile even if a region is needed. - */ - status = _composite_trap_region (gstate, src, operator, dst, - trap_region, &extents); - if (status != CAIRO_INT_STATUS_UNSUPPORTED) - goto out; - - /* If a clip regions aren't supported, fall through */ - } - - status = _composite_traps (gstate, src, operator, - dst, traps, &extents); + goto out; } + + /* For a simple rectangle, we can just use composite(), for more + * rectangles, we have to set a clip region. The cost of rasterizing + * trapezoids is pretty high for most backends currently, so it's + * worthwhile even if a region is needed. + * + * If we have a clip surface, we set it as the mask. + * + * CAIRO_INT_STATUS_UNSUPPORTED will be returned if the region has + * more than rectangle and the destination doesn't support clip + * regions. In that case, we fall through. + */ + status = _composite_trap_region (clip, src, operator, dst, + trap_region, &extents); + if (status != CAIRO_INT_STATUS_UNSUPPORTED) + goto out; } + traps_info.traps = traps; + traps_info.antialias = antialias; + + status = _cairo_gstate_clip_and_composite (clip, operator, src, + _composite_traps_draw_func, &traps_info, + dst, &extents); + out: if (trap_region) pixman_region_destroy (trap_region); @@ -1441,6 +1372,28 @@ _cairo_gstate_clip_and_composite_trapezoids (cairo_gstate_t *gstate, return status; } +/* Warning: This call modifies the coordinates of traps */ +static cairo_status_t +_cairo_gstate_clip_and_composite_trapezoids (cairo_gstate_t *gstate, + cairo_traps_t *traps) +{ + cairo_pattern_union_t pattern; + cairo_status_t status; + + _cairo_gstate_copy_transformed_source (gstate, &pattern.base); + + status = _cairo_surface_clip_and_composite_trapezoids (&pattern.base, + gstate->operator, + gstate->target, + traps, + &gstate->clip, + gstate->antialias); + + _cairo_pattern_fini (&pattern.base); + + return status; +} + cairo_status_t _cairo_gstate_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path) { @@ -1450,7 +1403,7 @@ _cairo_gstate_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path) if (gstate->source->status) return gstate->source->status; - status = _cairo_gstate_set_clip (gstate); + status = _cairo_surface_set_clip (gstate->target, &gstate->clip); if (status) return status; @@ -1466,17 +1419,16 @@ _cairo_gstate_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path) _cairo_traps_init (&traps); - status = _cairo_path_fixed_fill_to_traps (path, gstate, &traps); + status = _cairo_path_fixed_fill_to_traps (path, + gstate->fill_rule, + gstate->tolerance, + &traps); if (status) { _cairo_traps_fini (&traps); return status; } - _cairo_gstate_clip_and_composite_trapezoids (gstate, - gstate->source, - gstate->operator, - gstate->target, - &traps); + _cairo_gstate_clip_and_composite_trapezoids (gstate, &traps); _cairo_traps_fini (&traps); @@ -1497,7 +1449,10 @@ _cairo_gstate_in_fill (cairo_gstate_t *gstate, _cairo_traps_init (&traps); - status = _cairo_path_fixed_fill_to_traps (path, gstate, &traps); + status = _cairo_path_fixed_fill_to_traps (path, + gstate->fill_rule, + gstate->tolerance, + &traps); if (status) goto BAIL; @@ -1567,7 +1522,10 @@ _cairo_gstate_fill_extents (cairo_gstate_t *gstate, _cairo_traps_init (&traps); - status = _cairo_path_fixed_fill_to_traps (path, gstate, &traps); + status = _cairo_path_fixed_fill_to_traps (path, + gstate->fill_rule, + gstate->tolerance, + &traps); if (status) goto BAIL; @@ -1590,226 +1548,19 @@ BAIL: cairo_status_t _cairo_gstate_reset_clip (cairo_gstate_t *gstate) { - /* destroy any existing clip-region artifacts */ - if (gstate->clip.surface) - cairo_surface_destroy (gstate->clip.surface); - gstate->clip.surface = NULL; - - if (gstate->clip.region) - pixman_region_destroy (gstate->clip.region); - gstate->clip.region = NULL; - - if (gstate->clip.path) - _cairo_clip_path_destroy (gstate->clip.path); - gstate->clip.path = NULL; - - gstate->clip.serial = 0; - - return CAIRO_STATUS_SUCCESS; -} - -static cairo_status_t -_cairo_gstate_intersect_clip_path (cairo_gstate_t *gstate, - cairo_path_fixed_t *path) -{ - cairo_clip_path_t *clip_path; - cairo_status_t status; - - if (gstate->clip.mode != CAIRO_CLIP_MODE_PATH) - return CAIRO_INT_STATUS_UNSUPPORTED; - - clip_path = malloc (sizeof (cairo_clip_path_t)); - if (clip_path == NULL) - return CAIRO_STATUS_NO_MEMORY; - - status = _cairo_path_fixed_init_copy (&clip_path->path, path); - if (status) - return status; - - clip_path->ref_count = 1; - clip_path->fill_rule = gstate->fill_rule; - clip_path->tolerance = gstate->tolerance; - clip_path->prev = gstate->clip.path; - gstate->clip.path = clip_path; - gstate->clip.serial = _cairo_surface_allocate_clip_serial (gstate->target); - - return CAIRO_STATUS_SUCCESS; -} - -static void -_cairo_clip_path_reference (cairo_clip_path_t *clip_path) -{ - if (clip_path == NULL) - return; - - clip_path->ref_count++; -} - -static void -_cairo_clip_path_destroy (cairo_clip_path_t *clip_path) -{ - if (clip_path == NULL) - return; - - clip_path->ref_count--; - if (clip_path->ref_count) - return; - - _cairo_path_fixed_fini (&clip_path->path); - _cairo_clip_path_destroy (clip_path->prev); - free (clip_path); -} - -static cairo_status_t -_cairo_gstate_intersect_clip_region (cairo_gstate_t *gstate, - cairo_traps_t *traps) -{ - pixman_region16_t *region; - cairo_status_t status; - - if (gstate->clip.mode != CAIRO_CLIP_MODE_REGION) - return CAIRO_INT_STATUS_UNSUPPORTED; - - status = _cairo_traps_extract_region (traps, ®ion); - if (status) - return status; - - if (region == NULL) - return CAIRO_INT_STATUS_UNSUPPORTED; - - status = CAIRO_STATUS_SUCCESS; - if (gstate->clip.region == NULL) { - gstate->clip.region = region; - } else { - pixman_region16_t *intersection = pixman_region_create(); - - if (pixman_region_intersect (intersection, - gstate->clip.region, region) - == PIXMAN_REGION_STATUS_SUCCESS) { - pixman_region_destroy (gstate->clip.region); - gstate->clip.region = intersection; - } else { - status = CAIRO_STATUS_NO_MEMORY; - } - pixman_region_destroy (region); - } - gstate->clip.serial = _cairo_surface_allocate_clip_serial (gstate->target); - return status; -} - -static cairo_status_t -_cairo_gstate_intersect_clip_mask (cairo_gstate_t *gstate, - cairo_traps_t *traps) -{ - cairo_pattern_union_t pattern; - cairo_box_t extents; - cairo_rectangle_t surface_rect; - cairo_surface_t *surface; - cairo_status_t status; - - /* Represent the clip as a mask surface. We create a new surface - * the size of the intersection of the old mask surface and the - * extents of the new clip path. */ - - _cairo_traps_extents (traps, &extents); - _cairo_box_round_to_rectangle (&extents, &surface_rect); - - if (gstate->clip.surface != NULL) - _cairo_rectangle_intersect (&surface_rect, &gstate->clip.surface_rect); - - surface = _cairo_surface_create_similar_solid (gstate->target, - CAIRO_CONTENT_ALPHA, - surface_rect.width, - surface_rect.height, - CAIRO_COLOR_WHITE); - if (surface->status) - return CAIRO_STATUS_NO_MEMORY; - - /* Render the new clipping path into the new mask surface. */ - - translate_traps (traps, -surface_rect.x, -surface_rect.y); - _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE); - - status = _cairo_surface_composite_trapezoids (CAIRO_OPERATOR_IN, - &pattern.base, - surface, - 0, 0, - 0, 0, - surface_rect.width, - surface_rect.height, - traps->traps, - traps->num_traps); - - _cairo_pattern_fini (&pattern.base); - - if (status) { - cairo_surface_destroy (surface); - return status; - } - - /* If there was a clip surface already, combine it with the new - * mask surface using the IN operator, so we get the intersection - * of the old and new clipping paths. */ - - if (gstate->clip.surface != NULL) { - _cairo_pattern_init_for_surface (&pattern.surface, gstate->clip.surface); - - status = _cairo_surface_composite (CAIRO_OPERATOR_IN, - &pattern.base, - NULL, - surface, - surface_rect.x - gstate->clip.surface_rect.x, - surface_rect.y - gstate->clip.surface_rect.y, - 0, 0, - 0, 0, - surface_rect.width, - surface_rect.height); - - _cairo_pattern_fini (&pattern.base); - - if (status) { - cairo_surface_destroy (surface); - return status; - } - - cairo_surface_destroy (gstate->clip.surface); - } - - gstate->clip.surface = surface; - gstate->clip.surface_rect = surface_rect; - - return status; + return _cairo_clip_reset (&gstate->clip); } cairo_status_t _cairo_gstate_clip (cairo_gstate_t *gstate, cairo_path_fixed_t *path) { - cairo_status_t status; - cairo_traps_t traps; - - status = _cairo_gstate_intersect_clip_path (gstate, path); - if (status != CAIRO_INT_STATUS_UNSUPPORTED) - return status; - - _cairo_traps_init (&traps); - status = _cairo_path_fixed_fill_to_traps (path, gstate, &traps); - if (status) - goto bail; - - status = _cairo_gstate_intersect_clip_region (gstate, &traps); - if (status != CAIRO_INT_STATUS_UNSUPPORTED) - goto bail; - - status = _cairo_gstate_intersect_clip_mask (gstate, &traps); - - bail: - _cairo_traps_fini (&traps); - - return status; + return _cairo_clip_clip (&gstate->clip, + path, gstate->fill_rule, gstate->tolerance, + gstate->antialias, gstate->target); } static void -_cairo_gstate_unset_font (cairo_gstate_t *gstate) +_cairo_gstate_unset_scaled_font (cairo_gstate_t *gstate) { if (gstate->scaled_font) { cairo_scaled_font_destroy (gstate->scaled_font); @@ -1825,7 +1576,7 @@ _cairo_gstate_select_font_face (cairo_gstate_t *gstate, { cairo_font_face_t *font_face; - font_face = _cairo_simple_font_face_create (family, slant, weight); + font_face = _cairo_toy_font_face_create (family, slant, weight); if (font_face->status) return font_face->status; @@ -1839,7 +1590,7 @@ cairo_status_t _cairo_gstate_set_font_size (cairo_gstate_t *gstate, double size) { - _cairo_gstate_unset_font (gstate); + _cairo_gstate_unset_scaled_font (gstate); cairo_matrix_init_scale (&gstate->font_matrix, size, size); @@ -1850,7 +1601,7 @@ cairo_status_t _cairo_gstate_set_font_matrix (cairo_gstate_t *gstate, const cairo_matrix_t *matrix) { - _cairo_gstate_unset_font (gstate); + _cairo_gstate_unset_scaled_font (gstate); gstate->font_matrix = *matrix; @@ -1868,7 +1619,7 @@ cairo_status_t _cairo_gstate_set_font_options (cairo_gstate_t *gstate, const cairo_font_options_t *options) { - _cairo_gstate_unset_font (gstate); + _cairo_gstate_unset_scaled_font (gstate); gstate->font_options = *options; @@ -1979,9 +1730,9 @@ _cairo_gstate_ensure_font_face (cairo_gstate_t *gstate) if (!gstate->font_face) { cairo_font_face_t *font_face; - font_face = _cairo_simple_font_face_create (CAIRO_FONT_FAMILY_DEFAULT, - CAIRO_FONT_SLANT_DEFAULT, - CAIRO_FONT_WEIGHT_DEFAULT); + font_face = _cairo_toy_font_face_create (CAIRO_FONT_FAMILY_DEFAULT, + CAIRO_FONT_SLANT_DEFAULT, + CAIRO_FONT_WEIGHT_DEFAULT); if (font_face->status) return font_face->status; else @@ -1992,7 +1743,7 @@ _cairo_gstate_ensure_font_face (cairo_gstate_t *gstate) } static cairo_status_t -_cairo_gstate_ensure_font (cairo_gstate_t *gstate) +_cairo_gstate_ensure_scaled_font (cairo_gstate_t *gstate) { cairo_status_t status; cairo_font_options_t options; @@ -2022,7 +1773,7 @@ cairo_status_t _cairo_gstate_get_font_extents (cairo_gstate_t *gstate, cairo_font_extents_t *extents) { - cairo_status_t status = _cairo_gstate_ensure_font (gstate); + cairo_status_t status = _cairo_gstate_ensure_scaled_font (gstate); if (status) return status; @@ -2042,7 +1793,7 @@ _cairo_gstate_text_to_glyphs (cairo_gstate_t *gstate, cairo_status_t status; int i; - status = _cairo_gstate_ensure_font (gstate); + status = _cairo_gstate_ensure_scaled_font (gstate); if (status) return status; @@ -2071,18 +1822,15 @@ cairo_status_t _cairo_gstate_set_font_face (cairo_gstate_t *gstate, cairo_font_face_t *font_face) { - if (font_face->status) + if (font_face && font_face->status) return font_face->status; if (font_face != gstate->font_face) { - if (gstate->font_face) - cairo_font_face_destroy (gstate->font_face); - gstate->font_face = font_face; - if (gstate->font_face) - cairo_font_face_reference (gstate->font_face); + cairo_font_face_destroy (gstate->font_face); + gstate->font_face = cairo_font_face_reference (font_face); } - _cairo_gstate_unset_font (gstate); + _cairo_gstate_unset_scaled_font (gstate); return CAIRO_STATUS_SUCCESS; } @@ -2095,7 +1843,7 @@ _cairo_gstate_glyph_extents (cairo_gstate_t *gstate, { cairo_status_t status; - status = _cairo_gstate_ensure_font (gstate); + status = _cairo_gstate_ensure_scaled_font (gstate); if (status) return status; @@ -2106,6 +1854,58 @@ _cairo_gstate_glyph_extents (cairo_gstate_t *gstate, return CAIRO_STATUS_SUCCESS; } +typedef struct { + cairo_scaled_font_t *font; + cairo_glyph_t *glyphs; + int num_glyphs; +} cairo_show_glyphs_info_t; + +static cairo_status_t +_cairo_gstate_show_glyphs_draw_func (void *closure, + cairo_operator_t operator, + cairo_pattern_t *src, + cairo_surface_t *dst, + int dst_x, + int dst_y, + const cairo_rectangle_t *extents) +{ + cairo_show_glyphs_info_t *glyph_info = closure; + cairo_pattern_union_t pattern; + cairo_status_t status; + + /* Modifying the glyph array is fine because we know that this function + * will be called only once, and we've already made a copy of the + * glyphs in the wrapper. + */ + if (dst_x != 0 || dst_y != 0) { + int i; + + for (i = 0; i < glyph_info->num_glyphs; ++i) + { + glyph_info->glyphs[i].x -= dst_x; + glyph_info->glyphs[i].y -= dst_y; + } + } + + _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE); + if (!src) + src = &pattern.base; + + status = _cairo_scaled_font_show_glyphs (glyph_info->font, + operator, + src, dst, + extents->x, extents->y, + extents->x - dst_x, extents->y - dst_y, + extents->width, extents->height, + glyph_info->glyphs, + glyph_info->num_glyphs); + + if (src == &pattern.base) + _cairo_pattern_fini (&pattern.base); + + return status; +} + cairo_status_t _cairo_gstate_show_glyphs (cairo_gstate_t *gstate, cairo_glyph_t *glyphs, @@ -2117,15 +1917,16 @@ _cairo_gstate_show_glyphs (cairo_gstate_t *gstate, cairo_pattern_union_t pattern; cairo_box_t bbox; cairo_rectangle_t extents; + cairo_show_glyphs_info_t glyph_info; if (gstate->source->status) return gstate->source->status; - status = _cairo_gstate_set_clip (gstate); + status = _cairo_surface_set_clip (gstate->target, &gstate->clip); if (status) return status; - status = _cairo_gstate_ensure_font (gstate); + status = _cairo_gstate_ensure_scaled_font (gstate); if (status) return status; @@ -2140,113 +1941,41 @@ _cairo_gstate_show_glyphs (cairo_gstate_t *gstate, &transformed_glyphs[i].x, &transformed_glyphs[i].y); } - - status = _cairo_scaled_font_glyph_bbox (gstate->scaled_font, - transformed_glyphs, num_glyphs, - &bbox); - _cairo_box_round_to_rectangle (&bbox, &extents); - if (status) - goto CLEANUP_GLYPHS; - - if (gstate->clip.surface) + if (_cairo_operator_bounded (gstate->operator)) { - cairo_surface_t *intermediate; - cairo_surface_pattern_t intermediate_pattern; - - _cairo_rectangle_intersect (&extents, &gstate->clip.surface_rect); - - /* Shortcut if empty */ - if (_cairo_rectangle_empty (&extents)) { - status = CAIRO_STATUS_SUCCESS; - goto BAIL1; - } - - intermediate = _cairo_surface_create_similar_solid (gstate->clip.surface, - CAIRO_CONTENT_ALPHA, - extents.width, - extents.height, - CAIRO_COLOR_TRANSPARENT); - if (intermediate->status) { - status = CAIRO_STATUS_NO_MEMORY; - goto BAIL1; - } - - /* move the glyphs again, from dev space to intermediate space */ - for (i = 0; i < num_glyphs; ++i) - { - transformed_glyphs[i].x -= extents.x; - transformed_glyphs[i].y -= extents.y; - } - - _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE); - - status = _cairo_scaled_font_show_glyphs (gstate->scaled_font, - CAIRO_OPERATOR_ADD, - &pattern.base, intermediate, - extents.x, extents.y, - 0, 0, - extents.width, extents.height, - transformed_glyphs, num_glyphs); - - _cairo_pattern_fini (&pattern.base); - + status = _cairo_scaled_font_glyph_bbox (gstate->scaled_font, + transformed_glyphs, num_glyphs, + &bbox); if (status) - goto BAIL2; - - _cairo_pattern_init_for_surface (&pattern.surface, - gstate->clip.surface); - - status = _cairo_surface_composite (CAIRO_OPERATOR_IN, - &pattern.base, - NULL, - intermediate, - extents.x - gstate->clip.surface_rect.x, - extents.y - gstate->clip.surface_rect.y, - 0, 0, - 0, 0, - extents.width, extents.height); - - _cairo_pattern_fini (&pattern.base); - - if (status) - goto BAIL2; - - _cairo_pattern_init_for_surface (&intermediate_pattern, intermediate); - _cairo_pattern_init_copy (&pattern.base, gstate->source); - _cairo_gstate_pattern_transform (gstate, &pattern.base); - - status = _cairo_surface_composite (gstate->operator, - &pattern.base, - &intermediate_pattern.base, - gstate->target, - extents.x, extents.y, - 0, 0, - extents.x, extents.y, - extents.width, extents.height); - _cairo_pattern_fini (&pattern.base); - _cairo_pattern_fini (&intermediate_pattern.base); - - BAIL2: - cairo_surface_destroy (intermediate); - BAIL1: - ; + goto CLEANUP_GLYPHS; + + _cairo_box_round_to_rectangle (&bbox, &extents); } else { - _cairo_pattern_init_copy (&pattern.base, gstate->source); - _cairo_gstate_pattern_transform (gstate, &pattern.base); + status = _cairo_surface_get_extents (gstate->target, &extents); + if (status) + goto CLEANUP_GLYPHS; + } + + status = _cairo_clip_intersect_to_rectangle (&gstate->clip, &extents); + if (status) + goto CLEANUP_GLYPHS; + + _cairo_gstate_copy_transformed_source (gstate, &pattern.base); - status = _cairo_scaled_font_show_glyphs (gstate->scaled_font, - gstate->operator, &pattern.base, - gstate->target, - extents.x, extents.y, - extents.x, extents.y, - extents.width, extents.height, - transformed_glyphs, num_glyphs); + glyph_info.font = gstate->scaled_font; + glyph_info.glyphs = transformed_glyphs; + glyph_info.num_glyphs = num_glyphs; + + status = _cairo_gstate_clip_and_composite (&gstate->clip, gstate->operator, + &pattern.base, + _cairo_gstate_show_glyphs_draw_func, &glyph_info, + gstate->target, + &extents); - _cairo_pattern_fini (&pattern.base); - } + _cairo_pattern_fini (&pattern.base); CLEANUP_GLYPHS: free (transformed_glyphs); @@ -2264,7 +1993,7 @@ _cairo_gstate_glyph_path (cairo_gstate_t *gstate, int i; cairo_glyph_t *transformed_glyphs = NULL; - status = _cairo_gstate_ensure_font (gstate); + status = _cairo_gstate_ensure_scaled_font (gstate); if (status) return status; @@ -2287,3 +2016,19 @@ _cairo_gstate_glyph_path (cairo_gstate_t *gstate, free (transformed_glyphs); return status; } + +cairo_private cairo_status_t +_cairo_gstate_set_antialias (cairo_gstate_t *gstate, + cairo_antialias_t antialias) +{ + gstate->antialias = antialias; + + return CAIRO_STATUS_SUCCESS; +} + +cairo_private cairo_antialias_t +_cairo_gstate_get_antialias (cairo_gstate_t *gstate) +{ + return gstate->antialias; +} + diff --git a/src/cairo-hash-private.h b/src/cairo-hash-private.h new file mode 100644 index 0000000..6dc9c90 --- /dev/null +++ b/src/cairo-hash-private.h @@ -0,0 +1,125 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2004 Red Hat, Inc. + * Copyright © 2005 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is Red Hat, Inc. + * + * Contributor(s): + * Keith Packard <keithp@keithp.com> + * Graydon Hoare <graydon@redhat.com> + * Carl Worth <cworth@cworth.org> + */ + +#ifndef CAIRO_HASH_PRIVATE_H +#define CAIRO_HASH_PRIVATE_H + +/* XXX: I'd like this file to be self-contained in terms of + * includeability, but that's not really possible with the current + * monolithic cairoint.h. So, for now, just include cairoint.h instead + * if you want to include this file. */ + +typedef struct _cairo_hash_table cairo_hash_table_t; + +/** + * cairo_hash_entry_t: + * + * A #cairo_hash_entry_t contains both a key and a value for + * cairo_hash_table_t. User-derived types for cairo_hash_entry_t must + * be type-compatible with this structure (eg. they must have an + * unsigned long as the first parameter. The easiest way to get this + * is to use: + * + * typedef _my_entry { + * cairo_hash_entry_t base; + * ... Remainder of key and value fields here .. + * } my_entry_t; + * + * which then allows a pointer to my_entry_t to be passed to any of + * the cairo_hash_table functions as follows without requiring a cast: + * + * _cairo_hash_table_insert (hash_table, &my_entry->base); + * + * IMPORTANT: The caller is reponsible for initializing + * my_entry->base.hash with a hash code derived from the key. The + * essential property of the hash code is that keys_equal must never + * return TRUE for two keys that have different hashes. The best hash + * code will reduce the frequency of two keys with the same code for + * which keys_equal returns FALSE. + * + * Which parts of the entry make up the "key" and which part make up + * the value are entirely up to the caller, (as determined by the + * computation going into base.hash as well as the keys_equal + * function). A few of the cairo_hash_table functions accept an entry + * which will be used exclusively as a "key", (indicated by a + * parameter name of key). In these cases, the value-related fields of + * the entry need not be initialized if so desired. + **/ +typedef struct _cairo_hash_entry { + unsigned long hash; +} cairo_hash_entry_t; + +typedef cairo_bool_t +(*cairo_hash_keys_equal_func_t) (void *key_a, void *key_b); + +typedef cairo_bool_t +(*cairo_hash_predicate_func_t) (void *entry); + +typedef void +(*cairo_hash_callback_func_t) (void *entry, + void *closure); + +cairo_private cairo_hash_table_t * +_cairo_hash_table_create (cairo_hash_keys_equal_func_t keys_equal); + +cairo_private void +_cairo_hash_table_destroy (cairo_hash_table_t *hash_table); + +cairo_private cairo_bool_t +_cairo_hash_table_lookup (cairo_hash_table_t *hash_table, + cairo_hash_entry_t *key, + cairo_hash_entry_t **entry_return); + +cairo_private void * +_cairo_hash_table_random_entry (cairo_hash_table_t *hash_table, + cairo_hash_predicate_func_t predicate); + +cairo_private cairo_status_t +_cairo_hash_table_insert (cairo_hash_table_t *hash_table, + cairo_hash_entry_t *entry); + +cairo_private void +_cairo_hash_table_remove (cairo_hash_table_t *hash_table, + cairo_hash_entry_t *key); + +cairo_private void +_cairo_hash_table_foreach (cairo_hash_table_t *hash_table, + cairo_hash_callback_func_t hash_callback, + void *closure); + +#endif diff --git a/src/cairo-hash.c b/src/cairo-hash.c new file mode 100644 index 0000000..e44ab30 --- /dev/null +++ b/src/cairo-hash.c @@ -0,0 +1,533 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2004 Red Hat, Inc. + * Copyright © 2005 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is Red Hat, Inc. + * + * Contributor(s): + * Keith Packard <keithp@keithp.com> + * Graydon Hoare <graydon@redhat.com> + * Carl Worth <cworth@cworth.org> + */ + +#include "cairoint.h" + +/* + * An entry can be in one of three states: + * + * FREE: Entry has never been used, terminates all searches. + * Appears in the table as a NULL pointer. + * + * DEAD: Entry had been live in the past. A dead entry can be reused + * but does not terminate a search for an exact entry. + * Appears in the table as a pointer to DEAD_ENTRY. + * + * LIVE: Entry is currently being used. + * Appears in the table as any non-NULL, non-DEAD_ENTRY pointer. + */ + +static cairo_hash_entry_t dead_entry = { 0 }; +#define DEAD_ENTRY (&dead_entry) + +#define ENTRY_IS_FREE(entry) ((entry) == NULL) +#define ENTRY_IS_DEAD(entry) ((entry) == DEAD_ENTRY) +#define ENTRY_IS_LIVE(entry) ((entry) && ! ENTRY_IS_DEAD(entry)) + +/* We expect keys will not be destroyed frequently, so our table does not + * contain any explicit shrinking code nor any chain-coalescing code for + * entries randomly deleted by memory pressure (except during rehashing, of + * course). These assumptions are potentially bad, but they make the + * implementation straightforward. + * + * Revisit later if evidence appears that we're using excessive memory from + * a mostly-dead table. + * + * This table is open-addressed with double hashing. Each table size is a + * prime chosen to be a little more than double the high water mark for a + * given arrangement, so the tables should remain < 50% full. The table + * size makes for the "first" hash modulus; a second prime (2 less than the + * first prime) serves as the "second" hash modulus, which is co-prime and + * thus guarantees a complete permutation of table indices. + * + * This structure, and accompanying table, is borrowed/modified from the + * file xserver/render/glyph.c in the freedesktop.org x server, with + * permission (and suggested modification of doubling sizes) by Keith + * Packard. + */ + +typedef struct _cairo_hash_table_arrangement { + unsigned long high_water_mark; + unsigned long size; + unsigned long rehash; +} cairo_hash_table_arrangement_t; + +static const cairo_hash_table_arrangement_t hash_table_arrangements [] = { + { 16, 43, 41 }, + { 32, 73, 71 }, + { 64, 151, 149 }, + { 128, 283, 281 }, + { 256, 571, 569 }, + { 512, 1153, 1151 }, + { 1024, 2269, 2267 }, + { 2048, 4519, 4517 }, + { 4096, 9013, 9011 }, + { 8192, 18043, 18041 }, + { 16384, 36109, 36107 }, + { 32768, 72091, 72089 }, + { 65536, 144409, 144407 }, + { 131072, 288361, 288359 }, + { 262144, 576883, 576881 }, + { 524288, 1153459, 1153457 }, + { 1048576, 2307163, 2307161 }, + { 2097152, 4613893, 4613891 }, + { 4194304, 9227641, 9227639 }, + { 8388608, 18455029, 18455027 }, + { 16777216, 36911011, 36911009 }, + { 33554432, 73819861, 73819859 }, + { 67108864, 147639589, 147639587 }, + { 134217728, 295279081, 295279079 }, + { 268435456, 590559793, 590559791 } +}; + +#define NUM_HASH_TABLE_ARRANGEMENTS (sizeof(hash_table_arrangements)/sizeof(hash_table_arrangements[0])) + +struct _cairo_hash_table { + cairo_hash_keys_equal_func_t keys_equal; + + const cairo_hash_table_arrangement_t *arrangement; + cairo_hash_entry_t **entries; + + unsigned long live_entries; +}; + +/** + * _cairo_hash_table_create: + * @keys_equal: a function to return TRUE if two keys are equal + * + * Creates a new hash table which will use the keys_equal() function + * to compare hash keys. Data is provided to the hash table in the + * form of user-derived versions of cairo_hash_entry_t. A hash entry + * must be able to hold both a key (including a hash code) and a + * value. Sometimes only the key will be necessary, (as in + * _cairo_hash_table_remove), and other times both a key and a value + * will be necessary, (as in _cairo_hash_table_insert). + * + * See #cairo_hash_entry_t for more details. + * + * Return value: the new hash table or NULL if out of memory. + **/ +cairo_hash_table_t * +_cairo_hash_table_create (cairo_hash_keys_equal_func_t keys_equal) +{ + cairo_hash_table_t *hash_table; + + hash_table = malloc (sizeof (cairo_hash_table_t)); + if (hash_table == NULL) + return NULL; + + hash_table->keys_equal = keys_equal; + + hash_table->arrangement = &hash_table_arrangements[0]; + + hash_table->entries = calloc (hash_table->arrangement->size, + sizeof(cairo_hash_entry_t *)); + if (hash_table->entries == NULL) { + free (hash_table); + return NULL; + } + + hash_table->live_entries = 0; + + return hash_table; +} + +/** + * _cairo_hash_table_destroy: + * @hash_table: an empty hash table to destroy + * + * Immediately destroys the given hash table, freeing all resources + * associated with it. + * + * WARNING: The hash_table must have no live entries in it before + * _cairo_hash_table_destroy is called. It is a fatal error otherwise, + * and this function will halt. The rationale for this behavior is to + * avoid memory leaks and to avoid needless complication of the API + * with destroy notifiy callbacks. + **/ +void +_cairo_hash_table_destroy (cairo_hash_table_t *hash_table) +{ + if (hash_table == NULL) + return; + + /* The hash table must be empty. Otherwise, halt. */ + assert (hash_table->live_entries == 0); + + free (hash_table->entries); + hash_table->entries = NULL; + + free (hash_table); +} + +/** + * _cairo_hash_table_lookup_internal: + * + * @hash_table: a #cairo_hash_table_t to search + * @key: the key to search on + * @hash_code: the hash_code for @key + * @key_unique: If TRUE, then caller asserts that no key already + * exists that will compare equal to #key, so search can be + * optimized. If unsure, set to FALSE and the code will always work. + * + * Search the hashtable for a live entry for which + * hash_table->keys_equal returns true. If no such entry exists then + * return the first available (free or dead entry). + * + * If the key_unique flag is set, then the search will never call + * hash_table->keys_equal and will act as if it always returned + * false. This is useful as a performance optimization in special + * circumstances where the caller knows that there is no existing + * entry in the hash table with a matching key. + * + * Return value: The matching entry in the hash table (if + * any). Otherwise, the first available entry. The caller should check + * entry->state to check whether a match was found or not. + **/ +static cairo_hash_entry_t ** +_cairo_hash_table_lookup_internal (cairo_hash_table_t *hash_table, + cairo_hash_entry_t *key, + cairo_bool_t key_is_unique) +{ + cairo_hash_entry_t **entry, **first_available = NULL; + unsigned long table_size, i, idx, step; + + table_size = hash_table->arrangement->size; + + idx = key->hash % table_size; + step = 0; + + for (i = 0; i < table_size; ++i) + { + entry = &hash_table->entries[idx]; + + if (ENTRY_IS_FREE(*entry)) + { + return entry; + } + else if (ENTRY_IS_DEAD(*entry)) + { + if (key_is_unique) { + return entry; + } else { + if (! first_available) + first_available = entry; + } + } + else /* ENTRY_IS_LIVE(*entry) */ + { + if (! key_is_unique) + if (hash_table->keys_equal (key, *entry)) + return entry; + } + + if (step == 0) { + step = key->hash % hash_table->arrangement->rehash; + if (step == 0) + step = 1; + } + + idx += step; + if (idx >= table_size) + idx -= table_size; + } + + /* + * The table should not have permitted you to get here if you were just + * looking for a free slot: there should have been room. + */ + assert (key_is_unique == 0); + + return first_available; +} + +/** + * _cairo_hash_table_resize: + * @hash_table: a hash table + * + * Resize the hash table if the number of entries has gotten much + * bigger or smaller than the ideal number of entries for the current + * size. + * + * Return value: CAIRO_STATUS_SUCCESS if successful or + * CAIRO_STATUS_NO_MEMORY if out of memory. + **/ +static cairo_status_t +_cairo_hash_table_resize (cairo_hash_table_t *hash_table) +{ + cairo_hash_table_t tmp; + cairo_hash_entry_t **entry; + unsigned long new_size, i; + + /* This keeps the hash table between 25% and 50% full. */ + unsigned long high = hash_table->arrangement->high_water_mark; + unsigned long low = high >> 2; + + if (hash_table->live_entries >= low && hash_table->live_entries <= high) + return CAIRO_STATUS_SUCCESS; + + tmp = *hash_table; + + if (hash_table->live_entries > high) + { + tmp.arrangement = hash_table->arrangement + 1; + /* This code is being abused if we can't make a table big enough. */ + assert (tmp.arrangement - hash_table_arrangements < + NUM_HASH_TABLE_ARRANGEMENTS); + } + else /* hash_table->live_entries < low */ + { + /* Can't shrink if we're at the smallest size */ + if (hash_table->arrangement == &hash_table_arrangements[0]) + return CAIRO_STATUS_SUCCESS; + tmp.arrangement = hash_table->arrangement - 1; + } + + new_size = tmp.arrangement->size; + tmp.entries = calloc (new_size, sizeof (cairo_hash_entry_t*)); + if (tmp.entries == NULL) + return CAIRO_STATUS_NO_MEMORY; + + for (i = 0; i < hash_table->arrangement->size; ++i) { + if (ENTRY_IS_LIVE (hash_table->entries[i])) { + entry = _cairo_hash_table_lookup_internal (&tmp, + hash_table->entries[i], + TRUE); + assert (ENTRY_IS_FREE(*entry)); + *entry = hash_table->entries[i]; + } + } + + free (hash_table->entries); + hash_table->entries = tmp.entries; + hash_table->arrangement = tmp.arrangement; + + return CAIRO_STATUS_SUCCESS; +} + +/** + * _cairo_hash_table_lookup: + * @hash_table: a hash table + * @key: the key of interest + * @entry_return: pointer for return value. + * + * Performs a lookup in @hash_table looking for an entry which has a + * key that matches @key, (as determined by the keys_equal() function + * passed to _cairo_hash_table_create). + * + * Return value: TRUE if there is an entry in the hash table that + * matches the given key, (which will now be in *entry_return). FALSE + * otherwise, (in which case *entry_return will be NULL). + **/ +cairo_bool_t +_cairo_hash_table_lookup (cairo_hash_table_t *hash_table, + cairo_hash_entry_t *key, + cairo_hash_entry_t **entry_return) +{ + cairo_hash_entry_t **entry; + + /* See if we have an entry in the table already. */ + entry = _cairo_hash_table_lookup_internal (hash_table, key, FALSE); + if (ENTRY_IS_LIVE(*entry)) { + *entry_return = *entry; + return TRUE; + } + + *entry_return = NULL; + return FALSE; +} + +/** + * _cairo_hash_table_random_entry: + * @hash_table: a hash table + * @predicate: a predicate function, or NULL for any entry. + * + * Find a random entry in the hash table satisfying the given + * @predicate. A NULL @predicate is taken as equivalent to a function + * which always returns TRUE, (eg. any entry in the table will do). + * + * We use the same algorithm as the lookup algorithm to walk over the + * entries in the hash table in a pseudo-random order. Walking + * linearly would favor entries following gaps in the hash table. We + * could also call rand() repeatedly, which works well for almost-full + * tables, but degrades when the table is almost empty, or predicate + * returns TRUE for most entries. + * + * Return value: a random live entry or NULL if there are no entries + * that match the given predicate. In particular, if predicate is + * NULL, a NULL return value indicates that the table is empty. + **/ +void * +_cairo_hash_table_random_entry (cairo_hash_table_t *hash_table, + cairo_hash_predicate_func_t predicate) +{ + cairo_hash_entry_t **entry; + unsigned long hash; + unsigned long table_size, i, idx, step; + + table_size = hash_table->arrangement->size; + + hash = rand (); + idx = hash % table_size; + step = 0; + + for (i = 0; i < table_size; ++i) + { + entry = &hash_table->entries[idx]; + + if (ENTRY_IS_LIVE (*entry) && + (predicate == NULL || predicate (*entry))) + { + return *entry; + } + + if (step == 0) { + step = hash % hash_table->arrangement->rehash; + if (step == 0) + step = 1; + } + + idx += step; + if (idx >= table_size) + idx -= table_size; + } + + return NULL; +} + +/** + * _cairo_hash_table_insert: + * @hash_table: a hash table + * @key_and_value: an entry to be inserted + * + * Insert the entry #key_and_value into the hash table. + * + * WARNING: It is a fatal error if an entry exists in the hash table + * with a matching key, (this function will halt). + * + * Instead of using insert to replace an entry, consider just editing + * the entry obtained with _cairo_hash_table_lookup. Or if absolutely + * necessary, use _cairo_hash_table_remove first. + * + * Return value: CAIRO_STATUS_SUCCESS if successful or + * CAIRO_STATUS_NO_MEMORY if insufficient memory is available. + **/ +cairo_status_t +_cairo_hash_table_insert (cairo_hash_table_t *hash_table, + cairo_hash_entry_t *key_and_value) +{ + cairo_status_t status; + cairo_hash_entry_t **entry; + + entry = _cairo_hash_table_lookup_internal (hash_table, + key_and_value, FALSE); + + if (ENTRY_IS_LIVE(*entry)) + { + /* User is being bad, let's crash. */ + ASSERT_NOT_REACHED; + } + + *entry = key_and_value; + hash_table->live_entries++; + + status = _cairo_hash_table_resize (hash_table); + if (status) + return status; + + return CAIRO_STATUS_SUCCESS; +} + +/** + * _cairo_hash_table_remove: + * @hash_table: a hash table + * @key: key of entry to be removed + * + * Remove an entry from the hash table which has a key that matches + * @key, if any (as determined by the keys_equal() function passed to + * _cairo_hash_table_create). + * + * Return value: CAIRO_STATUS_SUCCESS if successful or + * CAIRO_STATUS_NO_MEMORY if out of memory. + **/ +void +_cairo_hash_table_remove (cairo_hash_table_t *hash_table, + cairo_hash_entry_t *key) +{ + cairo_hash_entry_t **entry; + + entry = _cairo_hash_table_lookup_internal (hash_table, key, FALSE); + if (! ENTRY_IS_LIVE(*entry)) + return; + + *entry = DEAD_ENTRY; + hash_table->live_entries--; + + /* This call _can_ fail, but only in failing to allocate new + * memory to shrink the hash table. It does leave the table in a + * consistent state, and we've already succeeded in removing the + * entry, so we don't examine the failure status of this call. */ + _cairo_hash_table_resize (hash_table); +} + +/** + * _cairo_hash_table_foreach: + * @hash_table: a hash table + * @hash_callback: function to be called for each live entry + * @closure: additional argument to be passed to @hash_callback + * + * Call @hash_callback for each live entry in the hash table, in a + * non-specified order. + **/ +void +_cairo_hash_table_foreach (cairo_hash_table_t *hash_table, + cairo_hash_callback_func_t hash_callback, + void *closure) +{ + unsigned long i; + cairo_hash_entry_t *entry; + + if (hash_table == NULL) + return; + + for (i = 0; i < hash_table->arrangement->size; i++) { + entry = hash_table->entries[i]; + if (ENTRY_IS_LIVE(entry)) + hash_callback (entry, closure); + } +} diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index b21cf12..f7dbc8c 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -69,7 +69,8 @@ _cairo_image_surface_create_for_pixman_image (pixman_image_t *pixman_image, surface->format = format; surface->data = (unsigned char *) pixman_image_get_data (pixman_image); - surface->owns_data = 0; + surface->owns_data = FALSE; + surface->has_clip = FALSE; surface->width = pixman_image_get_width (pixman_image); surface->height = pixman_image_get_height (pixman_image); @@ -408,8 +409,7 @@ _cairo_image_surface_clone_similar (void *abstract_surface, cairo_image_surface_t *surface = abstract_surface; if (src->backend == surface->base.backend) { - *clone_out = src; - cairo_surface_reference (src); + *clone_out = cairo_surface_reference (src); return CAIRO_STATUS_SUCCESS; } @@ -614,6 +614,16 @@ _cairo_image_surface_composite (cairo_operator_t operator, } } + if (!_cairo_operator_bounded (operator)) + _cairo_surface_composite_fixup_unbounded (&dst->base, + &src_attr, src->width, src->height, + mask ? &mask_attr : NULL, + mask ? mask->width : 0, + mask ? mask->height : 0, + src_x, src_y, + mask_x, mask_y, + dst_x, dst_y, width, height); + if (mask) _cairo_pattern_release_surface (mask_pattern, &mask->base, &mask_attr); @@ -645,10 +655,25 @@ _cairo_image_surface_fill_rectangles (void *abstract_surface, return CAIRO_STATUS_SUCCESS; } +static cairo_bool_t +_cairo_image_surface_is_alpha_only (cairo_image_surface_t *surface) +{ + int bpp, alpha, red, green, blue; + + if (surface->format != (cairo_format_t) -1) + return surface->format == CAIRO_FORMAT_A1 || surface->format == CAIRO_FORMAT_A8; + + pixman_format_get_masks (pixman_image_get_format (surface->pixman_image), + &bpp, &alpha, &red, &green, &blue); + + return red == 0 && blue == 0 && green == 0; +} + static cairo_int_status_t _cairo_image_surface_composite_trapezoids (cairo_operator_t operator, cairo_pattern_t *pattern, void *abstract_dst, + cairo_antialias_t antialias, int src_x, int src_y, int dst_x, @@ -662,8 +687,35 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t operator, cairo_image_surface_t *dst = abstract_dst; cairo_image_surface_t *src; cairo_int_status_t status; - int render_reference_x, render_reference_y; - int render_src_x, render_src_y; + pixman_image_t *mask; + pixman_format_t *format; + pixman_bits_t *mask_data; + int mask_stride; + int mask_bpp; + + /* Special case adding trapezoids onto a mask surface; we want to avoid + * creating an intermediate temporary mask unecessarily. + * + * We make the assumption here that the portion of the trapezoids + * contained within the surface is bounded by [dst_x,dst_y,width,height]; + * the Cairo core code passes bounds based on the trapezoid extents. + * + * Currently the check surface->has_clip is needed for correct + * functioning, since pixman_add_trapezoids() doesn't obey the + * surface clip, which is a libpixman bug , but there's no harm in + * falling through to the general case when the surface is clipped + * since libpixman would have to generate an intermediate mask anyways. + */ + if (operator == CAIRO_OPERATOR_ADD && + _cairo_pattern_is_opaque_solid (pattern) && + _cairo_image_surface_is_alpha_only (dst) && + !dst->has_clip && + antialias != CAIRO_ANTIALIAS_NONE) + { + pixman_add_trapezoids (dst->pixman_image, 0, 0, + (pixman_trapezoid_t *) traps, num_traps); + return CAIRO_STATUS_SUCCESS; + } status = _cairo_pattern_acquire_surface (pattern, &dst->base, src_x, src_y, width, height, @@ -672,28 +724,64 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t operator, if (status) return status; - if (traps[0].left.p1.y < traps[0].left.p2.y) { - render_reference_x = _cairo_fixed_integer_floor (traps[0].left.p1.x); - render_reference_y = _cairo_fixed_integer_floor (traps[0].left.p1.y); - } else { - render_reference_x = _cairo_fixed_integer_floor (traps[0].left.p2.x); - render_reference_y = _cairo_fixed_integer_floor (traps[0].left.p2.y); + status = _cairo_image_surface_set_attributes (src, &attributes); + if (status) + goto CLEANUP_SOURCE; + + switch (antialias) { + case CAIRO_ANTIALIAS_NONE: + format = pixman_format_create (PIXMAN_FORMAT_NAME_A1); + mask_stride = (width + 31)/8; + mask_bpp = 1; + break; + default: + format = pixman_format_create (PIXMAN_FORMAT_NAME_A8); + mask_stride = (width + 3) & ~3; + mask_bpp = 8; + break; + } + if (!format) { + status = CAIRO_STATUS_NO_MEMORY; + goto CLEANUP_SOURCE; + } + + /* The image must be initially transparent */ + mask_data = calloc (1, mask_stride * height); + if (!mask_data) { + status = CAIRO_STATUS_NO_MEMORY; + pixman_format_destroy (format); + goto CLEANUP_SOURCE; } - render_src_x = src_x + render_reference_x - dst_x; - render_src_y = src_y + render_reference_y - dst_y; + mask = pixman_image_create_for_data (mask_data, format, width, height, + mask_bpp, mask_stride); + pixman_format_destroy (format); + if (!mask) { + status = CAIRO_STATUS_NO_MEMORY; + goto CLEANUP_IMAGE_DATA; + } /* XXX: The pixman_trapezoid_t cast is evil and needs to go away * somehow. */ - status = _cairo_image_surface_set_attributes (src, &attributes); - if (status == CAIRO_STATUS_SUCCESS) - pixman_composite_trapezoids (_pixman_operator (operator), - src->pixman_image, - dst->pixman_image, - render_src_x + attributes.x_offset, - render_src_y + attributes.y_offset, - (pixman_trapezoid_t *) traps, num_traps); - + pixman_add_trapezoids (mask, - dst_x, - dst_y, + (pixman_trapezoid_t *) traps, num_traps); + + pixman_composite (_pixman_operator (operator), + src->pixman_image, + mask, + dst->pixman_image, + src_x + attributes.x_offset, + src_y + attributes.y_offset, + 0, 0, + dst_x, dst_y, + width, height); + + pixman_image_destroy (mask); + + CLEANUP_IMAGE_DATA: + free (mask_data); + + CLEANUP_SOURCE: _cairo_pattern_release_surface (pattern, &src->base, &attributes); return status; @@ -714,6 +802,8 @@ _cairo_image_surface_set_clip_region (cairo_image_surface_t *surface, { pixman_image_set_clip_region (surface->pixman_image, region); + surface->has_clip = region != NULL; + return CAIRO_STATUS_SUCCESS; } diff --git a/src/cairo-matrix.c b/src/cairo-matrix.c index 98feb57..7596b08 100644 --- a/src/cairo-matrix.c +++ b/src/cairo-matrix.c @@ -36,7 +36,6 @@ #define _GNU_SOURCE #include <stdlib.h> -#include <math.h> #include "cairoint.h" diff --git a/src/cairo-meta-surface-private.h b/src/cairo-meta-surface-private.h index 234c6cc..0a80fe7 100644 --- a/src/cairo-meta-surface-private.h +++ b/src/cairo-meta-surface-private.h @@ -77,6 +77,7 @@ typedef struct _cairo_command_composite_trapezoids { cairo_command_type_t type; cairo_operator_t operator; cairo_pattern_union_t pattern; + cairo_antialias_t antialias; int x_src; int y_src; int x_dst; @@ -99,6 +100,7 @@ typedef struct _cairo_command_intersect_clip_path { cairo_path_fixed_t path; cairo_fill_rule_t fill_rule; double tolerance; + cairo_antialias_t antialias; } cairo_command_intersect_clip_path_t; typedef struct _cairo_command_show_glyphs { @@ -123,6 +125,7 @@ typedef struct _cairo_command_fill_path { cairo_path_fixed_t path; cairo_fill_rule_t fill_rule; double tolerance; + cairo_antialias_t antialias; } cairo_command_fill_path_t; typedef union _cairo_command { @@ -142,10 +145,10 @@ typedef struct _cairo_meta_surface { cairo_array_t commands; } cairo_meta_surface_t; -cairo_surface_t * +cairo_private cairo_surface_t * _cairo_meta_surface_create (double width, double height); -cairo_int_status_t +cairo_private cairo_int_status_t _cairo_meta_surface_replay (cairo_surface_t *surface, cairo_surface_t *target); diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c index 8a893d6..f218ae2 100644 --- a/src/cairo-meta-surface.c +++ b/src/cairo-meta-surface.c @@ -35,15 +35,7 @@ #include "cairoint.h" #include "cairo-meta-surface-private.h" - -/* - * Notes: - * - * Can't use cairo_surface_* calls since we often don't want - * fallbacks. For example, when determining the font subsets or the - * fallback areas. Hmm... but maybe those passes could be integrated - * into the delegation wrappers and the ps output pass, respectively. - */ +#include "cairo-gstate-private.h" static const cairo_surface_backend_t cairo_meta_surface_backend; @@ -106,10 +98,6 @@ _cairo_meta_surface_finish (void *abstract_surface) free (command); break; - case CAIRO_COMMAND_SET_CLIP_REGION: - free (command); - break; - case CAIRO_COMMAND_INTERSECT_CLIP_PATH: if (command->intersect_clip_path.path_pointer) _cairo_path_fixed_fini (&command->intersect_clip_path.path); @@ -229,6 +217,7 @@ static cairo_int_status_t _cairo_meta_surface_composite_trapezoids (cairo_operator_t operator, cairo_pattern_t *pattern, void *abstract_surface, + cairo_antialias_t antialias, int x_src, int y_src, int x_dst, @@ -248,6 +237,7 @@ _cairo_meta_surface_composite_trapezoids (cairo_operator_t operator, command->type = CAIRO_COMMAND_COMPOSITE_TRAPEZOIDS; command->operator = operator; _cairo_pattern_init_copy (&command->pattern.base, pattern); + command->antialias = antialias; command->x_src = x_src; command->y_src = y_src; command->x_dst = x_dst; @@ -276,42 +266,11 @@ _cairo_meta_surface_composite_trapezoids (cairo_operator_t operator, } static cairo_int_status_t -_cairo_meta_surface_set_clip_region (void *abstract_surface, - pixman_region16_t *region) -{ - cairo_meta_surface_t *meta = abstract_surface; - cairo_command_set_clip_region_t *command; - - command = malloc (sizeof (cairo_command_set_clip_region_t)); - if (command == NULL) - return CAIRO_STATUS_NO_MEMORY; - - command->type = CAIRO_COMMAND_SET_CLIP_REGION; - - if (region) { - command->region = pixman_region_create (); - pixman_region_copy (command->region, region); - } else { - command->region = NULL; - } - - command->serial = meta->base.current_clip_serial; - - if (_cairo_array_append (&meta->commands, &command, 1) == NULL) { - if (command->region) - pixman_region_destroy (command->region); - free (command); - return CAIRO_STATUS_NO_MEMORY; - } - - return CAIRO_STATUS_SUCCESS; -} - -static cairo_int_status_t _cairo_meta_surface_intersect_clip_path (void *dst, cairo_path_fixed_t *path, cairo_fill_rule_t fill_rule, - double tolerance) + double tolerance, + cairo_antialias_t antialias) { cairo_meta_surface_t *meta = dst; cairo_command_intersect_clip_path_t *command; @@ -335,6 +294,7 @@ _cairo_meta_surface_intersect_clip_path (void *dst, } command->fill_rule = fill_rule; command->tolerance = tolerance; + command->antialias = antialias; if (_cairo_array_append (&meta->commands, &command, 1) == NULL) { if (path) @@ -387,8 +347,7 @@ _cairo_meta_surface_show_glyphs (cairo_scaled_font_t *scaled_font, return CAIRO_STATUS_NO_MEMORY; command->type = CAIRO_COMMAND_SHOW_GLYPHS; - command->scaled_font = scaled_font; - cairo_scaled_font_reference (scaled_font); + command->scaled_font = cairo_scaled_font_reference (scaled_font); command->operator = operator; _cairo_pattern_init_copy (&command->pattern.base, pattern); command->source_x = source_x; @@ -469,7 +428,7 @@ static const cairo_surface_backend_t cairo_meta_surface_backend = { _cairo_meta_surface_composite_trapezoids, NULL, /* copy_page */ NULL, /* show_page */ - _cairo_meta_surface_set_clip_region, + NULL, /* set_clip_region */ _cairo_meta_surface_intersect_clip_path, _cairo_meta_surface_get_extents, _cairo_meta_surface_show_glyphs, @@ -484,16 +443,24 @@ _cairo_meta_surface_replay (cairo_surface_t *surface, cairo_command_t *command, **elements; int i, num_elements; cairo_int_status_t status; + cairo_traps_t traps; + cairo_clip_t clip; meta = (cairo_meta_surface_t *) surface; status = CAIRO_STATUS_SUCCESS; + _cairo_clip_init (&clip, target); + num_elements = meta->commands.num_elements; elements = (cairo_command_t **) meta->commands.elements; for (i = 0; i < num_elements; i++) { command = elements[i]; switch (command->type) { case CAIRO_COMMAND_COMPOSITE: + status = _cairo_surface_set_clip (target, &clip); + if (status) + break; + status = _cairo_surface_composite (command->composite.operator, &command->composite.src_pattern.base, @@ -510,6 +477,10 @@ _cairo_meta_surface_replay (cairo_surface_t *surface, break; case CAIRO_COMMAND_FILL_RECTANGLES: + status = _cairo_surface_set_clip (target, &clip); + if (status) + break; + status = _cairo_surface_fill_rectangles (target, command->fill_rectangles.operator, @@ -519,10 +490,15 @@ _cairo_meta_surface_replay (cairo_surface_t *surface, break; case CAIRO_COMMAND_COMPOSITE_TRAPEZOIDS: + status = _cairo_surface_set_clip (target, &clip); + if (status) + break; + status = _cairo_surface_composite_trapezoids (command->composite_trapezoids.operator, &command->composite_trapezoids.pattern.base, target, + command->composite_trapezoids.antialias, command->composite_trapezoids.x_src, command->composite_trapezoids.y_src, command->composite_trapezoids.x_dst, @@ -533,27 +509,25 @@ _cairo_meta_surface_replay (cairo_surface_t *surface, command->composite_trapezoids.num_traps); break; - case CAIRO_COMMAND_SET_CLIP_REGION: - status = _cairo_surface_set_clip_region - (target, - command->set_clip_region.region, - command->set_clip_region.serial); - break; - case CAIRO_COMMAND_INTERSECT_CLIP_PATH: /* XXX Meta surface clipping is broken and requires some * cairo-gstate.c rewriting. Work around it for now. */ - if (target->backend->intersect_clip_path == NULL) - break; - - status = _cairo_surface_intersect_clip_path - (target, - command->intersect_clip_path.path_pointer, - command->intersect_clip_path.fill_rule, - command->intersect_clip_path.tolerance); + if (command->intersect_clip_path.path_pointer == NULL) + status = _cairo_clip_reset (&clip); + else + status = _cairo_clip_clip (&clip, + command->intersect_clip_path.path_pointer, + command->intersect_clip_path.fill_rule, + command->intersect_clip_path.tolerance, + command->intersect_clip_path.antialias, + target); break; case CAIRO_COMMAND_SHOW_GLYPHS: + status = _cairo_surface_set_clip (target, &clip); + if (status) + break; + status = _cairo_surface_show_glyphs (command->show_glyphs.scaled_font, command->show_glyphs.operator, @@ -570,18 +544,38 @@ _cairo_meta_surface_replay (cairo_surface_t *surface, break; case CAIRO_COMMAND_FILL_PATH: - /* XXX Meta surface fill_path is broken and requires some - * cairo-gstate.c rewriting. Work around it for now. */ - if (target->backend->fill_path == NULL) + status = _cairo_surface_set_clip (target, &clip); + if (status) break; - status = _cairo_surface_fill_path - (command->fill_path.operator, - &command->fill_path.pattern.base, - target, - &command->fill_path.path, - command->fill_path.fill_rule, - command->fill_path.tolerance); + status = _cairo_surface_fill_path (command->fill_path.operator, + &command->fill_path.pattern.base, + target, + &command->fill_path.path, + command->fill_path.fill_rule, + command->fill_path.tolerance); + if (status != CAIRO_INT_STATUS_UNSUPPORTED) + break; + + _cairo_traps_init (&traps); + + status = _cairo_path_fixed_fill_to_traps (&command->fill_path.path, + command->fill_path.fill_rule, + command->fill_path.tolerance, + &traps); + if (status) { + _cairo_traps_fini (&traps); + break; + } + + status = _cairo_surface_clip_and_composite_trapezoids (&command->fill_path.pattern.base, + command->fill_path.operator, + target, + &traps, + &clip, + command->fill_path.antialias); + + _cairo_traps_fini (&traps); break; default: @@ -592,5 +586,7 @@ _cairo_meta_surface_replay (cairo_surface_t *surface, break; } + _cairo_clip_fini (&clip); + return status; } diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c index 17ef7e2..afb4d42 100644 --- a/src/cairo-output-stream.c +++ b/src/cairo-output-stream.c @@ -39,6 +39,10 @@ #include <ctype.h> #include "cairoint.h" +#ifdef _MSC_VER +#define snprintf _snprintf +#endif /* _MSC_VER */ + struct _cairo_output_stream { cairo_write_func_t write_data; void *closure; diff --git a/src/cairo-path-data-private.h b/src/cairo-path-data-private.h index d680f90..3208bc1 100644 --- a/src/cairo-path-data-private.h +++ b/src/cairo-path-data-private.h @@ -38,7 +38,7 @@ #include "cairoint.h" -extern cairo_path_t cairo_path_nil; +extern const cairo_private cairo_path_t _cairo_path_nil; cairo_private cairo_path_t * _cairo_path_data_create (cairo_path_fixed_t *path, diff --git a/src/cairo-path-data.c b/src/cairo-path-data.c index b3bd312..e72e073 100644 --- a/src/cairo-path-data.c +++ b/src/cairo-path-data.c @@ -37,7 +37,7 @@ #include "cairo-path-fixed-private.h" #include "cairo-gstate-private.h" -cairo_path_t cairo_path_nil = { CAIRO_STATUS_NO_MEMORY, NULL, 0 }; +const cairo_path_t _cairo_path_nil = { CAIRO_STATUS_NO_MEMORY, NULL, 0 }; /* Closure for path interpretation. */ typedef struct cairo_path_data_count { @@ -346,7 +346,7 @@ _cairo_path_data_create_real (cairo_path_fixed_t *path_fixed, path = malloc (sizeof (cairo_path_t)); if (path == NULL) - return &cairo_path_nil; + return (cairo_path_t*) &_cairo_path_nil; path->num_data = _cairo_path_data_count (path, path_fixed, gstate->tolerance, flatten); @@ -354,7 +354,7 @@ _cairo_path_data_create_real (cairo_path_fixed_t *path_fixed, path->data = malloc (path->num_data * sizeof (cairo_path_data_t)); if (path->data == NULL) { free (path); - return &cairo_path_nil; + return (cairo_path_t*) &_cairo_path_nil; } path->status = CAIRO_STATUS_SUCCESS; @@ -382,7 +382,7 @@ _cairo_path_data_create_real (cairo_path_fixed_t *path_fixed, void cairo_path_destroy (cairo_path_t *path) { - if (path == NULL || path == &cairo_path_nil) + if (path == NULL || path == &_cairo_path_nil) return; free (path->data); @@ -454,29 +454,29 @@ _cairo_path_data_append_to_context (cairo_path_t *path, p = &path->data[i]; switch (p->header.type) { case CAIRO_PATH_MOVE_TO: - cairo_move_to (cr, - p[1].point.x, p[1].point.y); if (p->header.length != 2) return CAIRO_STATUS_INVALID_PATH_DATA; + cairo_move_to (cr, + p[1].point.x, p[1].point.y); break; case CAIRO_PATH_LINE_TO: - cairo_line_to (cr, - p[1].point.x, p[1].point.y); if (p->header.length != 2) return CAIRO_STATUS_INVALID_PATH_DATA; + cairo_line_to (cr, + p[1].point.x, p[1].point.y); break; case CAIRO_PATH_CURVE_TO: + if (p->header.length != 4) + return CAIRO_STATUS_INVALID_PATH_DATA; cairo_curve_to (cr, p[1].point.x, p[1].point.y, p[2].point.x, p[2].point.y, p[3].point.x, p[3].point.y); - if (p->header.length != 4) - return CAIRO_STATUS_INVALID_PATH_DATA; break; case CAIRO_PATH_CLOSE_PATH: - cairo_close_path (cr); if (p->header.length != 1) return CAIRO_STATUS_INVALID_PATH_DATA; + cairo_close_path (cr); break; default: return CAIRO_STATUS_INVALID_PATH_DATA; diff --git a/src/cairo-path-fill.c b/src/cairo-path-fill.c index c0015fc..31b83ad 100644 --- a/src/cairo-path-fill.c +++ b/src/cairo-path-fill.c @@ -36,10 +36,8 @@ #include "cairoint.h" -#include "cairo-gstate-private.h" - typedef struct cairo_filler { - cairo_gstate_t *gstate; + double tolerance; cairo_traps_t *traps; cairo_point_t current_point; @@ -48,7 +46,7 @@ typedef struct cairo_filler { } cairo_filler_t; static void -_cairo_filler_init (cairo_filler_t *filler, cairo_gstate_t *gstate, cairo_traps_t *traps); +_cairo_filler_init (cairo_filler_t *filler, double tolerance, cairo_traps_t *traps); static void _cairo_filler_fini (cairo_filler_t *filler); @@ -69,9 +67,9 @@ static cairo_status_t _cairo_filler_close_path (void *closure); static void -_cairo_filler_init (cairo_filler_t *filler, cairo_gstate_t *gstate, cairo_traps_t *traps) +_cairo_filler_init (cairo_filler_t *filler, double tolerance, cairo_traps_t *traps) { - filler->gstate = gstate; + filler->tolerance = tolerance; filler->traps = traps; filler->current_point.x = 0; @@ -132,7 +130,6 @@ _cairo_filler_curve_to (void *closure, cairo_status_t status = CAIRO_STATUS_SUCCESS; cairo_filler_t *filler = closure; cairo_polygon_t *polygon = &filler->polygon; - cairo_gstate_t *gstate = filler->gstate; cairo_spline_t spline; status = _cairo_spline_init (&spline, &filler->current_point, b, c, d); @@ -140,7 +137,7 @@ _cairo_filler_curve_to (void *closure, if (status == CAIRO_INT_STATUS_DEGENERATE) return CAIRO_STATUS_SUCCESS; - _cairo_spline_decompose (&spline, gstate->tolerance); + _cairo_spline_decompose (&spline, filler->tolerance); if (status) goto CLEANUP_SPLINE; @@ -174,13 +171,14 @@ _cairo_filler_close_path (void *closure) cairo_status_t _cairo_path_fixed_fill_to_traps (cairo_path_fixed_t *path, - cairo_gstate_t *gstate, + cairo_fill_rule_t fill_rule, + double tolerance, cairo_traps_t *traps) { cairo_status_t status = CAIRO_STATUS_SUCCESS; cairo_filler_t filler; - _cairo_filler_init (&filler, gstate, traps); + _cairo_filler_init (&filler, tolerance, traps); status = _cairo_path_fixed_interpret (path, CAIRO_DIRECTION_FORWARD, @@ -198,7 +196,7 @@ _cairo_path_fixed_fill_to_traps (cairo_path_fixed_t *path, status = _cairo_traps_tessellate_polygon (filler.traps, &filler.polygon, - filler.gstate->fill_rule); + fill_rule); if (status) goto BAIL; diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index 1fb1721..82b409b 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -236,8 +236,7 @@ _cairo_pattern_init_for_surface (cairo_surface_pattern_t *pattern, { _cairo_pattern_init (&pattern->base, CAIRO_PATTERN_SURFACE); - pattern->surface = surface; - cairo_surface_reference (surface); + pattern->surface = cairo_surface_reference (surface); } static void @@ -297,7 +296,7 @@ _cairo_pattern_create_solid (const cairo_color_t *color) * @green: green component of the color * @blue: blue component of the color * - * Create a new cairo_pattern_t corresponding to a opaque color. The + * Creates a new cairo_pattern_t corresponding to an opaque color. The * color components are floating point numbers in the range 0 to 1. * If the values passed in are outside that range, they will be * clamped. @@ -337,7 +336,7 @@ cairo_pattern_create_rgb (double red, double green, double blue) * @blue: blue component of the color * @alpha: alpha component of the color * - * Create a new cairo_pattern_t corresponding to a translucent color. + * Creates a new cairo_pattern_t corresponding to a translucent color. * The color components are floating point numbers in the range 0 to * 1. If the values passed in are outside that range, they will be * clamped. @@ -415,6 +414,10 @@ cairo_pattern_create_for_surface (cairo_surface_t *surface) * number of color stops should be defined using * cairo_pattern_add_color_stop_rgb() or * cairo_pattern_add_color_stop_rgba(). + * + * Note: The coordinates here are in pattern space. For a new pattern, + * pattern space is identical to user space, but the relationship + * between the spaces can be changed with cairo_pattern_set_matrix(). * * Return value: the newly created #cairo_pattern_t if succesful, or * an error pattern in case of no memory. The caller owns the @@ -450,11 +453,15 @@ cairo_pattern_create_linear (double x0, double y0, double x1, double y1) * @cy1: y coordinate for the center of the end circle * @radius1: radius of the end cirle * - * Create a new radial gradient cairo_pattern_t between the two + * Creates a new radial gradient cairo_pattern_t between the two * circles defined by (x0, y0, c0) and (x1, y1, c0). Before using the * gradient pattern, a number of color stops should be defined using * cairo_pattern_add_color_stop_rgb() or * cairo_pattern_add_color_stop_rgba(). + * + * Note: The coordinates here are in pattern space. For a new pattern, + * pattern space is identical to user space, but the relationship + * between the spaces can be changed with cairo_pattern_set_matrix(). * * Return value: the newly created #cairo_pattern_t if succesful, or * an error pattern in case of no memory. The caller owns the @@ -489,17 +496,21 @@ cairo_pattern_create_radial (double cx0, double cy0, double radius0, * Increases the reference count on @pattern by one. This prevents * @pattern from being destroyed until a matching call to * cairo_pattern_destroy() is made. + * + * Return value: the referenced #cairo_pattern_t. **/ -void +cairo_pattern_t * cairo_pattern_reference (cairo_pattern_t *pattern) { if (pattern == NULL) - return; + return NULL; if (pattern->ref_count == (unsigned int)-1) - return; + return pattern; pattern->ref_count++; + + return pattern; } /** @@ -509,7 +520,8 @@ cairo_pattern_reference (cairo_pattern_t *pattern) * Checks whether an error has previously occurred for this * pattern. * - * Return value: %CAIRO_STATUS_SUCCESS or %CAIRO_STATUS_NO_MEMORY + * Return value: %CAIRO_STATUS_SUCCESS, %CAIRO_STATUS_NO_MEMORY, or + * %CAIRO_STATUS_PATTERN_TYPE_MISMATCH. **/ cairo_status_t cairo_pattern_status (cairo_pattern_t *pattern) @@ -566,6 +578,26 @@ _cairo_pattern_add_color_stop (cairo_gradient_pattern_t *pattern, stop->color = *color; } +/** + * cairo_pattern_add_color_stop_rgb: + * @pattern: a #cairo_pattern_t + * @offset: an offset in the range [0.0 .. 1.0] + * @red: red component of color + * @green: green component of color + * @blue: blue component of color + * + * Adds an opaque color stop to a gradient pattern. The offset + * specifies the location along the gradient's control vector. For + * example, a linear gradient's control vector is from (x0,y0) to + * (x1,y1) while a radial gradient's control vector is from any point + * on the start circle to the corresponding point on the end circle. + * + * The color is specified in the same way as in cairo_set_source_rgb(). + * + * Note: If the pattern is not a gradient pattern, (eg. a linear or + * radial pattern), then the pattern will be put into an error status + * with a status of CAIRO_STATUS_PATTERN_MISMATCH. + **/ void cairo_pattern_add_color_stop_rgb (cairo_pattern_t *pattern, double offset, @@ -596,6 +628,27 @@ cairo_pattern_add_color_stop_rgb (cairo_pattern_t *pattern, &color); } +/** + * cairo_pattern_add_color_stop_rgba: + * @pattern: a #cairo_pattern_t + * @offset: an offset in the range [0.0 .. 1.0] + * @red: red component of color + * @green: green component of color + * @blue: blue component of color + * @alpha: alpha component of color + * + * Adds a translucent color stop to a gradient pattern. The offset + * specifies the location along the gradient's control vector. For + * example, a linear gradient's control vector is from (x0,y0) to + * (x1,y1) while a radial gradient's control vector is from any point + * on the start circle to the corresponding point on the end circle. + * + * The color is specified in the same way as in cairo_set_source_rgba(). + * + * Note: If the pattern is not a gradient pattern, (eg. a linear or + * radial pattern), then the pattern will be put into an error status + * with a status of CAIRO_STATUS_PATTERN_MISMATCH. + */ void cairo_pattern_add_color_stop_rgba (cairo_pattern_t *pattern, double offset, @@ -628,6 +681,38 @@ cairo_pattern_add_color_stop_rgba (cairo_pattern_t *pattern, &color); } +/** + * cairo_pattern_set_matrix: + * @pattern: a #cairo_pattern_t + * @matrix: a #cairo_matrix_t + * + * Sets the pattern's transformation matrix to @matrix. This matrix is + * a transformation from user space to pattern space. + * + * When a pattern is first created it always has the identity matrix + * for its transformation matrix, which means that pattern space is + * initially identical to user space. + * + * Important: Please note that the direction of this transformation + * matrix is from user space to pattern space. This means that if you + * imagine the flow from a pattern to user space (and on to device + * space), then coordinates in that flow will be transformed by the + * inverse of the pattern matrix. + * + * For example, if you want to make a pattern appear twice as large as + * it does by default the correct code to use is: + * + * <informalexample><programlisting> + * cairo_matrix_init_scale (&matrix, 0.5, 0.5); + * cairo_pattern_set_matrix (pattern, &matrix); + * </programlisting></informalexample> + * + * Meanwhile, using values of 2.0 rather than 0.5 in the code above + * would cause the pattern to appear at half of its default size. + * + * Also, please note the discussion of the user-space locking + * semantics of cairo_set_source(). + **/ void cairo_pattern_set_matrix (cairo_pattern_t *pattern, const cairo_matrix_t *matrix) @@ -640,6 +725,13 @@ cairo_pattern_set_matrix (cairo_pattern_t *pattern, pattern->matrix = *matrix; } +/** + * cairo_pattern_get_matrix: + * @pattern: a #cairo_pattern_t + * @matrix: return value for the matrix + * + * Stores the pattern's transformation matrix into @matrix. + **/ void cairo_pattern_get_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix) { diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index 485c1a0..6b86372 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -159,7 +159,7 @@ _cairo_pdf_document_destroy (cairo_pdf_document_t *document); static cairo_status_t _cairo_pdf_document_finish (cairo_pdf_document_t *document); -static void +static cairo_pdf_document_t * _cairo_pdf_document_reference (cairo_pdf_document_t *document); static unsigned int @@ -365,8 +365,7 @@ _cairo_pdf_surface_create_for_document (cairo_pdf_document_t *document, surface->width = width; surface->height = height; - _cairo_pdf_document_reference (document); - surface->document = document; + surface->document = _cairo_pdf_document_reference (document); _cairo_array_init (&surface->streams, sizeof (cairo_pdf_stream_t *)); _cairo_array_init (&surface->patterns, sizeof (cairo_pdf_resource_t)); _cairo_array_init (&surface->xobjects, sizeof (cairo_pdf_resource_t)); @@ -1152,6 +1151,7 @@ static cairo_int_status_t _cairo_pdf_surface_composite_trapezoids (cairo_operator_t operator, cairo_pattern_t *pattern, void *abstract_dst, + cairo_antialias_t antialias, int x_src, int y_src, int x_dst, @@ -1335,7 +1335,8 @@ static cairo_int_status_t _cairo_pdf_surface_intersect_clip_path (void *dst, cairo_path_fixed_t *path, cairo_fill_rule_t fill_rule, - double tolerance) + double tolerance, + cairo_antialias_t antialias) { cairo_pdf_surface_t *surface = dst; cairo_pdf_document_t *document = surface->document; @@ -1658,10 +1659,12 @@ _cairo_pdf_document_write_xref (cairo_pdf_document_t *document) return offset; } -static void +static cairo_pdf_document_t * _cairo_pdf_document_reference (cairo_pdf_document_t *document) { document->ref_count++; + + return document; } static void diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 0b2962c..a897ed0 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -272,6 +272,7 @@ static cairo_int_status_t _cairo_ps_surface_composite_trapezoids (cairo_operator_t operator, cairo_pattern_t *pattern, void *abstract_dst, + cairo_antialias_t antialias, int x_src, int y_src, int x_dst, @@ -286,6 +287,7 @@ _cairo_ps_surface_composite_trapezoids (cairo_operator_t operator, return _cairo_surface_composite_trapezoids (operator, pattern, surface->current_page, + antialias, x_src, y_src, x_dst, @@ -324,14 +326,16 @@ static cairo_int_status_t _cairo_ps_surface_intersect_clip_path (void *dst, cairo_path_fixed_t *path, cairo_fill_rule_t fill_rule, - double tolerance) + double tolerance, + cairo_antialias_t antialias) { cairo_ps_surface_t *surface = dst; return _cairo_surface_intersect_clip_path (surface->current_page, path, fill_rule, - tolerance); + tolerance, + antialias); } static cairo_int_status_t @@ -929,6 +933,7 @@ static cairo_int_status_t _ps_output_composite_trapezoids (cairo_operator_t operator, cairo_pattern_t *pattern, void *abstract_dst, + cairo_antialias_t antialias, int x_src, int y_src, int x_dst, @@ -1054,7 +1059,8 @@ static cairo_int_status_t _ps_output_intersect_clip_path (void *abstract_surface, cairo_path_fixed_t *path, cairo_fill_rule_t fill_rule, - double tolerance) + double tolerance, + cairo_antialias_t antialias) { ps_output_surface_t *surface = abstract_surface; cairo_output_stream_t *stream = surface->parent->stream; diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c index af92c01..70f408a 100644 --- a/src/cairo-quartz-surface.c +++ b/src/cairo-quartz-surface.c @@ -152,7 +152,8 @@ _cairo_quartz_surface_acquire_dest_image(void *abstract_surface, image_rect->height = surface->image->height; *image_out = surface->image; - *image_extra = NULL; + if (image_extra) + *image_extra = NULL; return CAIRO_STATUS_SUCCESS; } @@ -233,7 +234,7 @@ cairo_surface_t *cairo_quartz_surface_create(CGContextRef context, surface = malloc(sizeof(cairo_quartz_surface_t)); if (surface == NULL) { _cairo_error (CAIRO_STATUS_NO_MEMORY); - return &_cairo_surface_nil; + return (cairo_surface_t*) &_cairo_surface_nil; } _cairo_surface_init(&surface->base, &cairo_quartz_surface_backend); diff --git a/src/cairo-surface.c b/src/cairo-surface.c index 11fbc60..8353d32 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -245,18 +245,38 @@ _cairo_surface_get_clip_mode (cairo_surface_t *surface) return CAIRO_CLIP_MODE_MASK; } -void +/** + * cairo_surface_reference: + * @surface: a #cairo_surface_t + * + * Increases the reference count on @surface by one. This prevents + * @surface from being destroyed until a matching call to + * cairo_surface_destroy() is made. + * + * Return value: the referenced #cairo_surface_t. + **/ +cairo_surface_t * cairo_surface_reference (cairo_surface_t *surface) { if (surface == NULL) - return; + return NULL; if (surface->ref_count == (unsigned int)-1) - return; + return surface; surface->ref_count++; + + return surface; } +/** + * cairo_surface_destroy: + * @surface: a #cairo_t + * + * Decreases the reference count on @surface by one. If the result is + * zero, then @surface and all associated resources are freed. See + * cairo_surface_reference(). + **/ void cairo_surface_destroy (cairo_surface_t *surface) { @@ -310,7 +330,15 @@ cairo_surface_finish (cairo_surface_t *surface) surface->finished = TRUE; return; } - + + if (!surface->status && surface->backend->flush) { + status = surface->backend->flush (surface); + if (status) { + _cairo_surface_set_error (surface, status); + return; + } + } + status = surface->backend->finish (surface); if (status) { _cairo_surface_set_error (surface, status); @@ -393,6 +421,93 @@ cairo_surface_get_font_options (cairo_surface_t *surface, } /** + * cairo_surface_flush: + * @surface: a #cairo_surface_t + * + * Do any pending drawing for the surface and also restore any + * temporary modification's cairo has made to the surface's + * state. This function must be called before switching from + * drawing on the surface with cairo to drawing on it directly + * with native APIs. If the surface doesn't support direct access, + * then this function does nothing. + **/ +void +cairo_surface_flush (cairo_surface_t *surface) +{ + if (surface->status) { + _cairo_surface_set_error (surface, surface->status); + return; + } + + if (surface->finished) { + _cairo_surface_set_error (surface, CAIRO_STATUS_SURFACE_FINISHED); + return; + } + + if (surface->backend->flush) { + cairo_status_t status; + + status = surface->backend->flush (surface); + + if (status) + _cairo_surface_set_error (surface, status); + } +} + +/** + * cairo_surface_mark_dirty: + * @surface: a #cairo_surface_t + * + * Tells cairo that drawing has been done to surface using means other + * than cairo, and that cairo should reread any cached areas. Note + * that you must call cairo_surface_flush() before doing such drawing. + */ +void +cairo_surface_mark_dirty (cairo_surface_t *surface) +{ + cairo_surface_mark_dirty_rectangle (surface, 0, 0, -1, -1); +} + +/** + * cairo_surface_mark_dirty_rectangle: + * @surface: a #cairo_surface_t + * @x: X coordinate of dirty rectangle + * @y: Y coordinate of dirty rectangle + * @width: width of dirty rectangle + * @height: height of dirty rectangle + * + * Like cairo_surface_mark_dirty(), but drawing has been done only to + * the specified rectangle, so that cairo can retain cached contents + * for other parts of the surface. + */ +void +cairo_surface_mark_dirty_rectangle (cairo_surface_t *surface, + int x, + int y, + int width, + int height) +{ + if (surface->status) { + _cairo_surface_set_error (surface, surface->status); + return; + } + + if (surface->finished) { + _cairo_surface_set_error (surface, CAIRO_STATUS_SURFACE_FINISHED); + return; + } + + if (surface->backend->mark_dirty_rectangle) { + cairo_status_t status; + + status = surface->backend->mark_dirty_rectangle (surface, x, y, width, height); + + if (status) + _cairo_surface_set_error (surface, status); + } +} + +/** * cairo_surface_set_device_offset: * @surface: a #cairo_surface_t * @x_offset: the offset in the X direction, in device units @@ -876,6 +991,7 @@ static cairo_status_t _fallback_composite_trapezoids (cairo_operator_t operator, cairo_pattern_t *pattern, cairo_surface_t *dst, + cairo_antialias_t antialias, int src_x, int src_y, int dst_x, @@ -928,6 +1044,7 @@ _fallback_composite_trapezoids (cairo_operator_t operator, state.image->base.backend->composite_trapezoids (operator, pattern, &state.image->base, + antialias, src_x, src_y, dst_x - state.image_rect.x, dst_y - state.image_rect.y, @@ -945,6 +1062,7 @@ cairo_status_t _cairo_surface_composite_trapezoids (cairo_operator_t operator, cairo_pattern_t *pattern, cairo_surface_t *dst, + cairo_antialias_t antialias, int src_x, int src_y, int dst_x, @@ -965,6 +1083,7 @@ _cairo_surface_composite_trapezoids (cairo_operator_t operator, if (dst->backend->composite_trapezoids) { status = dst->backend->composite_trapezoids (operator, pattern, dst, + antialias, src_x, src_y, dst_x, dst_y, width, height, @@ -974,6 +1093,7 @@ _cairo_surface_composite_trapezoids (cairo_operator_t operator, } return _fallback_composite_trapezoids (operator, pattern, dst, + antialias, src_x, src_y, dst_x, dst_y, width, height, @@ -1076,7 +1196,8 @@ _cairo_surface_reset_clip (cairo_surface_t *surface) status = surface->backend->intersect_clip_path (surface, NULL, CAIRO_FILL_RULE_WINDING, - 0); + 0, + CAIRO_ANTIALIAS_DEFAULT); if (status) return status; } @@ -1122,7 +1243,8 @@ cairo_int_status_t _cairo_surface_intersect_clip_path (cairo_surface_t *surface, cairo_path_fixed_t *path, cairo_fill_rule_t fill_rule, - double tolerance) + double tolerance, + cairo_antialias_t antialias) { if (surface->status) return surface->status; @@ -1135,7 +1257,8 @@ _cairo_surface_intersect_clip_path (cairo_surface_t *surface, return surface->backend->intersect_clip_path (surface, path, fill_rule, - tolerance); + tolerance, + antialias); } static cairo_status_t @@ -1154,21 +1277,20 @@ _cairo_surface_set_clip_path_recursive (cairo_surface_t *surface, return surface->backend->intersect_clip_path (surface, &clip_path->path, clip_path->fill_rule, - clip_path->tolerance); + clip_path->tolerance, + clip_path->antialias); } /** * _cairo_surface_set_clip_path: - * @surface: the #cairo_surface_t to reset the clip on - * @path: the path to intersect against the current clipping path - * @fill_rule: fill rule to use for clipping - * @tolerance: tesselation to use for tesselating clipping path - * @serial: the clip serial number associated with the region + * @surface: the #cairo_surface_t to set the clip on + * @clip_path: the clip path to set + * @serial: the clip serial number associated with the clip path * - * Sets the clipping path to be the intersection of the current - * clipping path of the surface and the given path. + * Sets the given clipping path for the surface and assigns the + * clipping serial to the surface. **/ -cairo_status_t +static cairo_status_t _cairo_surface_set_clip_path (cairo_surface_t *surface, cairo_clip_path_t *clip_path, unsigned int serial) @@ -1186,7 +1308,8 @@ _cairo_surface_set_clip_path (cairo_surface_t *surface, status = surface->backend->intersect_clip_path (surface, NULL, CAIRO_FILL_RULE_WINDING, - 0); + 0, + CAIRO_ANTIALIAS_DEFAULT); if (status) return status; @@ -1199,6 +1322,27 @@ _cairo_surface_set_clip_path (cairo_surface_t *surface, return CAIRO_STATUS_SUCCESS; } +cairo_status_t +_cairo_surface_set_clip (cairo_surface_t *surface, cairo_clip_t *clip) +{ + if (!surface) + return CAIRO_STATUS_NULL_POINTER; + if (clip->serial == _cairo_surface_get_current_clip_serial (surface)) + return CAIRO_STATUS_SUCCESS; + + if (clip->path) + return _cairo_surface_set_clip_path (surface, + clip->path, + clip->serial); + + if (clip->region) + return _cairo_surface_set_clip_region (surface, + clip->region, + clip->serial); + + return _cairo_surface_reset_clip (surface); +} + /** * _cairo_surface_get_extents: * @surface: the #cairo_surface_t to fetch extents for @@ -1260,3 +1404,154 @@ _cairo_surface_show_glyphs (cairo_scaled_font_t *scaled_font, return status; } + +/** + * _cairo_surface_composite_fixup_unbounded: + * @dst: the destination surface + * @src_attr: source surface attributes (from _cairo_pattern_acquire_surface()) + * @src_width: width of source surface + * @src_height: height of source surface + * @mask_attr: mask surface attributes or %NULL if no mask + * @mask_width: width of mask surface + * @mask_height: height of mask surface + * @src_x: @src_x from _cairo_surface_composite() + * @src_y: @src_y from _cairo_surface_composite() + * @mask_x: @mask_x from _cairo_surface_composite() + * @mask_y: @mask_y from _cairo_surface_composite() + * @dst_x: @dst_x from _cairo_surface_composite() + * @dst_y: @dst_y from _cairo_surface_composite() + * @width: @width from _cairo_surface_composite() + * @height: @height_x from _cairo_surface_composite() + * + * Eeek! Too many parameters! This is a helper function to take care of fixing + * up for bugs in libpixman and RENDER where, when asked to composite an + * untransformed surface with an unbounded operator (like CLEAR or SOURCE) + * only the region inside both the source and the mask is affected. + * This function clears the region that should have been drawn but was wasn't. + **/ +void +_cairo_surface_composite_fixup_unbounded (cairo_surface_t *dst, + cairo_surface_attributes_t *src_attr, + int src_width, + int src_height, + cairo_surface_attributes_t *mask_attr, + int mask_width, + int mask_height, + int src_x, + int src_y, + int mask_x, + int mask_y, + int dst_x, + int dst_y, + unsigned int width, + unsigned int height) +{ + cairo_bool_t have_src = TRUE; + cairo_bool_t have_mask = mask_attr != NULL; + cairo_rectangle_t dst_rectangle; + cairo_rectangle_t drawn_rectangle; + cairo_rectangle_t rects[4]; + int num_rects = 0; + + /* The RENDER/libpixman operators are clipped to the bounds of the untransformed, + * non-repeating sources and masks. Other sources and masks can be ignored. + */ + if (!_cairo_matrix_is_integer_translation (&src_attr->matrix, NULL, NULL) || + src_attr->extend != CAIRO_EXTEND_NONE) + have_src = FALSE; + + if (have_mask && + (!_cairo_matrix_is_integer_translation (&mask_attr->matrix, NULL, NULL) || + mask_attr->extend != CAIRO_EXTEND_NONE)) + have_mask = FALSE; + + /* The area that was drawn is the area in the destination rectangle but not within + * the source or the mask. + */ + dst_rectangle.x = dst_x; + dst_rectangle.y = dst_y; + dst_rectangle.width = width; + dst_rectangle.height = height; + + drawn_rectangle = dst_rectangle; + + if (have_src) { + cairo_rectangle_t src_rectangle; + + src_rectangle.x = (dst_x - (src_x + src_attr->x_offset)); + src_rectangle.y = (dst_y - (src_y + src_attr->y_offset)); + src_rectangle.width = src_width; + src_rectangle.height = src_height; + + _cairo_rectangle_intersect (&drawn_rectangle, &src_rectangle); + } + + if (have_mask) { + cairo_rectangle_t mask_rectangle; + + mask_rectangle.x = (dst_x - (mask_x + mask_attr->x_offset)); + mask_rectangle.y = (dst_y - (mask_y + mask_attr->y_offset)); + mask_rectangle.width = mask_width; + mask_rectangle.height = mask_height; + + _cairo_rectangle_intersect (&drawn_rectangle, &mask_rectangle); + } + + /* Now compute the area that is in dst_rectangle but not in drawn_rectangle; + * this is the area we must clear; This computation could be done with + * regions, but the clumsiness of the libpixman API makes this easier. + */ + if (drawn_rectangle.width == 0 || drawn_rectangle.height == 0) + { + rects[num_rects].x = dst_rectangle.x; + rects[num_rects].y = dst_rectangle.y; + rects[num_rects].width = dst_rectangle.width; + rects[num_rects].height = dst_rectangle.height; + + num_rects++; + } + else + { + if (dst_rectangle.y < drawn_rectangle.y) { + rects[num_rects].x = dst_rectangle.x; + rects[num_rects].y = dst_rectangle.y; + rects[num_rects].width = dst_rectangle.width; + rects[num_rects].height = drawn_rectangle.y - dst_rectangle.y; + + num_rects++; + } + + if (dst_rectangle.x < drawn_rectangle.x) { + rects[num_rects].x = dst_rectangle.x; + rects[num_rects].y = drawn_rectangle.y; + rects[num_rects].width = drawn_rectangle.x - dst_rectangle.x; + rects[num_rects].height = drawn_rectangle.height; + + num_rects++; + } + + if (dst_rectangle.x + dst_rectangle.width > drawn_rectangle.x + drawn_rectangle.width) { + rects[num_rects].x = drawn_rectangle.x + drawn_rectangle.width; + rects[num_rects].y = drawn_rectangle.y; + rects[num_rects].width = (dst_rectangle.x + dst_rectangle.width) - (drawn_rectangle.x + drawn_rectangle.width); + rects[num_rects].height = drawn_rectangle.height; + + num_rects++; + } + + if (dst_rectangle.y + dst_rectangle.height > drawn_rectangle.y + drawn_rectangle.height) { + rects[num_rects].x = dst_rectangle.x; + rects[num_rects].y = drawn_rectangle.y + drawn_rectangle.height; + rects[num_rects].width = dst_rectangle.width; + rects[num_rects].height = (dst_rectangle.y + dst_rectangle.height) - (drawn_rectangle.y + drawn_rectangle.height); + + num_rects++; + } + } + + if (num_rects > 0) { + _cairo_surface_fill_rectangles (dst, CAIRO_OPERATOR_SOURCE, CAIRO_COLOR_TRANSPARENT, + rects, num_rects); + } +} + diff --git a/src/cairo-traps.c b/src/cairo-traps.c index a97d584..18b944c 100644 --- a/src/cairo-traps.c +++ b/src/cairo-traps.c @@ -229,6 +229,35 @@ _compare_point_fixed_by_y (const void *av, const void *bv) return ret; } +void +_cairo_traps_translate (cairo_traps_t *traps, int x, int y) +{ + cairo_fixed_t xoff, yoff; + cairo_trapezoid_t *t; + int i; + + /* Ugh. The cairo_composite/(Render) interface doesn't allow + an offset for the trapezoids. Need to manually shift all + the coordinates to align with the offset origin of the + intermediate surface. */ + + xoff = _cairo_fixed_from_int (x); + yoff = _cairo_fixed_from_int (y); + + for (i = 0, t = traps->traps; i < traps->num_traps; i++, t++) { + t->top += yoff; + t->bottom += yoff; + t->left.p1.x += xoff; + t->left.p1.y += yoff; + t->left.p2.x += xoff; + t->left.p2.y += yoff; + t->right.p1.x += xoff; + t->right.p1.y += yoff; + t->right.p2.x += xoff; + t->right.p2.y += yoff; + } +} + cairo_status_t _cairo_traps_tessellate_triangle (cairo_traps_t *traps, cairo_point_t t[3]) { diff --git a/src/cairo-wideint.c b/src/cairo-wideint.c index ee5141b..0294b14 100644 --- a/src/cairo-wideint.c +++ b/src/cairo-wideint.c @@ -1,5 +1,5 @@ /* - * $Id: cairo-wideint.c,v 1.5 2005/06/03 21:51:57 cworth Exp $ + * $Id: cairo-wideint.c,v 1.6 2005/07/30 19:57:54 keithp Exp $ * * Copyright © 2004 Keith Packard * @@ -36,22 +36,6 @@ #include "cairoint.h" -#if !HAVE_UINT64_T || !HAVE_UINT128_T - -static const unsigned char top_bit[256] = -{ - 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, -}; - -#endif - #if HAVE_UINT64_T #define _cairo_uint32s_to_uint64(h,l) ((uint64_t) (h) << 32 | (l)) @@ -157,7 +141,8 @@ _cairo_uint32x32_64_mul (uint32_t a, uint32_t b) cairo_int64_t _cairo_int32x32_64_mul (int32_t a, int32_t b) { - s = _cairo_uint32x32_64_mul ((uint32_t) a, (uint32_t b)); + cairo_int64_t s; + s = _cairo_uint32x32_64_mul ((uint32_t) a, (uint32_t) b); if (a < 0) s.hi -= b; if (b < 0) @@ -270,200 +255,38 @@ _cairo_uint64_negate (cairo_uint64_t a) } /* - * The design of this algorithm comes from GCC, - * but the actual implementation is new + * Simple bit-at-a-time divide. */ - -static const int -_cairo_leading_zeros32 (uint32_t i) -{ - int top; - - if (i < 0x100) - top = 0; - else if (i < 0x10000) - top = 8; - else if (i < 0x1000000) - top = 16; - else - top = 24; - top = top + top_bit [i >> top]; - return 32 - top; -} - -typedef struct _cairo_uquorem32_t { - uint32_t quo; - uint32_t rem; -} cairo_uquorem32_t; - -/* - * den >= num.hi - */ -static const cairo_uquorem32_t -_cairo_uint64x32_normalized_divrem (cairo_uint64_t num, uint32_t den) -{ - cairo_uquorem32_t qr; - uint32_t q0, q1, r0, r1; - uint16_t d0, d1; - uint32_t t; - - d0 = den & 0xffff; - d1 = den >> 16; - - q1 = num.hi / d1; - r1 = num.hi % d1; - - t = q1 * d0; - r1 = (r1 << 16) | (num.lo >> 16); - if (r1 < t) - { - q1--; - r1 += den; - if (r1 >= den && r1 < t) - { - q1--; - r1 += den; - } - } - - r1 -= t; - - q0 = r1 / d1; - r0 = r1 % d1; - t = q0 * d0; - r0 = (r0 << 16) | (num.lo & 0xffff); - if (r0 < t) - { - q0--; - r0 += den; - if (r0 >= den && r0 < t) - { - q0--; - r0 += den; - } - } - r0 -= t; - qr.quo = (q1 << 16) | q0; - qr.rem = r0; - return qr; -} - cairo_uquorem64_t _cairo_uint64_divrem (cairo_uint64_t num, cairo_uint64_t den) { - cairo_uquorem32_t qr32; cairo_uquorem64_t qr; - int norm; - uint32_t q1, q0, r1, r0; - - if (den.hi == 0) + cairo_uint64_t bit; + cairo_uint64_t quo; + + bit = _cairo_uint32_to_uint64 (1); + + /* normalize to make den >= num, but not overflow */ + while (_cairo_uint64_lt (den, num) && (den.hi & 0x80000000) == 0) { - if (den.lo > num.hi) - { - /* 0q = nn / 0d */ - - norm = _cairo_leading_zeros32 (den.lo); - if (norm) - { - den.lo <<= norm; - num = _cairo_uint64_lsl (num, norm); - } - q1 = 0; - } - else - { - /* qq = NN / 0d */ - - if (den.lo == 0) - den.lo = 1 / den.lo; - - norm = _cairo_leading_zeros32 (den.lo); - if (norm) - { - cairo_uint64_t num1; - den.lo <<= norm; - num1 = _cairo_uint64_rsl (num, 32 - norm); - qr32 = _cairo_uint64x32_normalized_divrem (num1, den.lo); - q1 = qr32.quo; - num.hi = qr32.rem; - num.lo <<= norm; - } - else - { - num.hi -= den.lo; - q1 = 1; - } - } - qr32 = _cairo_uint64x32_normalized_divrem (num, den.lo); - q0 = qr32.quo; - r1 = 0; - r0 = qr32.rem >> norm; + bit = _cairo_uint64_lsl (bit, 1); + den = _cairo_uint64_lsl (den, 1); } - else + quo = _cairo_uint32_to_uint64 (0); + + /* generate quotient, one bit at a time */ + while (bit.hi | bit.lo) { - if (den.hi > num.hi) - { - /* 00 = nn / DD */ - q0 = q1 = 0; - r0 = num.lo; - r1 = num.hi; - } - else + if (_cairo_uint64_le (den, num)) { - /* 0q = NN / dd */ - - norm = _cairo_leading_zeros32 (den.hi); - if (norm == 0) - { - if (num.hi > den.hi || num.lo >= den.lo) - { - q0 = 1; - num = _cairo_uint64_sub (num, den); - } - else - { - q0 = 0; - } - - q1 = 0; - r0 = num.lo; - r1 = num.hi; - } - else - { - cairo_uint64_t num1; - cairo_uint64_t part; - - num1 = _cairo_uint64_rsl (num, 32 - norm); - den = _cairo_uint64_lsl (den, norm); - - qr32 = _cairo_uint64x32_normalized_divrem (num1, den.hi); - part = _cairo_uint32x32_64_mul (qr32.quo, den.lo); - - q0 = qr32.quo; - - num.lo <<= norm; - num.hi = qr32.rem; - - if (_cairo_uint64_gt (part, num)) - { - q0--; - part = _cairo_uint64_sub (part, den); - } - - q1 = 0; - - num = _cairo_uint64_sub (num, part); - num = _cairo_uint64_rsl (num, norm); - r0 = num.lo; - r1 = num.hi; - } + num = _cairo_uint64_sub (num, den); + quo = _cairo_uint64_add (quo, bit); } + bit = _cairo_uint64_rsl (bit, 1); + den = _cairo_uint64_rsl (den, 1); } - qr.quo.lo = q0; - qr.quo.hi = q1; - qr.rem.lo = r0; - qr.rem.hi = r1; + qr.quo = quo; + qr.rem = num; return qr; } @@ -754,234 +577,42 @@ _cairo_uint128_eq (cairo_uint128_t a, cairo_uint128_t b) _cairo_uint64_eq (a.lo, b.lo)); } -/* - * The design of this algorithm comes from GCC, - * but the actual implementation is new - */ - -/* - * den >= num.hi - */ -static cairo_uquorem64_t -_cairo_uint128x64_normalized_divrem (cairo_uint128_t num, cairo_uint64_t den) -{ - cairo_uquorem64_t qr64; - cairo_uquorem64_t qr; - uint32_t q0, q1; - cairo_uint64_t r0, r1; - uint32_t d0, d1; - cairo_uint64_t t; - - d0 = uint64_lo32 (den); - d1 = uint64_hi32 (den); - - qr64 = _cairo_uint64_divrem (num.hi, _cairo_uint32_to_uint64 (d1)); - q1 = _cairo_uint64_to_uint32 (qr64.quo); - r1 = qr64.rem; - - t = _cairo_uint32x32_64_mul (q1, d0); - - r1 = _cairo_uint64_add (_cairo_uint64_lsl (r1, 32), - _cairo_uint64_rsl (num.lo, 32)); - - if (_cairo_uint64_lt (r1, t)) - { - q1--; - r1 = _cairo_uint64_add (r1, den); - if (_cairo_uint64_ge (r1, den) && _cairo_uint64_lt (r1, t)) - { - q1--; - r1 = _cairo_uint64_add (r1, den); - } - } - - r1 = _cairo_uint64_sub (r1, t); - - qr64 = _cairo_uint64_divrem (r1, _cairo_uint32_to_uint64 (d1)); - - q0 = _cairo_uint64_to_uint32 (qr64.quo); - r0 = qr64.rem; - - t = _cairo_uint32x32_64_mul (q0, d0); - - r0 = _cairo_uint64_add (_cairo_uint64_lsl (r0, 32), - _cairo_uint32_to_uint64 (_cairo_uint64_to_uint32 (num.lo))); - if (_cairo_uint64_lt (r0, t)) - { - q0--; - r0 = _cairo_uint64_add (r0, den); - if (_cairo_uint64_ge (r0, den) && _cairo_uint64_lt (r0, t)) - { - q0--; - r0 = _cairo_uint64_add (r0, den); - } - } - - r0 = _cairo_uint64_sub (r0, t); - - qr.quo = _cairo_uint32s_to_uint64 (q1, q0); - qr.rem = r0; - return qr; -} - #if HAVE_UINT64_T - -static int -_cairo_leading_zeros64 (cairo_uint64_t q) -{ - int top = 0; - - if (q >= (uint64_t) 0x10000 << 16) - { - top += 32; - q >>= 32; - } - if (q >= (uint64_t) 0x10000) - { - top += 16; - q >>= 16; - } - if (q >= (uint64_t) 0x100) - { - top += 8; - q >>= 8; - } - top += top_bit [q]; - return 64 - top; -} - +#define _cairo_msbset64(q) (q & ((uint64_t) 1 << 63)) #else - -static const int -_cairo_leading_zeros64 (cairo_uint64_t d) -{ - if (d.hi) - return _cairo_leading_zeros32 (d.hi); - else - return 32 + _cairo_leading_zeros32 (d.lo); -} - +#define _cairo_msbset64(q) (q.hi & ((uint32_t) 1 << 31)) #endif cairo_uquorem128_t _cairo_uint128_divrem (cairo_uint128_t num, cairo_uint128_t den) { - cairo_uquorem64_t qr64; cairo_uquorem128_t qr; - int norm; - cairo_uint64_t q1, q0, r1, r0; - - if (_cairo_uint64_eq (den.hi, _cairo_uint32_to_uint64 (0))) + cairo_uint128_t bit; + cairo_uint128_t quo; + + bit = _cairo_uint32_to_uint128 (1); + + /* normalize to make den >= num, but not overflow */ + while (_cairo_uint128_lt (den, num) && !_cairo_msbset64(den.hi)) { - if (_cairo_uint64_gt (den.lo, num.hi)) - { - /* 0q = nn / 0d */ - - norm = _cairo_leading_zeros64 (den.lo); - if (norm) - { - den.lo = _cairo_uint64_lsl (den.lo, norm); - num = _cairo_uint128_lsl (num, norm); - } - q1 = _cairo_uint32_to_uint64 (0); - } - else - { - /* qq = NN / 0d */ - - if (_cairo_uint64_eq (den.lo, _cairo_uint32_to_uint64 (0))) - den.lo = _cairo_uint64_divrem (_cairo_uint32_to_uint64 (1), - den.lo).quo; - - norm = _cairo_leading_zeros64 (den.lo); - if (norm) - { - cairo_uint128_t num1; - - den.lo = _cairo_uint64_lsl (den.lo, norm); - num1 = _cairo_uint128_rsl (num, 64 - norm); - qr64 = _cairo_uint128x64_normalized_divrem (num1, den.lo); - q1 = qr64.quo; - num.hi = qr64.rem; - num.lo = _cairo_uint64_lsl (num.lo, norm); - } - else - { - num.hi = _cairo_uint64_sub (num.hi, den.lo); - q1 = _cairo_uint32_to_uint64 (1); - } - } - qr64 = _cairo_uint128x64_normalized_divrem (num, den.lo); - q0 = qr64.quo; - r1 = _cairo_uint32_to_uint64 (0); - r0 = _cairo_uint64_rsl (qr64.rem, norm); + bit = _cairo_uint128_lsl (bit, 1); + den = _cairo_uint128_lsl (den, 1); } - else + quo = _cairo_uint32_to_uint128 (0); + + /* generate quotient, one bit at a time */ + while (_cairo_uint128_ne (bit, _cairo_uint32_to_uint128(0))) { - if (_cairo_uint64_gt (den.hi, num.hi)) - { - /* 00 = nn / DD */ - q0 = q1 = _cairo_uint32_to_uint64 (0); - r0 = num.lo; - r1 = num.hi; - } - else + if (_cairo_uint128_le (den, num)) { - /* 0q = NN / dd */ - - norm = _cairo_leading_zeros64 (den.hi); - if (norm == 0) - { - if (_cairo_uint64_gt (num.hi, den.hi) || - _cairo_uint64_ge (num.lo, den.lo)) - { - q0 = _cairo_uint32_to_uint64 (1); - num = _cairo_uint128_sub (num, den); - } - else - { - q0 = _cairo_uint32_to_uint64 (0); - } - - q1 = _cairo_uint32_to_uint64 (0); - r0 = num.lo; - r1 = num.hi; - } - else - { - cairo_uint128_t num1; - cairo_uint128_t part; - - num1 = _cairo_uint128_rsl (num, 64 - norm); - den = _cairo_uint128_lsl (den, norm); - - qr64 = _cairo_uint128x64_normalized_divrem (num1, den.hi); - part = _cairo_uint64x64_128_mul (qr64.quo, den.lo); - - q0 = qr64.quo; - - num.lo = _cairo_uint64_lsl (num.lo, norm); - num.hi = qr64.rem; - - if (_cairo_uint128_gt (part, num)) - { - q0 = _cairo_uint64_sub (q0, _cairo_uint32_to_uint64 (1)); - part = _cairo_uint128_sub (part, den); - } - - q1 = _cairo_uint32_to_uint64 (0); - - num = _cairo_uint128_sub (num, part); - num = _cairo_uint128_rsl (num, norm); - r0 = num.lo; - r1 = num.hi; - } + num = _cairo_uint128_sub (num, den); + quo = _cairo_uint128_add (quo, bit); } + bit = _cairo_uint128_rsl (bit, 1); + den = _cairo_uint128_rsl (den, 1); } - qr.quo.lo = q0; - qr.quo.hi = q1; - qr.rem.lo = r0; - qr.rem.hi = r1; + qr.quo = quo; + qr.rem = num; return qr; } diff --git a/src/cairo-wideint.h b/src/cairo-wideint.h index 08136df..3f56d0f 100644 --- a/src/cairo-wideint.h +++ b/src/cairo-wideint.h @@ -1,5 +1,5 @@ /* - * $Id: cairo-wideint.h,v 1.10 2005/05/10 19:42:32 cworth Exp $ + * $Id: cairo-wideint.h,v 1.12 2005/08/05 14:48:19 cworth Exp $ * * Copyright © 2004 Keith Packard * @@ -44,6 +44,18 @@ # include <inttypes.h> #elif HAVE_SYS_INT_TYPES_H # include <sys/int_types.h> +#elif defined(_MSC_VER) + typedef __int8 int8_t; + typedef unsigned __int8 uint8_t; + typedef __int16 int16_t; + typedef unsigned __int16 uint16_t; + typedef __int32 int32_t; + typedef unsigned __int32 uint32_t; + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; +# ifndef HAVE_UINT64_T +# define HAVE_UINT64_T 1 +# endif #else #error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.) #endif @@ -85,7 +97,7 @@ cairo_int64_t I _cairo_int32_to_int64(int32_t i); #define _cairo_int64_add(a,b) _cairo_uint64_add (a,b) #define _cairo_int64_sub(a,b) _cairo_uint64_sub (a,b) #define _cairo_int64_mul(a,b) _cairo_uint64_mul (a,b) -int I _cairo_int32x32_64_mul (int32_t a, int32_t b); +cairo_int64_t I _cairo_int32x32_64_mul (int32_t a, int32_t b); int I _cairo_int64_lt (cairo_uint64_t a, cairo_uint64_t b); #define _cairo_int64_eq(a,b) _cairo_uint64_eq (a,b) #define _cairo_int64_lsl(a,b) _cairo_uint64_lsl (a,b) @@ -208,7 +220,7 @@ cairo_int128_t I _cairo_int64_to_int128 (cairo_int64_t i); #define _cairo_int128_add(a,b) _cairo_uint128_add(a,b) #define _cairo_int128_sub(a,b) _cairo_uint128_sub(a,b) #define _cairo_int128_mul(a,b) _cairo_uint128_mul(a,b) -cairo_uint128_t I _cairo_int64x64_128_mul (cairo_int64_t a, cairo_int64_t b); +cairo_int128_t I _cairo_int64x64_128_mul (cairo_int64_t a, cairo_int64_t b); #define _cairo_int128_lsl(a,b) _cairo_uint128_lsl(a,b) #define _cairo_int128_rsl(a,b) _cairo_uint128_rsl(a,b) #define _cairo_int128_rsa(a,b) _cairo_uint128_rsa(a,b) diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c index 15dd96b..947f8c3 100644 --- a/src/cairo-win32-font.c +++ b/src/cairo-win32-font.c @@ -58,7 +58,6 @@ typedef struct { cairo_scaled_font_t base; LOGFONTW logfont; - cairo_font_options_t options; BYTE quality; @@ -215,6 +214,7 @@ _get_system_quality (void) static cairo_scaled_font_t * _win32_scaled_font_create (LOGFONTW *logfont, + cairo_font_face_t *font_face, const cairo_matrix_t *font_matrix, const cairo_matrix_t *ctm, const cairo_font_options_t *options) @@ -227,7 +227,6 @@ _win32_scaled_font_create (LOGFONTW *logfont, return NULL; f->logfont = *logfont; - f->options = *options; /* We don't have any control over the hinting style or subpixel * order in the Win32 font API, so we ignore those parts of @@ -263,7 +262,9 @@ _win32_scaled_font_create (LOGFONTW *logfont, cairo_matrix_multiply (&scale, font_matrix, ctm); _compute_transform (f, &scale); - _cairo_scaled_font_init (&f->base, font_matrix, ctm, &cairo_win32_scaled_font_backend); + _cairo_scaled_font_init (&f->base, font_face, + font_matrix, ctm, options, + &cairo_win32_scaled_font_backend); return &f->base; } @@ -429,13 +430,11 @@ _cairo_win32_scaled_font_done_unscaled_font (cairo_scaled_font_t *scaled_font) /* implement the font backend interface */ static cairo_status_t -_cairo_win32_scaled_font_create (const char *family, - cairo_font_slant_t slant, - cairo_font_weight_t weight, - const cairo_matrix_t *font_matrix, - const cairo_matrix_t *ctm, - const cairo_font_options_t *options, - cairo_scaled_font_t **scaled_font_out) +_cairo_win32_scaled_font_create_toy (cairo_toy_font_face_t *toy_face, + const cairo_matrix_t *font_matrix, + const cairo_matrix_t *ctm, + const cairo_font_options_t *options, + cairo_scaled_font_t **scaled_font_out) { LOGFONTW logfont; cairo_scaled_font_t *scaled_font; @@ -443,7 +442,8 @@ _cairo_win32_scaled_font_create (const char *family, int face_name_len; cairo_status_t status; - status = _cairo_utf8_to_utf16 (family, -1, &face_name, &face_name_len); + status = _cairo_utf8_to_utf16 (toy_face->family, -1, + &face_name, &face_name_len); if (status) return status; @@ -460,7 +460,7 @@ _cairo_win32_scaled_font_create (const char *family, logfont.lfEscapement = 0; /* filled in later */ logfont.lfOrientation = 0; /* filled in later */ - switch (weight) { + switch (toy_face->weight) { case CAIRO_FONT_WEIGHT_NORMAL: default: logfont.lfWeight = FW_NORMAL; @@ -470,7 +470,7 @@ _cairo_win32_scaled_font_create (const char *family, break; } - switch (slant) { + switch (toy_face->slant) { case CAIRO_FONT_SLANT_NORMAL: default: logfont.lfItalic = FALSE; @@ -496,7 +496,8 @@ _cairo_win32_scaled_font_create (const char *family, if (!logfont.lfFaceName) return CAIRO_STATUS_NO_MEMORY; - scaled_font = _win32_scaled_font_create (&logfont, font_matrix, ctm, options); + scaled_font = _win32_scaled_font_create (&logfont, toy_face, + font_matrix, ctm, options); if (!scaled_font) return CAIRO_STATUS_NO_MEMORY; @@ -506,7 +507,7 @@ _cairo_win32_scaled_font_create (const char *family, } static void -_cairo_win32_scaled_font_destroy (void *abstract_font) +_cairo_win32_scaled_font_fini (void *abstract_font) { cairo_win32_scaled_font_t *scaled_font = abstract_font; @@ -1059,7 +1060,6 @@ _cairo_win32_scaled_font_show_glyphs (void *abstract_font, */ COLORREF new_color; - /* XXX Use the unpremultiplied or premultiplied color? */ new_color = RGB (((int)solid_pattern->color.red_short) >> 8, ((int)solid_pattern->color.green_short) >> 8, ((int)solid_pattern->color.blue_short) >> 8); @@ -1274,15 +1274,15 @@ FAIL: } const cairo_scaled_font_backend_t cairo_win32_scaled_font_backend = { - _cairo_win32_scaled_font_create, - _cairo_win32_scaled_font_destroy, + _cairo_win32_scaled_font_create_toy, + _cairo_win32_scaled_font_fini, _cairo_win32_scaled_font_font_extents, _cairo_win32_scaled_font_text_to_glyphs, _cairo_win32_scaled_font_glyph_extents, _cairo_win32_scaled_font_glyph_bbox, _cairo_win32_scaled_font_show_glyphs, _cairo_win32_scaled_font_glyph_path, - _cairo_win32_scaled_font_get_glyph_cache_key, + _cairo_win32_scaled_font_get_glyph_cache_key }; /* cairo_win32_font_face_t */ @@ -1302,15 +1302,16 @@ _cairo_win32_font_face_destroy (void *abstract_face) } static cairo_status_t -_cairo_win32_font_face_create_font (void *abstract_face, - const cairo_matrix_t *font_matrix, - const cairo_matrix_t *ctm, - const cairo_font_options_t *options, - cairo_scaled_font_t **font) +_cairo_win32_font_face_scaled_font_create (void *abstract_face, + const cairo_matrix_t *font_matrix, + const cairo_matrix_t *ctm, + const cairo_font_options_t *options, + cairo_scaled_font_t **font) { cairo_win32_font_face_t *font_face = abstract_face; *font = _win32_scaled_font_create (&font_face->logfont, + font_face, font_matrix, ctm, options); if (*font) return CAIRO_STATUS_SUCCESS; @@ -1320,7 +1321,7 @@ _cairo_win32_font_face_create_font (void *abstract_face, static const cairo_font_face_backend_t _cairo_win32_font_face_backend = { _cairo_win32_font_face_destroy, - _cairo_win32_font_face_create_font, + _cairo_win32_font_face_scaled_font_create }; /** diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c index f920124..95c37d9 100644 --- a/src/cairo-win32-surface.c +++ b/src/cairo-win32-surface.c @@ -340,8 +340,9 @@ _cairo_win32_surface_finish (void *abstract_surface) if (surface->image) cairo_surface_destroy (surface->image); - if (surface->saved_clip) + if (surface->saved_clip) { DeleteObject (surface->saved_clip); + } /* If we created the Bitmap and DC, destroy them */ if (surface->bitmap) { @@ -792,7 +793,6 @@ _cairo_win32_surface_set_clip_region (void *abstract_surface, surface->set_clip = 0; } - return CAIRO_STATUS_SUCCESS; } else { @@ -893,6 +893,12 @@ _cairo_win32_surface_get_extents (void *abstract_surface, return CAIRO_STATUS_SUCCESS; } +static cairo_status_t +_cairo_win32_surface_flush (void *abstract_surface) +{ + return _cairo_surface_reset_clip (abstract_surface); +} + cairo_surface_t * cairo_win32_surface_create (HDC hdc) { @@ -964,5 +970,9 @@ static const cairo_surface_backend_t cairo_win32_surface_backend = { _cairo_win32_surface_set_clip_region, NULL, /* intersect_clip_path */ _cairo_win32_surface_get_extents, - NULL /* show_glyphs */ + NULL, /* show_glyphs */ + NULL, /* fill_path */ + NULL, /* get_font_options */ + _cairo_win32_surface_flush, + NULL /* mark_dirty_rectangle */ }; diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index b743cf4..19e4c49 100644 --- a/src/cairo-xcb-surface.c +++ b/src/cairo-xcb-surface.c @@ -643,8 +643,7 @@ _cairo_xcb_surface_clone_similar (void *abstract_surface, cairo_xcb_surface_t *xcb_src = (cairo_xcb_surface_t *)src; if (xcb_src->dpy == surface->dpy) { - *clone_out = src; - cairo_surface_reference (src); + *clone_out = cairo_surface_reference (src); return CAIRO_STATUS_SUCCESS; } @@ -943,6 +942,7 @@ static cairo_int_status_t _cairo_xcb_surface_composite_trapezoids (cairo_operator_t operator, cairo_pattern_t *pattern, void *abstract_dst, + cairo_antialias_t antialias, int src_x, int src_y, int dst_x, @@ -981,9 +981,17 @@ _cairo_xcb_surface_composite_trapezoids (cairo_operator_t operator, render_src_x = src_x + render_reference_x - dst_x; render_src_y = src_y + render_reference_y - dst_y; + switch (antialias) { + case CAIRO_ANTIALIAS_NONE: + render_format = _format_from_cairo (dst->dpy, CAIRO_FORMAT_A1); + break; + default: + render_format = _format_from_cairo (dst->dpy, CAIRO_FORMAT_A8); + break; + } + /* XXX: The XTrapezoid cast is evil and needs to go away somehow. */ /* XXX: _format_from_cairo is slow. should cache something. */ - render_format = _format_from_cairo (dst->dpy, CAIRO_FORMAT_A8), status = _cairo_xcb_surface_set_attributes (src, &attributes); if (status == CAIRO_STATUS_SUCCESS) XCBRenderTrapezoids (dst->dpy, diff --git a/src/cairo-xlib-screen.c b/src/cairo-xlib-screen.c index 6a4efdb..e71d10e 100644 --- a/src/cairo-xlib-screen.c +++ b/src/cairo-xlib-screen.c @@ -245,34 +245,59 @@ _cairo_xlib_init_screen_font_options (cairo_xlib_screen_info_t *info) CAIRO_MUTEX_DECLARE(_xlib_screen_mutex); -static cairo_xlib_screen_info_t *_cairo_xlib_screen_list; +static cairo_xlib_screen_info_t *_cairo_xlib_screen_list = NULL; static int _cairo_xlib_close_display (Display *dpy, XExtCodes *codes) { - cairo_xlib_screen_info_t *info; - cairo_xlib_screen_info_t **prev; + cairo_xlib_screen_info_t *info, *prev; /* * Unhook from the global list */ CAIRO_MUTEX_LOCK (_xlib_screen_mutex); - for (prev = &_cairo_xlib_screen_list; (info = *prev); prev = &(*prev)->next) { + prev = NULL; + for (info = _cairo_xlib_screen_list; info; info = info->next) { if (info->display == dpy) { - *prev = info->next; + if (prev) + prev->next = info->next; + else + _cairo_xlib_screen_list = info->next; free (info); - if (!*prev) - break; + break; } + prev = info; } CAIRO_MUTEX_UNLOCK (_xlib_screen_mutex); - + + /* Return value in accordance with requirements of + * XESetCloseDisplay */ return 0; } +static void +_cairo_xlib_screen_info_reset (void) +{ + cairo_xlib_screen_info_t *info, *next; + + /* + * Delete everything in the list. + */ + CAIRO_MUTEX_LOCK (_xlib_screen_mutex); + + for (info = _cairo_xlib_screen_list; info; info = next) { + next = info->next; + free (info); + } + + _cairo_xlib_screen_list = NULL; + + CAIRO_MUTEX_UNLOCK (_xlib_screen_mutex); + +} -cairo_private cairo_xlib_screen_info_t * +cairo_xlib_screen_info_t * _cairo_xlib_screen_info_get (Display *dpy, Screen *screen) { cairo_xlib_screen_info_t *info; @@ -344,3 +369,13 @@ _cairo_xlib_screen_info_get (Display *dpy, Screen *screen) return info; } +void +_cairo_xlib_screen_reset_static_data (void) +{ + _cairo_xlib_screen_info_reset (); + +#if HAVE_XRMFINALIZE + XrmFinalize (); +#endif + +} diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 5f26a2f..a054e28 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -91,6 +91,14 @@ struct _cairo_xlib_surface { * * We can't test for this because it depends on whether the * picture is in video memory or not. + * + * We also use this variable as a guard against a second + * independent bug with transformed repeating pictures: + * + * http://lists.freedesktop.org/archives/cairo/2004-September/001839.html + * + * Both are fixed in xorg >= 6.9 and hopefully in > 6.8.2, so + * we can reuse the test for now. */ cairo_bool_t buggy_repeat; @@ -662,8 +670,7 @@ _cairo_xlib_surface_clone_similar (void *abstract_surface, cairo_xlib_surface_t *xlib_src = (cairo_xlib_surface_t *)src; if (_cairo_xlib_surface_same_screen (surface, xlib_src)) { - *clone_out = src; - cairo_surface_reference (src); + *clone_out = cairo_surface_reference (src); return CAIRO_STATUS_SUCCESS; } @@ -878,11 +885,13 @@ _operator_needs_alpha_composite (cairo_operator_t operator, return TRUE; } -/* There is a bug in most older X servers with compositing using a repeating - * source pattern when the source is in off-screen video memory. When that - * bug could be triggered, we need a fallback: in the common case where we have no - * transformation and the source and destination have the same format/visual, - * we can do the operation using the core protocol, otherwise, we need +/* There is a bug in most older X servers with compositing using a + * untransformed repeating source pattern when the source is in off-screen + * video memory, and another with repeated transformed images using a + * general tranform matrix. When these bugs could be triggered, we need a + * fallback: in the common case where we have no transformation and the + * source and destination have the same format/visual, we can do the + * operation using the core protocol for the first bug, otherwise, we need * a software fallback. * * We can also often optimize a compositing operation by calling XCopyArea @@ -896,9 +905,11 @@ typedef enum { DO_UNSUPPORTED /* software fallback */ } composite_operation_t; -/* Initial check for the bug; we need to recheck after we turn - * patterns into surfaces, since that may introduce a repeating - * pattern for gradient patterns. +/* Initial check for the render bugs; we need to recheck for the + * offscreen-memory bug after we turn patterns into surfaces, since that + * may introduce a repeating pattern for gradient patterns. We don't need + * to check for the repeat+transform bug because gradient surfaces aren't + * transformed. * * All we do here is reject cases where we *know* are going to * hit the bug and won't be able to use a core protocol fallback. @@ -920,8 +931,10 @@ _categorize_composite_operation (cairo_xlib_surface_t *dst, if (_cairo_matrix_is_integer_translation (&src_pattern->matrix, NULL, NULL) && src_pattern->extend == CAIRO_EXTEND_REPEAT) { - /* This is the case where we have a bug; reject some cases where a - * core protocol fallback is impossible. + /* This is the case where we have the bug involving + * untransformed repeating source patterns with off-screen + * video memory; reject some cases where a core protocol + * fallback is impossible. */ if (have_mask || !(operator == CAIRO_OPERATOR_SOURCE || operator == CAIRO_OPERATOR_OVER)) @@ -942,6 +955,12 @@ _categorize_composite_operation (cairo_xlib_surface_t *dst, return DO_UNSUPPORTED; } } + + /* Check for the other bug involving repeat patterns with general + * transforms. */ + if (!_cairo_matrix_is_integer_translation (&src_pattern->matrix, NULL, NULL) && + src_pattern->extend == CAIRO_EXTEND_REPEAT) + return DO_UNSUPPORTED; } return DO_RENDER; @@ -1118,6 +1137,16 @@ _cairo_xlib_surface_composite (cairo_operator_t operator, dst_x, dst_y, width, height); } + + if (!_cairo_operator_bounded (operator)) + _cairo_surface_composite_fixup_unbounded (&dst->base, + &src_attr, src->width, src->height, + mask ? &mask_attr : NULL, + mask ? mask->width : 0, + mask ? mask->height : 0, + src_x, src_y, + mask_x, mask_y, + dst_x, dst_y, width, height); break; case DO_XCOPYAREA: @@ -1195,10 +1224,101 @@ _cairo_xlib_surface_fill_rectangles (void *abstract_surface, return CAIRO_STATUS_SUCCESS; } +/* Creates an A8 picture of size @width x @height, initialized with @color + */ +static Picture +_create_a8_picture (cairo_xlib_surface_t *surface, + XRenderColor *color, + int width, + int height, + cairo_bool_t repeat) +{ + XRenderPictureAttributes pa; + unsigned long mask = 0; + + Pixmap pixmap = XCreatePixmap (surface->dpy, surface->drawable, + width, height, + 8); + Picture picture; + + if (repeat) { + pa.repeat = TRUE; + mask = CPRepeat; + } + + picture = XRenderCreatePicture (surface->dpy, pixmap, + XRenderFindStandardFormat (surface->dpy, PictStandardA8), + mask, &pa); + XRenderFillRectangle (surface->dpy, PictOpSrc, picture, color, + 0, 0, width, height); + XFreePixmap (surface->dpy, pixmap); + + return picture; +} + +/* Creates a temporary mask for the trapezoids covering the area + * [@dst_x, @dst_y, @width, @height] of the destination surface. + */ +static Picture +_create_trapezoid_mask (cairo_xlib_surface_t *dst, + cairo_trapezoid_t *traps, + int num_traps, + int dst_x, + int dst_y, + int width, + int height, + XRenderPictFormat *pict_format) +{ + XRenderColor transparent = { 0, 0, 0, 0 }; + XRenderColor solid = { 0xffff, 0xffff, 0xffff, 0xffff }; + Picture mask_picture, solid_picture; + XTrapezoid *offset_traps; + int i; + + /* This would be considerably simpler using XRenderAddTraps(), but since + * we are only using this in the unbounded-operator case, we stick with + * XRenderCompositeTrapezoids, which is available on older versions + * of RENDER rather than conditionalizing. We should still hit an + * optimization that avoids creating another intermediate surface on + * the servers that have XRenderAddTraps(). + */ + mask_picture = _create_a8_picture (dst, &transparent, width, height, FALSE); + solid_picture = _create_a8_picture (dst, &solid, width, height, TRUE); + + offset_traps = malloc (sizeof (XTrapezoid) * num_traps); + if (!offset_traps) + return None; + + for (i = 0; i < num_traps; i++) { + offset_traps[i].top = traps[i].top - 0x10000 * dst_y; + offset_traps[i].bottom = traps[i].bottom - 0x10000 * dst_y; + offset_traps[i].left.p1.x = traps[i].left.p1.x - 0x10000 * dst_x; + offset_traps[i].left.p1.y = traps[i].left.p1.y - 0x10000 * dst_y; + offset_traps[i].left.p2.x = traps[i].left.p2.x - 0x10000 * dst_x; + offset_traps[i].left.p2.y = traps[i].left.p2.y - 0x10000 * dst_y; + offset_traps[i].right.p1.x = traps[i].right.p1.x - 0x10000 * dst_x; + offset_traps[i].right.p1.y = traps[i].right.p1.y - 0x10000 * dst_y; + offset_traps[i].right.p2.x = traps[i].right.p2.x - 0x10000 * dst_x; + offset_traps[i].right.p2.y = traps[i].right.p2.y - 0x10000 * dst_y; + } + + XRenderCompositeTrapezoids (dst->dpy, PictOpAdd, + solid_picture, mask_picture, + pict_format, + 0, 0, + offset_traps, num_traps); + + XRenderFreePicture (dst->dpy, solid_picture); + free (offset_traps); + + return mask_picture; +} + static cairo_int_status_t _cairo_xlib_surface_composite_trapezoids (cairo_operator_t operator, cairo_pattern_t *pattern, void *abstract_dst, + cairo_antialias_t antialias, int src_x, int src_y, int dst_x, @@ -1215,6 +1335,7 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t operator, composite_operation_t operation; int render_reference_x, render_reference_y; int render_src_x, render_src_y; + XRenderPictFormat *pict_format; if (!CAIRO_SURFACE_RENDER_HAS_TRAPEZOIDS (dst)) return CAIRO_INT_STATUS_UNSUPPORTED; @@ -1235,6 +1356,15 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t operator, status = CAIRO_INT_STATUS_UNSUPPORTED; goto FAIL; } + + switch (antialias) { + case CAIRO_ANTIALIAS_NONE: + pict_format = XRenderFindStandardFormat (dst->dpy, PictStandardA1); + break; + default: + pict_format = XRenderFindStandardFormat (dst->dpy, PictStandardA8); + break; + } if (traps[0].left.p1.y < traps[0].left.p2.y) { render_reference_x = _cairo_fixed_integer_floor (traps[0].left.p1.x); @@ -1247,17 +1377,52 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t operator, render_src_x = src_x + render_reference_x - dst_x; render_src_y = src_y + render_reference_y - dst_y; - /* XXX: The XTrapezoid cast is evil and needs to go away somehow. */ _cairo_xlib_surface_ensure_dst_picture (dst); status = _cairo_xlib_surface_set_attributes (src, &attributes); - if (status == CAIRO_STATUS_SUCCESS) + if (status) + goto FAIL; + + if (!_cairo_operator_bounded (operator)) { + /* XRenderCompositeTrapezoids() creates a mask only large enough for the + * trapezoids themselves, but if the operator is unbounded, then we need + * to actually composite all the way out to the bounds, so we create + * the mask and composite ourselves. There actually would + * be benefit to doing this in all cases, since RENDER implementations + * will frequently create a too temporary big mask, ignoring destination + * bounds and clip. (XRenderAddTraps() could be used to make creating + * the mask somewhat cheaper.) + */ + Picture mask_picture = _create_trapezoid_mask (dst, traps, num_traps, + dst_x, dst_y, width, height, + pict_format); + if (!mask_picture) { + status = CAIRO_STATUS_NO_MEMORY; + goto FAIL; + } + + XRenderComposite (dst->dpy, + _render_operator (operator), + src->src_picture, + mask_picture, + dst->dst_picture, + src_x + attributes.x_offset, + src_y + attributes.y_offset, + 0, 0, + dst_x, dst_y, + width, height); + + XRenderFreePicture (dst->dpy, mask_picture); + + } else { + /* XXX: The XTrapezoid cast is evil and needs to go away somehow. */ XRenderCompositeTrapezoids (dst->dpy, _render_operator (operator), src->src_picture, dst->dst_picture, - XRenderFindStandardFormat (dst->dpy, PictStandardA8), + pict_format, render_src_x + attributes.x_offset, render_src_y + attributes.y_offset, (XTrapezoid *) traps, num_traps); + } FAIL: _cairo_pattern_release_surface (pattern, &src->base, &attributes); @@ -1716,6 +1881,7 @@ typedef struct { cairo_glyph_cache_key_t key; GlyphSet glyphset; Glyph glyph; + cairo_glyph_size_t size; } glyphset_cache_entry_t; static Glyph @@ -1754,12 +1920,15 @@ _xlib_glyphset_cache_create_entry (void *abstract_cache, if (cache == NULL || entry == NULL || im_cache == NULL) { _cairo_unlock_global_image_glyph_cache (); + if (entry) + free (entry); return CAIRO_STATUS_NO_MEMORY; } status = _cairo_cache_lookup (im_cache, key, (void **) (&im), NULL); if (status != CAIRO_STATUS_SUCCESS || im == NULL) { _cairo_unlock_global_image_glyph_cache (); + free (entry); return CAIRO_STATUS_NO_MEMORY; } @@ -1770,6 +1939,7 @@ _xlib_glyphset_cache_create_entry (void *abstract_cache, entry->glyph = None; entry->glyphset = None; entry->key.base.memory = 0; + entry->size.x = entry->size.y = entry->size.width = entry->size.height = 0; goto out; } @@ -1778,6 +1948,8 @@ _xlib_glyphset_cache_create_entry (void *abstract_cache, data = im->image->data; + entry->size = im->size; + glyph_info.width = im->size.width; glyph_info.height = im->size.height; @@ -1916,8 +2088,9 @@ _xlib_glyphset_cache_destroy_entry (void *abstract_cache, glyphset_cache_entry_t *entry = abstract_entry; _cairo_unscaled_font_destroy (entry->key.unscaled); - XRenderFreeGlyphs (cache->display, entry->glyphset, - &(entry->glyph), 1); + if (entry->glyph) + XRenderFreeGlyphs (cache->display, entry->glyphset, + &(entry->glyph), 1); free (entry); } @@ -1943,8 +2116,10 @@ _lock_xlib_glyphset_caches (void) static void _unlock_xlib_glyphset_caches (glyphset_cache_t *cache) { - _cairo_cache_shrink_to (&cache->base, - CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT); + if (cache) { + _cairo_cache_shrink_to (&cache->base, + CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT); + } CAIRO_MUTEX_UNLOCK(_xlib_glyphset_caches_mutex); } @@ -2102,7 +2277,7 @@ _cairo_xlib_surface_show_glyphs32 (cairo_scaled_font_t *scaled_font, _render_operator (operator), src->src_picture, self->dst_picture, - cache->a8_pict_format, + mask_format, source_x, source_y, 0, 0, elts, count); @@ -2330,7 +2505,70 @@ _cairo_xlib_surface_show_glyphs8 (cairo_scaled_font_t *scaled_font, return CAIRO_STATUS_NO_MEMORY; } +/* Handles clearing the regions that are outside of the temporary + * mask created by XRenderCompositeText[N] but should be affected + * by an unbounded operator like CAIRO_OPERATOR_SOURCE. + */ +static void +_show_glyphs_fixup_unbounded (cairo_xlib_surface_t *self, + cairo_surface_attributes_t *src_attr, + cairo_xlib_surface_t *src, + const cairo_glyph_t *glyphs, + glyphset_cache_entry_t **entries, + int num_glyphs, + int src_x, + int src_y, + int dst_x, + int dst_y, + int width, + int height) +{ + cairo_surface_attributes_t mask_attr; + int x1 = INT_MAX; + int x2 = INT_MIN; + int y1 = INT_MAX; + int y2 = INT_MIN; + int i; + + /* Compute the size of the glyph mask as the bounding box + * of all the glyphs. + */ + for (i = 0; i < num_glyphs; ++i) { + int thisX, thisY; + + if (entries[i] == NULL || !entries[i]->glyph) + continue; + + thisX = (int) floor (glyphs[i].x + 0.5); + thisY = (int) floor (glyphs[i].y + 0.5); + + if (thisX + entries[i]->size.x < x1) + x1 = thisX + entries[i]->size.x; + if (thisX + entries[i]->size.x + entries[i]->size.width > x2) + x2 = thisX + entries[i]->size.x + entries[i]->size.width; + if (thisY + entries[i]->size.y < y1) + y1 = thisY + entries[i]->size.y; + if (thisY + entries[i]->size.y + entries[i]->size.height > y2) + y2 = thisY + entries[i]->size.y + entries[i]->size.height; + } + if (x1 >= x2 || y1 >= y2) + x1 = x2 = y1 = y2 = 0; + + cairo_matrix_init_identity (&mask_attr.matrix); + mask_attr.extend = CAIRO_EXTEND_NONE; + mask_attr.filter = CAIRO_FILTER_NEAREST; + mask_attr.x_offset = 0; + mask_attr.y_offset = 0; + + _cairo_surface_composite_fixup_unbounded (&self->base, + src_attr, src->width, src->height, + &mask_attr, x2 - x1, y2 - y1, + src_x, src_y, + dst_x - x1, dst_y - y1, + dst_x, dst_y, width, height); +} + static cairo_int_status_t _cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font, cairo_operator_t operator, @@ -2441,6 +2679,13 @@ _cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font, glyphs, entries, num_glyphs); } + if (!_cairo_operator_bounded (operator)) + _show_glyphs_fixup_unbounded (self, + &attributes, src, + glyphs, entries, num_glyphs, + source_x, source_y, + dest_x, dest_y, width, height); + UNLOCK: _unlock_xlib_glyphset_caches (cache); @@ -2452,3 +2697,23 @@ _cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font, return status; } + +static void +_destroy_glyphset_cache_recurse (glyphset_cache_t *cache) +{ + if (cache == NULL) + return; + + _destroy_glyphset_cache_recurse (cache->next); + _cairo_cache_destroy (&cache->base); + free (cache); +} + +void +_cairo_xlib_surface_reset_static_data (void) +{ + _lock_xlib_glyphset_caches (); + _destroy_glyphset_cache_recurse (_xlib_glyphset_caches); + _xlib_glyphset_caches = NULL; + _unlock_xlib_glyphset_caches (NULL); +} diff --git a/src/cairo.c b/src/cairo.c index b4fc546..8d759ea 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -111,6 +111,48 @@ _cairo_set_error (cairo_t *cr, cairo_status_t status) } /** + * cairo_version: + * + * Returns the version of the cairo library encoded in a single + * integer as per CAIRO_VERSION_ENCODE. The encoding ensures that + * later versions compare greater than earlier versions. + * + * A run-time comparison to check that cairo's version is greater than + * or equal to version X.Y.Z could be performed as follows: + * + * <informalexample><programlisting> + * if (cairo_version() >= CAIRO_VERSION_ENCODE(X,Y,Z)) {...} + * </programlisting></informalexample> + * + * See also cairo_version_string() as well as the compile-time + * equivalents %CAIRO_VERSION and %CAIRO_VERSION_STRING. + * + * Return value: the encoded version. + **/ +int +cairo_version (void) +{ + return CAIRO_VERSION; +} + +/** + * cairo_version_string: + * + * Returns the version of the cairo library as a human-readable string + * of the form "X.Y.Z". + * + * See also cairo_version() as well as the compile-time equivalents + * %CAIRO_VERSION_STRING and %CAIRO_VERSION. + * + * Return value: a string containing the version. + **/ +const char* +cairo_version_string (void) +{ + return CAIRO_VERSION_STRING; +} + +/** * cairo_create: * @target: target surface for the context * @@ -178,14 +220,18 @@ cairo_create (cairo_surface_t *target) * Increases the reference count on @cr by one. This prevents * @cr from being destroyed until a matching call to cairo_destroy() * is made. + * + * Return value: the referenced #cairo_t. **/ -void +cairo_t * cairo_reference (cairo_t *cr) { if (cr->ref_count == (unsigned int)-1) - return; + return cr; cr->ref_count++; + + return cr; } /** @@ -457,6 +503,11 @@ cairo_set_source_surface (cairo_t *cr, * will then be used for any subsequent drawing operation until a new * source pattern is set. * + * Note: The pattern's transformation matrix will be locked to the + * user space in effect at the time of cairo_set_source(). This means + * that further modifications of the CTM will not affect the source + * pattern. See cairo_pattern_set_matrix(). + * * XXX: I'd also like to direct the reader's attention to some * (not-yet-written) section on cairo's imaging model. How would I do * that if such a section existed? (cworth). @@ -532,6 +583,32 @@ cairo_set_tolerance (cairo_t *cr, double tolerance) } /** + * cairo_set_antialias: + * @cr: a #cairo_t + * @antialias: the new antialiasing mode + * + * Set the antialiasing mode of the rasterizer used for drawing shapes. + * This value is a hint, and a particular backend may or may not support + * a particular value. At the current time, no backend supports + * %CAIRO_ANTIALIAS_SUBPIXEL when drawing shapes. + * + * Note that this option does not affect text rendering, instead see + * cairo_font_options_set_antialias(). + **/ +void +cairo_set_antialias (cairo_t *cr, cairo_antialias_t antialias) +{ + if (cr->status) { + _cairo_set_error (cr, cr->status); + return; + } + + cr->status = _cairo_gstate_set_antialias (cr->gstate, antialias); + if (cr->status) + _cairo_set_error (cr, cr->status); +} + +/** * cairo_set_fill_rule: * @cr: a #cairo_t * @fill_rule: a fill rule, specified as a #cairo_fill_rule_t @@ -1401,8 +1478,9 @@ slim_hidden_def(cairo_stroke_preserve); * @cr: a cairo context * * A drawing operator that fills the current path according to the - * current fill rule. After cairo_fill, the current path will be - * cleared from the cairo context. See cairo_set_fill_rule() and + * current fill rule, (each sub-path is implicitly closed before being + * filled). After cairo_fill, the current path will be cleared from + * the cairo context. See cairo_set_fill_rule() and * cairo_fill_preserve(). **/ void @@ -1418,8 +1496,9 @@ cairo_fill (cairo_t *cr) * @cr: a cairo context * * A drawing operator that fills the current path according to the - * current fill rule. Unlike cairo_fill(), cairo_fill_preserve - * preserves the path within the cairo context. + * current fill rule, (each sub-path is implicitly closed before being + * filled). Unlike cairo_fill(), cairo_fill_preserve preserves the + * path within the cairo context. * * See cairo_set_fill_rule() and cairo_fill(). **/ @@ -1645,7 +1724,7 @@ cairo_reset_clip (cairo_t *cr) * for operations such as listing all available fonts on the system, * and it is expected that most applications will need to use a more * comprehensive font handling and text layout library in addition to - * Cairo. + * cairo. **/ void cairo_select_font_face (cairo_t *cr, @@ -1681,16 +1760,13 @@ cairo_get_font_face (cairo_t *cr) if (cr->status) { _cairo_set_error (cr, cr->status); - return NULL; + return (cairo_font_face_t*) &_cairo_font_face_nil; } cr->status = _cairo_gstate_get_font_face (cr->gstate, &font_face); if (cr->status) { _cairo_set_error (cr, cr->status); - /* XXX: When available: - return _cairo_font_face_nil; - */ - return NULL; + return (cairo_font_face_t*) &_cairo_font_face_nil; } return font_face; @@ -2079,6 +2155,20 @@ cairo_get_tolerance (cairo_t *cr) } /** + * cairo_get_antialias: + * @cr: a cairo context + * + * Gets the current shape antialiasing mode, as set by cairo_set_shape_antialias(). + * + * Return value: the current shape antialiasing mode. + **/ +cairo_antialias_t +cairo_get_antialias (cairo_t *cr) +{ + return _cairo_gstate_get_antialias (cr->gstate); +} + +/** * cairo_get_current_point: * @cr: a cairo context * @x: return value for X coordinate of the current point @@ -2257,7 +2347,7 @@ cairo_path_t * cairo_copy_path (cairo_t *cr) { if (cr->status) - return &cairo_path_nil; + return (cairo_path_t*) &_cairo_path_nil; return _cairo_path_data_create (&cr->path, cr->gstate); } @@ -2296,7 +2386,7 @@ cairo_path_t * cairo_copy_path_flat (cairo_t *cr) { if (cr->status) - return &cairo_path_nil; + return (cairo_path_t*) &_cairo_path_nil; else return _cairo_path_data_create_flat (&cr->path, cr->gstate); } diff --git a/src/cairo.h b/src/cairo.h index ba89998..06a6d6a 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -38,18 +38,26 @@ #ifndef CAIRO_H #define CAIRO_H -#ifdef __cplusplus -# define CAIRO_BEGIN_DECLS extern "C" { -# define CAIRO_END_DECLS } -#else -# define CAIRO_BEGIN_DECLS -# define CAIRO_END_DECLS -#endif - #include <cairo-features.h> CAIRO_BEGIN_DECLS +#define CAIRO_VERSION_ENCODE(major, minor, micro) ( \ + ((major) * 10000) \ + + ((minor) * 100) \ + + ((micro) * 1)) + +#define CAIRO_VERSION CAIRO_VERSION_ENCODE( \ + CAIRO_VERSION_MAJOR, \ + CAIRO_VERSION_MINOR, \ + CAIRO_VERSION_MICRO) + +int +cairo_version (void); + +const char* +cairo_version_string (void); + /** * cairo_bool_t: * @@ -230,7 +238,7 @@ typedef cairo_status_t (*cairo_read_func_t) (void *closure, cairo_t * cairo_create (cairo_surface_t *target); -void +cairo_t * cairo_reference (cairo_t *cr); void @@ -296,6 +304,29 @@ void cairo_set_tolerance (cairo_t *cr, double tolerance); /** + * cairo_antialias_t: + * @CAIRO_ANTIALIAS_DEFAULT: Use the default antialiasing for + * the subsystem and target device + * @CAIRO_ANTIALIAS_NONE: Use a bilevel alpha mask + * @CAIRO_ANTIALIAS_GRAY: Perform single-color antialiasing (using + * shades of gray for black text on a white background, for example). + * @CAIRO_ANTIALIAS_SUBPIXEL: Perform antialiasing by taking + * advantage of the order of subpixel elements on devices + * such as LCD panels + * + * Specifies the type of antialiasing to do when rendering text or shapes. + **/ +typedef enum _cairo_antialias { + CAIRO_ANTIALIAS_DEFAULT, + CAIRO_ANTIALIAS_NONE, + CAIRO_ANTIALIAS_GRAY, + CAIRO_ANTIALIAS_SUBPIXEL +} cairo_antialias_t; + +void +cairo_set_antialias (cairo_t *cr, cairo_antialias_t antialias); + +/** * cairo_fill_rule_t * @CAIRO_FILL_RULE_WINDING: If the path crosses the ray from * left-to-right, counts +1. If the path crosses the ray @@ -668,26 +699,6 @@ typedef enum _cairo_font_weight { } cairo_font_weight_t; /** - * cairo_antialias_t: - * @CAIRO_ANTIALIAS_DEFAULT: Use the default antialiasing for - * the font subsystem and target device - * @CAIRO_ANTIALIAS_NONE: Do no antialiasing of fonts; use bilevel text - * @CAIRO_ANTIALIAS_GRAY: Perform single-color antialiasing (using - * shades of gray for black text on a white background, for example). - * @CAIRO_ANTIALIAS_SUBPIXEL: Perform antialiasing by taking - * advantage of the order of subpixel elements on devices - * such as LCD panels - * - * Specifies the type of antialiasing to do when rendering text. - **/ -typedef enum _cairo_antialias { - CAIRO_ANTIALIAS_DEFAULT, - CAIRO_ANTIALIAS_NONE, - CAIRO_ANTIALIAS_GRAY, - CAIRO_ANTIALIAS_SUBPIXEL -} cairo_antialias_t; - -/** * cairo_subpixel_order_t: * @CAIRO_SUBPIXEL_ORDER_DEFAULT: Use the default subpixel order for * for the target device @@ -871,7 +882,7 @@ cairo_glyph_path (cairo_t *cr, cairo_glyph_t *glyphs, int num_glyphs); /* Generic identifier for a font style */ -void +cairo_font_face_t * cairo_font_face_reference (cairo_font_face_t *font_face); void @@ -898,7 +909,7 @@ cairo_scaled_font_create (cairo_font_face_t *font_face, const cairo_matrix_t *ctm, const cairo_font_options_t *options); -void +cairo_scaled_font_t * cairo_scaled_font_reference (cairo_scaled_font_t *scaled_font); void @@ -928,6 +939,9 @@ cairo_get_source (cairo_t *cr); double cairo_get_tolerance (cairo_t *cr); +cairo_antialias_t +cairo_get_antialias (cairo_t *cr); + void cairo_get_current_point (cairo_t *cr, double *x, double *y); @@ -1109,7 +1123,7 @@ cairo_surface_create_similar (cairo_surface_t *other, int width, int height); -void +cairo_surface_t * cairo_surface_reference (cairo_surface_t *surface); void @@ -1149,6 +1163,19 @@ cairo_surface_get_font_options (cairo_surface_t *surface, cairo_font_options_t *options); void +cairo_surface_flush (cairo_surface_t *surface); + +void +cairo_surface_mark_dirty (cairo_surface_t *surface); + +void +cairo_surface_mark_dirty_rectangle (cairo_surface_t *surface, + int x, + int y, + int width, + int height); + +void cairo_surface_set_device_offset (cairo_surface_t *surface, double x_offset, double y_offset); @@ -1236,7 +1263,7 @@ cairo_pattern_t * cairo_pattern_create_radial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1); -void +cairo_pattern_t * cairo_pattern_reference (cairo_pattern_t *pattern); void diff --git a/src/cairoint.h b/src/cairoint.h index 4574783..2fbf335 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -63,6 +63,7 @@ #include <stdio.h> #include "cairo.h" +#include "cairo-debug.h" #include <pixman.h> #if __GNUC__ >= 3 && defined(__ELF__) @@ -116,43 +117,20 @@ #define __attribute__(x) #endif -/* XXX: There's a bad bug in the cache locking code that attempts to - * recursively lock a mutex, (which we shouldn't actually need to ever - * do). This leads to deadlocks in even single-threaded applications, - * (if they link with -lpthread). - * - * For now, we're removing all mutex locking, which leaves things at - * the same level of non-thread-safeness that we've had in every - * snapshot since the cache code first landed. - * - * I'm rewriting the cache code now and plan to have thread-safe, - * locking caches working before the next snapshot. CDW. - */ - -#if CAIRO_CACHE_CODE_IS_FIXED_TO_NOT_DEADLOCK_SINGLE_THREADED_APPLICATIONS - -# if HAVE_PTHREAD_H -# define CAIRO_MUTEX_DECLARE(name) static pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER -# define CAIRO_MUTEX_DECLARE_GLOBAL(name) pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER -# define CAIRO_MUTEX_LOCK(name) pthread_mutex_lock (&name) -# define CAIRO_MUTEX_UNLOCK(name) pthread_mutex_unlock (&name) -# endif - -# ifndef CAIRO_MUTEX_DECLARE -# warning "No mutex declarations, assuming single-threaded code" -# define CAIRO_MUTEX_DECLARE(name) -# define CAIRO_MUTEX_DECLARE_GLOBAL(name) -# define CAIRO_MUTEX_LOCK(name) -# define CAIRO_MUTEX_UNLOCK(name) -# endif - -#else +#if HAVE_PTHREAD_H +# include <pthread.h> +# define CAIRO_MUTEX_DECLARE(name) static pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER +#define CAIRO_MUTEX_DECLARE_GLOBAL(name) pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER +# define CAIRO_MUTEX_LOCK(name) pthread_mutex_lock (&name) +# define CAIRO_MUTEX_UNLOCK(name) pthread_mutex_unlock (&name) +#endif +#ifndef CAIRO_MUTEX_DECLARE +# warning "No mutex declarations, assuming single-threaded code" # define CAIRO_MUTEX_DECLARE(name) # define CAIRO_MUTEX_DECLARE_GLOBAL(name) # define CAIRO_MUTEX_LOCK(name) # define CAIRO_MUTEX_UNLOCK(name) - #endif #define MIN(a, b) ((a) < (b) ? (a) : (b)) @@ -188,6 +166,8 @@ typedef cairo_fixed_16_16_t cairo_fixed_t; #define CAIRO_ALPHA_IS_OPAQUE(alpha) ((alpha) >= ((double)0xff00 / (double)0xffff)) +#include "cairo-hash-private.h" + typedef struct _cairo_point { cairo_fixed_t x; cairo_fixed_t y; @@ -239,6 +219,9 @@ typedef enum cairo_direction { } cairo_direction_t; typedef struct _cairo_path_fixed cairo_path_fixed_t; +typedef enum _cairo_clip_mode cairo_clip_mode_t; +typedef struct _cairo_clip_path cairo_clip_path_t; +typedef struct _cairo_clip cairo_clip_t; typedef struct _cairo_edge { cairo_line_t edge; @@ -288,6 +271,13 @@ typedef struct _cairo_pen { typedef struct _cairo_color cairo_color_t; typedef struct _cairo_image_surface cairo_image_surface_t; +cairo_private void +_cairo_box_round_to_rectangle (cairo_box_t *box, cairo_rectangle_t *rectangle); + +cairo_private void +_cairo_rectangle_intersect (cairo_rectangle_t *dest, cairo_rectangle_t *src); + + /* cairo_array.c structures and functions */ typedef struct _cairo_array cairo_array_t; @@ -443,8 +433,6 @@ _cairo_hash_string (const char *c); #define CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT 0x100000 #define CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT 0x100000 -typedef struct _cairo_unscaled_font cairo_unscaled_font_t; - typedef struct _cairo_unscaled_font_backend cairo_unscaled_font_backend_t; typedef struct _cairo_scaled_font_backend cairo_scaled_font_backend_t; typedef struct _cairo_font_face_backend cairo_font_face_backend_t; @@ -453,35 +441,40 @@ typedef struct _cairo_font_face_backend cairo_font_face_backend_t; * A cairo_unscaled_font_t is just an opaque handle we use in the * glyph cache. */ -struct _cairo_unscaled_font { +typedef struct _cairo_unscaled_font { + cairo_hash_entry_t hash_entry; int ref_count; const cairo_unscaled_font_backend_t *backend; +} cairo_unscaled_font_t; + +struct _cairo_font_options { + cairo_antialias_t antialias; + cairo_subpixel_order_t subpixel_order; + cairo_hint_style_t hint_style; + cairo_hint_metrics_t hint_metrics; }; struct _cairo_scaled_font { + cairo_hash_entry_t hash_entry; cairo_status_t status; int ref_count; + cairo_font_face_t *font_face; /* may be NULL */ cairo_matrix_t font_matrix; /* font space => user space */ cairo_matrix_t ctm; /* user space => device space */ cairo_matrix_t scale; /* font space => device space */ - cairo_font_face_t *font_face; /* may be NULL */ + cairo_font_options_t options; + const cairo_scaled_font_backend_t *backend; }; struct _cairo_font_face { + cairo_hash_entry_t hash_entry; cairo_status_t status; int ref_count; cairo_user_data_array_t user_data; const cairo_font_face_backend_t *backend; }; -struct _cairo_font_options { - cairo_antialias_t antialias; - cairo_subpixel_order_t subpixel_order; - cairo_hint_style_t hint_style; - cairo_hint_metrics_t hint_metrics; -}; - /* cairo_font.c is responsible for a global glyph cache: * * - glyph entries: [[[base], cairo_unscaled_font_t, scale, flags, index], @@ -516,6 +509,18 @@ _cairo_unlock_global_image_glyph_cache (void); cairo_private cairo_cache_t * _cairo_get_global_image_glyph_cache (void); +cairo_private void +_cairo_font_reset_static_data (void); + +cairo_private void +_cairo_ft_font_reset_static_data (void); + +cairo_private void +_cairo_xlib_surface_reset_static_data (void); + +cairo_private void +_cairo_xlib_screen_reset_static_data (void); + /* Some glyph cache functions you can reuse. */ cairo_private unsigned long @@ -534,66 +539,89 @@ struct _cairo_unscaled_font_backend { cairo_image_glyph_cache_entry_t *entry); }; +/* cairo_toy_font_face_t - simple family/slant/weight font faces used for + * the built-in font API + */ + +typedef struct _cairo_toy_font_face { + cairo_font_face_t base; + const char *family; + cairo_bool_t owns_family; + cairo_font_slant_t slant; + cairo_font_weight_t weight; +} cairo_toy_font_face_t; + struct _cairo_scaled_font_backend { - cairo_status_t (*create) (const char *family, - cairo_font_slant_t slant, - cairo_font_weight_t weight, - const cairo_matrix_t *font_matrix, - const cairo_matrix_t *ctm, - const cairo_font_options_t *options, - cairo_scaled_font_t **font); - - void (*destroy) (void *font); + cairo_status_t + (*create_toy) (cairo_toy_font_face_t *toy_face, + const cairo_matrix_t *font_matrix, + const cairo_matrix_t *ctm, + const cairo_font_options_t *options, + cairo_scaled_font_t **scaled_font); - cairo_status_t (*font_extents) (void *font, - cairo_font_extents_t *extents); + void + (*fini) (void *scaled_font); - cairo_status_t (*text_to_glyphs) (void *font, - const char *utf8, - cairo_glyph_t **glyphs, - int *num_glyphs); + cairo_status_t + (*font_extents) (void *scaled_font, + cairo_font_extents_t *extents); - cairo_status_t (*glyph_extents) (void *font, - cairo_glyph_t *glyphs, - int num_glyphs, - cairo_text_extents_t *extents); + cairo_status_t + (*text_to_glyphs) (void *scaled_font, + const char *utf8, + cairo_glyph_t **glyphs, + int *num_glyphs); - cairo_status_t (*glyph_bbox) (void *font, - const cairo_glyph_t *glyphs, - int num_glyphs, - cairo_box_t *bbox); - - cairo_status_t (*show_glyphs) (void *font, - cairo_operator_t operator, - cairo_pattern_t *pattern, - cairo_surface_t *surface, - int source_x, - int source_y, - int dest_x, - int dest_y, - unsigned int width, - unsigned int height, - const cairo_glyph_t *glyphs, - int num_glyphs); + cairo_status_t + (*glyph_extents) (void *scaled_font, + cairo_glyph_t *glyphs, + int num_glyphs, + cairo_text_extents_t *extents); + + cairo_status_t + (*glyph_bbox) (void *scaled_font, + const cairo_glyph_t *glyphs, + int num_glyphs, + cairo_box_t *bbox); + + cairo_status_t + (*show_glyphs) (void *scaled_font, + cairo_operator_t operator, + cairo_pattern_t *pattern, + cairo_surface_t *surface, + int source_x, + int source_y, + int dest_x, + int dest_y, + unsigned int width, + unsigned int height, + const cairo_glyph_t *glyphs, + int num_glyphs); - cairo_status_t (*glyph_path) (void *font, - cairo_glyph_t *glyphs, - int num_glyphs, - cairo_path_fixed_t *path); - void (*get_glyph_cache_key) (void *font, - cairo_glyph_cache_key_t *key); + cairo_status_t + (*glyph_path) (void *scaled_font, + cairo_glyph_t *glyphs, + int num_glyphs, + cairo_path_fixed_t *path); + + void + (*get_glyph_cache_key) (void *scaled_font, + cairo_glyph_cache_key_t *key); }; struct _cairo_font_face_backend { /* The destroy() function is allowed to resurrect the font face * by re-referencing. This is needed for the FreeType backend. */ - void (*destroy) (void *font_face); - cairo_status_t (*create_font) (void *font_face, - const cairo_matrix_t *font_matrix, - const cairo_matrix_t *ctm, - const cairo_font_options_t *options, - cairo_scaled_font_t **scaled_font); + void + (*destroy) (void *font_face); + + cairo_status_t + (*scaled_font_create) (void *font_face, + const cairo_matrix_t *font_matrix, + const cairo_matrix_t *ctm, + const cairo_font_options_t *options, + cairo_scaled_font_t **scaled_font); }; /* concrete font backends */ @@ -681,6 +709,7 @@ typedef struct _cairo_surface_backend { (*composite_trapezoids) (cairo_operator_t operator, cairo_pattern_t *pattern, void *dst, + cairo_antialias_t antialias, int src_x, int src_y, int dst_x, @@ -731,7 +760,8 @@ typedef struct _cairo_surface_backend { (*intersect_clip_path) (void *dst, cairo_path_fixed_t *path, cairo_fill_rule_t fill_rule, - double tolerance); + double tolerance, + cairo_antialias_t antialias); /* Get the extents of the current surface. For many surface types * this will be as simple as { x=0, y=0, width=surface->width, @@ -777,6 +807,17 @@ typedef struct _cairo_surface_backend { void (*get_font_options) (void *surface, cairo_font_options_t *options); + + cairo_status_t + (*flush) (void *surface); + + cairo_status_t + (*mark_dirty_rectangle) (void *surface, + int x, + int y, + int width, + int height); + } cairo_surface_backend_t; typedef struct _cairo_format_masks { @@ -787,12 +828,6 @@ typedef struct _cairo_format_masks { unsigned long blue_mask; } cairo_format_masks_t; -typedef enum _cairo_clip_mode { - CAIRO_CLIP_MODE_PATH, - CAIRO_CLIP_MODE_REGION, - CAIRO_CLIP_MODE_MASK -} cairo_clip_mode_t; - struct _cairo_surface { const cairo_surface_backend_t *backend; @@ -827,7 +862,9 @@ struct _cairo_image_surface { /* libic-specific fields */ cairo_format_t format; unsigned char *data; - int owns_data; + cairo_bool_t owns_data; + cairo_bool_t has_clip; + int width; int height; @@ -837,7 +874,7 @@ struct _cairo_image_surface { pixman_image_t *pixman_image; }; -extern const cairo_surface_backend_t cairo_image_surface_backend; +extern const cairo_private cairo_surface_backend_t cairo_image_surface_backend; /* XXX: Right now, the cairo_color structure puts unpremultiplied color in the doubles and premultiplied color in the shorts. Yes, @@ -892,7 +929,7 @@ typedef struct _cairo_solid_pattern { cairo_color_t color; } cairo_solid_pattern_t; -extern const cairo_solid_pattern_t cairo_solid_pattern_nil; +extern const cairo_private cairo_solid_pattern_t cairo_solid_pattern_nil; typedef struct _cairo_surface_pattern { cairo_pattern_t base; @@ -1207,7 +1244,7 @@ cairo_private cairo_status_t _cairo_gstate_set_font_size (cairo_gstate_t *gstate, double size); -void +cairo_private void _cairo_gstate_get_font_matrix (cairo_gstate_t *gstate, cairo_matrix_t *matrix); @@ -1215,7 +1252,7 @@ cairo_private cairo_status_t _cairo_gstate_set_font_matrix (cairo_gstate_t *gstate, const cairo_matrix_t *matrix); -void +cairo_private void _cairo_gstate_get_font_options (cairo_gstate_t *gstate, cairo_font_options_t *options); @@ -1260,6 +1297,8 @@ _cairo_gstate_glyph_path (cairo_gstate_t *gstate, int num_glyphs, cairo_path_fixed_t *path); +cairo_private cairo_bool_t +_cairo_operator_bounded (cairo_operator_t operator); /* cairo_color.c */ cairo_private const cairo_color_t * @@ -1305,33 +1344,38 @@ cairo_private void _cairo_scaled_font_set_error (cairo_scaled_font_t *scaled_font, cairo_status_t status); -extern const cairo_font_face_t _cairo_font_face_nil; +extern const cairo_private cairo_font_face_t _cairo_font_face_nil; cairo_private void _cairo_font_face_init (cairo_font_face_t *font_face, const cairo_font_face_backend_t *backend); cairo_private cairo_font_face_t * -_cairo_simple_font_face_create (const char *family, - cairo_font_slant_t slant, - cairo_font_weight_t weight); - -cairo_private void -_cairo_scaled_font_init (cairo_scaled_font_t *scaled_font, - const cairo_matrix_t *font_matrix, - const cairo_matrix_t *ctm, - const cairo_scaled_font_backend_t *backend); +_cairo_toy_font_face_create (const char *family, + cairo_font_slant_t slant, + cairo_font_weight_t weight); cairo_private void _cairo_unscaled_font_init (cairo_unscaled_font_t *font, const cairo_unscaled_font_backend_t *backend); -cairo_private void +cairo_private cairo_unscaled_font_t * _cairo_unscaled_font_reference (cairo_unscaled_font_t *font); cairo_private void _cairo_unscaled_font_destroy (cairo_unscaled_font_t *font); +cairo_private void +_cairo_scaled_font_init (cairo_scaled_font_t *scaled_font, + cairo_font_face_t *font_face, + const cairo_matrix_t *font_matrix, + const cairo_matrix_t *ctm, + const cairo_font_options_t *options, + const cairo_scaled_font_backend_t *backend); + +void +_cairo_scaled_font_fini (cairo_scaled_font_t *scaled_font); + cairo_private cairo_status_t _cairo_scaled_font_font_extents (cairo_scaled_font_t *scaled_font, cairo_font_extents_t *extents); @@ -1398,33 +1442,33 @@ _cairo_path_fixed_init_copy (cairo_path_fixed_t *path, cairo_private void _cairo_path_fixed_fini (cairo_path_fixed_t *path); -cairo_status_t +cairo_private cairo_status_t _cairo_path_fixed_move_to (cairo_path_fixed_t *path, cairo_fixed_t x, cairo_fixed_t y); -cairo_status_t +cairo_private cairo_status_t _cairo_path_fixed_rel_move_to (cairo_path_fixed_t *path, cairo_fixed_t dx, cairo_fixed_t dy); -cairo_status_t +cairo_private cairo_status_t _cairo_path_fixed_line_to (cairo_path_fixed_t *path, cairo_fixed_t x, cairo_fixed_t y); -cairo_status_t +cairo_private cairo_status_t _cairo_path_fixed_rel_line_to (cairo_path_fixed_t *path, cairo_fixed_t dx, cairo_fixed_t dy); -cairo_status_t +cairo_private cairo_status_t _cairo_path_fixed_curve_to (cairo_path_fixed_t *path, cairo_fixed_t x0, cairo_fixed_t y0, cairo_fixed_t x1, cairo_fixed_t y1, cairo_fixed_t x2, cairo_fixed_t y2); -cairo_status_t +cairo_private cairo_status_t _cairo_path_fixed_rel_curve_to (cairo_path_fixed_t *path, cairo_fixed_t dx0, cairo_fixed_t dy0, cairo_fixed_t dx1, cairo_fixed_t dy1, @@ -1433,7 +1477,7 @@ _cairo_path_fixed_rel_curve_to (cairo_path_fixed_t *path, cairo_private cairo_status_t _cairo_path_fixed_close_path (cairo_path_fixed_t *path); -cairo_status_t +cairo_private cairo_status_t _cairo_path_fixed_get_current_point (cairo_path_fixed_t *path, cairo_fixed_t *x, cairo_fixed_t *y); @@ -1472,7 +1516,8 @@ _cairo_path_fixed_bounds (cairo_path_fixed_t *path, /* cairo_path_fill.c */ cairo_private cairo_status_t _cairo_path_fixed_fill_to_traps (cairo_path_fixed_t *path, - cairo_gstate_t *gstate, + cairo_fill_rule_t fill_rule, + double tolerance, cairo_traps_t *traps); /* cairo_path_stroke.c */ @@ -1483,9 +1528,9 @@ _cairo_path_fixed_stroke_to_traps (cairo_path_fixed_t *path, /* cairo-surface.c */ -extern const cairo_surface_t _cairo_surface_nil; -extern const cairo_surface_t _cairo_surface_nil_read_error; -extern const cairo_surface_t _cairo_surface_nil_file_not_found; +extern const cairo_private cairo_surface_t _cairo_surface_nil; +extern const cairo_private cairo_surface_t _cairo_surface_nil_read_error; +extern const cairo_private cairo_surface_t _cairo_surface_nil_file_not_found; cairo_private cairo_surface_t * _cairo_surface_create_similar_scratch (cairo_surface_t *other, @@ -1549,6 +1594,7 @@ cairo_private cairo_status_t _cairo_surface_composite_trapezoids (cairo_operator_t operator, cairo_pattern_t *pattern, cairo_surface_t *dst, + cairo_antialias_t antialias, int src_x, int src_y, int dst_x, @@ -1559,6 +1605,14 @@ _cairo_surface_composite_trapezoids (cairo_operator_t operator, int ntraps); cairo_private cairo_status_t +_cairo_surface_clip_and_composite_trapezoids (cairo_pattern_t *src, + cairo_operator_t operator, + cairo_surface_t *dst, + cairo_traps_t *traps, + cairo_clip_t *clip, + cairo_antialias_t antialias); + +cairo_private cairo_status_t _cairo_surface_copy_page (cairo_surface_t *surface); cairo_private cairo_status_t @@ -1611,14 +1665,11 @@ cairo_private cairo_int_status_t _cairo_surface_intersect_clip_path (cairo_surface_t *surface, cairo_path_fixed_t *path, cairo_fill_rule_t fill_rule, - double tolerance); - -typedef struct _cairo_clip_path cairo_clip_path_t; + double tolerance, + cairo_antialias_t antialias); cairo_private cairo_status_t -_cairo_surface_set_clip_path (cairo_surface_t *surface, - cairo_clip_path_t *clip_path, - unsigned int serial); +_cairo_surface_set_clip (cairo_surface_t *surface, cairo_clip_t *clip); cairo_private cairo_status_t _cairo_surface_get_extents (cairo_surface_t *surface, @@ -1638,6 +1689,23 @@ _cairo_surface_show_glyphs (cairo_scaled_font_t *scaled_font, const cairo_glyph_t *glyphs, int num_glyphs); +cairo_private void +_cairo_surface_composite_fixup_unbounded (cairo_surface_t *dst, + cairo_surface_attributes_t *src_attr, + int src_width, + int src_height, + cairo_surface_attributes_t *mask_attr, + int mask_width, + int mask_height, + int src_x, + int src_y, + int mask_x, + int mask_y, + int dst_x, + int dst_y, + unsigned int width, + unsigned int height); + /* cairo_image_surface.c */ cairo_private cairo_format_t @@ -1773,6 +1841,9 @@ _cairo_traps_init_box (cairo_traps_t *traps, cairo_private void _cairo_traps_fini (cairo_traps_t *traps); +cairo_private void +_cairo_traps_translate (cairo_traps_t *traps, int x, int y); + cairo_private cairo_status_t _cairo_traps_tessellate_triangle (cairo_traps_t *traps, cairo_point_t t[3]); @@ -1873,6 +1944,13 @@ _cairo_pattern_acquire_surfaces (cairo_pattern_t *src, cairo_surface_attributes_t *src_attributes, cairo_surface_attributes_t *mask_attributes); +cairo_private cairo_status_t +_cairo_gstate_set_antialias (cairo_gstate_t *gstate, + cairo_antialias_t antialias); + +cairo_private cairo_antialias_t +_cairo_gstate_get_antialias (cairo_gstate_t *gstate); + /* cairo_unicode.c */ @@ -1922,7 +2000,7 @@ _cairo_output_stream_get_position (cairo_output_stream_t *status); cairo_private cairo_status_t _cairo_output_stream_get_status (cairo_output_stream_t *stream); -cairo_output_stream_t * +cairo_private cairo_output_stream_t * _cairo_output_stream_create_for_file (const char *filename); cairo_private void diff --git a/test/Makefile.am b/test/Makefile.am index 649c401..5475525 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,6 +1,8 @@ # All test cases go here TESTS = \ +a8-mask \ clip-nesting \ +clip-operator \ clip-twice \ composite-integer-translate-source \ composite-integer-translate-over \ @@ -16,6 +18,8 @@ leaky-polygon \ line-width \ linear-gradient \ mask \ +mask-ctm \ +mask-surface-ctm \ move-to-show-surface \ paint \ paint-with-alpha \ @@ -38,6 +42,8 @@ text-rotate \ transforms \ translate-show-surface \ trap-clip \ +unantialiased-shapes \ +unbounded-operator \ user-data \ rel-path @@ -57,7 +63,9 @@ endif # I really don't like having to repeat this list. Anyone know a good # way to avoid it? Can I use a wildcard here? EXTRA_DIST = \ +a8-mask-ref.png \ clip-nesting-ref.png \ +clip-operator-ref.png \ clip-twice-ref.png \ composite-integer-translate-source-ref.png \ composite-integer-translate-over-ref.png \ @@ -72,6 +80,8 @@ leaky-polygon-ref.png \ line-width-ref.png \ linear-gradient-ref.png \ mask-ref.png \ +mask-ctm-ref.png \ +mask-surface-ctm-ref.png \ move-to-show-surface-ref.png \ paint-ref.png \ paint-with-alpha-ref.png \ @@ -90,6 +100,8 @@ text-antialias-none-ref.png \ transforms-ref.png \ translate-show-surface-ref.png \ trap-clip-ref.png \ +unantialiased-shapes-ref.png \ +unbounded-operator-ref.png \ rel-path-ref.png # Any test for which the code committed to CVS is expected to fail @@ -106,10 +118,10 @@ rel-path-ref.png # Also, any test listed here should call cairo_test_expect_failure and # provide an explanation for the expected failure. XFAIL_TESTS = \ +a8-mask \ filter-nearest-offset \ pixman-rotate \ self-intersecting \ -source-surface-scale-paint \ text-antialias-subpixel \ text-rotate @@ -121,10 +133,11 @@ check_PROGRAMS = $(TESTS) # problem. INCLUDES = \ -D_GNU_SOURCE \ - $(CAIRO_CFLAGS) \ -I$(srcdir) \ + -I$(top_srcdir)/pixman/src \ -I$(top_builddir)/src \ - -I$(top_srcdir)/src + -I$(top_srcdir)/src \ + $(CAIRO_CFLAGS) noinst_LTLIBRARIES = libcairotest.la @@ -142,10 +155,16 @@ xmalloc.h LDADDS = libcairotest.la $(top_builddir)/src/libcairo.la +if HAVE_PTHREAD +LDADDS += -lpthread +endif + # ARGH! I have to repeat the list of tests a third time. Maybe it's # time to break down and auto-generate the Makefile.am or something # from autogen.sh. My, but this is painful... +a8_mask_LDADD = $(LDADDS) clip_nesting_LDADD = $(LDADDS) +clip_operator_LDADD = $(LDADDS) clip_twice_LDADD = $(LDADDS) composite_integer_translate_source_LDADD = $(LDADDS) composite_integer_translate_over_LDADD = $(LDADDS) @@ -161,6 +180,8 @@ leaky_polygon_LDADD = $(LDADDS) line_width_LDADD = $(LDADDS) linear_gradient_LDADD = $(LDADDS) mask_LDADD = $(LDADDS) +mask_ctm_LDADD = $(LDADDS) +mask_surface_ctm_LDADD = $(LDADDS) move_to_show_surface_LDADD = $(LDADDS) paint_LDADD = $(LDADDS) paint_with_alpha_LDADD = $(LDADDS) @@ -186,6 +207,8 @@ text_rotate_LDADD = $(LDADDS) transforms_LDADD = $(LDADDS) translate_show_surface_LDADD = $(LDADDS) trap_clip_LDADD = $(LDADDS) +unantialiased_shapes_LDADD = $(LDADDS) +unbounded_operator_LDADD = $(LDADDS) user_data_LDADD = $(LDADDS) rel_path_LDADD = $(LDADDS) xlib_surface_LDADD = $(LDADDS) diff --git a/test/Makefile.in b/test/Makefile.in index 0c121e3..37bd5a3 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -15,7 +15,7 @@ @SET_MAKE@ -SOURCES = $(libcairotest_la_SOURCES) clip-nesting.c clip-twice.c composite-integer-translate-over.c composite-integer-translate-over-repeat.c composite-integer-translate-source.c create-from-png.c create-from-png-stream.c fill-and-stroke.c fill-rule.c filter-nearest-offset.c get-and-set.c gradient-alpha.c imagediff.c leaky-polygon.c line-width.c linear-gradient.c mask.c move-to-show-surface.c paint.c paint-with-alpha.c path-data.c pdf-clip.c pdf-surface.c pixman-rotate.c ps-surface.c rel-path.c scale-source-surface-paint.c select-font-no-show-text.c self-copy.c self-intersecting.c set-source.c source-clip.c source-surface-scale-paint.c surface-finish-twice.c surface-pattern.c text-antialias-gray.c text-antialias-none.c text-antialias-subpixel.c text-cache-crash.c text-rotate.c transforms.c translate-show-surface.c trap-clip.c user-data.c xlib-surface.c +SOURCES = $(libcairotest_la_SOURCES) a8-mask.c clip-nesting.c clip-operator.c clip-twice.c composite-integer-translate-over.c composite-integer-translate-over-repeat.c composite-integer-translate-source.c create-from-png.c create-from-png-stream.c fill-and-stroke.c fill-rule.c filter-nearest-offset.c get-and-set.c gradient-alpha.c imagediff.c leaky-polygon.c line-width.c linear-gradient.c mask.c mask-ctm.c mask-surface-ctm.c move-to-show-surface.c paint.c paint-with-alpha.c path-data.c pdf-clip.c pdf-surface.c pixman-rotate.c ps-surface.c rel-path.c scale-source-surface-paint.c select-font-no-show-text.c self-copy.c self-intersecting.c set-source.c source-clip.c source-surface-scale-paint.c surface-finish-twice.c surface-pattern.c text-antialias-gray.c text-antialias-none.c text-antialias-subpixel.c text-cache-crash.c text-rotate.c transforms.c translate-show-surface.c trap-clip.c unantialiased-shapes.c unbounded-operator.c user-data.c xlib-surface.c srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -43,6 +43,7 @@ host_triplet = @host@ @CAIRO_HAS_PS_SURFACE_TRUE@am__append_2 = ps-surface @CAIRO_HAS_XLIB_SURFACE_TRUE@am__append_3 = xlib-surface check_PROGRAMS = $(am__EXEEXT_4) +@HAVE_PTHREAD_TRUE@am__append_4 = -lpthread noinst_PROGRAMS = imagediff$(EXEEXT) subdir = test DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in @@ -63,7 +64,8 @@ libcairotest_la_OBJECTS = $(am_libcairotest_la_OBJECTS) @CAIRO_HAS_PDF_SURFACE_TRUE@ pdf-clip$(EXEEXT) @CAIRO_HAS_PS_SURFACE_TRUE@am__EXEEXT_2 = ps-surface$(EXEEXT) @CAIRO_HAS_XLIB_SURFACE_TRUE@am__EXEEXT_3 = xlib-surface$(EXEEXT) -am__EXEEXT_4 = clip-nesting$(EXEEXT) clip-twice$(EXEEXT) \ +am__EXEEXT_4 = a8-mask$(EXEEXT) clip-nesting$(EXEEXT) \ + clip-operator$(EXEEXT) clip-twice$(EXEEXT) \ composite-integer-translate-source$(EXEEXT) \ composite-integer-translate-over$(EXEEXT) \ composite-integer-translate-over-repeat$(EXEEXT) \ @@ -72,6 +74,7 @@ am__EXEEXT_4 = clip-nesting$(EXEEXT) clip-twice$(EXEEXT) \ filter-nearest-offset$(EXEEXT) get-and-set$(EXEEXT) \ gradient-alpha$(EXEEXT) leaky-polygon$(EXEEXT) \ line-width$(EXEEXT) linear-gradient$(EXEEXT) mask$(EXEEXT) \ + mask-ctm$(EXEEXT) mask-surface-ctm$(EXEEXT) \ move-to-show-surface$(EXEEXT) paint$(EXEEXT) \ paint-with-alpha$(EXEEXT) path-data$(EXEEXT) \ pixman-rotate$(EXEEXT) scale-source-surface-paint$(EXEEXT) \ @@ -83,155 +86,176 @@ am__EXEEXT_4 = clip-nesting$(EXEEXT) clip-twice$(EXEEXT) \ text-antialias-subpixel$(EXEEXT) text-cache-crash$(EXEEXT) \ text-rotate$(EXEEXT) transforms$(EXEEXT) \ translate-show-surface$(EXEEXT) trap-clip$(EXEEXT) \ + unantialiased-shapes$(EXEEXT) unbounded-operator$(EXEEXT) \ user-data$(EXEEXT) rel-path$(EXEEXT) $(am__EXEEXT_1) \ $(am__EXEEXT_2) $(am__EXEEXT_3) PROGRAMS = $(noinst_PROGRAMS) +a8_mask_SOURCES = a8-mask.c +a8_mask_OBJECTS = a8-mask.$(OBJEXT) +am__DEPENDENCIES_1 = +am__DEPENDENCIES_2 = libcairotest.la $(top_builddir)/src/libcairo.la \ + $(am__DEPENDENCIES_1) +a8_mask_DEPENDENCIES = $(am__DEPENDENCIES_2) clip_nesting_SOURCES = clip-nesting.c clip_nesting_OBJECTS = clip-nesting.$(OBJEXT) -am__DEPENDENCIES_1 = libcairotest.la $(top_builddir)/src/libcairo.la -clip_nesting_DEPENDENCIES = $(am__DEPENDENCIES_1) +clip_nesting_DEPENDENCIES = $(am__DEPENDENCIES_2) +clip_operator_SOURCES = clip-operator.c +clip_operator_OBJECTS = clip-operator.$(OBJEXT) +clip_operator_DEPENDENCIES = $(am__DEPENDENCIES_2) clip_twice_SOURCES = clip-twice.c clip_twice_OBJECTS = clip-twice.$(OBJEXT) -clip_twice_DEPENDENCIES = $(am__DEPENDENCIES_1) +clip_twice_DEPENDENCIES = $(am__DEPENDENCIES_2) composite_integer_translate_over_SOURCES = \ composite-integer-translate-over.c composite_integer_translate_over_OBJECTS = \ composite-integer-translate-over.$(OBJEXT) -composite_integer_translate_over_DEPENDENCIES = $(am__DEPENDENCIES_1) +composite_integer_translate_over_DEPENDENCIES = $(am__DEPENDENCIES_2) composite_integer_translate_over_repeat_SOURCES = \ composite-integer-translate-over-repeat.c composite_integer_translate_over_repeat_OBJECTS = \ composite-integer-translate-over-repeat.$(OBJEXT) composite_integer_translate_over_repeat_DEPENDENCIES = \ - $(am__DEPENDENCIES_1) + $(am__DEPENDENCIES_2) composite_integer_translate_source_SOURCES = \ composite-integer-translate-source.c composite_integer_translate_source_OBJECTS = \ composite-integer-translate-source.$(OBJEXT) composite_integer_translate_source_DEPENDENCIES = \ - $(am__DEPENDENCIES_1) + $(am__DEPENDENCIES_2) create_from_png_SOURCES = create-from-png.c create_from_png_OBJECTS = create-from-png.$(OBJEXT) -create_from_png_DEPENDENCIES = $(am__DEPENDENCIES_1) +create_from_png_DEPENDENCIES = $(am__DEPENDENCIES_2) create_from_png_stream_SOURCES = create-from-png-stream.c create_from_png_stream_OBJECTS = create-from-png-stream.$(OBJEXT) -create_from_png_stream_DEPENDENCIES = $(am__DEPENDENCIES_1) +create_from_png_stream_DEPENDENCIES = $(am__DEPENDENCIES_2) fill_and_stroke_SOURCES = fill-and-stroke.c fill_and_stroke_OBJECTS = fill-and-stroke.$(OBJEXT) -fill_and_stroke_DEPENDENCIES = $(am__DEPENDENCIES_1) +fill_and_stroke_DEPENDENCIES = $(am__DEPENDENCIES_2) fill_rule_SOURCES = fill-rule.c fill_rule_OBJECTS = fill-rule.$(OBJEXT) -fill_rule_DEPENDENCIES = $(am__DEPENDENCIES_1) +fill_rule_DEPENDENCIES = $(am__DEPENDENCIES_2) filter_nearest_offset_SOURCES = filter-nearest-offset.c filter_nearest_offset_OBJECTS = filter-nearest-offset.$(OBJEXT) -filter_nearest_offset_DEPENDENCIES = $(am__DEPENDENCIES_1) +filter_nearest_offset_DEPENDENCIES = $(am__DEPENDENCIES_2) get_and_set_SOURCES = get-and-set.c get_and_set_OBJECTS = get-and-set.$(OBJEXT) -get_and_set_DEPENDENCIES = $(am__DEPENDENCIES_1) +get_and_set_DEPENDENCIES = $(am__DEPENDENCIES_2) gradient_alpha_SOURCES = gradient-alpha.c gradient_alpha_OBJECTS = gradient-alpha.$(OBJEXT) -gradient_alpha_DEPENDENCIES = $(am__DEPENDENCIES_1) +gradient_alpha_DEPENDENCIES = $(am__DEPENDENCIES_2) imagediff_SOURCES = imagediff.c imagediff_OBJECTS = imagediff.$(OBJEXT) -imagediff_DEPENDENCIES = $(am__DEPENDENCIES_1) +imagediff_DEPENDENCIES = $(am__DEPENDENCIES_2) leaky_polygon_SOURCES = leaky-polygon.c leaky_polygon_OBJECTS = leaky-polygon.$(OBJEXT) -leaky_polygon_DEPENDENCIES = $(am__DEPENDENCIES_1) +leaky_polygon_DEPENDENCIES = $(am__DEPENDENCIES_2) line_width_SOURCES = line-width.c line_width_OBJECTS = line-width.$(OBJEXT) -line_width_DEPENDENCIES = $(am__DEPENDENCIES_1) +line_width_DEPENDENCIES = $(am__DEPENDENCIES_2) linear_gradient_SOURCES = linear-gradient.c linear_gradient_OBJECTS = linear-gradient.$(OBJEXT) -linear_gradient_DEPENDENCIES = $(am__DEPENDENCIES_1) +linear_gradient_DEPENDENCIES = $(am__DEPENDENCIES_2) mask_SOURCES = mask.c mask_OBJECTS = mask.$(OBJEXT) -mask_DEPENDENCIES = $(am__DEPENDENCIES_1) +mask_DEPENDENCIES = $(am__DEPENDENCIES_2) +mask_ctm_SOURCES = mask-ctm.c +mask_ctm_OBJECTS = mask-ctm.$(OBJEXT) +mask_ctm_DEPENDENCIES = $(am__DEPENDENCIES_2) +mask_surface_ctm_SOURCES = mask-surface-ctm.c +mask_surface_ctm_OBJECTS = mask-surface-ctm.$(OBJEXT) +mask_surface_ctm_DEPENDENCIES = $(am__DEPENDENCIES_2) move_to_show_surface_SOURCES = move-to-show-surface.c move_to_show_surface_OBJECTS = move-to-show-surface.$(OBJEXT) -move_to_show_surface_DEPENDENCIES = $(am__DEPENDENCIES_1) +move_to_show_surface_DEPENDENCIES = $(am__DEPENDENCIES_2) paint_SOURCES = paint.c paint_OBJECTS = paint.$(OBJEXT) -paint_DEPENDENCIES = $(am__DEPENDENCIES_1) +paint_DEPENDENCIES = $(am__DEPENDENCIES_2) paint_with_alpha_SOURCES = paint-with-alpha.c paint_with_alpha_OBJECTS = paint-with-alpha.$(OBJEXT) -paint_with_alpha_DEPENDENCIES = $(am__DEPENDENCIES_1) +paint_with_alpha_DEPENDENCIES = $(am__DEPENDENCIES_2) path_data_SOURCES = path-data.c path_data_OBJECTS = path-data.$(OBJEXT) -path_data_DEPENDENCIES = $(am__DEPENDENCIES_1) +path_data_DEPENDENCIES = $(am__DEPENDENCIES_2) pdf_clip_SOURCES = pdf-clip.c pdf_clip_OBJECTS = pdf-clip.$(OBJEXT) -pdf_clip_DEPENDENCIES = $(am__DEPENDENCIES_1) +pdf_clip_DEPENDENCIES = $(am__DEPENDENCIES_2) pdf_surface_SOURCES = pdf-surface.c pdf_surface_OBJECTS = pdf-surface.$(OBJEXT) -pdf_surface_DEPENDENCIES = $(am__DEPENDENCIES_1) +pdf_surface_DEPENDENCIES = $(am__DEPENDENCIES_2) pixman_rotate_SOURCES = pixman-rotate.c pixman_rotate_OBJECTS = pixman-rotate.$(OBJEXT) -pixman_rotate_DEPENDENCIES = $(am__DEPENDENCIES_1) +pixman_rotate_DEPENDENCIES = $(am__DEPENDENCIES_2) ps_surface_SOURCES = ps-surface.c ps_surface_OBJECTS = ps-surface.$(OBJEXT) -ps_surface_DEPENDENCIES = $(am__DEPENDENCIES_1) +ps_surface_DEPENDENCIES = $(am__DEPENDENCIES_2) rel_path_SOURCES = rel-path.c rel_path_OBJECTS = rel-path.$(OBJEXT) -rel_path_DEPENDENCIES = $(am__DEPENDENCIES_1) +rel_path_DEPENDENCIES = $(am__DEPENDENCIES_2) scale_source_surface_paint_SOURCES = scale-source-surface-paint.c scale_source_surface_paint_OBJECTS = \ scale-source-surface-paint.$(OBJEXT) -scale_source_surface_paint_DEPENDENCIES = $(am__DEPENDENCIES_1) +scale_source_surface_paint_DEPENDENCIES = $(am__DEPENDENCIES_2) select_font_no_show_text_SOURCES = select-font-no-show-text.c select_font_no_show_text_OBJECTS = select-font-no-show-text.$(OBJEXT) -select_font_no_show_text_DEPENDENCIES = $(am__DEPENDENCIES_1) +select_font_no_show_text_DEPENDENCIES = $(am__DEPENDENCIES_2) self_copy_SOURCES = self-copy.c self_copy_OBJECTS = self-copy.$(OBJEXT) -self_copy_DEPENDENCIES = $(am__DEPENDENCIES_1) +self_copy_DEPENDENCIES = $(am__DEPENDENCIES_2) self_intersecting_SOURCES = self-intersecting.c self_intersecting_OBJECTS = self-intersecting.$(OBJEXT) -self_intersecting_DEPENDENCIES = $(am__DEPENDENCIES_1) +self_intersecting_DEPENDENCIES = $(am__DEPENDENCIES_2) set_source_SOURCES = set-source.c set_source_OBJECTS = set-source.$(OBJEXT) -set_source_DEPENDENCIES = $(am__DEPENDENCIES_1) +set_source_DEPENDENCIES = $(am__DEPENDENCIES_2) source_clip_SOURCES = source-clip.c source_clip_OBJECTS = source-clip.$(OBJEXT) -source_clip_DEPENDENCIES = $(am__DEPENDENCIES_1) +source_clip_DEPENDENCIES = $(am__DEPENDENCIES_2) source_surface_scale_paint_SOURCES = source-surface-scale-paint.c source_surface_scale_paint_OBJECTS = \ source-surface-scale-paint.$(OBJEXT) -source_surface_scale_paint_DEPENDENCIES = $(am__DEPENDENCIES_1) +source_surface_scale_paint_DEPENDENCIES = $(am__DEPENDENCIES_2) surface_finish_twice_SOURCES = surface-finish-twice.c surface_finish_twice_OBJECTS = surface-finish-twice.$(OBJEXT) -surface_finish_twice_DEPENDENCIES = $(am__DEPENDENCIES_1) +surface_finish_twice_DEPENDENCIES = $(am__DEPENDENCIES_2) surface_pattern_SOURCES = surface-pattern.c surface_pattern_OBJECTS = surface-pattern.$(OBJEXT) -surface_pattern_DEPENDENCIES = $(am__DEPENDENCIES_1) +surface_pattern_DEPENDENCIES = $(am__DEPENDENCIES_2) text_antialias_gray_SOURCES = text-antialias-gray.c text_antialias_gray_OBJECTS = text-antialias-gray.$(OBJEXT) -text_antialias_gray_DEPENDENCIES = $(am__DEPENDENCIES_1) +text_antialias_gray_DEPENDENCIES = $(am__DEPENDENCIES_2) text_antialias_none_SOURCES = text-antialias-none.c text_antialias_none_OBJECTS = text-antialias-none.$(OBJEXT) -text_antialias_none_DEPENDENCIES = $(am__DEPENDENCIES_1) +text_antialias_none_DEPENDENCIES = $(am__DEPENDENCIES_2) text_antialias_subpixel_SOURCES = text-antialias-subpixel.c text_antialias_subpixel_OBJECTS = text-antialias-subpixel.$(OBJEXT) -text_antialias_subpixel_DEPENDENCIES = $(am__DEPENDENCIES_1) +text_antialias_subpixel_DEPENDENCIES = $(am__DEPENDENCIES_2) text_cache_crash_SOURCES = text-cache-crash.c text_cache_crash_OBJECTS = text-cache-crash.$(OBJEXT) -text_cache_crash_DEPENDENCIES = $(am__DEPENDENCIES_1) +text_cache_crash_DEPENDENCIES = $(am__DEPENDENCIES_2) text_rotate_SOURCES = text-rotate.c text_rotate_OBJECTS = text-rotate.$(OBJEXT) -text_rotate_DEPENDENCIES = $(am__DEPENDENCIES_1) +text_rotate_DEPENDENCIES = $(am__DEPENDENCIES_2) transforms_SOURCES = transforms.c transforms_OBJECTS = transforms.$(OBJEXT) -transforms_DEPENDENCIES = $(am__DEPENDENCIES_1) +transforms_DEPENDENCIES = $(am__DEPENDENCIES_2) translate_show_surface_SOURCES = translate-show-surface.c translate_show_surface_OBJECTS = translate-show-surface.$(OBJEXT) -translate_show_surface_DEPENDENCIES = $(am__DEPENDENCIES_1) +translate_show_surface_DEPENDENCIES = $(am__DEPENDENCIES_2) trap_clip_SOURCES = trap-clip.c trap_clip_OBJECTS = trap-clip.$(OBJEXT) -trap_clip_DEPENDENCIES = $(am__DEPENDENCIES_1) +trap_clip_DEPENDENCIES = $(am__DEPENDENCIES_2) +unantialiased_shapes_SOURCES = unantialiased-shapes.c +unantialiased_shapes_OBJECTS = unantialiased-shapes.$(OBJEXT) +unantialiased_shapes_DEPENDENCIES = $(am__DEPENDENCIES_2) +unbounded_operator_SOURCES = unbounded-operator.c +unbounded_operator_OBJECTS = unbounded-operator.$(OBJEXT) +unbounded_operator_DEPENDENCIES = $(am__DEPENDENCIES_2) user_data_SOURCES = user-data.c user_data_OBJECTS = user-data.$(OBJEXT) -user_data_DEPENDENCIES = $(am__DEPENDENCIES_1) +user_data_DEPENDENCIES = $(am__DEPENDENCIES_2) xlib_surface_SOURCES = xlib-surface.c xlib_surface_OBJECTS = xlib-surface.$(OBJEXT) -xlib_surface_DEPENDENCIES = $(am__DEPENDENCIES_1) +xlib_surface_DEPENDENCIES = $(am__DEPENDENCIES_2) DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -243,39 +267,43 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libcairotest_la_SOURCES) clip-nesting.c clip-twice.c \ +SOURCES = $(libcairotest_la_SOURCES) a8-mask.c clip-nesting.c \ + clip-operator.c clip-twice.c \ composite-integer-translate-over.c \ composite-integer-translate-over-repeat.c \ composite-integer-translate-source.c create-from-png.c \ create-from-png-stream.c fill-and-stroke.c fill-rule.c \ filter-nearest-offset.c get-and-set.c gradient-alpha.c \ imagediff.c leaky-polygon.c line-width.c linear-gradient.c \ - mask.c move-to-show-surface.c paint.c paint-with-alpha.c \ - path-data.c pdf-clip.c pdf-surface.c pixman-rotate.c \ - ps-surface.c rel-path.c scale-source-surface-paint.c \ - select-font-no-show-text.c self-copy.c self-intersecting.c \ - set-source.c source-clip.c source-surface-scale-paint.c \ - surface-finish-twice.c surface-pattern.c text-antialias-gray.c \ - text-antialias-none.c text-antialias-subpixel.c \ - text-cache-crash.c text-rotate.c transforms.c \ - translate-show-surface.c trap-clip.c user-data.c \ + mask.c mask-ctm.c mask-surface-ctm.c move-to-show-surface.c \ + paint.c paint-with-alpha.c path-data.c pdf-clip.c \ + pdf-surface.c pixman-rotate.c ps-surface.c rel-path.c \ + scale-source-surface-paint.c select-font-no-show-text.c \ + self-copy.c self-intersecting.c set-source.c source-clip.c \ + source-surface-scale-paint.c surface-finish-twice.c \ + surface-pattern.c text-antialias-gray.c text-antialias-none.c \ + text-antialias-subpixel.c text-cache-crash.c text-rotate.c \ + transforms.c translate-show-surface.c trap-clip.c \ + unantialiased-shapes.c unbounded-operator.c user-data.c \ xlib-surface.c -DIST_SOURCES = $(libcairotest_la_SOURCES) clip-nesting.c clip-twice.c \ +DIST_SOURCES = $(libcairotest_la_SOURCES) a8-mask.c clip-nesting.c \ + clip-operator.c clip-twice.c \ composite-integer-translate-over.c \ composite-integer-translate-over-repeat.c \ composite-integer-translate-source.c create-from-png.c \ create-from-png-stream.c fill-and-stroke.c fill-rule.c \ filter-nearest-offset.c get-and-set.c gradient-alpha.c \ imagediff.c leaky-polygon.c line-width.c linear-gradient.c \ - mask.c move-to-show-surface.c paint.c paint-with-alpha.c \ - path-data.c pdf-clip.c pdf-surface.c pixman-rotate.c \ - ps-surface.c rel-path.c scale-source-surface-paint.c \ - select-font-no-show-text.c self-copy.c self-intersecting.c \ - set-source.c source-clip.c source-surface-scale-paint.c \ - surface-finish-twice.c surface-pattern.c text-antialias-gray.c \ - text-antialias-none.c text-antialias-subpixel.c \ - text-cache-crash.c text-rotate.c transforms.c \ - translate-show-surface.c trap-clip.c user-data.c \ + mask.c mask-ctm.c mask-surface-ctm.c move-to-show-surface.c \ + paint.c paint-with-alpha.c path-data.c pdf-clip.c \ + pdf-surface.c pixman-rotate.c ps-surface.c rel-path.c \ + scale-source-surface-paint.c select-font-no-show-text.c \ + self-copy.c self-intersecting.c set-source.c source-clip.c \ + source-surface-scale-paint.c surface-finish-twice.c \ + surface-pattern.c text-antialias-gray.c text-antialias-none.c \ + text-antialias-subpixel.c text-cache-crash.c text-rotate.c \ + transforms.c translate-show-surface.c trap-clip.c \ + unantialiased-shapes.c unbounded-operator.c user-data.c \ xlib-surface.c ETAGS = etags CTAGS = ctags @@ -314,6 +342,10 @@ CAIRO_HAS_XCB_SURFACE_TRUE = @CAIRO_HAS_XCB_SURFACE_TRUE@ CAIRO_HAS_XLIB_SURFACE_FALSE = @CAIRO_HAS_XLIB_SURFACE_FALSE@ CAIRO_HAS_XLIB_SURFACE_TRUE = @CAIRO_HAS_XLIB_SURFACE_TRUE@ CAIRO_LIBS = @CAIRO_LIBS@ +CAIRO_VERSION_MAJOR = @CAIRO_VERSION_MAJOR@ +CAIRO_VERSION_MICRO = @CAIRO_VERSION_MICRO@ +CAIRO_VERSION_MINOR = @CAIRO_VERSION_MINOR@ +CAIRO_VERSION_OTHER = @CAIRO_VERSION_OTHER@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -349,6 +381,8 @@ GLITZ_REQUIRES = @GLITZ_REQUIRES@ GLITZ_SURFACE_FEATURE = @GLITZ_SURFACE_FEATURE@ GTK_DOC_USE_LIBTOOL_FALSE = @GTK_DOC_USE_LIBTOOL_FALSE@ GTK_DOC_USE_LIBTOOL_TRUE = @GTK_DOC_USE_LIBTOOL_TRUE@ +HAVE_PTHREAD_FALSE = @HAVE_PTHREAD_FALSE@ +HAVE_PTHREAD_TRUE = @HAVE_PTHREAD_TRUE@ HTML_DIR = @HTML_DIR@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -374,8 +408,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PDF_LIBS = @PDF_LIBS@ PDF_SURFACE_FEATURE = @PDF_SURFACE_FEATURE@ -PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ -PIXMAN_LIBS = @PIXMAN_LIBS@ +PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ PKG_CONFIG = @PKG_CONFIG@ PNG_CFLAGS = @PNG_CFLAGS@ PNG_FUNCTIONS_FEATURE = @PNG_FUNCTIONS_FEATURE@ @@ -448,26 +481,30 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ # All test cases go here -TESTS = clip-nesting clip-twice composite-integer-translate-source \ +TESTS = a8-mask clip-nesting clip-operator clip-twice \ + composite-integer-translate-source \ composite-integer-translate-over \ composite-integer-translate-over-repeat create-from-png \ create-from-png-stream fill-and-stroke fill-rule \ filter-nearest-offset get-and-set gradient-alpha leaky-polygon \ - line-width linear-gradient mask move-to-show-surface paint \ - paint-with-alpha path-data pixman-rotate \ - scale-source-surface-paint select-font-no-show-text self-copy \ - self-intersecting set-source source-clip \ - source-surface-scale-paint surface-finish-twice \ - surface-pattern text-antialias-gray text-antialias-none \ - text-antialias-subpixel text-cache-crash text-rotate \ - transforms translate-show-surface trap-clip user-data rel-path \ + line-width linear-gradient mask mask-ctm mask-surface-ctm \ + move-to-show-surface paint paint-with-alpha path-data \ + pixman-rotate scale-source-surface-paint \ + select-font-no-show-text self-copy self-intersecting \ + set-source source-clip source-surface-scale-paint \ + surface-finish-twice surface-pattern text-antialias-gray \ + text-antialias-none text-antialias-subpixel text-cache-crash \ + text-rotate transforms translate-show-surface trap-clip \ + unantialiased-shapes unbounded-operator user-data rel-path \ $(am__append_1) $(am__append_2) $(am__append_3) # All tests which have a reference image go here. # I really don't like having to repeat this list. Anyone know a good # way to avoid it? Can I use a wildcard here? EXTRA_DIST = \ +a8-mask-ref.png \ clip-nesting-ref.png \ +clip-operator-ref.png \ clip-twice-ref.png \ composite-integer-translate-source-ref.png \ composite-integer-translate-over-ref.png \ @@ -482,6 +519,8 @@ leaky-polygon-ref.png \ line-width-ref.png \ linear-gradient-ref.png \ mask-ref.png \ +mask-ctm-ref.png \ +mask-surface-ctm-ref.png \ move-to-show-surface-ref.png \ paint-ref.png \ paint-with-alpha-ref.png \ @@ -500,6 +539,8 @@ text-antialias-none-ref.png \ transforms-ref.png \ translate-show-surface-ref.png \ trap-clip-ref.png \ +unantialiased-shapes-ref.png \ +unbounded-operator-ref.png \ rel-path-ref.png @@ -517,10 +558,10 @@ rel-path-ref.png # Also, any test listed here should call cairo_test_expect_failure and # provide an explanation for the expected failure. XFAIL_TESTS = \ +a8-mask \ filter-nearest-offset \ pixman-rotate \ self-intersecting \ -source-surface-scale-paint \ text-antialias-subpixel \ text-rotate @@ -531,10 +572,11 @@ text-rotate # problem. INCLUDES = \ -D_GNU_SOURCE \ - $(CAIRO_CFLAGS) \ -I$(srcdir) \ + -I$(top_srcdir)/pixman/src \ -I$(top_builddir)/src \ - -I$(top_srcdir)/src + -I$(top_srcdir)/src \ + $(CAIRO_CFLAGS) noinst_LTLIBRARIES = libcairotest.la libcairotest_la_SOURCES = \ @@ -549,12 +591,15 @@ write-png.h \ xmalloc.c \ xmalloc.h -LDADDS = libcairotest.la $(top_builddir)/src/libcairo.la +LDADDS = libcairotest.la $(top_builddir)/src/libcairo.la \ + $(am__append_4) # ARGH! I have to repeat the list of tests a third time. Maybe it's # time to break down and auto-generate the Makefile.am or something # from autogen.sh. My, but this is painful... +a8_mask_LDADD = $(LDADDS) clip_nesting_LDADD = $(LDADDS) +clip_operator_LDADD = $(LDADDS) clip_twice_LDADD = $(LDADDS) composite_integer_translate_source_LDADD = $(LDADDS) composite_integer_translate_over_LDADD = $(LDADDS) @@ -570,6 +615,8 @@ leaky_polygon_LDADD = $(LDADDS) line_width_LDADD = $(LDADDS) linear_gradient_LDADD = $(LDADDS) mask_LDADD = $(LDADDS) +mask_ctm_LDADD = $(LDADDS) +mask_surface_ctm_LDADD = $(LDADDS) move_to_show_surface_LDADD = $(LDADDS) paint_LDADD = $(LDADDS) paint_with_alpha_LDADD = $(LDADDS) @@ -595,6 +642,8 @@ text_rotate_LDADD = $(LDADDS) transforms_LDADD = $(LDADDS) translate_show_surface_LDADD = $(LDADDS) trap_clip_LDADD = $(LDADDS) +unantialiased_shapes_LDADD = $(LDADDS) +unbounded_operator_LDADD = $(LDADDS) user_data_LDADD = $(LDADDS) rel_path_LDADD = $(LDADDS) xlib_surface_LDADD = $(LDADDS) @@ -665,9 +714,15 @@ clean-noinstPROGRAMS: echo " rm -f $$p $$f"; \ rm -f $$p $$f ; \ done +a8-mask$(EXEEXT): $(a8_mask_OBJECTS) $(a8_mask_DEPENDENCIES) + @rm -f a8-mask$(EXEEXT) + $(LINK) $(a8_mask_LDFLAGS) $(a8_mask_OBJECTS) $(a8_mask_LDADD) $(LIBS) clip-nesting$(EXEEXT): $(clip_nesting_OBJECTS) $(clip_nesting_DEPENDENCIES) @rm -f clip-nesting$(EXEEXT) $(LINK) $(clip_nesting_LDFLAGS) $(clip_nesting_OBJECTS) $(clip_nesting_LDADD) $(LIBS) +clip-operator$(EXEEXT): $(clip_operator_OBJECTS) $(clip_operator_DEPENDENCIES) + @rm -f clip-operator$(EXEEXT) + $(LINK) $(clip_operator_LDFLAGS) $(clip_operator_OBJECTS) $(clip_operator_LDADD) $(LIBS) clip-twice$(EXEEXT): $(clip_twice_OBJECTS) $(clip_twice_DEPENDENCIES) @rm -f clip-twice$(EXEEXT) $(LINK) $(clip_twice_LDFLAGS) $(clip_twice_OBJECTS) $(clip_twice_LDADD) $(LIBS) @@ -716,6 +771,12 @@ linear-gradient$(EXEEXT): $(linear_gradient_OBJECTS) $(linear_gradient_DEPENDENC mask$(EXEEXT): $(mask_OBJECTS) $(mask_DEPENDENCIES) @rm -f mask$(EXEEXT) $(LINK) $(mask_LDFLAGS) $(mask_OBJECTS) $(mask_LDADD) $(LIBS) +mask-ctm$(EXEEXT): $(mask_ctm_OBJECTS) $(mask_ctm_DEPENDENCIES) + @rm -f mask-ctm$(EXEEXT) + $(LINK) $(mask_ctm_LDFLAGS) $(mask_ctm_OBJECTS) $(mask_ctm_LDADD) $(LIBS) +mask-surface-ctm$(EXEEXT): $(mask_surface_ctm_OBJECTS) $(mask_surface_ctm_DEPENDENCIES) + @rm -f mask-surface-ctm$(EXEEXT) + $(LINK) $(mask_surface_ctm_LDFLAGS) $(mask_surface_ctm_OBJECTS) $(mask_surface_ctm_LDADD) $(LIBS) move-to-show-surface$(EXEEXT): $(move_to_show_surface_OBJECTS) $(move_to_show_surface_DEPENDENCIES) @rm -f move-to-show-surface$(EXEEXT) $(LINK) $(move_to_show_surface_LDFLAGS) $(move_to_show_surface_OBJECTS) $(move_to_show_surface_LDADD) $(LIBS) @@ -794,6 +855,12 @@ translate-show-surface$(EXEEXT): $(translate_show_surface_OBJECTS) $(translate_s trap-clip$(EXEEXT): $(trap_clip_OBJECTS) $(trap_clip_DEPENDENCIES) @rm -f trap-clip$(EXEEXT) $(LINK) $(trap_clip_LDFLAGS) $(trap_clip_OBJECTS) $(trap_clip_LDADD) $(LIBS) +unantialiased-shapes$(EXEEXT): $(unantialiased_shapes_OBJECTS) $(unantialiased_shapes_DEPENDENCIES) + @rm -f unantialiased-shapes$(EXEEXT) + $(LINK) $(unantialiased_shapes_LDFLAGS) $(unantialiased_shapes_OBJECTS) $(unantialiased_shapes_LDADD) $(LIBS) +unbounded-operator$(EXEEXT): $(unbounded_operator_OBJECTS) $(unbounded_operator_DEPENDENCIES) + @rm -f unbounded-operator$(EXEEXT) + $(LINK) $(unbounded_operator_LDFLAGS) $(unbounded_operator_OBJECTS) $(unbounded_operator_LDADD) $(LIBS) user-data$(EXEEXT): $(user_data_OBJECTS) $(user_data_DEPENDENCIES) @rm -f user-data$(EXEEXT) $(LINK) $(user_data_LDFLAGS) $(user_data_OBJECTS) $(user_data_LDADD) $(LIBS) @@ -807,9 +874,11 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/a8-mask.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer-diff.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-test.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clip-nesting.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clip-operator.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clip-twice.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/composite-integer-translate-over-repeat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/composite-integer-translate-over.Po@am__quote@ @@ -825,6 +894,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/leaky-polygon.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line-width.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linear-gradient.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mask-ctm.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mask-surface-ctm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mask.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/move-to-show-surface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paint-with-alpha.Po@am__quote@ @@ -853,6 +924,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transforms.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/translate-show-surface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trap-clip.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unantialiased-shapes.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unbounded-operator.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/user-data.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/write-png.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xlib-surface.Po@am__quote@ diff --git a/test/a8-mask-ref.png b/test/a8-mask-ref.png Binary files differnew file mode 100644 index 0000000..3855615 --- /dev/null +++ b/test/a8-mask-ref.png diff --git a/test/a8-mask.c b/test/a8-mask.c new file mode 100644 index 0000000..e547ecc --- /dev/null +++ b/test/a8-mask.c @@ -0,0 +1,72 @@ +/* + * Copyright © Jeff Muizelaar + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Red Hat, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Red Hat, Inc. makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * JEFF MUIZELAAR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Jeff Muizelaar <jeff@infidigm.net> + */ + +#include "cairo-test.h" + +cairo_test_t test = { + "a8-mask", + "test masks of CAIRO_FORMAT_A8", + 8, 8 +}; + +static unsigned char mask[] = { + 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, + 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, + 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, + 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, + 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, + 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, + 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0, + 0x0, 0x0, 0xff, 0x0, 0xff, 0x0, 0x0 +}; + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + cairo_surface_t *surface; + cairo_pattern_t *pattern; + + cairo_set_source_rgb (cr, 0, 0, 1); + cairo_paint (cr); + + surface = cairo_image_surface_create_for_data (mask, CAIRO_FORMAT_A8, + 7, 8, 7); + pattern = cairo_pattern_create_for_surface (surface); + + cairo_set_source_rgb (cr, 1, 0, 0); + cairo_mask (cr, pattern); + + cairo_pattern_destroy (pattern); + cairo_surface_destroy (surface); + + return CAIRO_TEST_SUCCESS; +} + +int +main (void) +{ + return cairo_test_expect_failure (&test, draw, + "image backend fails because libpixman only handles (stride % sizeof(pixman_bits) == 0)"); +} diff --git a/test/buffer-diff.c b/test/buffer-diff.c index e5ba513..78284ef 100644 --- a/test/buffer-diff.c +++ b/test/buffer-diff.c @@ -23,10 +23,17 @@ * * Author: Richard D. Worth <richard@theworths.org> */ +#if HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdio.h> +#ifdef HAVE_UNISTD_H #include <unistd.h> +#endif #include <errno.h> #include <string.h> +#include <pixman.h> #include "cairo-test.h" @@ -45,18 +52,27 @@ xunlink (const char *pathname) } } -int -buffer_diff (unsigned char *buf_a, - unsigned char *buf_b, - unsigned char *buf_diff, - int width, - int height, - int stride) + +/* This function should be rewritten to compare all formats supported by + * cairo_format_t instead of taking a mask as a parameter. + */ +static int +buffer_diff_core (unsigned char *_buf_a, + unsigned char *_buf_b, + unsigned char *_buf_diff, + int width, + int height, + int stride, + pixman_bits_t mask) { int x, y; - unsigned char *row_a, *row_b, *row; + pixman_bits_t *row_a, *row_b, *row; int pixels_changed = 0; + pixman_bits_t *buf_a = (pixman_bits_t*)_buf_a; + pixman_bits_t *buf_b = (pixman_bits_t*)_buf_b; + pixman_bits_t *buf_diff = (pixman_bits_t*)_buf_diff; + stride /= sizeof(pixman_bits_t); for (y = 0; y < height; y++) { row_a = buf_a + y * stride; @@ -64,33 +80,54 @@ buffer_diff (unsigned char *buf_a, row = buf_diff + y * stride; for (x = 0; x < width; x++) { - int channel; - unsigned char value_a, value_b; - int pixel_differs = 0; - for (channel = 0; channel < 4; channel++) - { - double diff; - value_a = row_a[x * 4 + channel]; - value_b = row_b[x * 4 + channel]; - if (value_a != value_b) - pixel_differs = 1; - diff = value_a - value_b; - row[x * 4 + channel] = 128 + diff / 3.0; - } - if (pixel_differs) { + /* check if the pixels are the same */ + if ((row_a[x] & mask) != (row_b[x] & mask)) { + int channel; + pixman_bits_t diff_pixel = 0; + + /* calculate a difference value for all 4 channels */ + for (channel = 0; channel < 4; channel++) { + unsigned char value_a = (row_a[x] >> (channel*8)); + unsigned char value_b = (row_b[x] >> (channel*8)); + double diff; + diff = value_a - value_b; + diff_pixel |= (unsigned char)(128 + diff / 3.0) << (channel*8); + } + pixels_changed++; + row[x] = diff_pixel; } else { - row[x*4+0] = 0; - row[x*4+1] = 0; - row[x*4+2] = 0; + row[x] = 0; } - row[x * 4 + 3] = 0xff; /* Set ALPHA to 100% (opaque) */ + row[x] |= 0xff000000; /* Set ALPHA to 100% (opaque) */ } } return pixels_changed; } +int +buffer_diff (unsigned char *buf_a, + unsigned char *buf_b, + unsigned char *buf_diff, + int width, + int height, + int stride) +{ + return buffer_diff_core(buf_a, buf_b, buf_diff, width, height, stride, 0xffffffff); +} + +int +buffer_diff_noalpha (unsigned char *buf_a, + unsigned char *buf_b, + unsigned char *buf_diff, + int width, + int height, + int stride) +{ + return buffer_diff_core(buf_a, buf_b, buf_diff, width, height, stride, 0x00ffffff); +} + /* Image comparison code courtesy of Richard Worth <richard@theworths.org> * Returns number of pixels changed, (or -1 on error). * Also saves a "diff" image intended to visually show where the diff --git a/test/buffer-diff.h b/test/buffer-diff.h index a02834f..2734713 100644 --- a/test/buffer-diff.h +++ b/test/buffer-diff.h @@ -26,7 +26,7 @@ #ifndef BUFFER_DIFF_H #define BUFFER_DIFF_H -/* Returns number of pixels changed, (or -1 on error). +/* Returns number of pixels changed. * Also fills in a "diff" buffer intended to visually show where the * images differ. */ @@ -38,6 +38,18 @@ buffer_diff (unsigned char *buf_a, int height, int stride); +/* Returns number of pixels changed ignoring the alpha channel. + * Also fills in a "diff" buffer intended to visually show where the + * images differ. + */ +int +buffer_diff_noalpha (unsigned char *buf_a, + unsigned char *buf_b, + unsigned char *buf_diff, + int width, + int height, + int stride); + /* Returns number of pixels changed, (or -1 on error). * Also saves a "diff" image intended to visually show where the * images differ. diff --git a/test/cairo-test.c b/test/cairo-test.c index 456d7d8..6759c84 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -1,5 +1,5 @@ /* - * Copyright 2004 Red Hat, Inc. + * Copyright © 2004 Red Hat, Inc. * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without @@ -23,12 +23,19 @@ * Author: Carl D. Worth <cworth@cworth.org> */ +#if HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdio.h> #include <stdlib.h> #include <stdarg.h> +#ifdef HAVE_UNISTD_H #include <unistd.h> +#endif #include <errno.h> #include <string.h> +#include <fontconfig/fontconfig.h> #include "cairo-test.h" @@ -37,6 +44,10 @@ #include "write-png.h" #include "xmalloc.h" +#ifdef _MSC_VER +#define vsnprintf _vsnprintf +#endif + #define CAIRO_TEST_LOG_SUFFIX ".log" #define CAIRO_TEST_PNG_SUFFIX "-out.png" #define CAIRO_TEST_REF_SUFFIX "-ref.png" @@ -469,6 +480,9 @@ cairo_test_for_target (cairo_test_t *test, UNWIND_CAIRO: cairo_destroy (cr); cairo_surface_destroy (surface); + + cairo_debug_reset_static_data (); + target->cleanup_target (target->closure); UNWIND_STRINGS: @@ -557,6 +571,10 @@ cairo_test_expecting (cairo_test_t *test, cairo_test_draw_function_t draw, fclose (cairo_test_log_file); +#if HAVE_FCFINI + FcFini (); +#endif + return ret; } diff --git a/test/cairo-test.h b/test/cairo-test.h index beabc6a..d35faab 100644 --- a/test/cairo-test.h +++ b/test/cairo-test.h @@ -28,6 +28,7 @@ #include <math.h> #include <cairo.h> +#include <cairo-debug.h> typedef enum cairo_test_status { CAIRO_TEST_SUCCESS = 0, diff --git a/test/clip-operator-ref.png b/test/clip-operator-ref.png Binary files differnew file mode 100644 index 0000000..8a0e181 --- /dev/null +++ b/test/clip-operator-ref.png diff --git a/test/clip-operator.c b/test/clip-operator.c new file mode 100644 index 0000000..6cc5216 --- /dev/null +++ b/test/clip-operator.c @@ -0,0 +1,205 @@ +/* + * Copyright © 2005 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Red Hat, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Red Hat, Inc. makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Kristian Høgsberg <krh@redhat.com> + */ + +#include <math.h> +#include "cairo-test.h" +#include <stdio.h> + +#define WIDTH 64 +#define HEIGHT 64 +#define PAD 10 + +const char png_filename[] = "romedalen.png"; + +static void +draw_mask (cairo_t *cr, int x, int y) +{ + cairo_surface_t *mask_surface; + cairo_t *cr2; + + double width = (int)(0.9 * WIDTH); + double height = (int)(0.9 * HEIGHT); + x += 0.05 * WIDTH; + y += 0.05 * HEIGHT; + + mask_surface = cairo_surface_create_similar (cairo_get_target (cr), + CAIRO_CONTENT_ALPHA, + width, height); + cr2 = cairo_create (mask_surface); + + cairo_save (cr2); + cairo_set_source_rgba (cr2, 0, 0, 0, 0); /* transparent */ + cairo_set_operator (cr2, CAIRO_OPERATOR_SOURCE); + cairo_paint (cr2); + cairo_restore (cr2); + + cairo_set_source_rgb (cr2, 1, 1, 1); /* white */ + + cairo_arc (cr2, 0.5 * width, 0.5 * height, 0.45 * height, 0, 2 * M_PI); + cairo_fill (cr2); + + cairo_destroy (cr2); + + cairo_mask_surface (cr, mask_surface, x, y); + + cairo_surface_destroy (mask_surface); +} + +static void +draw_glyphs (cairo_t *cr, int x, int y) +{ + cairo_text_extents_t extents; + + cairo_set_font_size (cr, 0.8 * HEIGHT); + + cairo_text_extents (cr, "FG", &extents); + cairo_move_to (cr, + x + (WIDTH - extents.width) / 2 - extents.x_bearing, + y + (HEIGHT - extents.height) / 2 - extents.y_bearing); + cairo_show_text (cr, "FG"); +} + +static void +draw_polygon (cairo_t *cr, int x, int y) +{ + double width = (int)(0.9 * WIDTH); + double height = (int)(0.9 * HEIGHT); + x += 0.05 * WIDTH; + y += 0.05 * HEIGHT; + + cairo_new_path (cr); + cairo_move_to (cr, x, y); + cairo_line_to (cr, x, y + height); + cairo_line_to (cr, x + width / 2, y + 3 * height / 4); + cairo_line_to (cr, x + width, y + height); + cairo_line_to (cr, x + width, y); + cairo_line_to (cr, x + width / 2, y + height / 4); + cairo_close_path (cr); + cairo_fill (cr); +} + +static void +draw_rects (cairo_t *cr, int x, int y) +{ + double block_width = (int)(0.33 * WIDTH + 0.5); + double block_height = (int)(0.33 * HEIGHT + 0.5); + int i, j; + + for (i = 0; i < 3; i++) + for (j = 0; j < 3; j++) + if ((i + j) % 2 == 0) + cairo_rectangle (cr, + x + block_width * i, y + block_height * j, + block_width, block_height); + + cairo_fill (cr); +} + +static void (*draw_funcs[])(cairo_t *cr, int x, int y) = { + draw_mask, + draw_glyphs, + draw_polygon, + draw_rects +}; + +#define N_OPERATORS (1 + CAIRO_OPERATOR_SATURATE - CAIRO_OPERATOR_CLEAR) + +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) +#define IMAGE_WIDTH (N_OPERATORS * (WIDTH + PAD) + PAD) +#define IMAGE_HEIGHT (ARRAY_SIZE (draw_funcs) * (HEIGHT + PAD) + PAD) + +static cairo_test_t test = { + "clip-operator", + "Surface clipping with different operators", + IMAGE_WIDTH, IMAGE_HEIGHT +}; + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + int j, x, y; + cairo_operator_t op; + cairo_font_options_t *font_options; + cairo_pattern_t *pattern; + + cairo_select_font_face (cr, "Bitstream Vera Sans", + CAIRO_FONT_SLANT_NORMAL, + CAIRO_FONT_WEIGHT_NORMAL); + cairo_set_font_size (cr, 0.9 * HEIGHT); + + font_options = cairo_font_options_create (); + + cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE); + cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY); + + cairo_set_font_options (cr, font_options); + cairo_font_options_destroy (font_options); + + for (j = 0; j < ARRAY_SIZE (draw_funcs); j++) { + for (op = CAIRO_OPERATOR_CLEAR; op <= CAIRO_OPERATOR_SATURATE; op++) { + x = op * (WIDTH + PAD) + PAD; + y = j * (HEIGHT + PAD) + PAD; + + cairo_save (cr); + + pattern = cairo_pattern_create_linear (x + WIDTH, y, + x, y + HEIGHT); + cairo_pattern_add_color_stop_rgba (pattern, 0.2, + 0.0, 0.0, 1.0, 1.0); /* Solid blue */ + cairo_pattern_add_color_stop_rgba (pattern, 0.8, + 0.0, 0.0, 1.0, 0.0); /* Transparent blue */ + cairo_set_source (cr, pattern); + cairo_pattern_destroy (pattern); + + cairo_rectangle (cr, x, y, WIDTH, HEIGHT); + cairo_fill (cr); + + cairo_set_operator (cr, op); + cairo_set_source_rgb (cr, 1.0, 0.0, 0.0); + + cairo_move_to (cr, x, y); + cairo_line_to (cr, x + WIDTH, y); + cairo_line_to (cr, x, y + HEIGHT); + cairo_clip (cr); + + draw_funcs[j] (cr, x, y); + if (cairo_status (cr)) + cairo_test_log ("%d %d HERE!\n", op, j); + + cairo_restore (cr); + } + } + + if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) + cairo_test_log ("%d %d .HERE!\n", op, j); + + return CAIRO_TEST_SUCCESS; +} + +int +main (void) +{ + return cairo_test (&test, draw); +} diff --git a/test/composite-integer-translate-over-repeat.c b/test/composite-integer-translate-over-repeat.c index ed55f63..61a0ea7 100644 --- a/test/composite-integer-translate-over-repeat.c +++ b/test/composite-integer-translate-over-repeat.c @@ -44,7 +44,7 @@ draw (cairo_t *cr, int width, int height) cairo_fill (cr); cairo_translate (cr, OFFSET, OFFSET); - cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); + cairo_set_operator (cr, CAIRO_OPERATOR_OVER); cairo_set_source (cr, pat); cairo_rectangle (cr, 0, 0, SIZE - OFFSET, SIZE - OFFSET); cairo_fill (cr); diff --git a/test/mask-ctm-ref.png b/test/mask-ctm-ref.png Binary files differnew file mode 100644 index 0000000..88a0402 --- /dev/null +++ b/test/mask-ctm-ref.png diff --git a/test/mask-ctm.c b/test/mask-ctm.c new file mode 100644 index 0000000..1fd4828 --- /dev/null +++ b/test/mask-ctm.c @@ -0,0 +1,82 @@ +/* + * Copyright © 2005 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Red Hat, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Red Hat, Inc. makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Carl D. Worth <cworth@cworth.org> + */ + +#include "cairo-test.h" + +cairo_test_t test = { + "mask-ctm", + "Test that cairo_mask is affected properly by the CTM", + 10, 10 +}; + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + cairo_surface_t *mask_surface; + cairo_pattern_t *mask; + unsigned long data[] = { + 0x80000000, 0x80000000, + 0x80000000, 0x80000000, + }; + cairo_matrix_t matrix; + + mask_surface = cairo_image_surface_create_for_data ((unsigned char *) data, + CAIRO_FORMAT_ARGB32, 2, 2, 8); + mask = cairo_pattern_create_for_surface (mask_surface); + cairo_surface_destroy (mask_surface); + + cairo_set_source_rgb (cr, 1.0, 0, 0); + + /* We can translate with the CTM, with the pattern matrix, or with + * both. */ + + /* 1. CTM alone. */ + cairo_save (cr); + { + cairo_translate (cr, 2, 2); + cairo_mask (cr, mask); + } + cairo_restore (cr); + + /* 2. Pattern matrix alone. */ + cairo_matrix_init_translate (&matrix, -4, -4); + cairo_pattern_set_matrix (mask, &matrix); + + cairo_mask (cr, mask); + + /* 3. CTM + pattern matrix */ + cairo_translate (cr, 2, 2); + cairo_mask (cr, mask); + + cairo_pattern_destroy (mask); + + return CAIRO_TEST_SUCCESS; +} + +int +main (void) +{ + return cairo_test (&test, draw); +} diff --git a/test/mask-surface-ctm-ref.png b/test/mask-surface-ctm-ref.png Binary files differnew file mode 100644 index 0000000..744b1dd --- /dev/null +++ b/test/mask-surface-ctm-ref.png diff --git a/test/mask-surface-ctm.c b/test/mask-surface-ctm.c new file mode 100644 index 0000000..6eb2bf2 --- /dev/null +++ b/test/mask-surface-ctm.c @@ -0,0 +1,75 @@ +/* + * Copyright © 2005 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Red Hat, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Red Hat, Inc. makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Carl D. Worth <cworth@cworth.org> + */ + +#include "cairo-test.h" + +cairo_test_t test = { + "mask-surface-ctm", + "Test that cairo_mask_surface is affected properly by the CTM", + 10, 10 +}; + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + cairo_surface_t *mask; + unsigned long data[] = { + 0x80000000, 0x80000000, + 0x80000000, 0x80000000, + }; + + mask = cairo_image_surface_create_for_data ((unsigned char *) data, + CAIRO_FORMAT_ARGB32, 2, 2, 8); + + cairo_set_source_rgb (cr, 1.0, 0, 0); + + /* We can translate with the CTM, with the mask_surface offset, or + * with both. */ + + /* 1. CTM alone. */ + cairo_save (cr); + { + cairo_translate (cr, 2, 2); + cairo_mask_surface (cr, mask, 0, 0); + } + cairo_restore (cr); + + /* 2. Offset alone. */ + cairo_mask_surface (cr, mask, 4, 4); + + /* 3. CTM + offset */ + cairo_translate (cr, 2, 2); + cairo_mask_surface (cr, mask, 4, 4); + + cairo_surface_destroy (mask); + + return CAIRO_TEST_SUCCESS; +} + +int +main (void) +{ + return cairo_test (&test, draw); +} diff --git a/test/read-png.c b/test/read-png.c index 96259df..ff311c2 100644 --- a/test/read-png.c +++ b/test/read-png.c @@ -35,6 +35,18 @@ # include <inttypes.h> #elif HAVE_SYS_INT_TYPES_H # include <sys/int_types.h> +#elif defined(_MSC_VER) + typedef __int8 int8_t; + typedef unsigned __int8 uint8_t; + typedef __int16 int16_t; + typedef unsigned __int16 uint16_t; + typedef __int32 int32_t; + typedef unsigned __int32 uint32_t; + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; +# ifndef HAVE_UINT64_T +# define HAVE_UINT64_T 1 +# endif #else #error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.) #endif @@ -79,7 +91,7 @@ read_png_argb32 (const char *filename, { int i; FILE *file; - static const int PNG_SIG_SIZE = 8; +#define PNG_SIG_SIZE 8 unsigned char png_sig[PNG_SIG_SIZE]; int sig_bytes; png_struct *png; diff --git a/test/source-surface-scale-paint-ref.png b/test/source-surface-scale-paint-ref.png Binary files differindex ec3c059..a81f93d 100644 --- a/test/source-surface-scale-paint-ref.png +++ b/test/source-surface-scale-paint-ref.png diff --git a/test/source-surface-scale-paint.c b/test/source-surface-scale-paint.c index 9862ba5..1af972f 100644 --- a/test/source-surface-scale-paint.c +++ b/test/source-surface-scale-paint.c @@ -28,7 +28,7 @@ cairo_test_t test = { "source-surface-scale-paint", "Test call sequence: cairo_set_source_surface; cairo_scale; cairo_paint", - 12, 12 + 8, 8 }; static cairo_test_status_t @@ -59,6 +59,5 @@ draw (cairo_t *cr, int width, int height) int main (void) { - return cairo_test_expect_failure (&test, draw, - "cairo_set_source needs user space locking semantics"); + return cairo_test (&test, draw); } diff --git a/test/surface-finish-twice.c b/test/surface-finish-twice.c index ce4f065..ad6c0e9 100644 --- a/test/surface-finish-twice.c +++ b/test/surface-finish-twice.c @@ -52,7 +52,6 @@ static cairo_test_status_t draw (cairo_t *cr, int width, int height) { cairo_surface_t *surface; - cairo_status_t status; surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1); diff --git a/test/text-cache-crash.c b/test/text-cache-crash.c index 547e2a3..08e8573 100644 --- a/test/text-cache-crash.c +++ b/test/text-cache-crash.c @@ -118,20 +118,6 @@ main (void) ret = cairo_test (&test, draw); - /* It's convenient to be able to free all memory (including - * statically allocated memory). This makes it quite easy to use - * tools such as valgrind to verify that there are no memory leaks - * whatsoever. - * - * But I'm not sure what would be a sensible cairo API function - * for this. The cairo_destroy_caches call below is just something - * I made as a local modification to cairo. - */ - /* - cairo_destroy_caches (); - FcFini (); - */ - return ret; } diff --git a/test/unantialiased-shapes-ref.png b/test/unantialiased-shapes-ref.png Binary files differnew file mode 100644 index 0000000..b948592 --- /dev/null +++ b/test/unantialiased-shapes-ref.png diff --git a/test/unantialiased-shapes.c b/test/unantialiased-shapes.c new file mode 100644 index 0000000..eaadf41 --- /dev/null +++ b/test/unantialiased-shapes.c @@ -0,0 +1,103 @@ +/* + * Copyright © 2005 Billy Biggs + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Billy Biggs not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Billy Biggs makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * BILLY BIGGS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL BILLY BIGGS BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Author: Billy Biggs <vektor@dumbterm.net> + */ + +#include "cairo-test.h" + +cairo_test_t test = { + "unantialiased-shapes", + "Test shape drawing without antialiasing", + 320, 240 +}; + +/* The star shape from the SVG test suite, from the fill rule test */ +static void +big_star_path (cairo_t *cr) +{ + cairo_move_to (cr, 40, 0); + cairo_rel_line_to (cr, 25, 80); + cairo_rel_line_to (cr, -65, -50); + cairo_rel_line_to (cr, 80, 0); + cairo_rel_line_to (cr, -65, 50); + cairo_close_path (cr); +} + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + int i; + + cairo_set_source_rgb (cr, 0, 0, 0); + cairo_paint (cr); + + cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE); + + /* Try a circle */ + cairo_arc (cr, 40, 40, 20, 0, 2 * M_PI); + cairo_set_source_rgb (cr, 1, 0, 0); + cairo_fill (cr); + + /* Try using clipping to draw a circle */ + cairo_arc (cr, 100, 40, 20, 0, 2 * M_PI); + cairo_clip (cr); + cairo_rectangle (cr, 80, 20, 40, 40); + cairo_set_source_rgb (cr, 0, 0, 1); + cairo_fill (cr); + + /* Reset the clipping */ + cairo_reset_clip (cr); + + /* Draw a bunch of lines */ + cairo_set_line_width (cr, 1.0); + cairo_set_source_rgb (cr, 0, 1, 0); + for (i = 0; i < 10; i++) { + cairo_move_to (cr, 10, 70 + (i * 4)); + cairo_line_to (cr, 120, 70 + (i * 18)); + cairo_stroke (cr); + } + + /* Try filling a poly */ + cairo_translate (cr, 160, 120); + cairo_set_source_rgb (cr, 1, 1, 0); + big_star_path (cr); + cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD); + cairo_fill (cr); + cairo_translate (cr, -160, -120); + + /* How about some curves? */ + cairo_set_source_rgb (cr, 1, 0, 1); + for (i = 0; i < 10; i++) { + cairo_move_to (cr, 150, 50 + (i * 5)); + cairo_curve_to (cr, 250, 50, 200, (i * 10), 300, 50 + (i * 10)); + cairo_stroke (cr); + } + + return CAIRO_TEST_SUCCESS; +} + +int +main (void) +{ + return cairo_test (&test, draw); +} diff --git a/test/unbounded-operator-ref.png b/test/unbounded-operator-ref.png Binary files differnew file mode 100644 index 0000000..7e3b3a0 --- /dev/null +++ b/test/unbounded-operator-ref.png diff --git a/test/unbounded-operator.c b/test/unbounded-operator.c new file mode 100644 index 0000000..45535b9 --- /dev/null +++ b/test/unbounded-operator.c @@ -0,0 +1,201 @@ +/* + * Copyright © 2005 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of + * Red Hat, Inc. not be used in advertising or publicity pertaining to + * distribution of the software without specific, written prior + * permission. Red Hat, Inc. makes no representations about the + * suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Authors: Kristian Høgsberg <krh@redhat.com> + * Owen Taylor <otaylor@redhat.com> + */ + +#include <math.h> +#include "cairo-test.h" +#include <stdio.h> + +#define WIDTH 64 +#define HEIGHT 64 +#define PAD 10 + +static void +draw_mask (cairo_t *cr, int x, int y) +{ + cairo_surface_t *mask_surface; + cairo_t *cr2; + + double width = (int)(0.9 * WIDTH); + double height = (int)(0.9 * HEIGHT); + x += 0.05 * WIDTH; + y += 0.05 * HEIGHT; + + mask_surface = cairo_surface_create_similar (cairo_get_target (cr), + CAIRO_CONTENT_ALPHA, + width, height); + cr2 = cairo_create (mask_surface); + + cairo_save (cr2); + cairo_set_source_rgba (cr2, 0, 0, 0, 0); /* transparent */ + cairo_set_operator (cr2, CAIRO_OPERATOR_SOURCE); + cairo_paint (cr2); + cairo_restore (cr2); + + cairo_set_source_rgb (cr2, 1, 1, 1); /* white */ + + cairo_arc (cr2, 0.5 * width, 0.5 * height, 0.45 * height, 0, 2 * M_PI); + cairo_fill (cr2); + + cairo_destroy (cr2); + + cairo_mask_surface (cr, mask_surface, x, y); + + cairo_surface_destroy (mask_surface); +} + +static void +draw_glyphs (cairo_t *cr, int x, int y) +{ + cairo_text_extents_t extents; + + cairo_set_font_size (cr, 0.8 * HEIGHT); + + cairo_text_extents (cr, "FG", &extents); + cairo_move_to (cr, + x + (WIDTH - extents.width) / 2 - extents.x_bearing, + y + (HEIGHT - extents.height) / 2 - extents.y_bearing); + cairo_show_text (cr, "FG"); +} + +static void +draw_polygon (cairo_t *cr, int x, int y) +{ + double width = (int)(0.9 * WIDTH); + double height = (int)(0.9 * HEIGHT); + x += 0.05 * WIDTH; + y += 0.05 * HEIGHT; + + cairo_new_path (cr); + cairo_move_to (cr, x, y); + cairo_line_to (cr, x, y + height); + cairo_line_to (cr, x + width / 2, y + 3 * height / 4); + cairo_line_to (cr, x + width, y + height); + cairo_line_to (cr, x + width, y); + cairo_line_to (cr, x + width / 2, y + height / 4); + cairo_close_path (cr); + cairo_fill (cr); +} + +static void +draw_rects (cairo_t *cr, int x, int y) +{ + double block_width = (int)(0.33 * WIDTH + 0.5); + double block_height = (int)(0.33 * HEIGHT + 0.5); + int i, j; + + for (i = 0; i < 3; i++) + for (j = 0; j < 3; j++) + if ((i + j) % 2 == 0) + cairo_rectangle (cr, + x + block_width * i, y + block_height * j, + block_width, block_height); + + cairo_fill (cr); +} + +static void (*draw_funcs[])(cairo_t *cr, int x, int y) = { + draw_mask, + draw_glyphs, + draw_polygon, + draw_rects +}; + +static cairo_operator_t operators[] = { + CAIRO_OPERATOR_CLEAR, CAIRO_OPERATOR_SOURCE, CAIRO_OPERATOR_IN, + CAIRO_OPERATOR_OUT, CAIRO_OPERATOR_DEST_IN, CAIRO_OPERATOR_DEST_ATOP +}; + +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) +#define IMAGE_WIDTH (ARRAY_SIZE (operators) * (WIDTH + PAD) + PAD) +#define IMAGE_HEIGHT (ARRAY_SIZE (draw_funcs) * (HEIGHT + PAD) + PAD) + +static cairo_test_t test = { + "unbounded-operator", + "Operators with an effect for transparent source/mask", + IMAGE_WIDTH, IMAGE_HEIGHT +}; + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + int i, j, x, y; + cairo_font_options_t *font_options; + cairo_pattern_t *pattern; + + cairo_select_font_face (cr, "Bitstream Vera Sans", + CAIRO_FONT_SLANT_NORMAL, + CAIRO_FONT_WEIGHT_NORMAL); + + font_options = cairo_font_options_create (); + + cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE); + cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY); + + cairo_set_font_options (cr, font_options); + cairo_font_options_destroy (font_options); + + for (j = 0; j < ARRAY_SIZE (draw_funcs); j++) { + for (i = 0; i < ARRAY_SIZE (operators); i++) { + x = i * (WIDTH + PAD) + PAD; + y = j * (HEIGHT + PAD) + PAD; + + cairo_save (cr); + + pattern = cairo_pattern_create_linear (x + WIDTH, y, + x, y + HEIGHT); + cairo_pattern_add_color_stop_rgba (pattern, 0.2, + 0.0, 0.0, 1.0, 1.0); /* Solid blue */ + cairo_pattern_add_color_stop_rgba (pattern, 0.8, + 0.0, 0.0, 1.0, 0.0); /* Transparent blue */ + cairo_set_source (cr, pattern); + cairo_pattern_destroy (pattern); + + cairo_rectangle (cr, x, y, WIDTH, HEIGHT); + cairo_fill_preserve (cr); + cairo_clip (cr); + + cairo_set_operator (cr, operators[i]); + cairo_set_source_rgb (cr, 1.0, 0.0, 0.0); + + draw_funcs[j] (cr, x, y); + if (cairo_status (cr)) + cairo_test_log ("%d %d HERE!\n", i, j); + + cairo_restore (cr); + } + } + + if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) + cairo_test_log ("%d %d .HERE!\n", i, j); + + return CAIRO_TEST_SUCCESS; +} + +int +main (void) +{ + return cairo_test (&test, draw); +} diff --git a/test/xlib-surface.c b/test/xlib-surface.c index 2921eb8..0df5514 100644 --- a/test/xlib-surface.c +++ b/test/xlib-surface.c @@ -155,19 +155,19 @@ do_test (Display *dpy, if (offscreen) { size_t offset = 4 * (SIZE * OFFSCREEN_OFFSET + OFFSCREEN_OFFSET); - result = !buffer_diff (reference_data + offset, - test_data + offset, - diff_data + offset, - SIZE - OFFSCREEN_OFFSET, - SIZE - OFFSCREEN_OFFSET, - 4 * SIZE); + result = !buffer_diff_noalpha (reference_data + offset, + test_data + offset, + diff_data + offset, + SIZE - OFFSCREEN_OFFSET, + SIZE - OFFSCREEN_OFFSET, + 4 * SIZE); } else { - result = !buffer_diff (reference_data, - test_data, - diff_data, - SIZE, - SIZE, - 4 * SIZE); + result = !buffer_diff_noalpha (reference_data, + test_data, + diff_data, + SIZE, + SIZE, + 4 * SIZE); } fprintf (log_file, "xlib-surface: %s, %s, %s%s: %s\n", @@ -267,6 +267,8 @@ main (void) XCloseDisplay (dpy); + cairo_debug_reset_static_data (); + fclose (log_file); return result; |