Simon Hausmann
4e9b2725a7
doc fix: Remove mention of SharedVector in SharedPixelBuffer
...
It's an implementation detail
2021-08-10 15:56:01 +02:00
Simon Hausmann
a0f06e35d7
Fix rustdoc link
...
Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
2021-08-10 15:56:01 +02:00
Simon Hausmann
0d3c38899f
minor doc fix: capitalize Rust
2021-08-10 15:56:01 +02:00
Simon Hausmann
d023475f1c
Rename Image::new_rgb*()
to Image::from_rgb*
2021-08-10 15:56:01 +02:00
Simon Hausmann
76041684c0
Simplify scenario description in Image docs
...
It doesn't have to be an external crate that renders images, just Rust code generally.
Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
2021-08-10 15:56:01 +02:00
Simon Hausmann
2a420d7a86
Remove imgref dependency from the public Image API
...
There's only one place where we need this ourselves and that's also
easily done by hand. Otherwise the `as_bytes(_mut)()` accessor provides the
functionality along with `width()` and `height()`.
Other than that the API is mostly consuming, given that `sixtyfps::Image`
has no way of extracting the data again.
2021-08-10 15:56:01 +02:00
Simon Hausmann
cfb6caca01
Fix calling Image::size()
on default or pixel-buffer constructed images
...
For such images we do not need a backend and can avoid the panic.
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
c18b289e62
Provide convenience as_bytes(_mut)
for SharedPixelBuffer
...
This avoids the need for users of the API to import the ComponentBytes trait from rgb.
2021-08-10 15:56:01 +02:00
Simon Hausmann
8b62564a4b
Fix incorrect self parameter in SharedPixelBuffer
...
We don't need a mutable reference for `as_slice()`
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
12916e7488
Fix C++ build after Image API changes
...
Export missing types
2021-08-10 15:56:01 +02:00
Simon Hausmann
2e9e818691
Mark SharedPixelBuffer as repr(C)
...
For use in the ffi later
2021-08-10 15:56:01 +02:00
Simon Hausmann
b6254d2fd7
Fix doc error
...
In a non-Qt build ImageInner would be unused and trigger a warning that's an error.
2021-08-10 15:56:01 +02:00
Simon Hausmann
64522d9d17
Qt backend: speed up determining the size of embedded images
...
Don't go through the dance of copying the image buffer into a QImage just to determine the size.
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
Simon Hausmann
f0a7c4f817
Fix build with Qt 6
...
QFont::resolve(uint mask) is QFont::setResolveMask(...) in Qt 6.
Fixes #399
2021-08-10 09:02:01 +02:00
Simon Hausmann
7384ebdc32
Deprecated SharedVector::as_slice_mut() in favor of SharedVector::as_mut_slice()
...
The standard library uses the latter name.
2021-08-09 14:51:09 +02:00
Tobias Hunger
c3ce321429
Janitor: Fix clippy::ptr_arg
2021-08-09 13:19:34 +02:00
Tobias Hunger
afa52d0f18
Janitor: Remove unneeded mut
2021-08-09 13:19:34 +02:00
Tobias Hunger
cbdea7c9c7
Janitor: Fix clippy::missing_safety_doc
2021-08-09 13:19:34 +02:00
Tobias Hunger
9dcd107e84
Janitor: Fix clippy::single_match
2021-08-09 13:19:34 +02:00
Tobias Hunger
d50dcf77f5
Janitor: Fix clippy::from_iter_instead_of_collect
2021-08-09 13:19:34 +02:00
Tobias Hunger
bac4d895ce
Janitor: Fix clippy::while_let_on_iterator
2021-08-09 13:19:34 +02:00
Tobias Hunger
094f4bb082
Janitor: Fix clippy::cmp_owned
2021-08-09 13:19:34 +02:00
Olivier Goffart
16325d5474
Remove dbg!
2021-08-09 12:40:21 +02:00
Olivier Goffart
8728052578
Fix panic when typing into the line edit in the gallery
...
The problem was that the item array's parent was not properly
computed. Leading to corrupted item when getting the parent of the
focus item.
2021-08-09 12:00:17 +02:00
Olivier Goffart
c33e4d76aa
Use proper rustdoc link.
...
Its ``[`...`]`` not ``[[..]]``
2021-08-07 17:07:41 +02:00
Olivier Goffart
58af765b07
Fix the qt backend always rebuilding
...
(because of one of the previous changes which renamed the file)
2021-08-06 21:48:38 +02:00
Olivier Goffart
3d7ce0fed8
Rename the qt/widgets.rs to qt/qt_widgets.rs
...
there are other files wih widgets in their name, so disambiguate
2021-08-06 18:48:58 +02:00
Olivier Goffart
fb5be2ed8a
Fix compiler warning
2021-08-06 18:46:56 +02:00
Simon Hausmann
b4ba77dba7
Fix SharedVector creation from iterators with default size hints
...
* In capacity_for_grow, don't compare the number of elements
(current_cap) with the size of an element in bytes, but
with the required capacity instead (to detect that we don't need
to grow). Not all call sites check for that (i.e. push), so there's
a new test for that.
* When re-allocating due to growth and copying elements from the old
inner to the new inner, make sure to copy all old elements from the beginning,
not only the last element repeatedly.
2021-08-06 16:18:33 +02:00
Olivier Goffart
6789e7195e
Fix compilation
...
The recently removed property was actually not complely unused
2021-08-06 15:58:13 +02:00
Olivier Goffart
a89d83e58f
Apply suggestions from code review
...
Co-authored-by: Simon Hausmann <simon.hausmann@sixtyfps.io>
2021-08-06 15:58:13 +02:00
Olivier Goffart
d41839abe3
Compiler pass for the TabWidget
...
it will lower the TabWidget into a TabWidgetImpl and the tabs into TabImpl
2021-08-06 15:58:13 +02:00
Olivier Goffart
c58ffe1589
Better panic message when we reference a property that does not exist
2021-08-06 15:58:13 +02:00
Olivier Goffart
29e0ae913c
TabBar: implement something in the ugly style
...
and change the TabImpl API
2021-08-06 15:58:13 +02:00
Olivier Goffart
18572fbaa3
WIP: More TabWidget work in progress
2021-08-06 15:58:13 +02:00
Olivier Goffart
9d40779d69
WIP work for TabWidget
2021-08-06 15:58:13 +02:00
Tobias Hunger
ff76aa8953
Janitor: Fix clippy::blocks_in_if_conditions
2021-08-05 23:41:56 +02:00
Tobias Hunger
9c12421c18
Janitor: Fix clippy::option_map_unit_fn
2021-08-05 23:41:56 +02:00
Simon Hausmann
acb10caea3
internal cleanup: don't bother with Cargo.toml files
...
Crates names just create noise
2021-08-05 13:54:17 +02:00
Simon Hausmann
9f4fa3599a
internal cleanup: make the GL backend cSpell clean
2021-08-05 13:52:55 +02:00
Simon Hausmann
3ec2274365
internal cleanup: rename the eventloop module to event_loop
...
That's consistent with graphics_window and silences cSpell
2021-08-05 13:46:42 +02:00
Tobias Hunger
04738a900f
Janitor: Fix clippy::map_clone
2021-08-04 22:50:35 +02:00
Tobias Hunger
cbeecfefba
Remove unnecessary clone() calls
...
window is just &self once the redundant clone() call has been removed,
so remove that variable entirely.
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
c74565a883
Janitor: Fix clippy::needless_return
2021-08-04 22:50:35 +02:00
Tobias Hunger
24a2021226
Janitor: Fix clippy::needless_borrow
2021-08-04 22:50:35 +02:00