aboutsummaryrefslogtreecommitdiffstats
path: root/components/canvas/raqote_backend.rs
Commit message (Collapse)AuthorAgeFilesLines
* canvas: Implement line dash setters and getters (#36257)Steven Novaryo2025-04-011-0/+10
| | | | | | | | | | | Implement `setLineDash`, `getLineDash`, and `lineDashOffset` from `CanvasPathDrawingStyles` mixin, according to the spec https://html.spec.whatwg.org/multipage/canvas.html#canvaspathdrawingstyles. Testing: Existing WPT. --------- Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
* Add `Path2D` (#35783)Lukas Lihotzki2025-03-261-0/+26
| | | Signed-off-by: Lukas Lihotzki <lukas@lihotzki.de>
* Update rustfmt to the 2024 style edition (#35764)Simon Wülker2025-03-031-1/+1
| | | | | | | | | | | | | * Use 2024 style edition Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Reformat all code Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* prefs: Move some `DebugOptions` to `Preferences` and clean up (#34998)Martin Robinson2025-01-171-4/+3
| | | | | | | | | - Move options configuring antialiasing and WebRender shader precache to the `Preferences` to group them with other related WebRender and DOM settings. - Remove the option to disable antialiasing for canvases. This was unused. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Elide lifetimes where possible after rustup (#34824)Martin Robinson2025-01-031-1/+1
| | | | | | | | | The new version of rust allows us to elide some lifetimes and clippy is now complaining about this. This change elides them where possible and removes the clippy exceptions. Fixes #34804. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* fonts: Instantiate system fonts using system font loaders (#33747)Martin Robinson2024-10-101-3/+2
| | | | | | | | | | | | | | | | | | | | | System fonts used to be instantiated using the system font loader and this change restores that behavior. In addition, on macOS and FreeType platforms font data for system fonts is loaded using memory mapping. The benefit is that system font loaders typically are able to cache fonts in system memory (using memory mapping, for instance) and we'd like to load them in a the way most compatible with other applications. On my Linux system, this manages to get the overhead of loading a very large font down from 10ms to approximately 1ms. Subsequent runs show even less overhead. We've measured similar gains on macOS systems. Currently, system font data must be loaded into memory manually for canvas and this is unlikely to change even with a switch to `vello`. The use of explicit memmory mapping should help in this case -- though it probably won't be possible to use this properly on macOS and Windows if we ever want to load fonts from TTCs properly. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* fonts: Use `IpcSharedMemory` to send font data (#33530)Martin Robinson2024-09-251-1/+3
| | | | | | | | | | | | | | | | | | | | | This changes modifes the way that font data is sent over IPC channels. Instead of serializing the data or sending it via IPC byte senders, font data is copied into shared memory and a copy of the handle is sent over the channel. There is also the idea of sending the file handle of the on disk data of system fonts. This could be implemented as a further followup once there is an abstraction in `ipc-channel` over file handles. To accomplish this, a `FontData` abstraction is added, which also allows caching an in-memory shared `Arc<Vec<u8>>` version of the data (neeeded by some APIs). This could also be a place for caching font tables in the future. Finally, the `FontCacheThread` is renamed to the `SystemFontService` while the proxy for this is now named `SystemFontServiceProxy`. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* fix a couple of simple clipy warnings (#32813)Rodion Borovyk2024-07-191-1/+1
| | | Signed-off-by: Rodion Borovyk <rodion.borovyk@gmail.com>
* canvas: Remove as much usage of `font-kit` as possible (#32758)Martin Robinson2024-07-111-37/+68
| | | | | | | | | | | | | Do font selection using Servo's font backend, which is shared with the rest of layout. In addition, delay the creation of the `font-kit` font until just before rendering with `raqote`. The idea is that when `raqote` is no longer used, we can drop the `font-kit` dependency. This change has the side-effect of fixing text rendering in canvas, adding support for font fallback in canvas, and also correcting a bug in font selection with size overrides. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* Upgrade Stylo to 2024-03-01 (#32089)Oriol Brufau2024-04-161-44/+23
| | | | | | | * Upgrade Stylo to 2024-03-01 * Fixup for https://bugzil.la/1882754 * Update test expectations
* Update Stylo to 2023-10-16 (#31932)Oriol Brufau2024-03-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * Update Stylo to 2023-10-16 * Fixup for https://phabricator.services.mozilla.com/D185154 * Fixup for https://phabricator.services.mozilla.com/D188216 * Fixup for https://phabricator.services.mozilla.com/D185677 * Fixup for https://phabricator.services.mozilla.com/D188566 * Fixup for https://phabricator.services.mozilla.com/D188727 * Fixup for https://phabricator.services.mozilla.com/D189475 * Fixup for https://phabricator.services.mozilla.com/D189521 * Fixup for https://phabricator.services.mozilla.com/D188812 * Fixup for https://phabricator.services.mozilla.com/D189484 * Update test expectations
* Update Stylo to 2023-09-01 (#31609)Oriol Brufau2024-03-181-15/+15
| | | | | | | | | | | | | | | | | | | | | * Update Stylo to 2023-09-01 * Fixup for https://phabricator.services.mozilla.com/D184929 * Fixup for https://phabricator.services.mozilla.com/D184526 * Fixup for https://phabricator.services.mozilla.com/D184525 * Fixup for https://phabricator.services.mozilla.com/D185154 * Fixup for https://phabricator.services.mozilla.com/D184685 * Fixup for https://phabricator.services.mozilla.com/D185916 * Fixup for https://phabricator.services.mozilla.com/D185492 * Fixup for https://phabricator.services.mozilla.com/D186626 * Update test expectations
* clippy: Fix assorted warnings in `components/` (#31628)eri2024-03-131-4/+4
| | | | | | | * clippy: fix assorted warnings in `components/` * fix: new and default * fix: review comments
* clippy: fix some warnings in components/canvas (#31563)eri2024-03-081-32/+27
|
* Further changes required by ServoOriol Brufau2023-11-211-12/+12
|
* Further changes required by ServoOriol Brufau2023-11-061-3/+35
|
* Clean up a bit of the canvas backend abstractions (#30637)Ennui Langeweile2023-10-271-33/+14
| | | | | | * Clean up a bit of the canvas backend abstractions * Remove unused import Sneaky, sneaky little hecker
* Strict import formatting (grouping and granularity) (#30325)Samson2023-09-111-8/+10
| | | | | * strict imports formatting * Reformat all imports
* remove `extern crate` (#30311)Samson2023-09-081-0/+1
| | | | | | | | | | | * remove extern crate * Update components/script_plugins/lib.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Bump euclid to 0.22Martin Robinson2023-01-261-2/+2
| | | | | | | | | | | | | - Also updates raqote to latest with an upgrade of font-kit to 0.11 applied on as a patch - Update lyon_geom to the latest version Major change: - All matrices are now stored in row major order. This means that parameters to rotation functions no longer should be negated. - `post_...()` functions are now named `then()`. `pre_transform()` is removed, so `then()` is used and the order of operations changed.
* Skip missing glyphs when drawing 2d canvas text.Josh Matthews2020-08-071-3/+25
|
* Fix ./mach build --release --with-layout-2020Utsav Oza2020-06-101-6/+3
|
* Enable textAlign, textBaseline and direction attributes for canvasUtsav Oza2020-06-101-19/+16
|
* Implement CanvasRenderingContext2D.font propertyUtsav Oza2020-06-101-0/+1
|
* Query layout to resolve canvas font property valueUtsav Oza2020-06-101-1/+1
|
* Basic implementation of canvas.fillTextUtsav Oza2020-06-101-0/+29
|
* Revert "Add a simple implementation of CanvasRenderingContext2d.fillText"Paul Rouget2020-03-241-81/+0
| | | | Windows crash: https://github.com/servo/servo/issues/26015
* Add a simple implementation of CanvasRenderingContext2d.fillTextkaiakz2020-03-191-0/+81
|
* Make fill_rect() draw patterns correctlypylbrecht2020-03-031-25/+6
|
* Refactor arc() and ellipse() to use lyon_geom::Arcpylbrecht2020-02-261-82/+57
|
* Add missing CompositionStyle::Clearpylbrecht2020-01-271-0/+1
|
* Remove duplication for creating gradient stopspylbrecht2019-12-171-16/+16
|
* Add transform to Pattern::Surface to properly draw imagespylbrecht2019-12-171-6/+32
|
* Consider empty gradients in `is_zero_size_gradient()`pylbrecht2019-12-171-2/+4
|
* Handle `BlendMode::Clear` in `GenericDrawTarget::fill()`pylbrecht2019-12-171-0/+1
|
* Add a layer to store Pattern related informationpylbrecht2019-12-171-164/+246
| | | | | | | | Some information of `canvas_data::Pattern` was lost by converting it to `raqote::Source` due to the fact that Raqote did not store this information (e.g. linear gradient's start/end points). We introduce another layer to keep this information for later use (like in `is_zero_size_gradient()`).
* Implement "repeat-x" and "repeat-y" for imagespylbrecht2019-12-171-47/+68
|
* Set images' ExtendMode based on available informationpylbrecht2019-12-171-1/+6
|
* Handle overlapping gradient stops for linear gradientspylbrecht2019-12-171-3/+10
| | | | | | | | | | | From `addColorStop(offset, color)`s spec: If multiple stops are added at the same offset on a gradient, they must be placed in the order added, with the first one closest to the start of the gradient, and each subsequent one infinitesimally further along towards the end point (in effect causing all but the first and last stop added at each point to be ignored) https://www.w3.org/html/test/results/2dcontext/annotated-spec/canvas.html#testrefs.2d.gradient.interpolate.overlapu
* Use push_layer_with_blend() only when necessarypylbrecht2019-12-171-5/+36
| | | | | push_layer_with_blend() comes at a performance cost, so we only use it on blend modes that require it.
* Make arc() wrap angles mod 2pipylbrecht2019-12-171-1/+8
|
* Make arc() use `anticlockwise` argumentpylbrecht2019-12-171-1/+2
|
* Make fill() handle all composition operationspylbrecht2019-12-171-30/+5
|
* Make fill() draw uncovered pixels as (0,0,0,0) for certain composition opspylbrecht2019-12-171-7/+42
|
* Respect direction when drawing arcspylbrecht2019-12-171-2/+5
|
* Respect FilterMode when drawing imagespylbrecht2019-12-171-10/+29
|
* Add check for handling equal radial gradientspylbrecht2019-12-171-1/+8
|
* Add check to handle zerosize linear gradientspylbrecht2019-12-171-1/+6
|
* Use tolerance > 0 in Path::contains_point()pylbrecht2019-12-171-1/+1
|
* Create raqote::SolidSource with premultiplied colorpylbrecht2019-12-171-30/+30
| | | | SolidSource expects a premultiplied color.