1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:57:36 +00:00

LibWeb: Implement CanvasRenderingContext2D.resetTransform

This commit is contained in:
Luke Wilde 2022-04-10 18:47:01 +01:00 committed by Andreas Kling
parent 329e740c85
commit 27cc8742ce
3 changed files with 9 additions and 0 deletions

View file

@ -719,6 +719,13 @@ void CanvasRenderingContext2D::set_transform(double a, double b, double c, doubl
transform(a, b, c, d, e, f);
}
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-resettransform
void CanvasRenderingContext2D::reset_transform()
{
// The resetTransform() method, when invoked, must reset the current transformation matrix to the identity matrix.
m_drawing_state.transform = {};
}
// https://html.spec.whatwg.org/multipage/canvas.html#check-the-usability-of-the-image-argument
DOM::ExceptionOr<CanvasImageSourceUsability> check_usability_of_image(CanvasImageSource const& image)
{

View file

@ -100,6 +100,7 @@ public:
void transform(double a, double b, double c, double d, double e, double f);
void set_transform(double a, double b, double c, double d, double e, double f);
void reset_transform();
private:
explicit CanvasRenderingContext2D(HTMLCanvasElement&);

View file

@ -58,5 +58,6 @@ interface CanvasRenderingContext2D {
// FIXME: All these `double`s should be `unrestricted double`
undefined transform(double a, double b, double c, double d, double e, double f);
undefined setTransform(double a, double b, double c, double d, double e, double f);
undefined resetTransform();
};