Commit graph

84 commits

Author SHA1 Message Date
J-P Nurmi
ddf1038ea7 Skia: fix eliding of multiline text 2023-09-19 08:50:01 +02:00
Guilhem Vallat
5cf1a45e41 Remove duplicated geometry properties from items 2023-09-13 16:08:37 +02:00
Simon Hausmann
91d0747d06 Make use of the ItemCache more robust when the window scale factor changes
Previously, all the closures passed to `get_or_update_cache_entry` would
have to make sure that the scale factor is an included dependency. This
is error prone, as the parent commits show.

Instead, this change adds a property tracker to each ItemCache and lets
the renderer clear the cache if the scale factor changes.

Strictly speaking this may delete too many entries from the cache (not
all depend on the scale factor), but on the other hand this doesn't
happen very often so we trade robustness over efficiency.
2023-08-16 16:37:07 +02:00
Simon Hausmann
bd08cb47b5 Skia: Fix paths not being re-rendered when the scale factor changes
Include the scale factor in the property dependency chain.
2023-08-16 16:37:07 +02:00
Simon Hausmann
562a5e42df Fix cached femtovg layers not being re-rendered when the scale factor changes
Include the scale factor in the property dependency chain.
2023-08-16 16:37:07 +02:00
Simon Hausmann
4881bd1a87 Fix box-shadow cache not being invalidate when the scale factor changes
Include the scale factor in the dependency tracker of the item cache used for box shadows.
2023-08-16 16:37:07 +02:00
Simon Hausmann
5f48dca2c0 Skia: Fix re-rendering quality of SVGs when the scale factor changes
Make sure that the scale factor to compute the target size for an SVG is
a property dependency.
2023-08-15 15:46:09 +02:00
Simon Hausmann
868173cc20 Disambiguate the type name SkiaRenderer
- Use WinitSkiaRenderer for the adapter in the winit backend (similar to WinitSoftwareRenderer)
- Use SkiaItemRenderer for the impl of the ItemRenderer trait
2023-07-31 17:11:43 +02:00
Simon Hausmann
b503733d03 Update to a new release of the Rust Skia bindings 2023-07-31 16:18:42 +02:00
Simon Hausmann
84ddfc6c2f Add support for rendering the mouse cursor with linuxkms
The cursor is loaded by the window adapter from the cache. When it's
loaded the first time, its format will be Svg, so we convert it to a
pixel buffer. That way the skia backend can convert it on first draw
into a skia_safe::Image and replace the cache entry with the backend
storage variant.
2023-07-31 13:06:28 +02:00
Aurindam Jana
5a4a7fee63
Update royalty free license to 1.1 (#2994) 2023-07-10 10:12:11 +02:00
Simon Hausmann
053b990f2a Skia: align gradient rendering with software renderer and Qt
Interpolate colors as pre-multiplied.

cc #313
2023-06-27 17:19:50 +02:00
Olivier Goffart
11dea135f7 Domain: slint-ui.com -> slint.dev 2023-06-16 10:55:08 +02:00
Aurindam Jana
039e54a5de
Add royalty free license to files except examples and docs (#2888) 2023-06-15 11:20:50 +02:00
Simon Hausmann
6bdddd94f8 janitor: Update to skia-safe 0.63 2023-06-07 13:58:20 +02:00
Simon Hausmann
eadfec64a3 Add support for importing OpenGL textures into Slint
This is the initial API for Slint to borrow OpenGL textures from the
application for rendering.
2023-06-01 15:56:55 +02:00
Olivier Goffart
37e70c302e Refactoring: Pass the size to to the render function
So that we don't need to query the geometry multiple time, and this pave
the way to not have the geometry in the items

Part of #1932

As a drive by, fix the clipping of the Path element which incorrectly
offseted the clip by (x,y).
Similar fixes happen in the Clip element in some renderer, but that
didn't have effect because x and y are always 0 for the Clip element
2023-05-05 19:53:57 +02:00
Simon Hausmann
85da840603 Fold TextVisualRepresentation::apply_password_character_substitution into the TextInput's visual_representation() function
That way the call doesn't need to be duplicated on all call sites.
2023-04-26 17:48:46 +02:00
Simon Hausmann
baba08baeb Move the default password character into corelib
And only let Qt customize it
2023-04-26 17:48:46 +02:00
Simon Hausmann
fd9a2638b7 Use the common TextInputVisualization::apply_password_character_substitution also for the Qt renderer 2023-04-26 17:48:46 +02:00
Simon Hausmann
0bf4916a5f Skia: Add support for password input fields
Fixes #2619
2023-04-25 15:26:39 +02:00
Simon Hausmann
2872c13fff Fix using the software renderer with the native style
Provide access to the window inner also from within the software
renderer, so that the native style rendering can query the active state.

Fixes #2404
2023-03-24 16:29:21 +01:00
Simon Hausmann
c14ec0fb9c Update Skia
- This allows creating the Skia GL interface without string allocations
- Port the item renderer to use SkImageFilters::Shader instead of
  SkImageFilter::Paint
2023-03-21 09:36:39 +01:00
Tobias Hunger
3ac01c3f07 clippy: Fix clippy warnings 2023-03-09 09:35:29 +01:00
Simon Hausmann
7d984c7cb9 Skia: Improve quality of rounded rect rendering
Enable anti-aliasing, just like with FemtoVG and Qt.
2023-03-08 10:42:24 +01:00
Simon Hausmann
5ff0278185 Simplify path event extraction
Return the path events for rendering as an Option, so that if the path is empty,
we simply return.

This avoids a double property dependency in the (likely) event the path is not empty.
2023-01-21 13:10:19 +01:00
Olivier Goffart
d6b66a0690 Skia/femtfovg rectangle with transluscent border: set minimum radius
Set the minimum radius of the background to limit the artifact when
drawing the border
2023-01-20 14:12:43 +01:00
Simon Hausmann
b2c0392d7d
Fix Skia's drawing of the border rectangle with non-opaque borders (#2079) (#2086)
Also fix the border radius to be the outer radius of the rectangle

Skia renderer part of #1988 (minus clipping)
2023-01-20 11:33:55 +01:00
Simon Hausmann
0d23478469 skia: Cache and re-use Skia path elements for Slint item paths
This follows Skia best practices to re-use the path, because internally each path has its own id
that is used by the backend to cache stuff.
2023-01-16 21:31:10 +01:00
Simon Hausmann
5ebab4b354 skia: Fix wrong path offset
Convert from logical to physical pixels for the offset.
2023-01-16 21:31:10 +01:00
Simon Hausmann
0d37565cc2 janitor: bump Rust Skia bindings to the latest release
This includes additional cross-compilation build fixes that will allow
removing patches from the Yocto recipes.
2023-01-16 10:12:52 +01:00
Olivier Goffart
5cd38adb14 Move the colorize property to the Image item
Instead of the ClippedImage. Because we use the colorize property more
often than the source property, and these are soon going to be even more
expensive
2022-12-20 08:42:47 -08:00
Simon Hausmann
aea216fb49 Fix rendering of border widths with FemtoVG and Skia
Commit f66a2a5775 and dc048a11db introduced
the regression of issue #1985 where in adjust_rect_and_border_for_inner_drawing
instead of subtracting the entire border width from the size,
only half of it was subtracted,
leaving an inner area of the rectangle visible.

Fixes #1985
2022-12-14 15:32:53 +01:00
Simon Hausmann
01d2efce4e Move the Skia renderer into a separate crate
The crate is an internal crate until the API has been polished and
documented, after which we can call slint-renderer-skia for example.

This also duplicates a little bit of the glutin setup code, because
that would otherwise have to go into another shared crate.
2022-12-09 17:04:54 +01:00
Renamed from internal/backends/winit/renderer/skia/itemrenderer.rs (Browse further)