diff options
author | 2023-06-10 13:18:42 -0700 | |
---|---|---|
committer | 2023-07-12 08:59:07 +0200 | |
commit | af386fd0a3de432337ee9cdaa4d3661e98bd4105 (patch) | |
tree | bffedaee67922de5f4825ad640643de5883acb19 /tiny_skia/src/text.rs | |
parent | 9f2be29a286d435b3d1daa8025a74063c50713cb (diff) | |
download | iced-af386fd0a3de432337ee9cdaa4d3661e98bd4105.tar.gz iced-af386fd0a3de432337ee9cdaa4d3661e98bd4105.tar.bz2 iced-af386fd0a3de432337ee9cdaa4d3661e98bd4105.zip |
Upgrade resvg to 0.34 and tiny_skia to 0.10
Diffstat (limited to 'tiny_skia/src/text.rs')
-rw-r--r-- | tiny_skia/src/text.rs | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/tiny_skia/src/text.rs b/tiny_skia/src/text.rs index 8f494650..58f7d145 100644 --- a/tiny_skia/src/text.rs +++ b/tiny_skia/src/text.rs @@ -3,6 +3,7 @@ use crate::core::font::{self, Font}; use crate::core::text::{Hit, LineHeight, Shaping}; use crate::core::{Color, Pixels, Point, Rectangle, Size}; +use bytemuck::cast; use rustc_hash::{FxHashMap, FxHashSet}; use std::borrow::Cow; use std::cell::RefCell; @@ -288,14 +289,15 @@ impl GlyphCache { for _y in 0..image.placement.height { for _x in 0..image.placement.width { - buffer[i] = tiny_skia::ColorU8::from_rgba( - b, - g, - r, - image.data[i], - ) - .premultiply() - .get(); + buffer[i] = cast( + tiny_skia::ColorU8::from_rgba( + b, + g, + r, + image.data[i], + ) + .premultiply(), + ); i += 1; } @@ -307,14 +309,15 @@ impl GlyphCache { for _y in 0..image.placement.height { for _x in 0..image.placement.width { // TODO: Blend alpha - buffer[i >> 2] = tiny_skia::ColorU8::from_rgba( - image.data[i + 2], - image.data[i + 1], - image.data[i], - image.data[i + 3], - ) - .premultiply() - .get(); + buffer[i >> 2] = cast( + tiny_skia::ColorU8::from_rgba( + image.data[i + 2], + image.data[i + 1], + image.data[i], + image.data[i + 3], + ) + .premultiply(), + ); i += 4; } |