diff options
author | Oriol Brufau <obrufau@igalia.com> | 2024-03-18 14:52:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-18 13:52:40 +0000 |
commit | c07484fcb605a9ab0a3f9fba4cb4ddd24d89cb87 (patch) | |
tree | 3328bfaa0552bee8f6d7833b8e07a06b2b5ebedc /components/canvas | |
parent | 94c1f2c99229fde82e09ae5d8e06792ea9d90787 (diff) | |
download | servo-c07484fcb605a9ab0a3f9fba4cb4ddd24d89cb87.tar.gz servo-c07484fcb605a9ab0a3f9fba4cb4ddd24d89cb87.zip |
Update Stylo to 2023-09-01 (#31609)
* Update Stylo to 2023-09-01
* Fixup for https://phabricator.services.mozilla.com/D184929
* Fixup for https://phabricator.services.mozilla.com/D184526
* Fixup for https://phabricator.services.mozilla.com/D184525
* Fixup for https://phabricator.services.mozilla.com/D185154
* Fixup for https://phabricator.services.mozilla.com/D184685
* Fixup for https://phabricator.services.mozilla.com/D185916
* Fixup for https://phabricator.services.mozilla.com/D185492
* Fixup for https://phabricator.services.mozilla.com/D186626
* Update test expectations
Diffstat (limited to 'components/canvas')
-rw-r--r-- | components/canvas/canvas_data.rs | 6 | ||||
-rw-r--r-- | components/canvas/raqote_backend.rs | 30 |
2 files changed, 18 insertions, 18 deletions
diff --git a/components/canvas/canvas_data.rs b/components/canvas/canvas_data.rs index b125eb4e65c..c9855b1937b 100644 --- a/components/canvas/canvas_data.rs +++ b/components/canvas/canvas_data.rs @@ -7,7 +7,7 @@ use std::mem; use std::sync::{Arc, Mutex}; use canvas_traits::canvas::*; -use cssparser::RGBA; +use cssparser::RgbaLegacy; use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D}; use euclid::{point2, vec2}; use font_kit::family_name::FamilyName; @@ -74,7 +74,7 @@ impl PathState { pub trait Backend { fn get_composition_op(&self, opts: &DrawOptions) -> CompositionOp; fn need_to_draw_shadow(&self, color: &Color) -> bool; - fn set_shadow_color(&mut self, color: RGBA, state: &mut CanvasPaintState<'_>); + fn set_shadow_color(&mut self, color: RgbaLegacy, state: &mut CanvasPaintState<'_>); fn set_fill_style( &mut self, style: FillOrStrokeStyle, @@ -1156,7 +1156,7 @@ impl<'a> CanvasData<'a> { self.state.shadow_blur = value; } - pub fn set_shadow_color(&mut self, value: RGBA) { + pub fn set_shadow_color(&mut self, value: RgbaLegacy) { self.backend.set_shadow_color(value, &mut self.state); } diff --git a/components/canvas/raqote_backend.rs b/components/canvas/raqote_backend.rs index aa3737897eb..ae7266475af 100644 --- a/components/canvas/raqote_backend.rs +++ b/components/canvas/raqote_backend.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use canvas_traits::canvas::*; -use cssparser::RGBA; +use cssparser::RgbaLegacy; use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D}; use euclid::Angle; use font_kit::font::Font; @@ -29,7 +29,7 @@ impl Backend for RaqoteBackend { color.as_raqote().a != 0 } - fn set_shadow_color(&mut self, color: RGBA, state: &mut CanvasPaintState<'_>) { + fn set_shadow_color(&mut self, color: RgbaLegacy, state: &mut CanvasPaintState<'_>) { state.shadow_color = Color::Raqote(color.to_raqote_style()); } @@ -880,10 +880,10 @@ pub fn clamp_floor_256_f32(val: f32) -> u8 { impl ToRaqoteGradientStop for CanvasGradientStop { fn to_raqote(self) -> raqote::GradientStop { let color = raqote::Color::new( - self.color.alpha.map(clamp_unit_f32).unwrap_or(0), - self.color.red.unwrap_or(0), - self.color.green.unwrap_or(0), - self.color.blue.unwrap_or(0), + clamp_unit_f32(self.color.alpha), + self.color.red, + self.color.green, + self.color.blue, ); let position = self.offset as f32; raqote::GradientStop { position, color } @@ -897,10 +897,10 @@ impl ToRaqotePattern<'_> for FillOrStrokeStyle { match self { Color(color) => Some(Pattern::Color( - color.alpha.map(clamp_unit_f32).unwrap_or(0), - color.red.unwrap_or(0), - color.green.unwrap_or(0), - color.blue.unwrap_or(0), + clamp_unit_f32(color.alpha), + color.red, + color.green, + color.blue, )), LinearGradient(style) => { let start = Point2D::new(style.x0 as f32, style.y0 as f32); @@ -951,15 +951,15 @@ impl Color { } } -impl ToRaqoteStyle for RGBA { +impl ToRaqoteStyle for RgbaLegacy { type Target = raqote::SolidSource; fn to_raqote_style(self) -> Self::Target { raqote::SolidSource::from_unpremultiplied_argb( - self.alpha.map(clamp_unit_f32).unwrap_or(0), - self.red.unwrap_or(0), - self.green.unwrap_or(0), - self.blue.unwrap_or(0), + clamp_unit_f32(self.alpha), + self.red, + self.green, + self.blue, ) } } |