From af386fd0a3de432337ee9cdaa4d3661e98bd4105 Mon Sep 17 00:00:00 2001 From: Alec Deason Date: Sat, 10 Jun 2023 13:18:42 -0700 Subject: Upgrade resvg to 0.34 and tiny_skia to 0.10 --- tiny_skia/src/text.rs | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'tiny_skia/src/text.rs') 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; } -- cgit