1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

LibWeb: Add canvas.strokeRect(), and fix scale & translate

Add an implementation of CanvasRenderingContext2DWrapper.strokeRect().
While implementing this I fixed fillRect() and the new strokeRect() to
honor the .scale() and .translate() values that had previously been plumbed.

Also enhance the canvas.html demo to utilize strokeRect(), scale(), and translate().
This commit is contained in:
Brian Gianforcaro 2020-04-07 01:09:17 -07:00 committed by Andreas Kling
parent 7291d5c86f
commit 39855fe9ef
5 changed files with 80 additions and 3 deletions

View file

@ -43,10 +43,13 @@ private:
virtual const char* class_name() const override { return "CanvasRenderingContext2DWrapper"; }
static JS::Value fill_rect(JS::Interpreter&);
static JS::Value stroke_rect(JS::Interpreter&);
static JS::Value scale(JS::Interpreter&);
static JS::Value translate(JS::Interpreter&);
static JS::Value fill_style_getter(JS::Interpreter&);
static void fill_style_setter(JS::Interpreter&, JS::Value);
static JS::Value stroke_style_getter(JS::Interpreter&);
static void stroke_style_setter(JS::Interpreter&, JS::Value);
NonnullRefPtr<CanvasRenderingContext2D> m_impl;
};