summaryrefslogtreecommitdiff
path: root/src/cairo-quartz-surface.c
Commit message (Collapse)AuthorAgeFilesLines
* Make cairo_tag_begin/end work correctly in groupsAdrian Johnson2023-04-181-2/+1
| | | | Fixes #508
* [quartz]Conditionally Use Main Display ColorSpace instead of ↵John Ralls2023-02-171-51/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | kCGColorSpaceDefaultRGB. The default RGB colorspace must be converted to the GPU's colorspace using CGColorTransformConvertUsingCMSConverter. Profiling has shown this function to consume as much as 48% of a redraw cycle in gdk-quartz. There seems to be no named colorspace that matches the one stored on the display, so we use the one associated with the main display. This has some risks for users with multiple monitors but in testing with my own two-monitor setup, one of which is HDR and the other not, the colorspace was the same for both. This is applied to quartz surfaces created with cairo_quartz_surface_create(); surfaces created with cairo_quartz_surface_create_for_cg_context will inherit the colorspace from the context. In order to generate PNGs that look right I've converted the existing debugging functions for writing a quartz surface to png into private functions and wired cairo-boilerplate-quartz to use them. Using the generic cairo routine produced washed-out PNGs. Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/330
* [quartz] Pretty up the surface-type and zero-size tests.John Ralls2023-02-141-19/+25
|
* [quartz] Cleanup and make better use of cairo_quartz_image_surface_t.John Ralls2023-02-141-179/+74
| | | | | | | | | Use a CGBitmapContext mapping the underlying image surface's data instead of maintaining a CGImage. Generalize the quartz surface snapshot mechanism to work with both cairo_quartz_surface_t and cairo_quartz_image_surface_t and to use the latter to get a CGContext around non-quartz surfaces. Use this snapshot machanism to get a CGImageRef when needed from a cairo_quartz_image_surface_t.
* Fix shared use of recording surface with paginated targetsAdrian Johnson2023-01-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is _cairo_recording_surface_replay_and_create_regions() stores the cairo_recording_region_type_t in the same structure as the recording commands. This does not work well when the recording surface is used as source by multiple surfaces Fix this by moving the cairo_recording_region_type_t into a separate struct cairo_recording_regions_array_t. This struct is stored in a list that allows multiple create regions results to be store in the surface. The new function _cairo_recording_surface_region_array_attach() is used to create a new cairo_recording_regions_array_t, attach it to the recording surface and return a unique region id. The _cairo_recording_surface_replay_and_create_regions() and _cairo_recording_surface_replay_region() functions use this region id to identify the cairo_recording_regions_array_t. To handle nested recording surfaces, when replaying a recording, the region id is passed to the target as an extra parameter in the surface pattern. The wrapper surface makes a temporary copy of the pattern to ensure the snapshot pattern in the recording surface is not modified. cairo_recording_regions_array_t has a reference count so the target can hold on to the cairo_recording_regions_array_t after the paginated surface has called _cairo_recording_surface_region_array_remove().
* Merge branch 'pbounds-size' into 'master'Adrian Johnson2022-12-281-5/+1
|\ | | | | | | | | Ensure pbounds.size is initialized even in EXTEND_NONE mode. See merge request cairo/cairo!363
| * Ensure pbounds.size is initialized even in EXTEND_NONE mode.Jonathan Kew2022-10-191-5/+1
| | | | | | | | | | | | Since the if/else was replaced by a switch() here in https://gitlab.freedesktop.org/cairo/cairo/-/commit/2e0075e265155ff144ced23ff87c4bed4cdfbc27, the size field of pbounds is not being set in the EXTEND_NONE case, which means we end up passing uninitialized values to CGPatternCreate.
* | Pass the same type when creating the static glyphs and positions arrays.John Ralls2022-11-171-1/+1
|/ | | | Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/574
* quartz: Avoid reading beyond the end of image surfaces.Jeff Muizelaar2022-06-291-1/+5
| | | | | The last row of data may have less than stride bytes so make sure we only copy what we need.
* Merge branch 'quartz-core-text' into 'master'Adrian Johnson2022-04-271-218/+41
|\ | | | | | | | | quartz: support rendering colored bitmap fonts See merge request cairo/cairo!289
| * [quartz] Convert font handling from CGFont to CTFont.John Ralls2022-04-241-60/+23
| |
| * [quartz] Require at least Mac OS X 10.7 LionJohn Ralls2022-04-241-158/+19
| | | | | | | | Allows removal of most conditional compilation and dlsym lookups.
| * [quartz] Fix some compiler warnings.John Ralls2022-04-241-3/+2
| |
* | [quartz] Destroy local copy of snapshot after attaching it.John Ralls2022-04-231-0/+1
|/ | | | | | Because cairo_surface_snapshot_attach refs the snapshot. Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/562
* quartz: Fix spelling in commentChristopher Chavez2022-02-261-1/+1
|
* [quartz] Don't use CGContextDrawTiledImage for tiled patterns.John Ralls2022-02-241-68/+45
| | | | | | | | | | | CGContextDrawTiledImage turned up as a significant time-user while profiling a benchmark created to evaluate https://gitlab.gnome.org/GNOME/gtk/-/issues/3714. Without this commit the benchmark is able to perform a mean frame rate of 2.19 frames per second with a standard deviation of 0.09; with the commit the mean frame rate is 2.37 fps, s.d. 0.30, both over 15 10-second samples. Student's t-test reports a 9.8% likelyhood that the two represent the same distribution.
* [quartz] extract function _cairo_quartz_setup_pattern_sourceJohn Ralls2022-02-241-137/+146
| | | | To simplify _cairo_quartz_setup_state.
* [quartz]Cleanup _cairo_quartz_cairo_repeating_surface_pattern_to_quartzJohn Ralls2022-02-241-23/+9
|
* [quartz] Use CoreGraphics instead of Qt to write debug png file.John Ralls2022-02-241-75/+27
|
* [quartz] Create similar surfaces using a CGLayer for faster drawing.John Ralls2022-02-241-29/+108
|
* [quartz] Remove cached image_surface on quartz surfaces.John Ralls2022-02-241-32/+34
| | | | | Caching doesn't really do anything and removing it provides a 50% speedup and gets pdf-operators-text to pass on argb32.
* [quartz] Snapshot CGBitmapContext-mapped surfaces to cache CGImages.John Ralls2022-02-241-4/+76
| | | | | | | | Motivation: Avoid need to recreate CGImages for unchanged surfaces, an expensive operation, while ensuring that the CGImages are properly freed and new ones created when the surface does change. Thanks to Uli Schlacter for suggestion and coding guidance.
* quartz: Fix spelling in commentChristopher Chavez2022-02-231-1/+1
|
* Remove stray _GNU_SOURCE definitionsEmmanuele Bassi2021-05-011-1/+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().
* Quartz Better manage acquired/replayed surface.John Ralls2020-12-051-19/+37
|
* Quartz image drawing: Remove containers for cairo_surface_t.John Ralls2020-12-031-46/+18
| | | | | | Since we now copy the data that CGImage needs we don't need to keep the surface around anymore, nor release it or the image in the DataProviderReleaseCallback.
* Quartz: Ensure that image data and surface are available to draw.John Ralls2020-12-031-3/+12
| | | | | | | | Snapshot the cairo_surface_t and copy the image data to provide to the CGDataProvider so that it is independent of the cairo_surface_t's lifetime. Closes https://gitlab.freedesktop.org/cairo/cairo/-/issues/420
* Ensure _cairo_quartz_surface_create_internal always nulls imageSurfaceEquiv.John Ralls2020-11-301-4/+3
|
* Use _cairo_malloc instead of mallocAdrian Johnson2018-05-071-3/+3
| | | | | | | | | | _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 some surfaces missed in b1192beaAdrian Johnson2015-10-171-1/+2
|
* quartz: be more strict about the behavior of blend operatorsAndrea Canciani2015-07-271-1/+5
| | | | | | | | | | | | | | Some blend operators have a (small, but potentially noticeable) different behaviour in Quartz and pixman. Use the Quartz ones only for the operators which match pixman except for rounding errors. Fixes: - extended-blend - extended-blend-alpha - extended-blend-mask - extended-blend-alpha-mask - extended-blend-solid - extended-blend-solid-alpha
* quartz: Align filtering quality with image backendAndrea Canciani2015-07-271-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | The Quartz framework provides several quality settings, but they were not used. Now the translation of cairo_filter_t to Quartz filtering modes tries to match the quality settings from image as much as possible. Specifically, CAIRO_FILTER_GOOD and CAIRO_FILTER_BILINEAR are now converted to kCGInterpolationLow, which seems to be a bilinear filter. Fixes: - pixman-downscale-bilinear-24 - pixman-downscale-bilinear-95 - pixman-downscale-good-24 - pixman-downscale-good-95 - pthread-same-source - recording-surface-extend-none - recording-surface-extend-reflect - recording-surface-extend-repeat - recording-surface-over - recording-surface-source - surface-pattern-big-scale-down - surface-pattern-scale-down - surface-pattern-scale-down-extend-none - surface-pattern-scale-down-extend-reflect - surface-pattern-scale-down-extend-repeat
* quartz-image: Fix buildAndrea Canciani2014-10-031-4/+1
| | | | | | | | | The quartz-image backend uses _cairo_surface_is_quartz(), which therefore needs to be made available to it. Fixed as suggested by Bryce in the referenced bugreport. References: https://bugs.freedesktop.org/show_bug.cgi?id=84569 Signed-off-by: Andrea Canciani <ranma42@gmail.com>
* quartz: Fix buildAndrea Canciani2014-10-031-14/+8
| | | | | | | | | Cairo cannot build with Quartz enabled since 573ddfc3d5c08c37b95a21e0a1b34acecc646053, because of a double definition of _cairo_surface_is_quartz(). References: https://bugs.freedesktop.org/show_bug.cgi?id=84569 Signed-off-by: Andrea Canciani <ranma42@gmail.com>
* src: check the surface backend for NULLRavi Nanjundappa2014-09-291-0/+14
| | | | | | | | | | This is a follow-up patch on top of 150c1e7044c57443d458e12bfc427d3a019cb60b As discussed in the mailing list, http://lists.cairographics.org/archives/cairo/2014-September/025647.html, check if the surfaces are of particular backend type or not, before proceeding further. These changes are based on _cairo_surface_is_xlib() and _cairo_surface_is_image() Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
* quartz: Don't release memory we don't ownMichael Hutchinson2013-03-291-1/+0
| | | | | | | | This was causing crashes due to double frees. https://bugs.freedesktop.org/show_bug.cgi?id=62885 Signed-off-by: Benjamin Otte <otte@redhat.com>
* quartz: Use the correct transform when replaying recording surfacesAndrea Canciani2012-07-241-6/+10
| | | | | | | | | Recording surfaces should be replayed with the transform matrix used in the pattern, otherwise the image surface will be transformed, introducing artifacts. Fixes record{1414x,2x}-paint-alpha-{,solid-clip,clip}, record2x-{self-intersecting,text-transform} and record90-paint-alpha.
* quartz: Never acquire recording surfacesHenry (Yu) Song - SISA2012-07-241-19/+67
| | | | | | | We need to replay if the source/mask surface is a recording surface otherwise, a crash happens if it is unbounded. Fixes crashes in recordxx-xxx tests
* quartz: Provide a valid implementation of map_to_imageAndrea Canciani2012-05-261-132/+71
| | | | | | | | | | and reuse it to implement acquire_source. Fixes cairo-quartz-surface.c: In function '_cairo_quartz_surface_map_to_image': cairo-quartz-surface.c:1568: warning: return from incompatible pointer type cairo-quartz-surface.c:1576: warning: return from incompatible pointer type
* quartz: Mark surfaces created clear as is_clearAndrea Canciani2012-05-261-0/+3
| | | | | | | This might provide a speedup when clearing an already clear surface and is required by cairo_surface_create_similar(). Fixes zero-mask.
* quartz: Silence warningAndrea Canciani2012-05-261-2/+3
| | | | | cairo-quartz-surface.c:177: warning: enumeration value 'CAIRO_FORMAT_RGB30' not handled in switch
* surface: Make backend-specific map/unmap functions symmetricAndrea Canciani2012-05-261-0/+1
| | | | Map allocates a surface. Symmetrically, unmap should destroy it.
* surface: Make map_to_image return cairo_image_surface_t*Andrea Canciani2012-05-261-1/+1
| | | | | This makes it easier to check that the funciton is returning the correct type of surfaces.
* doc: Fix some wrong versionsAndrea Canciani2012-03-291-3/+3
| | | | | The script from the previous commit reported that some 'Since' fields indicate incorrect versions.
* 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 doc ids more consistent my always putting ':' after themAndrea Canciani2012-03-291-3/+3
| | | | | This makes the documentations comments more consistent and fixes many reports of 'invalid doc id'.
* doc: Make documentation comments symmetricAndrea Canciani2012-03-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* quartz: Add missing source hookChris Wilson2012-02-101-0/+1
| | | | | | | Regression from 2061cd81f2. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45866 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* quartz: Make glyph antialiasing consistent with quartz-fontAndrea Canciani2012-01-151-0/+3
| | | | | | | | | | | | CAIRO_ANTIALIAS_{FAST,GOOD,BEST} were introduced and used in cairo-quartz-font.c by commit 70cd3b473d09e9ad3d803014a904a22639db1a24. Fixes the warnings: cairo-quartz-surface.c: In function '_cairo_quartz_cg_glyphs': cairo-quartz-surface.c:1976: warning: enumeration value 'CAIRO_ANTIALIAS_FAST' not handled in switch cairo-quartz-surface.c:1976: warning: enumeration value 'CAIRO_ANTIALIAS_GOOD' not handled in switch cairo-quartz-surface.c:1976: warning: enumeration value 'CAIRO_ANTIALIAS_BEST' not handled in switch
* quartz: Fix building with QUARTZ_DEBUGAndrea Canciani2012-01-151-4/+9
| | | | Multiple code refactorings broke the debugging code.