mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
canvas: Implement strokeText
(#39183)
Mostly it's just reusing/copy&edit fillText stuff. Testing: Existing WPT tests Fixes: #29973 Try run: https://github.com/sagudev/servo/actions/runs/17511337550 --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
bd3231847e
commit
643ac08cf0
28 changed files with 300 additions and 64 deletions
|
@ -124,6 +124,25 @@ impl CanvasPaintThread {
|
|||
transform,
|
||||
);
|
||||
},
|
||||
Canvas2dMsg::StrokeText(
|
||||
text_bounds,
|
||||
text_runs,
|
||||
fill_or_stroke_style,
|
||||
line_options,
|
||||
shadow_options,
|
||||
composition_options,
|
||||
transform,
|
||||
) => {
|
||||
self.canvas(canvas_id).stroke_text(
|
||||
text_bounds,
|
||||
text_runs,
|
||||
fill_or_stroke_style,
|
||||
line_options,
|
||||
shadow_options,
|
||||
composition_options,
|
||||
transform,
|
||||
);
|
||||
},
|
||||
Canvas2dMsg::FillRect(rect, style, shadow_options, composition_options, transform) => {
|
||||
self.canvas(canvas_id).fill_rect(
|
||||
&rect,
|
||||
|
@ -311,6 +330,40 @@ impl Canvas {
|
|||
}
|
||||
}
|
||||
|
||||
fn stroke_text(
|
||||
&mut self,
|
||||
text_bounds: Rect<f64>,
|
||||
text_runs: Vec<TextRun>,
|
||||
fill_or_stroke_style: FillOrStrokeStyle,
|
||||
line_options: LineOptions,
|
||||
shadow_options: ShadowOptions,
|
||||
composition_options: CompositionOptions,
|
||||
transform: Transform2D<f64>,
|
||||
) {
|
||||
match self {
|
||||
#[cfg(feature = "vello")]
|
||||
Canvas::Vello(canvas_data) => canvas_data.stroke_text(
|
||||
text_bounds,
|
||||
text_runs,
|
||||
fill_or_stroke_style,
|
||||
line_options,
|
||||
shadow_options,
|
||||
composition_options,
|
||||
transform,
|
||||
),
|
||||
#[cfg(feature = "vello_cpu")]
|
||||
Canvas::VelloCPU(canvas_data) => canvas_data.stroke_text(
|
||||
text_bounds,
|
||||
text_runs,
|
||||
fill_or_stroke_style,
|
||||
line_options,
|
||||
shadow_options,
|
||||
composition_options,
|
||||
transform,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
fn fill_text(
|
||||
&mut self,
|
||||
text_bounds: Rect<f64>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue