Simon Hausmann
df2620838e
Improve RefCell usage
...
Use a RefCell only where we need it, in the glyph cache. We don't need
it for the platform data.
2020-08-13 10:23:08 +02:00
Simon Hausmann
674a25cfdc
Fix leaks of vertex and index buffers
...
Free them like the other GL resources
Closes : #3
2020-08-12 15:25:54 +02:00
Simon Hausmann
7807631ba0
Fix leaking texture atlas allocations
...
When a rendering primitive holding a reference into a texture atlas
allocation is dropped, we should free that area for future re-use.
2020-08-10 17:30:41 +02:00
Simon Hausmann
d6ef7c31a8
Fix rendering artifacts when scaling
...
The use of the texture atlas may result in pixels from adjacent textures
bleeding into the currently rendered texture. The standard technique appears to be
to add a padding around each image.
2020-08-10 15:53:44 +02:00
Simon Hausmann
ccb2e23cf5
Fix GL texture not freeing its texture id
...
Similar to the shaders, keep a reference count on the resource itself and
keep the context around for convenient deletion.
Fixes : #3
2020-08-10 11:20:58 +02:00
Simon Hausmann
6faf7439c2
Delete GL shader programs automatically
...
We already keep the context in an RC, might as well keep another copy :-)
This re-applies commit 9b0dfa14b5
but
replaces the Clone trait on Shader, which would lead to duplicate and
too early program deletion, with an Rc<Shader>.
2020-08-10 11:20:58 +02:00
Simon Hausmann
d9c776eb57
Revert "Delete GL shader programs automatically"
...
This reverts commit 9b0dfa14b5
as there's
an issue with webgl and everything disappearing.
2020-08-10 09:50:04 +02:00
Simon Hausmann
9b0dfa14b5
Delete GL shader programs automatically
...
We already keep the context in an RC, might as well keep another copy :-)
2020-08-08 13:31:37 +02:00
Simon Hausmann
f86f8360b2
Fix rendering of text with spaces
...
Don't waste glyphs and potential pixels from the rasterizer for space --
merely use the advance.
2020-08-07 15:32:59 +02:00
Simon Hausmann
aecf6a8878
Center text in buttons in the demo and gallery
...
This adds horizontal_alignment/vertical_alignment properties, along with
width/height to Text.
This still uses a hard-coded enumeration in the compiler, which is meant
to go away in favor of general enum support.
2020-08-07 10:02:52 +02:00
Simon Hausmann
b6a5810bdc
Fix wasm build
2020-08-05 11:10:39 +02:00
Simon Hausmann
d3c596669c
Add larger icons to the printer demo
...
The icons on the main screen are now nicely large and they scale down on
activation.
2020-08-05 10:04:11 +02:00
Simon Hausmann
48df8d0911
Rework the API between the items and the renderer
...
Move fields out of the HighLevelRenderingPrimitive that are suitable to
represent as uniform variables. That reduces fields like Image or
Rectangle to their image or dimension, and only if *they* change, then
we re-do the work of building geometry and uploading it to the GPU.
Instead, the typically animated properties such as the position or the
color are passed separately with each draw call. This avoids re-decoding
PNG files and uploading them again when moving an image element around
on the screen.
2020-08-05 09:44:12 +02:00
Simon Hausmann
a9297af00d
Update the rendering primitives lazily using a property listener scope
...
This also allows avoiding the need to store the high-level rendering
primitive item in the low-level primitive struct for comparison later.
2020-08-04 22:48:03 +02:00
Simon Hausmann
685a3fb8ab
Rename Text::font_pixel_size to just font_size
...
Since length are resolution independent, it doesn't make sense anymore
to have the pixel infix.
2020-08-04 16:56:42 +02:00
Simon Hausmann
2b713eb341
Use a default font size that scales with the window scale factor
...
This is still coded in the backend but eventually we'll have default values
properties of items and then that can go there.
2020-08-04 16:53:48 +02:00
Simon Hausmann
76adda0abd
Move ComponentWindow and friends from datastructures into eventloop
2020-08-03 14:26:47 +02:00
Simon Hausmann
1b270f42d0
Move datastructures::Color into graphics
2020-08-03 13:27:35 +02:00
Simon Hausmann
fa87363dc5
Move Point, Rect and Size into graphics
...
And move the expanded structures for cbindgen into an ffi sub-module.
2020-08-03 13:24:39 +02:00
Simon Hausmann
a2cec9e86f
Clean up LyonPathIterator API
...
* Remove Lyon from the name and instead call it PathDataIterator.
* Remove the fit() function and just provide two factory functions.
2020-08-03 13:18:38 +02:00
Simon Hausmann
ce7f66320b
Move datastructures::Resource into graphics
...
It's only used for graphics at the moment and used
for image resources.
2020-08-03 12:47:05 +02:00
Simon Hausmann
05f3ff10a6
Rename graphics::RenderingPrimitive to HighLevelRenderingPrimitive
...
That plays better with the existing LowlLevelRenderingPrimitive.
2020-08-03 12:39:57 +02:00
Simon Hausmann
550d0122a5
Move datastructures::RenderingPrimitive to graphics
2020-08-03 12:39:52 +02:00
Simon Hausmann
aa398c6277
Rename Resource::EmbeddedDataOwned -> EmbeddedRgbaImage
2020-08-03 12:20:17 +02:00
Simon Hausmann
6c5d423cd4
Rename sixtyfps_corelib to sixtyfps-corelib
2020-08-03 10:01:58 +02:00
Simon Hausmann
893124d64e
Minor cleanup in glyph cache code
...
Merge string_to_glyphs and layout_glyphs -- they only make sense together here.
2020-07-28 14:22:34 +02:00
Simon Hausmann
cd77171bbc
Move all glyph cache related code into one module
2020-07-28 14:22:34 +02:00
Simon Hausmann
c102fca828
Move the glyph rasterization code into the new font module in corelib
2020-07-28 14:22:34 +02:00
Olivier Goffart
d77d7cddc3
The viewer can use the Qt style with --style qt
2020-07-24 18:06:55 +02:00
Olivier Goffart
b8299747c6
WIP: some draft of a Qt style
2020-07-24 17:59:23 +02:00
Simon Hausmann
0c5b0fbabd
Don't require a border width to make a rounded rect
2020-07-24 14:54:49 +02:00
Simon Hausmann
016834ad91
Don't fill a rectangle beyond its outline
2020-07-24 14:25:37 +02:00
Simon Hausmann
424f74a506
Minor style tweak
...
Use collect() instead of the explicit from_iter call. A little neater :-)
2020-07-24 10:49:17 +02:00
Simon Hausmann
9938197b58
Split Rectangle again
...
Into the previous Rectangle and BorderRectangle that allows (rounded) borders through a stroke in addition to the fill.
Next step is to make the compiler make the choice automatically depending
on the properties used.
2020-07-24 10:15:12 +02:00
Simon Hausmann
0a24fbd56d
Reduce some code duplication in the renderer
2020-07-24 09:28:02 +02:00
Simon Hausmann
dd9bd2cf72
Add a rounded border to the button
...
There's still an open question about how to avoid the border properties
for all rectangles but allocate them only for those who have a border.
Regardless, this border illustrates the issue with the lack of text sizing.
2020-07-24 09:21:30 +02:00
Simon Hausmann
00f2d384b2
Fix formatting
2020-07-24 07:52:18 +02:00
Olivier Goffart
debd2b5839
Smaller workaround for the fact that some function are not exported
2020-07-23 17:11:00 +02:00
Simon Hausmann
992f990fa8
Allow for fitting paths into a given bounding rectangle
...
... by applying a transformation. This allows designing a path in some
other path design tool and then make it fit using bindings.
2020-07-13 15:41:11 +02:00
Simon Hausmann
6243df1702
Avoid unnecessary path building
...
When the path was constructed from events (SVG commands), then we don't really need to build an intermediate path,
neither for rendering nor for path layouting.
2020-07-10 13:59:40 +02:00
Simon Hausmann
ad98ae65ae
Avoid unnecessary path building
2020-07-10 10:24:36 +02:00
Simon Hausmann
f45ff6ce79
Add support for stroking paths
...
This will make it easier to visualize the path for layouts.
2020-07-09 09:36:16 +02:00
Simon Hausmann
dfe95a2f6d
Allow rendering primitives to break down into multiple GL primitives
...
This is in preparation for path stroking and filling.
2020-07-09 09:10:55 +02:00
Simon Hausmann
afa23faa94
Move the path building function into corelib
...
We're going to need it not only in the GL renderer but also in the layout code.
2020-07-08 20:36:40 +02:00
Simon Hausmann
32f9f4117f
Upgrade to a new upstream glow version
...
This includes our fix for the texture creation from canvas, and requires
a little source compatibility fix.
2020-07-08 20:25:40 +02:00
Simon Hausmann
c6c0f1f589
Make path arc rendering more robust
...
Some arcs may not result in any content, for example if the radius is too small
or start and end pointer overlap. Let Lyon do the
checking for us and handle it accordingly.
Newer versions of Lyon will allow the re-use of the SvgArc created temporarily.
2020-07-08 08:42:01 +02:00
Simon Hausmann
f646809ff4
Added ArcTo element for paths
2020-07-07 16:02:46 +02:00
Simon Hausmann
1ab71b8ca3
Prepare the path element setup in the run-time for extensibility
...
Make the anonymous struct for the LineTo variant in the PathElement enum
as separate structure, which can be introspected using rtto::FieldInfo.
2020-07-07 14:14:17 +02:00
Simon Hausmann
9cf2d618d2
Use Lyon's path builder
...
Instead of trying to convert the individual (future) elements, let's use a builder.
This way the markup remains simple and due to
future support for bindings we can't really
pre-compute the path events anyway.
2020-07-07 14:14:17 +02:00
Olivier Goffart
1cbd522a03
Rust: make non-constant model and if expression work
2020-07-03 14:04:23 +02:00