mirror of
https://github.com/enso-org/enso.git
synced 2024-12-22 23:51:31 +03:00
a103c8d82f
This PR contains the first implementation of `cached_shape!` macro, which should help us with reducing draw calls in our application. ```rust mod icon1 { use super::*; ensogl_core::cached_shape! { 32 x 32; () { let shape = Circle(16.px()).fill(color::Rgba::green()); shape.into() } } } mod icon2 { use super::*; ensogl_core::cached_shape! { 202 x 312; () { let shape = Rect((200.px(), 310.px())).fill(color::Rgba::red()); shape.into() } } } ``` The above code creates two cached shapes. They are similar to normal shapes (created with `shape!` macro), except that: 1. they do not allow for any parametrization 2. They are rendered at the application start to the special texture with cached shapes. The texture will be used in next PRs to cache all Component Browser icons on the texture and draw all of them just by single, fast draw call. In the future, more shapes can be cached, further reducing draw calls and making them simple. # Important Notes The results are presented in `cached_shapes` debug scene: there are two shapes displayed and a scaled cached texture is displayed in the background. |
||
---|---|---|
.. | ||
macros | ||
src | ||
tests | ||
Cargo.toml | ||
README.md |
Shapely
This crate provides automatic derivation for useful type classes.