Commit graph

363 commits

Author SHA1 Message Date
Olivier Goffart
a094ce7a2a Add a warning on the internal crates documentation that we don't follow semver 2021-08-16 18:26:33 +02:00
Simon Hausmann
1fca971fa8 Rename RGB(A)8Pixel to Rgb(a)8Pixel
That's consistent casing with RgbaColor.
2021-08-10 15:56:01 +02:00
Simon Hausmann
6016007c6f Avoid the need for SharedPixelBuffer users to depend on rgb
Re-export the two typical pixel types, for convenience. Of course other
types can be used, too, if the user depends on rgb directly.
2021-08-10 15:56:01 +02:00
Simon Hausmann
f25f85844d Remove SharedImageBuffer from the public Rust API
and instead fold the constructor functions into Image as `new_rgb8`/`new_rgba8` and `new_rgba8_premultiplied`.
2021-08-10 15:56:01 +02:00
Simon Hausmann
8a3a68a4fa Add API to Rust sixtyfps::Image to enable creation from user supplied image buffers
This adds an ImageBuffer and PixelBuffer type for SharedVector
backed images. The documentation explains how to use this
with low-level rendering functions and the popular image crate.

Fixes #387
2021-08-10 15:56:01 +02:00
ogoffart
53f286258c Bump version number to 0.1.1 2021-08-10 08:06:20 +00:00
Tobias Hunger
4c7ecc57d8 Janitor: Fix clippy::or_fun_call 2021-08-04 22:50:35 +02:00
Tobias Hunger
2606d6d9e7 Janitor: Fix clippy::clone_on_copy 2021-08-04 22:50:35 +02:00
Tobias Hunger
ce976a1dbb Janitor: Fix clippy::useless_conversion 2021-08-04 22:50:35 +02:00
Tobias Hunger
24a2021226 Janitor: Fix clippy::needless_borrow 2021-08-04 22:50:35 +02:00
Olivier Goffart
603c5df47a Building the doc no longer need nightly rust
Rust 1.54 has the feature that allow us to include markdown files
in the docs
2021-08-03 16:27:31 +02:00
Simon Hausmann
29f5853332 Provide sixtyfps::Window by reference in the Rust API
This also removes Clone from the Window again, to avoid having to face
the question: Does cloning a window duplicate it on the screen?
2021-08-03 10:32:04 +02:00
Simon Hausmann
66891a299c Start a new sixtyfps::Window API for Rust, C++, the interpreters and JS
The generated component now provides access to a Window type
via the window() accessor function.

This is part of #333
2021-08-03 10:32:04 +02:00
Simon Hausmann
cb76186b59 Remove stray line 2021-08-01 09:34:36 +02:00
Simon Hausmann
52aee8d366 Another minor reduction in generated code
Further build on b3529d1b75 and move the
strong/weak reference dance into the API crate out of the generated
code.

Saves ~21k llvm lines on the printer demo (debug).

It's also possible to move the as_pin_ref() bit, but that didn't
really give any savings overall.
2021-08-01 09:34:36 +02:00
Simon Hausmann
b3529d1b75 Rust: Speed up compilation times of generated code
The binding setup functions (set_binding, set_animated_binding, etc.)
are taking the binding basically as an `impl Fn() -> T`, which means
each call site creates a new copy. The bodies of these can be quite big.
Since most of our uses follow the pattern of just capturing the
samereduce the number of copies needed parameter, we can reduce the
number of copies needed by providing wrappers.

With rustc 1.54.0 on my mbp and debug, the build time of

    touch ../ui/printerdemo.60
    cargo rustc

goes from 1m:15s down to 42s, and total llvm lines goes from
2079842 down to 1134237.
2021-07-30 09:22:20 +02:00
Olivier Goffart
f38ce3c090 Fix the tests 2021-07-29 18:25:23 +02:00
Olivier Goffart
188806ef89 An empty sixtyfps! macro should compile 2021-07-29 17:50:57 +02:00
Olivier Goffart
c11d880424 Rerun the build scripts that compile .60 if the default style might have changed 2021-07-28 16:57:09 +02:00
Olivier Goffart
43e07320a5 Fix comments and naming found in review in #355 2021-07-28 16:57:09 +02:00
Olivier Goffart
7821926002 Rust: defaults to the native style when Qt is available
This requires some gymnastics to get right as the information
need to be passed to the compiler despite having no direct dependency
between the compiler and the runtime or backends.
So use a file in the build directory to tell the default style

cc: #83
2021-07-28 16:57:09 +02:00
Olivier Goffart
fae6e0b52d Document that angles are represented in degrees at run-time 2021-07-26 17:36:02 +02:00
Tobias Hunger
27b42687fa Janitor: Fix clippy::redundant_closure 2021-07-23 13:48:52 +02:00
Simon Hausmann
3146fb7764 internal cleanup: Remove the sixtyfps::testing::HasWindow trait
and replace it with the internal, re-exported WindowHandleAccess
one.

Strictly speaking, this is a breaking change. In practice the
returned type of this trait was in `sixtyfps::re_exports`, so any
public use is questionable :)
2021-07-21 20:33:02 +02:00
Simon Hausmann
eaddbe664e internal cleanup: Rename ComponentWindow to WindowRc
That's all it is nowadays, it's a wrapper around Rc<Window>. It's not an
alias because we need to also "wrap" it to C++ via cbindgen, but that's
about it.
2021-07-21 20:33:02 +02:00
Simon Hausmann
1c285694d7 internal cleanup: Remove the use of ComponentWindow in the interpreter 2021-07-21 17:41:12 +02:00
Simon Hausmann
ef184f7f1a internal cleanup: Remove the rest of the ComponentWindow API
Now it just remains a wrapper around the Rc, and it can soon be moved to
the API crate hopefully.
2021-07-21 17:41:12 +02:00
Simon Hausmann
e005058285 internal cleanup: remove free_graphics_resource from the public ComponentWindow API
Use the WindowHandleAccess backdoor instead.
2021-07-21 17:41:12 +02:00
Olivier Goffart
3078285114 Add sixtyfps::Weak::upgrade_in_event_loop 2021-07-19 15:57:29 +02:00
Olivier Goffart
b3e58d58fe Add a note in the doc that recomands resolver = "2" 2021-07-16 17:32:08 +02:00
Simon Hausmann
6e12b00b3f Re-add new constructor functions for ComponentCompiler and CompilerConfiguration
Amends commit dc51d4ccda

As discussed in #310
2021-07-12 13:26:17 +02:00
Tobias Hunger
dc51d4ccda Use impl Default instead of new() constructors 2021-07-12 13:22:25 +02:00
Tobias Hunger
8f7d7afa94 Janitor: Replace Option::map returning () with if let 2021-07-09 17:00:46 +02:00
Tobias Hunger
718126e148 Janitor: Remove useless into() 2021-07-09 17:00:46 +02:00
Tobias Hunger
a0c567d242 Janitor: Remove unnecessary return 2021-07-09 17:00:46 +02:00
Tobias Hunger
86e847fec0 Janitor: Prefer strip_prefix over manual stripping 2021-07-09 17:00:46 +02:00
Tobias Hunger
b82ee6a470 Janitor: Replace a == "" with a.is_empty() 2021-07-09 17:00:46 +02:00
Simon Hausmann
be47f708d9 Cleanup: Move docs/html to docs/resources 2021-07-08 07:01:51 +02:00
Simon Hausmann
ad321c7735 Use one shared html file for the syntax highlighting
Using Olivier's idea to check the meta tag, we can distinguish rustdoc
from "the rest". The html is included in mdbook by directly by
symlinking head.hbs.
2021-07-08 07:01:51 +02:00
Simon Hausmann
8003c06f3a Move all HTML/CSS/JS related to preview and syntax highlighting in the docs into a shared folder
This will also be the place where the .60 language definition for
highlight.js can go.
2021-07-08 07:01:51 +02:00
Simon Hausmann
77898796da Rust docs: Split up the preview from the syntax highlighting
The preview is now in sixtyfps-docs-preview.html and the highlighting in
sixtyfps-docs-highlight.html. This faciliates reusing the preview from
C++ while using a different HTML file later for syntax highlighting.

Relates to #282
Needed for #281
2021-07-07 14:00:04 +02:00
Simon Hausmann
0236bbcf07 Avoid overriding rustdoc highlighting
Only run highlight.js on .60 code blocks, to not interfere with rustdoc

Relates to #282
2021-07-07 11:36:22 +02:00
Simon Hausmann
8ecddc120a Try to add syntax highlighting for .60 snippets in Rust documentation
Load our highlight.js snippet that we also use for the mdbook tutorial.
Once change we need to apply on top is that the rustdoc CSS theme does
not currently provide hljs classes that change with the currently
selected theme, so instead we're mapping the classes to the CSS classes
that are used for Rust syntax highlighting. Those change with the
current theme.

Relates to #282
2021-07-07 11:13:54 +02:00
Tobias Hunger
ac207428dc Janitor: CSpell fixes
Mark up some special words in documents (like C++ lingo in rust files).
2021-07-06 22:44:09 +02:00
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +02:00
Olivier Goffart
1b9b583e3c Move the published editor and wasm-interpreter to the snapshots directory 2021-07-01 10:12:53 +02:00
Simon Hausmann
b314bc9789 Fix up docs preview integration for dev builds
Use the wasm interpreter from the dev branch for dev docs
2021-06-30 18:49:04 +02:00
Olivier Goffart
423656d900 Update some more version number
Meaning that following the docs or tutorial won't work until the release is complete
2021-06-30 17:21:38 +02:00
Simon Hausmann
5d58d34e84 Document run_event_loop() and quit_event_loop()
The C++ versions were there before, but undocumented. The Rust version
for quit() was missing.
2021-06-29 16:12:00 +02:00
Olivier Goffart
16ba23ae47 Move StateInfo to the private namespace 2021-06-28 11:23:44 +02:00