Commit graph

11 commits

Author SHA1 Message Date
Simon Hausmann
9799571396 Make it possible to implement the ItemRenderer trait with a lifetime
The as_any() method returning a `&mut dyn Any` meant that the type has to be
'static. The class solution of returning &()
doesn't work because it has to be a mutable ref. Therefore just return an Option.
2022-07-12 20:37:14 +02:00
Olivier Goffart
4ecc2cd1c0 swrenderer: add a renderer that operate dirrectly on the frame buffer 2022-07-06 17:06:40 +02:00
Olivier Goffart
1b551504a2 swrenderer: Refactor so that we can add a BufferRenderer 2022-07-06 17:06:40 +02:00
Simon Hausmann
3a5c4981de Clarify comment about clipping in the sw renderer's text drawing 2022-06-17 12:59:48 +02:00
Simon Hausmann
27dc1ec1a6 Fix build with --cfg slint_int_coord 2022-06-17 12:59:48 +02:00
Simon Hausmann
2903b1814c swrenderer: clip glyphs to the text element's geometry
This ensures that the partial renderer updates correctly and this also
fixes a panic in the printer demo on the stm32h7 when opening the format
combobox in the scan page:

We would attempt to render the word "JPEG" with a font size of 12 pixels.
The letter J has a height of 12 pixels, like the font ascender reported, but it's
y coordinate is negative.
That would also result in a negative text item relative origin for the glyph (target
rect in physical pixels),
which fails to convert to an usize and panics.
2022-06-17 12:59:48 +02:00
Olivier Goffart
711fa66ca3 rp2040 backend: use DMA to send pixels to the screen via SPI 2022-06-17 09:30:09 +02:00
Olivier Goffart
014c827194 swrenderer: Optimize image drawing by using premultiplied colors 2022-06-14 11:23:02 +02:00
Simon Hausmann
2d2eb70b51 Fix panic about multiple mutable borrows with the software renderer
When using repeaters - like in the slide puzzle - and during renderer a component
gets deleted, we call free_graphics_resources and try to free
the dirty rectangle list in the partial renderer cache. At that point the cache is
already mutably borrowed, which causes a panic.

As remedy, apply the mutable borrow more fine grained and not right when calling
render().
2022-06-10 08:38:34 +02:00
Olivier Goffart
dc7117eeb1 swrenderer: move some computation outside of loop 2022-06-08 16:36:46 +02:00
Olivier Goffart
a72115518d Move the software renderer to core 2022-06-04 13:40:50 +02:00
Renamed from internal/backends/mcu/renderer.rs (Browse further)