diff options
author | asynts <asynts@gmail.com> | 2021-01-18 17:25:44 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-22 22:14:30 +0100 |
commit | ea7b7d8ceb2f48127b196a4eaf958bb387bb61da (patch) | |
tree | 81ef2a3848a8b64ed0960f0c9055c216390b8baf /Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp | |
parent | fb8d3635d912a40a66a9e4b50454cfdd83f71d16 (diff) | |
download | serenity-ea7b7d8ceb2f48127b196a4eaf958bb387bb61da.zip |
Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
Diffstat (limited to 'Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp index e5812a4f30..a11ac8c7fd 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp @@ -36,66 +36,73 @@ namespace Web::SVG { -#ifdef PATH_DEBUG static void print_instruction(const PathInstruction& instruction) { + ASSERT(debug_path); + auto& data = instruction.data; switch (instruction.type) { case PathInstructionType::Move: - dbg() << "Move (absolute=" << instruction.absolute << ")"; + dbgln("Move (absolute={})", instruction.absolute); for (size_t i = 0; i < data.size(); i += 2) - dbg() << " x=" << data[i] << ", y=" << data[i + 1]; + dbgln(" x={}, y={}", data[i], data[i + 1]); break; case PathInstructionType::ClosePath: - dbg() << "ClosePath (absolute=" << instruction.absolute << ")"; + dbgln("ClosePath (absolute={})", instruction.absolute); break; case PathInstructionType::Line: - dbg() << "Line (absolute=" << instruction.absolute << ")"; + dbgln("Line (absolute={})", instruction.absolute); for (size_t i = 0; i < data.size(); i += 2) - dbg() << " x=" << data[i] << ", y=" << data[i + 1]; + dbgln(" x={}, y={}", data[i], data[i + 1]); break; case PathInstructionType::HorizontalLine: - dbg() << "HorizontalLine (absolute=" << instruction.absolute << ")"; + dbgln("HorizontalLine (absolute={})", instruction.absolute); for (size_t i = 0; i < data.size(); ++i) - dbg() << " x=" << data[i]; + dbgln(" x={}", data[i]); break; case PathInstructionType::VerticalLine: - dbg() << "VerticalLine (absolute=" << instruction.absolute << ")"; + dbgln("VerticalLine (absolute={})", instruction.absolute); for (size_t i = 0; i < data.size(); ++i) - dbg() << " y=" << data[i]; + dbgln(" y={}", data[i]); break; case PathInstructionType::Curve: - dbg() << "Curve (absolute=" << instruction.absolute << ")"; + dbgln("Curve (absolute={})", instruction.absolute); for (size_t i = 0; i < data.size(); i += 6) - dbg() << " (x1=" << data[i] << ", y1=" << data[i + 1] << "), (x2=" << data[i + 2] << ", y2=" << data[i + 3] << "), (x=" << data[i + 4] << ", y=" << data[i + 5] << ")"; + dbgln(" (x1={}, y1={}, x2={}, y2={}), (x={}, y={})", data[i], data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5]); break; case PathInstructionType::SmoothCurve: - dbg() << "SmoothCurve (absolute=" << instruction.absolute << ")"; + dbgln("SmoothCurve (absolute={})", instruction.absolute); for (size_t i = 0; i < data.size(); i += 4) - dbg() << " (x2=" << data[i] << ", y2=" << data[i + 1] << "), (x=" << data[i + 2] << ", y=" << data[i + 3] << ")"; + dbgln(" (x2={}, y2={}), (x={}, y={})", data[i], data[i + 1], data[i + 2], data[i + 3]); break; case PathInstructionType::QuadraticBezierCurve: - dbg() << "QuadraticBezierCurve (absolute=" << instruction.absolute << ")"; + dbgln("QuadraticBezierCurve (absolute={})", instruction.absolute); for (size_t i = 0; i < data.size(); i += 4) - dbg() << " (x1=" << data[i] << ", y1=" << data[i + 1] << "), (x=" << data[i + 2] << ", y=" << data[i + 3] << ")"; + dbgln(" (x1={}, y1={}), (x={}, y={})", data[i], data[i + 1], data[i + 2], data[i + 3]); break; case PathInstructionType::SmoothQuadraticBezierCurve: - dbg() << "SmoothQuadraticBezierCurve (absolute=" << instruction.absolute << ")"; + dbgln("SmoothQuadraticBezierCurve (absolute={})", instruction.absolute); for (size_t i = 0; i < data.size(); i += 2) - dbg() << " x=" << data[i] << ", y=" << data[i + 1]; + dbgln(" x={}, y={}", data[i], data[i + 1]); break; case PathInstructionType::EllipticalArc: - dbg() << "EllipticalArc (absolute=" << instruction.absolute << ")"; + dbgln("EllipticalArc (absolute={})", instruction.absolute); for (size_t i = 0; i < data.size(); i += 7) - dbg() << " (rx=" << data[i] << ", ry=" << data[i + 1] << ") x-axis-rotation=" << data[i + 2] << ", large-arc-flag=" << data[i + 3] << ", sweep-flag=" << data[i + 4] << ", (x=" << data[i + 5] << ", y=" << data[i + 6] << ")"; + dbgln(" (rx={}, ry={}) x-axis-rotation={}, large-arc-flag={}, sweep-flag={}, (x={}, y={})", + data[i], + data[i + 1], + data[i + 2], + data[i + 3], + data[i + 4], + data[i + 5], + data[i + 6]); break; case PathInstructionType::Invalid: dbgln("Invalid"); break; } } -#endif PathDataParser::PathDataParser(const String& source) : m_source(source) @@ -456,9 +463,9 @@ Gfx::Path& SVGPathElement::get_path() auto& absolute = instruction.absolute; auto& data = instruction.data; -#ifdef PATH_DEBUG - print_instruction(instruction); -#endif + if constexpr (debug_path) { + print_instruction(instruction); + } bool clear_last_control_point = true; |