1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00

LibWeb: Use Gfx::AntiAliasingPainter to draw SVG paths

This is still quite bad, but it's much more pleasing to look at when
drawing random SVGs :^)
This commit is contained in:
Ali Mohammad Pur 2021-09-17 12:03:24 +04:30 committed by Ali Mohammad Pur
parent e2cd558101
commit 5a2e7d30ce
4 changed files with 42 additions and 8 deletions

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibGfx/AntiAliasingPainter.h>
#include <LibGfx/Painter.h>
#include <LibWeb/Layout/SVGPathBox.h>
#include <LibWeb/SVG/SVGPathElement.h>
@ -47,10 +48,10 @@ void SVGPathBox::paint(PaintContext& context, PaintPhase phase)
closed_path.close();
// Fills are computed as though all paths are closed (https://svgwg.org/svg2-draft/painting.html#FillProperties)
auto& painter = context.painter();
Gfx::AntiAliasingPainter painter { context.painter() };
auto& svg_context = context.svg_context();
auto offset = (absolute_position() - effective_offset()).to_type<int>();
auto offset = absolute_position() - effective_offset();
painter.translate(offset);