summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/Bindings/CanvasRenderingContext2DWrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibWeb/Bindings/CanvasRenderingContext2DWrapper.cpp')
-rw-r--r--Libraries/LibWeb/Bindings/CanvasRenderingContext2DWrapper.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/Libraries/LibWeb/Bindings/CanvasRenderingContext2DWrapper.cpp b/Libraries/LibWeb/Bindings/CanvasRenderingContext2DWrapper.cpp
index 5af008f98a..64ae861ff1 100644
--- a/Libraries/LibWeb/Bindings/CanvasRenderingContext2DWrapper.cpp
+++ b/Libraries/LibWeb/Bindings/CanvasRenderingContext2DWrapper.cpp
@@ -45,6 +45,8 @@ CanvasRenderingContext2DWrapper::CanvasRenderingContext2DWrapper(CanvasRendering
{
put_native_property("fillStyle", fill_style_getter, fill_style_setter);
put_native_function("fillRect", fill_rect, 4);
+ put_native_function("scale", scale, 2);
+ put_native_function("translate", translate, 2);
}
CanvasRenderingContext2DWrapper::~CanvasRenderingContext2DWrapper()
@@ -71,6 +73,28 @@ JS::Value CanvasRenderingContext2DWrapper::fill_rect(JS::Interpreter& interprete
return JS::js_undefined();
}
+JS::Value CanvasRenderingContext2DWrapper::scale(JS::Interpreter& interpreter)
+{
+ auto* impl = impl_from(interpreter);
+ if (!impl)
+ return {};
+ auto& arguments = interpreter.call_frame().arguments;
+ if (arguments.size() >= 2)
+ impl->scale(arguments[0].to_number().as_double(), arguments[1].to_number().as_double());
+ return JS::js_undefined();
+}
+
+JS::Value CanvasRenderingContext2DWrapper::translate(JS::Interpreter& interpreter)
+{
+ auto* impl = impl_from(interpreter);
+ if (!impl)
+ return {};
+ auto& arguments = interpreter.call_frame().arguments;
+ if (arguments.size() >= 2)
+ impl->translate(arguments[0].to_number().as_double(), arguments[1].to_number().as_double());
+ return JS::js_undefined();
+}
+
JS::Value CanvasRenderingContext2DWrapper::fill_style_getter(JS::Interpreter& interpreter)
{
auto* impl = impl_from(interpreter);