mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
canvas: Respect FillRule (#38294)
We just need to pass user provided FillRule via IPC to canvas paint thread, then pass it all down to backend, which will handle it. Testing: Added WPT tests. --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
4188852963
commit
bc71fb8c0d
22 changed files with 693 additions and 32 deletions
|
@ -17,7 +17,7 @@ use std::num::NonZeroUsize;
|
|||
use std::rc::Rc;
|
||||
|
||||
use canvas_traits::canvas::{
|
||||
CompositionOptions, FillOrStrokeStyle, LineOptions, Path, ShadowOptions,
|
||||
CompositionOptions, FillOrStrokeStyle, FillRule, LineOptions, Path, ShadowOptions,
|
||||
};
|
||||
use compositing_traits::SerializableImageData;
|
||||
use euclid::default::{Point2D, Rect, Size2D, Transform2D};
|
||||
|
@ -311,13 +311,14 @@ impl GenericDrawTarget for VelloDrawTarget {
|
|||
fn fill(
|
||||
&mut self,
|
||||
path: &Path,
|
||||
fill_rule: FillRule,
|
||||
style: FillOrStrokeStyle,
|
||||
composition_options: CompositionOptions,
|
||||
transform: Transform2D<f32>,
|
||||
) {
|
||||
self.with_draw_options(&composition_options, |self_| {
|
||||
self_.scene.fill(
|
||||
peniko::Fill::NonZero,
|
||||
fill_rule.convert(),
|
||||
transform.cast().into(),
|
||||
&style
|
||||
.convert()
|
||||
|
@ -418,7 +419,7 @@ impl GenericDrawTarget for VelloDrawTarget {
|
|||
self.scene.pop_layer();
|
||||
}
|
||||
|
||||
fn push_clip(&mut self, path: &Path, transform: Transform2D<f32>) {
|
||||
fn push_clip(&mut self, path: &Path, _fill_rule: FillRule, transform: Transform2D<f32>) {
|
||||
self.scene
|
||||
.push_layer(peniko::Mix::Clip, 1.0, transform.cast().into(), &path.0);
|
||||
}
|
||||
|
@ -432,7 +433,7 @@ impl GenericDrawTarget for VelloDrawTarget {
|
|||
rect.size.width,
|
||||
rect.size.height,
|
||||
);
|
||||
self.push_clip(&path, Transform2D::identity());
|
||||
self.push_clip(&path, FillRule::Nonzero, Transform2D::identity());
|
||||
}
|
||||
|
||||
fn stroke(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue