mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
LibWeb: Support "c" and "C" curves in SVG <path> data
These instructions now generate cubic Bézier curves.
This commit is contained in:
parent
09d13e437b
commit
422d725c79
Notes:
sideshowbarker
2024-07-18 03:55:14 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/422d725c79f
@ -584,7 +584,19 @@ Gfx::Path& SVGPathElement::get_path()
|
||||
break;
|
||||
}
|
||||
|
||||
case PathInstructionType::Curve:
|
||||
case PathInstructionType::Curve: {
|
||||
Gfx::FloatPoint c1 = { data[0], data[1] };
|
||||
Gfx::FloatPoint c2 = { data[2], data[3] };
|
||||
Gfx::FloatPoint p2 = { data[4], data[5] };
|
||||
if (!absolute) {
|
||||
p2 += path.segments().last().point();
|
||||
c1 += path.segments().last().point();
|
||||
c2 += path.segments().last().point();
|
||||
}
|
||||
path.cubic_bezier_curve_to(c1, c2, p2);
|
||||
break;
|
||||
}
|
||||
|
||||
case PathInstructionType::SmoothCurve:
|
||||
// Instead of crashing the browser every time we come across an SVG
|
||||
// with these path instructions, let's just skip them
|
||||
|
Loading…
Reference in New Issue
Block a user