Commit graph

108 commits

Author SHA1 Message Date
Simon Hausmann
f79b80f1e6 Split corelib::abi::sharedarray into corelib::sharedarray and corelib::sharedarray::ffi 2020-08-04 08:26:44 +02:00
Simon Hausmann
0252d2ac34 Move slice out of abi 2020-08-03 17:41:16 +02:00
Simon Hausmann
9b13b363c3 Move corelib::abi::properties to corelib::properties
And the bits that are only there for the C binding are now in an ffi sub-module.
2020-08-03 17:32:28 +02:00
Simon Hausmann
785bdb62ed Fix linking on Linux 2020-08-03 15:35:19 +02:00
Simon Hausmann
f284af27c0 Fix build without rtti 2020-08-03 14:34:34 +02:00
Simon Hausmann
37fa04098f Move MouseEvent and MouseEventType from datastructures into input 2020-08-03 13:55:33 +02:00
Simon Hausmann
30d7a0b36d Move PathData and friends from datastructure to
graphics
2020-08-03 13:43:44 +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
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
Olivier Goffart
9760cf4969 Begin to implement a Flickable
The implementation is still very rough and will need to be improved
2020-07-30 14:36:21 +02:00
Simon Hausmann
c847a7b924 Fix values of width/height properties on initial show on macOS 2020-07-28 14:45:17 +02:00
Olivier Goffart
96a2efcb93 Only recompute the layout when needed 2020-07-28 10:43:06 +02:00
Olivier Goffart
e00491811b Get rid of the context in properties/signal 2020-07-13 18:49:06 +02:00
Olivier Goffart
caca0d0ba4 Put the component in a Pin<>
Removed the drop and create from the ComponentVTable:
since we are not using VBox<ComponentVTable>, this simplifies a bit
the code of the interpreter and everything else.

But there is still a lot of changes everywhere to support that the Component
is pinned.
This is just for the component. Which would be required if later we want
to access the properties as Pin<Property<_>>. But we have not yet ability
to do projections
2020-06-24 14:13:27 +02:00
Olivier Goffart
f8b7989c0b Access the properties in the parent component of a repeated element
This required some refactoring of the EvaluationContext structure to include the parent context
2020-06-22 14:38:38 +02:00
Simon Hausmann
072bff1871 Introduce the animation driver in the event loop
This re-applies commit 1ef269305e but with
an Rc<RefCell<>> to make the borrow checker happy :-)
2020-06-20 16:24:17 +02:00
Simon Hausmann
8f613685ba Expose a ComponentWindow in C++
This paves a way for a more modular API.
2020-06-17 19:15:18 +02:00
Simon Hausmann
d78c93bfee Revert "Integrate the animation driver into the event loop"
This reverts commit 1ef269305e. Breaks the
wasm build, to be fixed later.
2020-06-17 18:58:32 +02:00
Simon Hausmann
1ef269305e Integrate the animation driver into the event loop 2020-06-17 15:16:46 +02:00
Simon Hausmann
85bf8a195a Improve EventLoop encapsulation
Hide the winit loop and extract it only in the GL renderer
2020-06-17 15:16:46 +02:00
Simon Hausmann
5711f25195 Newtype'ify the event loop
That way it'll be easier to introduce a user event later and control the
public API.
2020-06-17 10:15:03 +02:00
Olivier Goffart
d7fe69ff74 Lookup the index from a repeater expression 2020-06-16 17:23:38 +02:00
Simon Hausmann
2b95b344d8 Further cleanups
Move the GraphicsWindow into graphics.rs -- there's not much in that
file otherwise ;-) and now lib.rs is concise again.
2020-06-16 16:38:37 +02:00
Simon Hausmann
bcc6c6a60a Move Color and RenderingPrimitive into abi::datastructures
This paves the way to replace RenderingInfo.
2020-05-22 16:07:06 +02:00
Simon Hausmann
230870a292 Style cleanup
Remove some where clauses that leads to less verbose signatures. Also
use impl FnFoo, which is shorter as well.
2020-05-22 16:07:06 +02:00
Simon Hausmann
d48faf711f Update cached rendering data only when there are changes
This introduces a separate rendering preparation step in the main
window. As a consequence, the component becomes a parameter and the
graphicstest example can't use the main window anymore.

The decision whether a new low-level primitive needs to be created or
not is made by comparing the last RenderingPrimitive against the new
one.

On the upside, this means that property changes are now reflected in the
graphics.
2020-05-22 16:07:06 +02:00
Simon Hausmann
cd80a4038f Clean up HasRenderingPrimitive trait API after transition
The extraction does not have to be optional anymore. That will make
future code using this simpler.
2020-05-22 16:07:06 +02:00
Simon Hausmann
21842bdd75 Remove the individual primitive factory functions from RenderingPrimitivesBuilder
Only use the new one that takes the new enum.
2020-05-22 16:07:06 +02:00
Simon Hausmann
9459578265 Add API to the RenderingPrimitivesBuilder to build the new style primitive 2020-05-22 16:07:06 +02:00
Simon Hausmann
5c8163d7a7 Introduce a new rendering primitive enum in the graphics module
This shall become the successor to RenderingInfo. For now it's just a
place holder, but the idea is that backend creates the opaque primitive
that holds this public rendering primitive, exposed via the
HasRenderingPrimitive trait.
2020-05-22 16:07:06 +02:00
Simon Hausmann
e7fd69bad1 Rename internal types
Rename the backend specific RenderingPrimitive to LowLevelRenderingPrimitive,
in order to make room for a high-level RenderingPrimitive enum that's public.
2020-05-22 16:07:06 +02:00
Simon Hausmann
f2662f0884 Simplify image primitives graphics API
Don't require a dest rect for now. Rendering is always at (0, 0) but
with the transformation applied. And the size shall for now not be a
parameter.
2020-05-22 16:07:06 +02:00
Simon Hausmann
bbc4c508f9 Minor cleanup
Replace lyon's rect import, which is a re-export of euclid's Rect<f32>,
with our own. Only the Path is
lyon specific, for now.
2020-05-22 16:07:06 +02:00
Simon Hausmann
4d26fe6674 Implement support for selecting the font family and pixel size in the GL renderer
The public API in the properties is still missing.
2020-05-21 20:55:34 +02:00
Simon Hausmann
81b5f70718 Implement colored text rendering 2020-05-19 21:58:01 +02:00
Simon Hausmann
cbd28bf745 Simplify image primitives API
Removed the source rectangle as that can also be done on the source image side,
if necessary.
2020-05-19 20:37:36 +02:00
Simon Hausmann
23d3964a0d Add boilerplate for text items
Forward the text and color properties to the rendering backend, where
right now we just rendering all the glyphs into a dedicated texture.

Next steps are a glyph atlas texture, blending the specified color with
the alpha of the glyphs, configurable size and family, shaping with
Harfbuzz and may more things.
2020-05-18 19:04:12 +02:00
Simon Hausmann
a7d5bd9f59 Minor rendering cleanup
Remove the x/y parameters from the rectangle primitive. They're always zero
since we always render with a transformation
matrix.
2020-05-18 16:01:53 +02:00
Simon Hausmann
c26a2a1562 Fix GL context state handling
Make our GL context not current when done with the initialization
and make it current for the duration fo primitive creation and frame
rendering.

Fixes #4
2020-05-12 21:42:34 +02:00
Simon Hausmann
ea03e08306 Clean up rectangle creation
Use a simple shared convenience method in the GraphicsBackend trait
2020-05-12 19:22:01 +02:00
Simon Hausmann
85e2ac36ef Prepare for caching rendering info for Items
Replace the RenderTree with a RenderingCache that is just the free-list vector
of rendering primitives.
2020-05-12 15:44:08 +02:00
Simon Hausmann
7efcbd5816 Simplify geometry handing
Replace the use of kurbo's primitives with lyon/euclid. This means less data copying,
conversion and also no annoying precision
casts.
2020-05-11 19:23:03 +02:00
Simon Hausmann
c966f6e546 Add primitive rectangle rendering
This is still uncached, but gets something onto the screen.
2020-05-11 15:33:14 +02:00
Simon Hausmann
3a954e4cea Move window system creation and other GL related code into the GL backend 2020-05-11 13:11:55 +02:00
Simon Hausmann
12626472c4 Fix wasm build
Get rid of the glutin dependency in the GL renderer -- the caller is now responsible for swapping buffers.
2020-05-07 15:07:29 +02:00
Simon Hausmann
e0b024d2cf Some work towards implementing the gl renderer
... in plain GL(ow). swapbuffers and clearing the color buffer is working.
2020-05-07 15:07:29 +02:00
Simon Hausmann
17d3d49a83 Use cgmath throughout
And remove usage of kurbo::Affine. That avoids extra translations.
2020-05-05 23:00:03 +02:00