summaryrefslogtreecommitdiff
path: root/src/cairo-surface.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused _cairo_tee_surface_find_matchUli Schlachter2023-02-051-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | A little history digging shows that we only ever had one caller of _cairo_tee_surface_find_match. Commit 658cdc7c9a "Introduce cairo_tee_surface_t" added this code to _cairo_surface_clone_similar(): if (src->type == CAIRO_SURFACE_TYPE_TEE) { cairo_surface_t *match; match = _cairo_tee_surface_find_match (src, surface->backend, content); if (match != NULL) src = match; } Then, two years later in 2011, commit af9fbd176b1 "Introduce a new compositor architecture" removed _cairo_surface_clone_similar() and thus this code became unused. This commit drops this unused code. Signed-off-by: Uli Schlachter <psychon@znc.in>
* PDF Type 3 color fontsAdrian Johnson2023-01-291-5/+27
| | | | | | | | | This implements Type 3 color fonts for PDF for any font with a CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE. This includes user-fonts, SVG fonts, and COLR fonts. Glyphs with foreground colors are not yet implemented as Type 3 glyphs and will be rendered as images by cairo-surface.
* Rename is_userfont_foreground to is_foreground_markerAdrian Johnson2023-01-271-7/+7
| | | | as it is used by FT as well as user fonts.
* surface: Don't optimize away color glyphsMatthias Clasen2023-01-211-2/+6
| | | | | | | The surface code was optimizing away show_text_glyphs based on the operator when the source pattern is clear. But if we are rendering color glyphs, that is not correct since we are using the glyphs as source.
* Merge branch 'fix-svg-crash' into 'master'Adrian Johnson2023-01-211-0/+1
|\ | | | | | | | | Fix svg renderer crash See merge request cairo/cairo!416
| * svg-font: return SVG_FONT_ERROR on errorAdrian Johnson2023-01-201-0/+1
| |
* | [scaled-font] Clean up font-options before copyBehdad Esfahbod2023-01-191-0/+1
|/
* Fix docs for cairo_surface_[sg]et_device_scaleUli Schlachter2023-01-061-2/+2
| | | | | Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/616 Signed-off-by: Uli Schlachter <psychon@znc.in>
* Fix user-font with foreground in group failures on image, PDF, and PSAdrian Johnson2023-01-031-1/+42
|
* Add color mode optionAdrian Johnson2022-06-261-1/+3
|
* Fix the scaled_glyph_init color glyph logicAdrian Johnson2022-04-251-2/+2
| | | | | | and split _cairo_user_scaled_glyph_init() into multiple functions. Update user-font test to test changing foreground text color.
* Merge branch 'fix-color-glyph-clear-surface' into 'master'Adrian Johnson2022-04-251-4/+4
|\ | | | | | | | | | | | | Fix rendering of color glyphs on a clear surface Closes #539 See merge request cairo/cairo!283
| * Fix rendering of color glyphs on a clear surfaceMatthias Clasen2022-02-221-4/+4
| | | | | | | | | | | | | | | | We were calling the backend vfuncs directly, thereby missing some of the surface state bookkeeping that is done in the wrappers. Fixes: #539
* | Merge branch 'color-font-vector-surface' into 'master'Adrian Johnson2022-04-241-5/+34
|\ \ | | | | | | | | | | | | Paint color glyphs in fallback resolution on vector surfaces See merge request cairo/cairo!293
| * | On vector surfaces render color glyphs in the fallback resolutionAdrian Johnson2022-03-011-5/+34
| |/
* | Check font status in show_text_glyphsAdrian Johnson2022-04-051-1/+5
| | | | | | | | to prevent asserting in _cairo_scaled_font_freeze_cache()
* | dwrite: add color font supportAdrian Johnson2022-02-271-0/+1
|/
* Fix mixed color clustersMatthias Clasen2022-02-121-14/+19
| | | | | | | | | | | When rendering clusters that have colored and non-colored glyphs, we were falling back to using show_text_glyphs, rendering all glyphs in the cluster without color. Instead, make composite_one_color_glyph smart enough to handle non-color glyphs, and only skip clusters that are entirely non-color. Testcase: hb-view AmiriQuranColored.otf -u 627,64e
* Fix rtl handling for color glyphsMatthias Clasen2022-02-111-1/+3
| | | | | | | | | | | | When the run contains a mix of color and non-color glyphs, composite_color_glyphs returns the non-color glyphs unhandled in the same array. In the rtl case, the glyphs are processed from the end and the unhandled glyphs are accumulated at the end as well, and we need to move them to the beginning of the array before we return. Add the missing memmove call to do that. Fixes: #533
* Support color fonts that use the foreground colorAdrian Johnson2021-08-281-3/+10
| | | | | | | | | | | | | COLR fonts can have a layer with the same color as the current text color. This change passes the current color (if solid) through to the font backend where it can be used to render color fonts. scaled_glyph_lookup checks if the foreground color has changed (for glyph that require it) and requests a new color surface if required. This also fixes a bug where scaled_glyph_lookup would always request a color surface for glyphs for glyphs in color fonts that do not have color.
* Merge branch 'fix-color-glyph-compositing' into 'master'Adrian Johnson2021-08-141-2/+1
|\ | | | | | | | | Fix compositing non-color glyphs in one case See merge request cairo/cairo!224
| * Fix compositing non-color glyphs in one caseMatthias Clasen2021-08-021-2/+1
| | | | | | | | | | | | | | | | | | | | The intention here is: "if show_text_glyphs is unsupported, try show_gyphs". We need to make sure to set the status to unsupported before checking it, otherwise we end up looking at the status that was set by composite_color_glyphs if show_text_glyphs is NULL. This showed up in https://github.com/harfbuzz/harfbuzz/issues/2675
* | Fix color fonts when antialias == SUBPIXEL or NONEAdrian Johnson2021-08-141-1/+0
| |
* | Add color user-font supportAdrian Johnson2021-08-141-1/+9
|/ | | | | Adds new API cairo_user_font_face_set_render_color_glyph_func() to set a color glyph renderer.
* Remove all gstate from _cairo_surface_tagAdrian Johnson2021-07-181-15/+2
| | | | | The gstate is not required and was causing some tag operations to be ignored.
* Fix _cairo_surface_paint not setting is_clearUli Schlachter2021-01-111-2/+4
| | | | | | | | | | | | | | | | | | | | | In commit 10e58a4a I changed the code in cairo-surface.c to avoid setting surface->is_clear = FALSE; in some situations where it was not necessary, because the operation did not actually modify anything (it returned CAIRO_INT_STATUS_NOTHING_TO_DO). However, that change accidentally also caused _cairo_surface_paint() not to set surface->is_clear = TRUE; in similar cases. That was unintended. This commit fixes that by always setting is_clear = TRUE when necessary, but keeps the optimisation of not setting is_clear = FALSE when not necessary. The connection to the below issue is that the issue happened with surfaces with width=0. Clearing such a surface with CAIRO_OPERATOR_CLEAR causes CAIRO_INT_STATUS_NOTHING_TO_DO and thus is_clear = TRUE was not set. This error was later caught by a failed assertion. Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/283 Signed-off-by: Uli Schlachter <psychon@znc.in>
* Merge branch 'master' of gitlab.freedesktop.org:sgerwk/cairoUli Schlachter2020-07-201-2/+2
|\
| * a surface may also be checked for status after finishingsgerwk2019-10-141-2/+2
| |
* | Fix documentation typo in src/cairo-surface.cluzpaz2019-12-201-1/+1
|/
* Fix a thinko in composite_color_glyphsMatthias Clasen2019-07-181-0/+10
| | | | | | | | We can't just move around the contents of the passed-in string, we need to make a copy. This was showing up as memory corruption in pango. See https://gitlab.gnome.org/GNOME/pango/issues/346
* tags: Don't ignore tag on empty pagesAdrian Johnson2019-02-011-0/+1
| | | | Issue 357
* 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>
* Don't leak patterns when compositing color glyphsMatthias Clasen2018-01-041-0/+1
| | | | We were forgetting to free the pattern here.
* Fix a logic error in color glyph compositingMatthias Clasen2017-12-171-3/+3
| | | | | | | | | | | | | | When a color glyph is completely clipped away, we get the non-zero status 'nothing to do'. In that case, we must not exit early, since there might still be work to do for the other color glyphs. This bug was showing up as color glyphs stopping to render in GTK+ entries that are scrolled to the right, and also as color glyphs not rendering inside the selection sometimes. See https://bugzilla.gnome.org/show_bug.cgi?id=790255 and https://bugzilla.gnome.org/show_bug.cgi?id=788071.
* ps: add CAIRO_MIME_TYPE_EPS mime type for embedding EPS filesAdrian Johnson2017-11-091-0/+18
|
* pdf: fix mime-unique-id jpeg attached to recording testAdrian Johnson2017-11-091-0/+42
| | | | | | | | | | | | | | - Restructure the emit_surface code so that mime types are checked first. - Add a test parameter to emit_surface to test if the surface will be emitted as an image or recording instead checking the surface type as the attached mime may override this. - Mark surface as not clear when mime is attached to avoid optimizing away "clear" surfaces that have mime attached. - Include entire surface in analysis if mime attached (also fixes bug with calculating the extents CONTENT_COLOR surfaces)
* pdf: fix mime-unique-id unbounded recording testAdrian Johnson2017-11-091-2/+2
| | | | | | PDF XObjects need to specify the bounding box. Emit unbounded surfaces when finishing as at this point the extents of all uses of the unbounded surface are known.
* Add CCITT_FAX mime type for PDF and PS surfacesAdrian Johnson2017-10-221-1/+20
| | | | | | | | | | | This completes the full set of PDF/PS image filters allowing image data to be passed though without decompressing then recompresssing in a less efficient format. The difficulty with CCITT_FAX is it needs some decoding parameters that are not stored inside the image data. This is achieved by using an additional mime type CCITT_FAX_PARAMS that contains the params in key=value format.
* Handle SOURCE and CLEAR operators when painting color glyphsBehdad Esfahbod2017-09-121-1/+4
| | | | | | | | | | | | | | | | | In cairo, most operators are composited this way: ((src IN mask) OP dst) LERP_clip dst but SOURCE and CLEAR operators are composited this way: (src OP dst) LERP_(clip IN mask) dst (why is this not specified anywhere in the docs or source tree?) With color glyphs, we were not special-casing SOURCE and CLEAR. We do now. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=102661
* Remove redundant check.Guillermo Rodriguez2017-08-211-4/+0
| | | | | | Spotted by David Kastrup <dak@gnu.org>. Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* Fix uninitialized status!Behdad Esfahbod2017-07-291-3/+3
|
* Simplify things a bitMatthias Clasen2017-07-291-138/+89
| | | | | | | | | | Do away with the separate check for color glyphs - we can just do the filtering, and if there are no color glyphs, it is a no-op. As long as we only do this for fonts with color glyphs, it should be fine. Reduce repetition in composite_color_glyphs by breaking out some helper functions.
* Render color glyphs as source, not as maskMatthias Clasen2017-07-291-1/+257
| | | | | | | | Use paint instead of show_glyphs for color glyphs. To avoid overhead, we only check for color glyphs if the font is known to contain any. Paint clusters containing only color glyphs and rewrite the inputs to remove the handled clusters and glyphs.
* doc: Clarify when the device scale is inherited and when it isn'tDebarshi Ray2017-03-151-5/+8
| | | | | | | | | | | In short, cairo_surface_create_similar inherits it, while cairo_surface_create_similar_image doesn't. It wasn't obvious without reading the code or explicitly checking the device scale of the new surface. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99094 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* doc: Fix the units used by cairo_surface_create_similar_imageDebarshi Ray2017-03-151-2/+2
| | | | | | Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99094 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* 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-0/+1
|
* Add tag functions to cairo_t and cairo_surface_tAdrian Johnson2016-10-011-0/+36
| | | | | | | | 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-0/+1
|
* Add CAIRO_STATUS_FREETYPE_ERROR for errors returned by libfreetypeAdrian Johnson2016-03-261-0/+1
|