-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* make image formats optional via features * make sure image is also imported when importing an image format * make the features propperly formatted * fix merge * Move cairo over to 0.14 version * Fix clippy issues * Fix weird addition * Remove snapshots * Fix tests * Fix CI * Make piet-cairo almost unwrap free * Make gradient stops hashable (#454) Implement Hash and Eq traits on gradient stops, which implies doing the same for colors. This facilitates creating a cache of baked gradient ramps. Closes #450 * [cairo] Fix for big-endian systems Cairo defines pixels as "a 32-bit quantity [...] stored in native-endian". However, the existing code was treating a pixel as four 8-bit quantities. Put differently, it was hardcoding little endian. This commit changes the code to first calculate the pixel value as an u32 and then use u32::to_ne_bytes() to get back to "the world of bytes". For readability, this is done in a new helper function. I did not actually check if this fixes anything on big endian, but at least it does not change anything for little endian according to the test-pictures examples. Fixes: #224 Signed-off-by: Uli Schlachter <psychon@znc.in> * Remove unnecessary dst_off parameter Signed-off-by: Uli Schlachter <psychon@znc.in> * Fix clippy warning about single-character names error: 5 bindings with single-character names in scope Error: --> piet-cairo/src/lib.rs:523:47 | 523 | fn write_rgba(data: &mut [u8], offset: usize, x: usize, r: u8, g: u8, b: u8, a: u8) { | ^ ^ ^ ^ ^ | = note: `-D clippy::many-single-char-names` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#many_single_char_names Signed-off-by: Uli Schlachter <psychon@znc.in> * Add a simple criterion benchmark This adds a simple benchmark for piet-cairo's make_image function. Signed-off-by: Uli Schlachter <psychon@znc.in> * Fill benchmark image with random data Signed-off-by: Uli Schlachter <psychon@znc.in> * Make rustfmt happy Signed-off-by: Uli Schlachter <psychon@znc.in> * Try to clarify docs for ImageFormat The image format is based on individual bytes and thus independent of the system's endianness. This commit tries to make that more explicit. This was originally suggested in issue #224. Signed-off-by: Uli Schlachter <psychon@znc.in> * Fix issue with benchmarks * Remove redefinition * Add safety comment Co-authored-by: Raph Levien <raph.levien@gmail.com> Co-authored-by: Uli Schlachter <psychon@znc.in>
- Loading branch information
1 parent
f14021b
commit 88c7f19
Showing
7 changed files
with
123 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.