Commit graph

276 commits

Author SHA1 Message Date
Olivier Goffart
aea1b3393d Fix wasm build 2020-12-15 12:38:42 +01:00
Olivier Goffart
2b5213c408 Refactor the rendering variables in a enum instead of an array
And finish the ImageFit::contain implementation
2020-12-15 12:16:44 +01:00
Olivier Goffart
26827733ac Fix: disabled slider should not react to click 2020-12-14 09:44:10 +01:00
Olivier Goffart
63a0d9308b Bump version 2020-12-14 08:49:54 +01:00
Olivier Goffart
f6d60c2662 Update winit 2020-12-11 16:17:45 +01:00
Simon Hausmann
d9a92aea81 Prospective fix for WebGL rendering performance on Windows
Disable anti-aliasing on the GL context, as that's often implemented
multi-sampling and it appears generally slow with Angle on Windows.Since
we do anti-aliasing ourselves, so it is not needed.
2020-12-10 09:41:29 +01:00
Simon Hausmann
8314fbbb86 Simplify the texture width/height calculation a little bit 2020-12-08 16:01:53 +01:00
Simon Hausmann
1b2261c562 Fix two compiler warnings about unsued code paths when targeting wasm 2020-12-08 12:09:44 +01:00
Olivier Goffart
125ec13f24 Bump version numbers
Note: this does not update the documentation yet
2020-12-07 15:41:29 +01:00
Olivier Goffart
c18f2ce1cc Fix disabled widgets in the native style 2020-12-01 10:59:57 +01:00
Olivier Goffart
5bdb9befb5 Use the PopupWindow in the native style combobox
Note: the background is not styled yet
2020-11-30 18:39:41 +01:00
Simon Hausmann
49112cda9b Fix deprecation warning from image-rs
Bump to the latest version and use the non-deprecated API
2020-11-26 10:56:21 +01:00
Simon Hausmann
fc4656571f Tweak the html canvas handling
Refresh the canvas size if the browser window gets resized, for example due to orientation changes.
2020-11-26 10:42:04 +01:00
Olivier Goffart
c37f0ce4c4 Load the cursor width property from the style
Ideally we would put the bindings dirrectly in the builtins.60
But this is unfortunately not possible because the "StyleMetrics" is not
yet available there and that would be a circular dependencies.
2020-11-25 09:58:54 +01:00
Simon Hausmann
af8df5cfbe More font handling cleanup
Rename FontHandle to PlatformFont
2020-11-25 08:39:32 +01:00
Simon Hausmann
f9ed6df123 Avoid unnecessary font loading with font-kit
Load (mmap) the font_kit::font::Font only once, not per pixel size.
2020-11-24 22:40:19 +01:00
Olivier Goffart
0c97b4f296 More use of the ItemRc 2020-11-24 13:42:34 +01:00
Simon Hausmann
f0289192b7 More font handling cleanup
Group all fields we need to determine a physical font into one FontRequest
structure and use that throughout.

That way adding more fields will require less changes.
2020-11-24 09:00:07 +01:00
Simon Hausmann
79b7e825bb Minor cleanup of font cache handling
Store the font family as a SharedString, as that allows us to make a
lookup without a string copy.
2020-11-23 18:23:22 +01:00
Simon Hausmann
bad7734c21 Avoid leaking cached texture allocations
Let the texture cache hold weak references and drain them each time
the rendering primitives builder finishes.
2020-11-23 16:26:21 +01:00
Simon Hausmann
ad99dc6475 Add support for image loading caching for embedded images
Extend the texture cache in the GL rendering backend to has by either
the path on disk or by the address of the static data.
2020-11-23 15:50:00 +01:00
Simon Hausmann
fdeda0d0ed Add some basic image loading caching for images loaded from the file system
Place them in a HashMap that's indexed by the path. This needs further
tuning, for example to also be applied to embedded images, and the cache
shouldn't hold a strong reference. But it makes the berlin page
playable.
2020-11-23 15:49:57 +01:00
Simon Hausmann
3d85e45ec3 Add support for source clipping to the Image element
This allows rendering only a sub-rectangle of the original image, which
we can use right away in the sliding puzzle demo.
2020-11-23 15:46:59 +01:00
Simon Hausmann
7583394751 Remove unnecessary image_size field of the Texture low-level primitive
Since our atlas allocator has an alignment of 1, the texture coordinates
(non-normalized) are identical.
2020-11-23 13:53:35 +01:00
Olivier Goffart
2e60afec39 Run cargo fmt 2020-11-23 12:08:23 +01:00
Olivier Goffart
596b740b62 Rename ARGBColor to RgbaColor 2020-11-23 11:47:47 +01:00
Simon Hausmann
89e0b57627 Rework and simplify the focus handling
Instead of determining the focus item through item tree traversal and
pointer comparison and storing the intermediate indices in the
components in the tree, remember the focus item by a pair of
VWeak<ComponentVTable, Dyn> and item_index: usize.

This speeds up determining the focus item as well as delivering events,
which can now be done directly after retrieving an ItemRef with
get_item_ref.

This also fixes the duplicate line edit focus in the 7gui cells
test case.
2020-11-20 15:33:15 +01:00
Olivier Goffart
62272bd73d Fix canvas size on browser. The size writen in the html is logical 2020-11-13 15:48:26 +01:00
Simon Hausmann
0389893df5 Add enabled state to CheckBox/SpinBox/Slider/GroupBox in the native style 2020-11-06 11:09:40 +01:00
Olivier Goffart
f940292182 Rename the builtinf file 2020-11-04 17:11:29 +01:00
Olivier Goffart
281a744e86 Load the builtin from a fake .60 file 2020-11-04 16:56:35 +01:00
Olivier Goffart
8a95b806c7 Strawman implementation of a combo box 2020-11-03 17:55:49 +01:00
Olivier Goffart
59707f068c add a enabled property on the line edit 2020-11-02 18:20:01 +01:00
Olivier Goffart
a82c23fc41 Add ability for the native style to export native Globals 2020-11-02 16:13:04 +01:00
Olivier Goffart
d2255327fe Properties: make sure that the falue is different before marking all dependencies dirty
Fix the animation of the gauge in the printer demo
2020-10-31 12:58:11 +01:00
Olivier Goffart
608ba95f9e Fix wasm warning 2020-10-31 11:58:10 +01:00
Simon Hausmann
c3ba5a0808 Clean up NativeButton
Eliminate native_button_enabled
2020-10-30 16:28:06 +01:00
Simon Hausmann
6b7630963f Add support for disabling a Button
This also removes the funny binding on the button in the gallery.
UI wise it's confusing that a button changes its size when pressed, and we can
show off bindings somewhere else :-)
2020-10-30 15:55:18 +01:00
Simon Hausmann
7e305a53fe Fix rendering of NativeButton and NativeCheckBox
* Set the Enabled state throughout the "widgets". This corrects the visual appearance of Button and CheckBox in particular.
* Render a button that's not down as raised, in order to show its outline.
2020-10-30 15:55:18 +01:00
Simon Hausmann
7d3337e1d1 Add missing comment I forgot to stage 2020-10-29 14:56:26 +01:00
Simon Hausmann
aa303d29c5 Fix rendering of scrollbars on macOS
The NSScroller is drawn completely disregarding the painter's translation.

So this patch goes for an intermediate image buffer instead.
2020-10-29 14:53:16 +01:00
Simon Hausmann
f010f62ad2 Remove dead code
The Q_WS_MAC pre-processor macro does not exist anymore. The original
reason for the widget was erroneously applied - the cocoa controls
themselves are NSViews and it's just that the backing store view in the
style will be nil -- that seems to make no visual difference though.
2020-10-29 14:47:53 +01:00
Simon Hausmann
42f11b3270 Fix rendering of integer aligned solid fill rectangles
Without a border radius they should have sharp edges when
aligned on integer coordinates.
2020-10-27 19:30:22 +01:00
Olivier Goffart
47be71e16d Introduce layout stretching 2020-10-26 16:40:35 +01:00
Olivier Goffart
20cfb65e53 Bump version 2020-10-22 08:41:45 +02:00
Olivier Goffart
9f08492258 Make sure that the ListView is not scrolled when there is enough room for all contents
Fixes #93
2020-10-21 09:47:33 +02:00
Simon Hausmann
a98da9ecc9 Draw rounded rectangles with anti-aliasing
Draw rounded rectangles using a distance function. This removes the need
to use lyon to tesselate the rounded corners and as a bonus it gives
anti-aliased borders.
2020-10-21 09:35:35 +02:00
Simon Hausmann
ccb57114ce Clean up cursor rectangle handling
Generalize this to be called a normalized rectangle and create it by hand.
2020-10-21 08:15:16 +02:00
Olivier Goffart
e46e0b683c Fix the size of the native CheckBox 2020-10-20 19:00:40 +02:00
Simon Hausmann
1887b37af7 Remove premultiply_alpha from ARGBColor again
It's not safe to use with ARGBColor<u8> because of overflows, so instead let's
use it in the place where we need it and where the precision is given.
2020-10-19 18:45:33 +02:00