summaryrefslogtreecommitdiff
path: root/src/cairo.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'doc-fixes' into 'master'Adrian Johnson2023-02-081-15/+11
|\ | | | | | | | | More random doc fixes See merge request cairo/cairo!437
| * doc: Fix internal linksKhaled Hosny2023-02-021-2/+2
| |
| * doc: Don’t mention non-existent cairo_stroke_to_path()Khaled Hosny2023-02-021-13/+9
| | | | | | | | The code for it is commented out and unimplemented.
* | Fix -Wparentheses-equality warningsKhaled Hosny2023-02-041-1/+1
|/ | | | warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
* svg-font: return SVG_FONT_ERROR on errorAdrian Johnson2023-01-201-1/+2
|
* Integrate COLR v1 renderer with cairo-ft-font.cAdrian Johnson2023-01-081-0/+2
|
* Add some missing slim_hidden entriesAdrian Johnson2022-12-281-0/+17
|
* Document whether colors are premultipliedMatthias Clasen2022-12-241-0/+2
| | | | | | For the various APIs that take or return RGBA colors, make it explicit that they are unpremultiplied.
* dwrite: add color font supportAdrian Johnson2022-02-271-2/+2
|
* Added hairline support to cairoRick Yorgason2021-08-151-0/+61
|
* doc: fix link tags code exampleAdrian Johnson2018-10-241-18/+17
| | | | The old code did not work.
* Use HTTPS URLs for cairographics.org domainsPaul Menzel2018-10-161-3/+3
| | | | | | | | Run the command below suggested by geirha in ##sed@irc.freenode.net. git grep -l 'http://.*cairographics.org' | xargs sed -i 's|http\(://\([[:alnum:].-]*\.\)\{0,1\}cairographics\.org\)|https\1|g' Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
* Cairo trivial typosUnknown2018-04-021-3/+3
| | | | | | | | | | | | | Found using `codespell -q 3 -I cairo-whitelist.txt` whereby whitelist contained: ``` amin iff lod writen ``` Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* Fix various doxygen warnings found by check-doc-syntax.shBryce Harrington2017-12-071-3/+1
| | | | | | | | | | | | | | | | ./cairo-clip-boxes.c (268): ERROR: copy invalid doc id (should be 'cairo_...:') ./cairo-clip-boxes.c (274): ERROR: copy bad line: ' */' ./cairo-clip-boxes.c (274): ERROR: copy documentation comment not closed with **/ ./cairo-boxes.c (106): ERROR: Computes invalid doc id (should be 'cairo_...:') ./cairo-boxes.c (114): ERROR: Computes bad line: ' */' ./cairo-boxes.c (114): ERROR: Computes documentation comment not closed with **/ ./cairo-boxes.c (279): ERROR: Computes invalid doc id (should be 'cairo_...:') ./cairo-boxes.c (284): ERROR: Computes bad line: ' */' ./cairo-boxes.c (284): ERROR: Computes documentation comment not closed with **/ ./cairo-boxes.c (338): ERROR: Linearize invalid doc id (should be 'cairo_...:') ./cairo-boxes.c (345): ERROR: Linearize documentation comment not closed with **/ ./cairo.c (240): ERROR: SECTION:cairo-tag bad line: '' ./cairo.c (892): ERROR: cairo_set_source_rgb: Duplicate 'Since' field
* Un-doxygen disabled cairo_set_opacityBryce Harrington2017-11-061-2/+2
| | | | | | | | | | | | The cairo_set_opacity() routine has been disabled since 2010. There appears to be support for it internally in the backend, so it is unclear why it is not enabled or what might break if it were re-enabled. Given the lack of bug reports about its omission, it may be vestigal. For now, just hide the doxygen for it to suppress warnings. It may be worth deeper review to either re-enable it or remove it entirely. Reported-by: Rafał Mużyło (See fdo bugzilla #82741) Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
* pdf: fix link positionsAdrian Johnson2017-08-261-3/+4
| | | | | | | | | | | | | | | Converting the link position from cairo to pdf coordinates requires the page height. Since the link may point to a different page, build an array of the height of each page and use the target page height for the conversion. Don't default to a [0,0] position if "pos" is not specified. PDF allows a null destination position to be specified which means don't change the position if the page is already displayed or show top left if switching to a different page. This is more useful default particularly for external files where the coordinates (which must be in PDF coordinates as we don't know the page height) of the top left corner may not be known.
* Fix grammar in cairo_*_reference() function documentation.Bryce Harrington2016-10-101-2/+2
| | | | | | | "can be get" is incorrect grammar; "can be gotten" would be better, but active voice is best. Signed-off-by: Bryce Harrington <bryce@bryceharrington.org>
* pdf: structured text and hyperlink supportAdrian Johnson2016-10-011-1/+261
|
* Add tag functions to cairo_t and cairo_surface_tAdrian Johnson2016-10-011-0/+49
| | | | | | | | 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.
* Add CAIRO_STATUS_WIN32_GDI_ERROR for GDI errorsAdrian Johnson2016-03-261-1/+2
|
* Add CAIRO_STATUS_FREETYPE_ERROR for errors returned by libfreetypeAdrian Johnson2016-03-261-1/+2
|
* Add CAIRO_STATUS_PNG_ERROR for errors returned by libpngAdrian Johnson2016-03-261-1/+2
|
* cairo_create(): Add finished surface checkKouhei Sutou2013-10-311-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Without this change, the following program crashes: #include <cairo.h> #include <cairo-svg.h> int main(int argc, char **argv) { cairo_t *cr; cairo_surface_t *finished_surface; finished_surface = cairo_svg_surface_create ("/tmp/xxx.svg", 1.0, 1.0); cairo_surface_finish (finished_surface); cr = cairo_create (finished_surface); cairo_destroy (cr); cairo_surface_destroy (finished_surface); return 0; } Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
* pdf: support JBIG2 mime dataAdrian Johnson2013-09-151-1/+3
| | | | | | | | | | JBIG2 images may have shared global data that is stored in a separate stream in PDF. The CAIRO_MIME_TYPE_JBIG2 mime type is for the JBIG2 data for each image. All images that use global data must also set CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID to a unique identifier. One of the images must also set CAIRO_MIME_TYPE_JBIG2_GLOBAL to the global data. The global data will be shared by all JBIG2 images with the same CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID.
* Satisfy check-doc-syntax.awk for unimplemented functionsChris Wilson2012-04-291-0/+4
| | | | | | | ./cairo.c (634): ERROR: cairo_set_opacity: missing 'Since' field ./cairo.c (3578): ERROR: cairo_get_opacity: missing 'Since' field Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* doc: Add "since" tag to documentationAndrea Canciani2012-03-291-0/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following Python script was used to compute "Since: 1.X" tags, based on the first version where a symbol became officially supported. This script requires a concatenation of the the cairo public headers for the officially supported beckends to be available as "../../includes/1.X.0.h". from sys import argv import re syms = {} def stripcomments(text): def replacer(match): s = match.group(0) if s.startswith('/'): return "" else: return s pattern = re.compile( r'//.*?$|/\*.*?\*/|\'(?:\\.|[^\\\'])*\'|"(?:\\.|[^\\"])*"', re.DOTALL | re.MULTILINE ) return re.sub(pattern, replacer, text) for minor in range(12,-2,-2): version = "1.%d" % minor names = re.split('([A-Za-z0-9_]+)', stripcomments(open("../../includes/%s.0.h" % version).read())) for s in names: syms[s] = version for filename in argv[1:]: is_public = False lines = open(filename, "r").read().split("\n") newlines = [] for i in range(len(lines)): if lines[i] == "/**": last_sym = lines[i+1][2:].strip().replace(":", "") is_public = last_sym.lower().startswith("cairo") elif is_public and lines[i] == " **/": if last_sym in syms: v = syms[last_sym] if re.search("Since", newlines[-1]): newlines = newlines[:-1] if newlines[-1].strip() != "*": newlines.append(" *") newlines.append(" * Since: %s" % v) else: print "%s (%d): Cannot determine the version in which '%s' was introduced" % (filename, i, last_sym) newlines.append(lines[i]) out = open(filename, "w") out.write("\n".join(newlines)) out.close()
* doc: Make doc ids more consistent my always putting ':' after themAndrea Canciani2012-03-291-4/+4
| | | | | This makes the documentations comments more consistent and fixes many reports of 'invalid doc id'.
* doc: Make documentation comments symmetricAndrea Canciani2012-03-291-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Documentation comments should always start with "/**" and end with "**/". This is not required by gtk-doc, but it makes the documentations formatting more consistent and simplifies the checking of documentation comments. The following Python script tries to enforce this. from sys import argv from sre import search for filename in argv[1:]: in_doc = False lines = open(filename, "r").read().split("\n") for i in range(len(lines)): ls = lines[i].strip() if ls == "/**": in_doc = True elif in_doc and ls == "*/": lines[i] = " **/" if ls.endswith("*/"): in_doc = False out = open(filename, "w") out.write("\n".join(lines)) out.close() This fixes most 'documentation comment not closed with **/' warnings by check-doc-syntax.awk.
* doc: fix a few typos found by codespellNis Martensen2012-03-101-1/+1
| | | | Signed-off-by: Uli Schlachter <psychon@znc.in>
* Introduce a new compositor architectureChris Wilson2011-09-121-0/+1
| | | | | | | | | | | | | | | | | | Having spent the last dev cycle looking at how we could specialize the compositors for various backends, we once again look for the commonalities in order to reduce the duplication. In part this is motivated by the idea that spans is a good interface for both the existent GL backend and pixman, and so they deserve a dedicated compositor. xcb/xlib target an identical rendering system and so they should be using the same compositor, and it should be possible to run that same compositor locally against pixman to generate reference tests. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> P.S. This brings massive upheaval (read breakage) I've tried delaying in order to fix as many things as possible but now this one patch does far, far, far too much. Apologies in advance for breaking your favourite backend, but trust me in that the end result will be much better. :)
* Introduce cairo_mime_surface_tChris Wilson2011-08-151-3/+8
| | | | | | | | | | | The mime surface is a user-callback surface designed for interfacing cairo with an opaque data source. For instance, in a web browser, the incoming page may be laid out and rendered to a recording surface before all the image data has finished being downloaded. In this circumstance we need to pass a place holder to cairo and to supply the image data later upon demand. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* gstate: Copy clusters for an untransformed unbounded surfaceChris Wilson2011-08-141-7/+11
| | | | | | Fixes record-select-font-face Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* pattern: Add observer hooksChris Wilson2011-07-151-0/+1
| | | | | | | | | In order for custom context to automatically track when a pattern is modify after being set on the context (and before it is used in an operator), we need for there to be a callback when the pattern is modified. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Implement cairo_backend_tChris Wilson2011-07-151-628/+411
| | | | | | | | | | 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>
* device: Add CAIRO_STATUS_DEVICE_FINISHEDAndrea Canciani2011-07-081-1/+2
| | | | | | Instead of abusing CAIRO_STATUS_SURFACE_FINISHED to indicate the use of a finished device, define and use the new error status CAIRO_STATUS_DEVICE_FINISHED.
* Make error contexts staticAndrea Canciani2011-07-051-83/+65
| | | | | | Dynamically creating error contexts requires locking and failure handling. The code logic can be simplified by statically defining all the possible error contexts.
* Clean up context_pool upon static data resetAndrea Canciani2011-07-051-0/+2
| | | | | | | | | | | In commit f46ba56d5b8c54be5f0379aca204c0ce05d0f58a the static context stash was replaced by a dynamic freed pool, which needs to be cleared upon resets. Fixes: cairo.c:181: warning: ‘context_pool’ defined but not used Reported-by: Uli Schlachter <psychon@znc.in>
* Remove conditional compilation of freed-poolsAndrea Canciani2011-07-051-3/+0
| | | | | | | | | | | Conditional compilation was needed to avoid warnings: cairo-clip.c:51: warning: ‘clip_path_pool’ defined but not used cairo.c:181: warning: ‘context_pool’ defined but not used They can be avoided by making sure that _freed_pool_reset(ptr) actually consumes its argument. This has the pleasant side-effect that forgetting to properly reset a freed-pool now results in a warning if atomic ops are disabled/not available.
* Do not open-code freed-poolAndrea Canciani2011-06-251-82/+12
| | | | | | | | | | Reuse the freed-pool system to reduce allocation pressure of context creation/destruction. As a side effect, this removes the use of ffs() on Win32, cleaning up some MSVC-specific code and fixing a mingw-related build issue. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=30277
* error: Do not define _cairo_error twiceAndrea Canciani2011-06-241-26/+0
| | | | | | | | | | | | cairo-perf-trace uses cairo-hash.c, which calls _cairo_error. Instead of redefining it in cairo-perf-trace.c it can be abstracted in a separate source which is directly included in the build of cairo-perf-trace. This avoids visibility issues when compiling cairo-perf-trace with a statically linked cairo library on architectures which do not support hidden visibility (example: win32).
* Fix visibility issues found by make checkAndrea Canciani2011-03-211-0/+1
|
* Do not warn when ignoring the return value of _cairo_rectangle_intersect()Andrea Canciani2011-03-191-1/+1
| | | | | | | | | | | | gcc complains that cairo-surface-wrapper.c:647: warning: ignoring return value of ‘_cairo_rectangle_intersect’, declared with attribute warn_unused_result It can be silenced by making _cairo_rectangle_intersect() cairo_private_no_warn. This makes it possible to avoid unused temporary variables in other places and reduces the dead assignments reported by clang static analyzer from 114 to 98.
* Improve cairo_rectangle_list_t error handlingAndrea Canciani2011-03-181-20/+0
| | | | | | | | | | | Unify the _cairo_rectangle_list_create_in_error() functions, keeping the best features from both (the one in cairo-clip.c statically allocates the most common cases, the one in cairo.c throws a NO_MEMORY error when it cannot malloc() instead of rethrowing the same error). The same function can be used to return an error-list in _cairo_gstate_copy_clip_rectangle_list() when _cairo_clip_rectangle() fails (for example becaouse of an OOM).
* Make cairo_set_font_size() a wrapper of cairo_set_font_matrix()Andrea Canciani2011-03-181-6/+3
| | | | | | | | 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.
* arc: Remove erroneous return statementBenjamin Otte2011-02-191-2/+0
| | | | Introduced in e46dc9e17a6f6737d5624dbcdd3c42c2353a72f1.
* arc: Handle radius == 0 the same no matter the arc directionBenjamin Otte2011-02-181-1/+6
| | | | | | Commit a0ea0b63fdd38a73d6696da5cd4800d9a7289240 fixed cairo_arc() but did not apply the same patch to cairo_arc_negative(). This patch fixes that oversight.
* gstate: Set an error status when restoring a push_groupAndrea Canciani2011-01-221-15/+11
| | | | | | | cairo_push_group (cr) followed by cairo_restore (cr) should put cr in an error status of CAIRO_STATUS_INVALID_RESTORE. Fixes group-state.
* doc: Fix some broken references and gtk-doc warningsMaarten Bosmans2011-01-161-12/+15
| | | | The gtk-doc comments contain some typos and are missing some escaping.
* arc: Avoid infinite loopAndrea Canciani2010-12-091-4/+16
| | | | | | | | | Adding/subtracting 2 * M_PI to a huge floating point number doesn't change it (because of rounding) and for smaller numbers it still requires a lot of cycles before the angle is in the desired range. The same computation can be performed using fmod, which should provide more accurate results and only requires O(1) time.
* Fix degenerate arcsAndrea Canciani2010-10-291-0/+1
| | | | | | | Make sure that degenerate arcs become a move_to-line_to sequence instead of just a move_to. Fixes get-path-extents.