|
@@ -129,17 +129,51 @@ void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- auto stroke_linecap = graphics_element.stroke_linecap().value_or(CSS::StrokeLinecap::Butt);
|
|
|
- (void)stroke_linecap; // FIXME: Use
|
|
|
+ Gfx::Path::CapStyle cap_style;
|
|
|
+ switch (graphics_element.stroke_linecap().value_or(CSS::InitialValues::stroke_linecap())) {
|
|
|
+ case CSS::StrokeLinecap::Butt:
|
|
|
+ cap_style = Gfx::Path::CapStyle::Butt;
|
|
|
+ break;
|
|
|
+ case CSS::StrokeLinecap::Round:
|
|
|
+ cap_style = Gfx::Path::CapStyle::Round;
|
|
|
+ break;
|
|
|
+ case CSS::StrokeLinecap::Square:
|
|
|
+ cap_style = Gfx::Path::CapStyle::Square;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ Gfx::Path::JoinStyle join_style;
|
|
|
+ switch (graphics_element.stroke_linejoin().value_or(CSS::InitialValues::stroke_linejoin())) {
|
|
|
+ case CSS::StrokeLinejoin::Miter:
|
|
|
+ join_style = Gfx::Path::JoinStyle::Miter;
|
|
|
+ break;
|
|
|
+ case CSS::StrokeLinejoin::Round:
|
|
|
+ join_style = Gfx::Path::JoinStyle::Round;
|
|
|
+ break;
|
|
|
+ case CSS::StrokeLinejoin::Bevel:
|
|
|
+ join_style = Gfx::Path::JoinStyle::Bevel;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ auto miter_limit = graphics_element.stroke_miterlimit().value_or(CSS::InitialValues::stroke_miterlimit()).resolved(layout_node());
|
|
|
|
|
|
auto stroke_opacity = graphics_element.stroke_opacity().value_or(1);
|
|
|
|
|
|
// Note: This is assuming .x_scale() == .y_scale() (which it does currently).
|
|
|
auto viewbox_scale = paint_transform.x_scale();
|
|
|
float stroke_thickness = graphics_element.stroke_width().value_or(1) * viewbox_scale;
|
|
|
+ auto stroke_dasharray = graphics_element.stroke_dasharray();
|
|
|
+ for (auto& value : stroke_dasharray)
|
|
|
+ value *= viewbox_scale;
|
|
|
+ float stroke_dashoffset = graphics_element.stroke_dashoffset().value_or(0) * viewbox_scale;
|
|
|
|
|
|
if (auto paint_style = graphics_element.stroke_paint_style(paint_context); paint_style.has_value()) {
|
|
|
context.display_list_recorder().stroke_path({
|
|
|
+ .cap_style = cap_style,
|
|
|
+ .join_style = join_style,
|
|
|
+ .miter_limit = static_cast<float>(miter_limit),
|
|
|
+ .dash_array = stroke_dasharray,
|
|
|
+ .dash_offset = stroke_dashoffset,
|
|
|
.path = path,
|
|
|
.paint_style = *paint_style,
|
|
|
.thickness = stroke_thickness,
|
|
@@ -148,6 +182,11 @@ void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const
|
|
|
});
|
|
|
} else if (auto stroke_color = graphics_element.stroke_color(); stroke_color.has_value()) {
|
|
|
context.display_list_recorder().stroke_path({
|
|
|
+ .cap_style = cap_style,
|
|
|
+ .join_style = join_style,
|
|
|
+ .miter_limit = static_cast<float>(miter_limit),
|
|
|
+ .dash_array = stroke_dasharray,
|
|
|
+ .dash_offset = stroke_dashoffset,
|
|
|
.path = path,
|
|
|
.color = stroke_color->with_opacity(stroke_opacity),
|
|
|
.thickness = stroke_thickness,
|