Skip to content

Commit 27cc874

Browse files
Lubrsiawesomekling
authored andcommitted
LibWeb: Implement CanvasRenderingContext2D.resetTransform
1 parent 329e740 commit 27cc874

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,13 @@ void CanvasRenderingContext2D::set_transform(double a, double b, double c, doubl
719719
transform(a, b, c, d, e, f);
720720
}
721721

722+
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-resettransform
723+
void CanvasRenderingContext2D::reset_transform()
724+
{
725+
// The resetTransform() method, when invoked, must reset the current transformation matrix to the identity matrix.
726+
m_drawing_state.transform = {};
727+
}
728+
722729
// https://html.spec.whatwg.org/multipage/canvas.html#check-the-usability-of-the-image-argument
723730
DOM::ExceptionOr<CanvasImageSourceUsability> check_usability_of_image(CanvasImageSource const& image)
724731
{

Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ class CanvasRenderingContext2D
100100

101101
void transform(double a, double b, double c, double d, double e, double f);
102102
void set_transform(double a, double b, double c, double d, double e, double f);
103+
void reset_transform();
103104

104105
private:
105106
explicit CanvasRenderingContext2D(HTMLCanvasElement&);

Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.idl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@ interface CanvasRenderingContext2D {
5858
// FIXME: All these `double`s should be `unrestricted double`
5959
undefined transform(double a, double b, double c, double d, double e, double f);
6060
undefined setTransform(double a, double b, double c, double d, double e, double f);
61+
undefined resetTransform();
6162

6263
};

0 commit comments

Comments
 (0)