LibWeb: Add canvas.quadraticCurveTo()

Also adds a test, and removes debug spam ™️
This commit is contained in:
AnotherTest 2020-05-05 06:54:26 +04:30 committed by Andreas Kling
commit 0a55679de4
Notes: sideshowbarker 2024-07-19 06:58:33 +09:00
7 changed files with 70 additions and 2 deletions

View file

@ -63,6 +63,7 @@ CanvasRenderingContext2DWrapper::CanvasRenderingContext2DWrapper(CanvasRendering
put_native_function("stroke", stroke, 0);
put_native_function("moveTo", move_to, 2);
put_native_function("lineTo", line_to, 2);
put_native_function("quadraticCurveTo", quadratic_curve_to, 4);
put_native_function("createImageData", create_image_data, 1);
put_native_function("putImageData", put_image_data, 3);
@ -240,6 +241,19 @@ JS::Value CanvasRenderingContext2DWrapper::line_to(JS::Interpreter& interpreter)
return JS::js_undefined();
}
JS::Value CanvasRenderingContext2DWrapper::quadratic_curve_to(JS::Interpreter& interpreter)
{
auto* impl = impl_from(interpreter);
if (!impl)
return {};
double cx = interpreter.argument(0).to_double();
double cy = interpreter.argument(1).to_double();
double x = interpreter.argument(2).to_double();
double y = interpreter.argument(3).to_double();
impl->quadratic_curve_to(cx, cy, x, y);
return JS::js_undefined();
}
JS::Value CanvasRenderingContext2DWrapper::create_image_data(JS::Interpreter& interpreter)
{
auto* impl = impl_from(interpreter);