1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:18:13 +00:00

LibWeb: Apply canvas transform while building paths

The transform can change between path building operations (and before
the path is filled or stroked). This fixes the sun ray backgroun on
the https://www.kevs3d.co.uk/dev/html5logo/ canvas demo.
This commit is contained in:
MacDue 2023-06-17 00:17:22 +01:00 committed by Andreas Kling
parent 9e57f8d183
commit 4f2770a745
3 changed files with 40 additions and 17 deletions

View file

@ -7,6 +7,7 @@
#pragma once
#include <LibGfx/Path.h>
#include <LibWeb/HTML/Canvas/CanvasState.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::HTML {
@ -35,8 +36,17 @@ protected:
{
}
explicit CanvasPath(Bindings::PlatformObject& self, CanvasState const& canvas_state)
: m_self(self)
, m_canvas_state(canvas_state)
{
}
private:
Gfx::AffineTransform active_transform() const;
JS::NonnullGCPtr<Bindings::PlatformObject> m_self;
Optional<CanvasState const&> m_canvas_state;
Gfx::Path m_path;
};