cargo:warning=widgets.rs:983:31: error: reference to local binding 'rect' declared in enclosing function '__cpp_closure_1878168448326367357_impl'
cargo:warning= option.rect = rect;
cargo:warning= ^
cargo:warning=widgets.rs:978:24: note: 'rect' declared here
cargo:warning= auto [img, rect] = offline_style_rendering_image(size, dpr);
cargo:warning= ^
cargo:warning=1 error generated.
Also revert the QStyle::State_Horizontal in the spinbox that should not have been part of the previous patch
Unfortunately something is wrong with the Qt style, it looks like the Qt style
does not respect the rect given for the sub components
Also Input is not handled yet.
QStyle returns logical coordinates while SixtyFPS operates on physical
coordinates, so an extra multiplication is needed.
This is a temporary fix until we have access to the concrete (winit)
window we're rendering to, in order to apply the correct DPR.
A CGBitmapContext can only be created on a 32bpp/8bpc QImage if the
alpha channel is pre-multiplied. That context is needed to draw cocoa
controls to the QImage. So create a QImage with pre-multipled alpha.
Fortunately our blend mode in the GL renderer already supports that.
Also a QWidget is needed to have an NSView (through the widget's backing store).
Centralize the code in one function, so that we can later change it to
deal with different device pixel ratios. The function returns an image
and a QRect that contains the logical size.
winit sets an NSApplicationDelegate on the NSApplication and expects it
to remain there. We must instruct Qt not to install its own application delegate, to avoid
winit being confused.
For something like
Window {
GridLayout {
Rectangle {
border_width: 2lx;
border_radius: 2lx;
border_color: black;
}
}
}
The border was not fully visible and partly obscured by the window
frame, the canvas element in the case of the preview in the examples.
That looks bad, and this patch fixes it by respecting the border width
in the geometry used to stroke and fill the rectangle.
Some of the example code does not include a Window {} element with a
size. The html says <canvas width=100 height=100> but it turns out that
winit is not interested in these values and any newly created window
with a canvas will get an initial size of 1024x768.
This is not quite the behavior we want, preserving the canvas size may
be more sensible -- it certainly is for our docs. So this patch tries to
preserve that.
QPainter does not like to draw in an empty QImage.
And the rendering code does not like to render it.
So we would get this on the console:
```
QPainter::begin: Paint device returned engine == 0, type: 3
QPainter::save: Painter not active
QPainter::save: Painter not active
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::save: Painter not active
QPainter::setClipRegion: Painter not active
QPainter::setPen: Painter not active
QPainter::setBrush: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::setPen: Painter not active
QPainter::setBrush: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::save: Painter not active
QPainter::restore: Unbalanced save/restore
QPainter::restore: Unbalanced save/restore
thread 'main' panicked at 'attempt to subtract with overflow', sixtyfps_runtime/rendering_backends/gl/texture.rs:285:42
```
Make the text color a rendering variable, so that it can be passed
through as uniform to the glyph shader and applied to the gray
map of the glyphs. This avoids re-creating the glyph runs when
merely the color changes.
This already "worked" for the glyph cache based text rendering,
but it wasn't used because of the wasm canvas code path. This
patch changes that to render the text into a text using simply black
and then render that texture using our existing glyph shader,
which merely uses the alpha channel anyway.
This reduces also #cfg's.
Currently the Qt backend still redirect everything to the GL backend,
but the goal is to use QPainter and QWindow
This also adds a "default" backend, whose goal is to select the proper
backend at compile time
The path shader uses only one attribute array, while the others use two.
First rendering with say the glyph shader and then the path one may leave
odd artifacts around with GLES, which is fixed by properly disabling the
vertex attribute arrays after use.
Closes: #17
- Give all the sixtyfps-* create a 0.0.1 version
- Make sure that the internal dependences are using the exact same version
(so "=0.0.1")
- Add the description/homepage/repository fields in the .toml files
- Set publish=false to crates that are not meant to be published on crates.io