summaryrefslogtreecommitdiff
path: root/src/cairo-gstate-private.h
Commit message (Collapse)AuthorAgeFilesLines
* Added hairline support to cairoRick Yorgason2021-08-151-0/+6
|
* Add tag functions to cairo_t and cairo_surface_tAdrian Johnson2016-10-011-0/+9
| | | | | | | | The cairo_tag_begin/cairo_tag_end API is for supporting hyperlinks and creating tagged PDF files. The source, ctm, and stroke style are passed to the backend to allow these parameters to be used to specify hyperlink border attributes.
* context: Add missing functions to transform between user and backend coordinatesChris Wilson2012-09-101-0/+10
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* default-context: Convert the relative path segments into the backend coordinatesChris Wilson2012-09-041-0/+10
| | | | | | | | | | | When transforming the incoming paths, the goal is to transform them from user space onto the target coordinate system. Currently for relative paths we used user_to_device_distance as we presumed that there was no backend scale factor. However, Alex Larsson noticed that these then broke when playing around with such a device transform... Reported-by: Alexander Larsson <alexl@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* clip: Rudimentary support for clip-polygon extractionChris Wilson2011-07-191-1/+1
| | | | | | | Step 1, fix the failings sighted recently by tracking clip-boxes as an explicit property of the clipping and of composition. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Implement cairo_backend_tChris Wilson2011-07-151-21/+18
| | | | | | | | | | Allow a backend to completely reimplement the Cairo API as it wants. The goal is to pass operations to the native backends such as Quartz, Direct2D, Qt, Skia, OpenVG with no overhead. And to permit complete logging contexts, and whatever else the imagination holds. Perhaps to experiment with double-paths? Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Remove unused function declarationsAndrea Canciani2011-03-191-8/+0
| | | | These functions have no implementation and are never called.
* Make cairo_set_font_size() a wrapper of cairo_set_font_matrix()Andrea Canciani2011-03-181-4/+0
| | | | | | | | cairo_set_font_size() should be equivalent to setting the font matrix to an appropriate scale matrix. Implementing it this way saves some code and makes sure that the same code path is used whenever the font matrix is changed.
* gstate: Remove unused codeAndrea Canciani2011-01-221-6/+0
| | | | | | | | | | | | | | | _cairo_gstate_redirect_target asserts that this surface is NULL immediately before destroying it. If the code is compiled with assertions disabled and the assert would be false, it is now safer because instead of an invalid access it will only memleak. _cairo_gstate_get_parent_target () is not used anymore in cairo_pop_group () and the related code can be removed. _cairo_gstate_is_redirected () has never been used. The comment about the clipping is misleading, because the clip is translated as expected since fb7f7c2f27f0823d7702f960204d6e638d697624.
* gstate: Set an error status when restoring a push_groupAndrea Canciani2011-01-221-0/+3
| | | | | | | cairo_push_group (cr) followed by cairo_restore (cr) should put cr in an error status of CAIRO_STATUS_INVALID_RESTORE. Fixes group-state.
* gstate: Update cached matrix state after device transform changes on the targetChris Wilson2010-06-111-0/+3
| | | | | | | | | | | | Commit 8d67186cb291cb877e52b987e2ac18c2a1175a57 caches whether the device transform is identity on context creation. However, the api is quite lax and allows the user to modify the device transform *after* he has started to use the surface in a context, as apparently WebKit does. Since this is not the only instance where we may need to invalidate caches if the user modifies state, introduce a simple mechanism for hooking into notifications of property changes. Fixes test/clip-device-offset.
* gstate: Track whether the combination of ctm * device is identity.Chris Wilson2010-06-101-0/+310
| | | | | | In the fairly common condition that both the ctm and the device transforms are identity, the function overhead of calling the matrix multiplication on the point overwhelmingly dominates.
* Update FSF addressAndrea Canciani2010-04-271-1/+1
| | | | | | | | | | | I updated the Free Software Foundation address using the following script. for i in $(git grep Temple | cut -d: -f1 ) do sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i" done Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
* [cairo] Track the MRU scaled fontChris Wilson2009-06-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | When observing applications two patterns emerge. The first is due to Pango, which wraps each glyph run within a context save/restore. This causes the scaled font to be evicted after every run and reloaded on the next. This is caught by the MRU slot on the cairo_scaled_font_map and prevents a relatively costly traversal of the hash table and holdovers. The second pattern is by applications that directly manage the rendering of their own glyphs. The prime example of this is gnome-terminal/vte. Here the application frequently alternates between a few scaled fonts - which requires a hash table retrieval every time. By introducing a MRU slot on the gstate we are able to directly recover the scaled font around 90% of the time. Of 110,000 set-scaled-fonts: 4,000 were setting the current font 96,000 were setting to the previous font 2,500 were recovered from the MRU on the cairo_scaled_font_map 7,500 needed a hash retrieval which compares to ~106,000 hash lookups without the additional MRU slot on the gstate. This translates to an elapsed time saving of ~5% when replaying a gnome-terminal trace using the drm backend.
* Remove include of cairoint.h from *-private.h header files.Carl Worth2007-08-231-1/+0
| | | | | | | | | | | | These were recently added, (as part of sparse integration?), but they break boilerplate which reaches into at least cairo-types-private.h and cairo-scaled-font-private.h. But boilerplate cannot see cairoint.h or else it gets the internal sybol renaming, (with the INT_ prefix), and then all the test suite tests refuse to link. If this change reverts some recently-added functionality, (or cleanliness), then we'll just need to find some other way to add that back again without the breakage.
* [Makefile.am] Add target sparse to run sparse static source code analyzerBehdad Esfahbod2007-08-221-0/+1
| | | | There are still some bits not quite working.
* Remove extraneous whitespace from "blank" lines.Carl Worth2006-06-061-1/+1
| | | | | | | | This patch was produced with the following (GNU) sed script: sed -i -r -e 's/^[ \t]+$//' run on all *.[ch] files within cairo.
* Implement push_group/pop_groupVladimir Vukicevic2006-05-041-1/+3
| | | | | | | | | | | | | | | | This patch adds the following API calls: cairo_push_group cairo_push_group_with_content cairo_pop_group cairo_pop_group_to_source cairo_get_group_target These methods support implementing layers on top of a cairo context, allowing for drawing with transparency and temporary buffering. cairo_get_group_target allows an app to get access to the actual surface created by the last push_group call, in case itneeds to perform native drawing to it.
* Globally rename "operator" to "op", to allow writing backends in C++Christian Biesinger2005-12-161-1/+1
| | | | reviewed by: cworth
* Rework support in the surface backend for the five basic drawing operations ↵Carl Worth2005-11-041-9/+1
| | | | | | | | | (paint, mask, stroke, fill, and show_glyphs). Now, all 5 operations have backend functions, and all use a consistent convention for argument naming and ordering. The old fill_path has been replaced with a new fill. The old show_glyphs function was recently renamed to old_show_glyphs and has not yet been ported to the new show_glyphs, (so all backends have a NULL show_glyphs function). In fact, of the 5 new backend functions, fill is the only one that has an implementation in any backend. As part of this cleanup a new cairo_stroke_style_t object is introduced to capture the many settings unique to the stroke operation, (line_width, line_cap, line_join, miter_limit, dash, num_dashes, and dash_offset). Track changes in surface backend from fill_path to fill. Track the new canonical argument naming and ordering for the 5 drawing operations. Move various stroke style settings into new cairo_stroke_style_t. Drop NULL fill_path backend function which no longer exists.
* Originally 2005-10-28 Keith Packard <keithp@keithp.com>:Carl Worth2005-10-311-2/+0
| | | | | | | Remove pen_regular field from the gstate. Move stroke fallback from gstate to surface where it belongs. Eliminate dependence on cairo_gstate_t object. Fix to include just cairo-clip-private.h rather than cairo-gstate.private.h.
* Add device_x_scale and device_y_scale to surface so that the coordinate ↵Keith Packard2005-08-241-2/+2
| | | | | | | | system seen by the backend can differ from the nominal device coordinate space used by the application. Useful for printer backends where the device coordinate space should be in pixels while the user visible device space is in points. There is no API to set these values; the backends using this functionality should do that themselves before the first cairo_t is created. reviewed by: cworth
* Add a new API for disabling antialiasing of shapes drawn by cairo. This is a ↵Billy Biggs2005-08-081-0/+1
| | | | | | | | | | | | | | | | | hint and is not supported by all backends. Store the antialiasing mode in the gstate and pass it to the backend for trapezoid rendering and for clipping. Pass the antialiasing parameter down to the backend where appropriate. Pass the antialiasing parameter down to the backend where appropriate. Add support for A1 format trapezoid rendering, and remove the _create_mask_image function, creating a temporary image from memory we allocate and clear. Support A1 masks to disable antialiasing using the RENDER extension when requested. Support A1 masks to disable antialiasing using the RENDER extension when requested. Blindly pass through the antialising parameter. Add the antialiasing parameter but don't support it. Add a test case and a reference image from the latest libpixman. Add the new antialiasing disabling API to the docs. Update progress on a parameter to disable antialiasing. reviewed by: cworth, otaylor
* New files. Move code for manipulating cairo_clip_t out into cairo_clip_* ↵Kristian Høgsberg2005-08-041-40/+1
| | | | | | | | | | | functions and put them in cairo-clip.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. Use new cairo_clip_t function to maintain clip state while replaying. Pass fill rule and tolerance directly, to break gstate dependency. New function. Set the clip for a surface as specified by the cairo_clip_t. Move translate_traps() from cairo-gstate.c to here and rename it. Reviewed by: otaylor
* src/cairo-gstate.c src/cairo-gstate-private.h: Store the inverse CTM at the ↵Owen Taylor2005-08-011-0/+1
| | | | | | | | | | time of cairo_gstate_set_source() to "lock" the user space matrix. Move the source pattern transformation to the outside of _cairo_gstate_clip_and_composite_trapezoids() instead of doing it at the leaves. Change size of output surface for aesthetics. Updated to correspond to the current definition. Remove source-surface-scale-paint. reviewed by: cworth
* src/cairo.[ch] src/cairo-gstate-private.h src/cairo-gstate.c src/cairoint.c: ↵Owen Taylor2005-07-251-0/+1
| | | | | | | | Add cairo_{get,set}_font_options(). Add cairo-xlib-private.h Update reviewed by: cworth
* Implement path clipping and refactor _cairo_gstate_clip() out in three ↵Kristian Høgsberg2005-06-141-1/+15
| | | | | | | different functions corresponding to the three different clipping modes. Add NULL pointers for intersect_clip_path. New test case to exercise PDF clipping code.
* Fix Freudian unwrapped line in paragraph describing why long lines should be ↵Carl Worth2005-06-031-1/+0
| | | | wrapped.
* Rename gstate->surface to gstate->target. No intended changes in functionality.Carl Worth2005-06-011-1/+1
|
* Remove unused fields from cairo_gstate_t, (font_family, font_slant, ↵Carl Worth2005-06-011-9/+5
| | | | font_weight). Reorder fields to match between declaration and initialization and to put the most problematic fields (surface and source) at the end. No intended changes in functionality.
* Replace nesting-only surface clipping with gstate contained serial-number ↵Keith Packard2005-05-261-2/+28
| | | | | | | | | | | | | | | | tracked clipping sets that are loaded into the surface on demand just before each rendering operation. This permits multiple cairo_t contexts to reference a surface without regard to ordering of operations among the contexts. Also in this patch is a change to the xlib surface that creates two separate Pictures, one for source and one for destination operands which separates the source clipping from destination clipping. Cairo now specifies that sources are never clipped by any clipping applied to them as destinations. Move cairo_clip_t (renamed from cairo_clip_rec_t) from cairoint.h to cairo-gstate-private.h. Eliminate stack of clip state from surfaces. Add new surface clipping API. Manage clip objects entirely within the gstate, loading the whole thing into the surface just before drawing. Source surfaces need not have clipping modified as the surface interface now specifies that source surfaces are always unclipped. Eliminate nested clipping contexts, leaving clip management entirely to the gstate. Create new clip API for the gstate which uses per-surface serial numbers to match gstate clipping against current surface clipping values. Surfaces no longer track clipping regions at all, so the old _cairo_surface_get_clip_extents has been replaced with _cairo_surface_get_extents. For PDF/PS surfaces, this function is expected to return a rectangle covering the entire fixed point coordinate space to leave rendering unclipped by the surface. Region clipping capability is now signalled by a non-NULL function pointer in set_clip_region. Each surface now contains two Pictures, one for source and one for destination operands so that source operands are never clipped by destination clipping. CAIRO_STATUS_BAD_NESTING removed self-copy now passes (Xlib only, until libpixman changes land) reviewed by: krh, otaylor, cworth
* src/cairo-surface.c src/cairoint.h: Add _cairo_surface_begin/end to save and ↵Owen Taylor2005-05-021-0/+1
| | | | | | | | | | | | restore the clip state of a surface. Copy and store clip regions set on a surface so that we can save and restore them. Add a CAIRO_STATUS_BAD_NESTING error for interleaved use of two cairo_t's on the same surface. Also, add a skeleton doc comment for cairo_status_t. src/cairo.c src/cairo-gstate.c src/cairoint.h: Use _cairo_surface_begin/end to replace _cairo_gstate_restore_external_state. Use _cairo_surface_begin/end to save the state of a surface when we start drawing at it and restore it at the end. Check that the save level of the surface is what we expect on drawing operations and fail with CAIRO_STATUS_BAD_NESTING otherwise. src/cairo-pattern.c src/cairoint.h (_cairo_pattern_acquire_surface_for_surface) (_cairo_pattern_release_surface): Surround use of pattern->surface with _cairo_surface->begin/end so we don't clip surfaces used as sources. test/clip-nesting.c test/Makefile.am: Test of destinatin clipping with the nested creation of cairo_t's for the same context. test/source-clip.c test/Makefile.am: Test that clipping on a source as a destination doesn't affect use of it as a source. XFAIL test for copying from a surface as a source to itself as a destination with a clip.
* Originally: 2005-04-19 Carl Worth <cworth@cworth.org>Carl Worth2005-04-261-4/+0
| | | | | | | | | | | | | Add cairo_stroke_preserve, cairo_fill_preserve, and cairo_clip_preserve. Rip the path out of cairo_gstate_t. Add path to cairo_t. Bring in most of the path code that used to live in cairo-gstate.c Move arc generation code into its own file. Accept path+ctm_inverse+tolerance instead of gstate. Absorb flattening and device space->user space conversion that used to be in _cairo_gstate_intepret_path. Prefer cairo_fixed_t parameters over ciaro_point_t for cross-file interfaces. Track changes in _cairo_path_fixed interfaces. Port to use cairo_fill_preserve rather than cairo_save/cairo_restore which no longer work for saving the path. Remove get and set of current point since it is no longer affected by cairo_save and cairo_restore. Add get and set testing for cairo_matrix_t.
* and delete:Carl Worth2005-04-141-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | cairo_set_pattern -> cairo_set_source cairo_get_pattern -> cairo_get_source cairo_set_rgb_color -> cairo_set_source_rgb -> cairo_set_source_rgba cairo_set_alpha -> cairo_get_alpha -> Note that we'll likely want to add cairo_set_source_surface. Add _cairo_stock_color helper function. Improve some interfaces: _cairo_color_init _cairo_color_init_rgb _cairo_color_set_rgb -> _cairo_color_init_rgba _cairo_color_set_alpha _cairo_color_multiply_alpha _cairo_color_get_rgb -> _cairo_color_get_rbga _cairo_color_get_rgba_premultiplied Add cairo_stock_t and some helper macros: CAIRO_COLOR_WHITE CAIRO_COLOR_BLACK CAIRO_COLOR_TRANSPARENT Fix cairo_pattern_t by eliminating pattern->alpha. Fix cairo_solid_pattern_t to use cairo_color_t rather than three doubles. Track removal of pattern->alpha, simplifying the code considerably Track _cairo_color interface changes. Remove gstate->alpha. Propagate down set_source renamings. cairo_pattern_add_color_stop -> cairo_pattern_add_color_stop_rgba and add: cairo_pattern_add_color_stop_rgb Remove pattern->alpha, simplifying the code considerably. Track pattern and color interface changes. Add const where appropriate on cairo_color_t*. Add private type inspection predicate. (cairo_xlib_surface_set_size): Add check for surface type mismatch, (no useful error reporting yet, though). Note coverage as en expected failure. Improve line wrap on expected failure messages. Port all tests to new cairo_set_source interfaces.
* src/cairo.h src/cairo-gstate.c src/cairo-font.c: Add a cairo_font_face_t ↵Owen Taylor2005-04-071-1/+2
| | | | | | | | | | | | | | | type to hold a description of a font face. Replace cairo_set_font() with cairo_set_font_face(). src/cairoint.h src/cairo-font.c src/cairo-gstate.c: Add "cairo_simple_font_face" for family/weight/slant and use it to implement font naming for the toy API. src/cairo-ft.h src/cairo-ft-font.c cairo-win32.h cairo-win32-font.c: Switch the FreeType and Win32 backends over to using cairo_font_face_t. src/cairo.h src/cairo-font.c src/cairo-ft-font.c src/cairo-win32-font.c: Pass in font matrix and CTM separately rather than as a composite scale when creating fonts; allows removing font_matrix argument to metrics functions. src/cairoint.h src/cairo-font.c src/cairo-ft-font.c src/cairo-win32-font.c: Remove cairo_font_scale_t type, just use cairo_matrix_t and ignore translations. src/cairo-ft.h src/cairo-ft-font.c: Remove cairo_ft_font_get_pattern() -- it can't work for all FreeType backend fonts and doesn't seem particularly useful. Rename cairo_font_get_extents() to cairo_font_extents() split font functions into a separate section. Fix locking order problem. Add caches for simple font faces and from cairo_font_face_t to cairo_scaled_font_t. src/cairo.h src/cairoint.h src/cairo-font.c src/cairo-win32-font.c src/cairo-ft-font.c src/cairo-gstate.c src/cairo-gstate-private.h: Rename cairo_font_t to cairo_scaled_font_t.
* Drop cairo_default_matrix since it is now always identical to ↵Carl Worth2005-04-041-2/+0
| | | | | | | cairo_identity_matrix. Remove gstate->pixels_per inch. Change default matrix to always be the identity matrix. Drop pixels_per_inch function from surface backend interface as it is no longer needed.
* Rename cairo_path_real_t to cairo_path_fixed_t and fix all _cairo_path ↵Carl Worth2005-03-231-1/+1
| | | | | | functions to be named as _cairo_path_fixed functions. Track name change of cairo_path_real_t and _cairo_path_fixed functions.
* Begin the process of breaking up cairoint.h, moving structure definitions of ↵Carl Worth2005-03-231-0/+85
cairo_t, cairo_gstate_t, and cairo_path_real_t into their own header files. Track changes to header files, reaching into the new private headers where necessary.