summaryrefslogtreecommitdiff
path: root/src/cairo-misc.c
Commit message (Collapse)AuthorAgeFilesLines
* svg-font: return SVG_FONT_ERROR on errorAdrian Johnson2023-01-201-0/+2
|
* Defining Windows version macros in meson.buildFujii Hironori2023-01-131-9/+0
| | | | | | | | | WINVER and _WIN32_WINNT macros were defined in each source files and headers that were including <windows.h>. However, because DirectWrite requires new Windows API, some files included <windows.h> without the version macros. This inconsistency sometimes caused troubles. Define the version macros in meson.build.
* Fix mingw build failure when SVG fonts enabledAdrian Johnson2023-01-031-0/+27
| | | | | Add missing strndup() function. Copied the strndup() implementation from util/cairo-missing/strndup.c plus a bug fix.
* dwrite: add color font supportAdrian Johnson2022-02-271-0/+2
|
* Fix some win32 compile warningsAdrian Johnson2021-07-251-0/+3
|
* Accept a leading sign character in _cairo_strtod.Jonathan Kew2021-07-201-0/+2
|
* Remove stray _GNU_SOURCE definitionsEmmanuele Bassi2021-05-011-2/+0
| | | | | | We define _GNU_SOURCE globally in both the Autotools build, through the use of the AC_USE_SYSTEM_EXTENSIONS macro; and in the Meson build, with add_project_arguments().
* Make the _cairo_operator_bounded family of functions consistentAnton Danilkin2021-04-241-8/+6
|
* meson: Fix musl buildGeorge Matsumura2020-09-021-0/+3
| | | | | | | This constitutes few fixes that are necessary to compile correctly and reduce errors when using musl libc. Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
* Misc. typosluz.paz2019-01-311-1/+1
| | | | | | | Found via `codespell -i 3 -w -I ../cairo-word-whitelist.txt -L tim,ned,uint` Follow up of 12cb59be7da Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
* Use _cairo_malloc instead of mallocAdrian Johnson2018-05-071-1/+1
| | | | | | | | | | _cairo_malloc(0) always returns NULL, but has not been used consistently. This patch replaces many calls to malloc() with _cairo_malloc(). Fixes: fdo# 101547 CVE: CVE-2017-9814 Heap buffer overflow at cairo-truetype-subset.c:1299 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* Fix two type casting warnings in get_C_locale()Bryce Harrington2018-01-231-2/+2
| | | | | | | | | | | | cairo-misc.c:806:43: warning: passing argument 1 of ‘_cairo_atomic_ptr_get’ from incompatible pointer type C = (locale_t) _cairo_atomic_ptr_get (&C_locale); ^ cairo-misc.c:811:45: warning: passing argument 1 of ‘_cairo_atomic_ptr_cmpxchg_impl’ from incompatible pointer type if (!_cairo_atomic_ptr_cmpxchg (&C_locale, NULL, C)) { ^ Routines are expecting a void** so cast.
* Use strtod_l when availableMatthias Clasen2017-12-191-0/+37
| | | | | | Using strtod_l and newlocale is a nicer way to have provide a C-locale-only strtod. Since these APIs are not available everywhere, keep the old code as a fallback.
* Make _intern_string_hash non-staticMatthias Clasen2017-12-191-3/+3
| | | | | We will use this function in cairo-font-options.c in the following commits.
* Make _intern_string_hash safe for ""Matthias Clasen2017-12-191-1/+1
| | | | | | The loop was unnecessarily written in a way that fails to terminate if len is 0 (ie for the empty string). Avoid that by checking for len > 0 explicitly.
* Use UTF-8 filenames on WindowsTom Schoonjans2017-11-261-0/+62
| | | | | | | | | | | Until now fopen was used on Windows to open files for reading and writing. This assumed however that the filename would be encoded in the current codepage, which is a major inconvenience and makes it even impossible to use filenames that use characters from more than one codepage. This patch enforces the use of UTF-8 filenames on all platforms. Based on the work of Owen Taylor (https://lists.cairographics.org/archives/cairo/2007-February/009591.html)
* factor out ascii to double code in cff-subset into _cairo_strtodAdrian Johnson2017-09-221-2/+58
|
* pdf: structured text and hyperlink supportAdrian Johnson2016-10-011-0/+2
|
* cairo-misc: Whitespace cleanupBryce Harrington2016-07-061-1/+1
|
* Add CAIRO_STATUS_WIN32_GDI_ERROR for GDI errorsAdrian Johnson2016-03-261-0/+2
|
* Add CAIRO_STATUS_FREETYPE_ERROR for errors returned by libfreetypeAdrian Johnson2016-03-261-0/+2
|
* Add CAIRO_STATUS_PNG_ERROR for errors returned by libpngAdrian Johnson2016-03-261-0/+2
|
* Fix cairo_get_locale_decimal_point() on AndroidFredrik Fornwall2015-06-051-1/+1
|
* Fix compilation with bionic libcAdrian Johnson2014-09-231-0/+18
| | | | | | | | | | | Refactor out a cairo_get_locale_decimal_point() routine to handle a case where localeconv() is not available. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=70492 Reviewed-by: Bryce Harrington <b.harrington@samsung.com> [edit: Condensed cairo_get_locale_decimal_point and conditionalized locale.h inclusion. -- bryce]
* pdf: support JBIG2 mime dataAdrian Johnson2013-09-151-0/+2
| | | | | | | | | | 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.
* doc: Add "since" tag to documentationAndrea Canciani2012-03-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 documentation comments symmetricAndrea Canciani2012-03-291-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove useless checks for NULL before freeingAndrea Canciani2011-07-311-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch has been generated by the following Coccinelle semantic patch: // Remove useless checks for NULL before freeing // // free (NULL) is a no-op, so there is no need to avoid it @@ expression E; @@ + free (E); + E = NULL; - if (unlikely (E != NULL)) { - free(E); ( - E = NULL; | - E = 0; ) ... - } @@ expression E; @@ + free (E); - if (unlikely (E != NULL)) { - free (E); - }
* 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>
* Handle CAIRO_STATUS_DEVICE_FINISHED in switchesUli Schlachter2011-07-091-0/+2
| | | | | | | | Fixes all warnings that looked like this: warning: enumeration value 'CAIRO_STATUS_DEVICE_FINISHED' not handled in switch Signed-off-by: Uli Schlachter <psychon@znc.in>
* mesh: Add mesh pattern type and enum valuesAdrian Johnson2011-01-011-0/+2
| | | | | | | | Add the mesh pattern type and an error status to be used to report an incorrect construction of the pattern. Update the backends to make them ready to handle the new pattern type, even if it cannot be created yet.
* doc: Move tmpl/ docs to inline docsBenjamin Otte2010-07-081-0/+20
| | | | | | I did this manually so I could review the docs at the same time. If anyone finds typos or other mistakes I did, please complain to me (or better: fix them).
* 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
* misc: Only use custom lround() under DISABLE_SOME_FLOATING_POINTChris Wilson2010-01-221-0/+2
| | | | | | | | | | On my Core2, the library version of lround() is faster than our hand-rolled non-floating point implementation. So only enable our code if we are trying to minimise the number of floating point operations -- even then, it would worth investigating the library performance first. [Just a reminder that optimisation choices will change over time as our hardware and software evolves.]
* drm: Add backends for i915 and i965.Chris Wilson2010-01-221-0/+57
| | | | | | | | | | | | | As proof-of-principle add the nearly working demonstrations of using DRM to render directly with the GPU bypassing both RENDER and GL for performance whilst preserving high quality rendering. The basis behind developing these chip specific backends is that this is the idealised interface that we desire for this chips, and so a target for cairo-gl as we continue to develop both it and our GL stack. Note that this backends do not yet fully pass the test suite, so only use if you are brave and willing to help develop them further.
* Alter definition of cairo_composite_rectangles_tChris Wilson2010-01-221-0/+41
| | | | | | | This is a more useful definition that is able to individually track the rectangles that compose the composite operation. This will be used by the specialist compositors as a means to perform the common extents determination for an operation.
* Add cairo_device_tChris Wilson2010-01-221-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The device is a generic method for accessing the underlying interface with the native graphics subsystem, typically the X connection or perhaps the GL context. By exposing a cairo_device_t on a surface and its various methods we enable finer control over interoperability with external interactions of the device by applications. The use case in mind is, for example, a multi-threaded gstreamer which needs to serialise its own direct access to the device along with Cairo's across many threads. Secondly, the cairo_device_t is a unifying API for the mismash of backend specific methods for controlling creation of surfaces with explicit devices and a convenient hook for debugging and introspection. The principal components of the API are the memory management of: cairo_device_reference(), cairo_device_finish() and cairo_device_destroy(); along with a pair of routines for serialising interaction: cairo_device_acquire() and cairo_device_release() and a method to flush any outstanding accesses: cairo_device_flush(). The device for a particular surface may be retrieved using: cairo_surface_get_device(). The device returned is owned by the surface.
* Move _cairo_error() to a standalone headerChris Wilson2010-01-221-0/+1
| | | | | A pending commit will want to include some utility code from cairo and so we need to extricate the error handling from the PLT symbol hiding.
* Use new pixman extended blend operatorsBenjamin Otte2009-07-141-0/+30
| | | | | | It also adds extended-blend tests. Based on a previous patch by Emmanuel Pacaud <emmanuel.pacaud@free.fr>
* [cairo] Tweak error strings.Chris Wilson2009-06-031-6/+6
| | | | | | Rewrite a few error strings so that they more closer match the documentation. Where they differ, I believe I have chosen the more informative combination of the two texts.
* [user-font] Add CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTEDBehdad Esfahbod2009-05-061-0/+2
| | | | | This is useful for language bindings to signal that a method is not implemented.
* [memfault] Manually inject faults when using stack allocationsChris Wilson2009-04-231-0/+3
| | | | | | | | | | Ensure that no assumptions are made that a small allocation will succeed by manually injecting faults when we may be simply allocating from an embedded memory pool. The main advantage in manual fault injection is improved code coverage - from within the test suite most allocations are handled by the embedded memory pools.
* Silence compiler warnings for CAIRO_STATUS_LAST_STATUSChris Wilson2009-03-291-2/+3
| | | | | Add ASSERT_NOT_REACHED (or similar) cases to the error handling switches to silence the compiler.
* [wince] Use the official _WIN32_WCE define instead of WINCEStefan Klug2009-03-201-2/+2
|
* [wince] We don't need cairo_win32_tmpfile on Windows CEJeff Muizelaar2009-02-131-1/+4
| | | | | | | _cairo_win32_tmpfile() uses _open_osfhandle() which is not available on Windows CE. However, Windows CE doesn't have the permisions problems that necessitated _cairo_win32_tmpfile() in the first place so we can just use tmpfile() on Windows CE.
* Inline _cairo_restrict_value()Chris Wilson2009-02-131-9/+0
| | | | | This is one instance where the function call overhead dominated the function call in both time and size.
* Elaborate the meaning of arithmetic rounding as done by _cairo_lround()Jeff Muizelaar2009-02-041-1/+1
|
* [surface] add CAIRO_STATUS_INVALID_SIZEPaolo Bonzini2009-01-291-1/+3
| | | | | | | | Adds an error code replacing CAIRO_STATUS_NO_MEMORY in one case where it is not really appropriate. CAIRO_STATUS_INVALID_SIZE is used by several backends that do not support image sizes beyond 2^15 pixels on each side. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Add a missing _cairo_error() to a bunch of status returns.Jeff Muizelaar2008-12-171-2/+2
|
* Mark allocation failures as unlikely.Chris Wilson2008-11-291-8/+16
| | | | | Use the gcc likelihood annotation to indicate that allocation failures are extremely unlikely.