Commit graph

32 commits

Author SHA1 Message Date
Simon Hausmann
7e5de3d5d3 Remove use of euclid types and tags for logical/physical position and size in the public API
Instead provide our own types.
2022-09-02 11:05:53 +02:00
Simon Hausmann
c1dbf47d15 Fix appearance of drop shadows with Skia
Similar to commit 957186acb7 we need to take the blur into account in the box shadow image:

We add blur margins around the entire image, but we also need to start drawing at (blur, blur) instead of (0, 0).
The same offset needs to be subtracted again when drawing the cached image.
2022-08-31 11:36:04 +02:00
Simon Hausmann
1a8a295e38 Skia/FemtoVG: implement re-use of box shadow textures
When using box shadows in repeaters, we end up creating multiple
distinct textures of the drop shadow. That's a waste of precious texture
memory if they have the same properties.

Instead, when creating box shadows in a frame, see if they can be
re-used across images.  The texture still persistent in the image_cache,
via the explicitly shared skia_safe::Image and Rc<Texture>.

This works well when rendering repeated elements new top-down, but it's
not perfect.  For example if a bunch of repeated elements are in a
flickable, only a portion of them are visible and the view is scroll up,
then the top-down rendering will not find a cache hit for the newly
visible element with drop shadows. Yet this is simple enough to help
with sharing in many cases.
2022-08-23 15:27:34 +02:00
Simon Hausmann
af86f36157 Invert slint:🪟:WindowInner and PlatformWindow ownership
Previously: Window is an Rc<WindowInner>, which has an Rc<dyn
PLatformWindow> - and weak references the other way around.

Now: Rc<dyn PlatformWindow> is the root of window ownership. The impl
PlatformWindow has a slint::api::Window, which just holds a WindowInner.

This change is incomplete on a few levels, mainly that neither of the
code generators nor the interpreter is ported.
2022-08-19 15:07:27 +02:00
Olivier Goffart
a1724602e6 Skia: Cache the Skia image in the core image cache
Because re-generating the Skia image is slow and there is no point
storing both the image buffer and the SkiaImage in the cache as it
is basically the same information.
2022-08-16 11:22:11 +02:00
Olivier Goffart
ff1400ab6b Skia: Fix drawing of images with source clip, but no colorize
Colorize property with transparent value means no coloration is applied

CC #1445
2022-08-15 12:41:36 +02:00
Simon Hausmann
7b50e38e53 Skia: Implement rotation support 2022-08-11 13:32:40 +02:00
Simon Hausmann
fa956aca2d janitor: Fix nightly doc warnings about unused parentheses 2022-08-05 09:25:31 +02:00
Simon Hausmann
0805e52cf0 Skia and FemtoVG: Release cached layers when cache-rendering-hint is disabled
There's no good reason to keep the texture around.
2022-08-03 08:33:56 +02:00
Simon Hausmann
4189eebeb4 Skia: Fix caching of colorized image
Commit 0cf432b9a0 placed the colorize_image() call on the result
of the item cache retrieval, not inside the cache update closure.
2022-08-03 08:28:45 +02:00
Simon Hausmann
0cf432b9a0 Skia: Cache the result of colorizing an image
Colorization is typically implemented using an intermediate layer and since
usually it doesn't change so often, it's faster to cache the result in the existing SkImage cache
per Image item.
2022-08-02 13:48:04 +02:00
Simon Hausmann
b0851301d0 Fix rendering of border rects with border-width = 0
Don't stroke such rectangles.
2022-08-02 12:00:56 +02:00
Simon Hausmann
f47a1221fb Implement rendering of the native style with Skia 2022-08-02 12:00:56 +02:00
Simon Hausmann
33d080924c Implement ImageRendering option for Skia 2022-08-02 12:00:56 +02:00
Simon Hausmann
dacf083162 Silence unused paramter warnings 2022-08-02 12:00:56 +02:00
Simon Hausmann
59cab28d0d Add support for layer caching 2022-08-02 12:00:56 +02:00
Simon Hausmann
5e670dd511 Add support for caching the box shadow 2022-08-02 12:00:56 +02:00
Olivier Goffart
44f905fc5f skia: implement Path 2022-08-02 12:00:56 +02:00
Olivier Goffart
4ff8daa2ac skia: implement text vertical alignment 2022-08-02 12:00:56 +02:00
Olivier Goffart
881fbcb86d skia: Implement colorized image 2022-08-02 12:00:56 +02:00
Olivier Goffart
159e72f702 skia: Implement drop shadow 2022-08-02 12:00:56 +02:00
Simon Hausmann
01f09599dc Add support for rendering SVGs 2022-08-02 12:00:56 +02:00
Olivier Goffart
183d58b876 Skia: attempt to get text eliding and alignment 2022-08-02 12:00:56 +02:00
Simon Hausmann
793327f5c1 Initial support for image rendering
This lacks support for colorization, image rendering quality and SVG.
2022-08-02 12:00:56 +02:00
Simon Hausmann
ca30af383b Don't panic when the clip region is empty
It may happen that the clip region becomes empty (for literally invisible items).
For example this happens in the printer demo.
In that case we want to return an empty rect.
2022-08-02 12:00:56 +02:00
Olivier Goffart
2e1044afd7 skia backend: gradients 2022-08-02 12:00:56 +02:00
Simon Hausmann
89a7a4fb30 Render the output of the performance counter 2022-08-02 12:00:56 +02:00
Simon Hausmann
780775a303 Begin work on text rendering 2022-08-02 12:00:56 +02:00
Simon Hausmann
9bfd8c8477 Implement clipping 2022-08-02 12:00:56 +02:00
Simon Hausmann
69fa40ebbf Implement drawing of rounded rects with border 2022-08-02 12:00:56 +02:00
Simon Hausmann
aac89c458a Implement translate, opacity layers and global opacity
The latter requires manually applying the alpha to colors. But on the upside, opacity
layers are a built-in feature.
2022-08-02 12:00:56 +02:00
Simon Hausmann
771b122198 Add skia renderer skeleton
This one can render basically just plain rectangles.
2022-08-02 12:00:56 +02:00