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

LibWeb: Extract CanvasRect class from CRC2D

This one requires drawing to the canvas, so it doesn't make so much
sense to move the implementation over.
This commit is contained in:
Sam Atkins 2022-08-12 16:06:32 +01:00 committed by Andreas Kling
parent aa3cb8b425
commit c0494988ed
4 changed files with 38 additions and 8 deletions

View file

@ -18,6 +18,7 @@
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/HTML/Canvas/CanvasFillStrokeStyles.h>
#include <LibWeb/HTML/Canvas/CanvasPath.h>
#include <LibWeb/HTML/Canvas/CanvasRect.h>
#include <LibWeb/HTML/Canvas/CanvasState.h>
#include <LibWeb/HTML/Canvas/CanvasTransform.h>
#include <LibWeb/HTML/CanvasGradient.h>
@ -36,7 +37,8 @@ class CanvasRenderingContext2D
, public CanvasPath
, public CanvasState
, public CanvasTransform<CanvasRenderingContext2D>
, public CanvasFillStrokeStyles<CanvasRenderingContext2D> {
, public CanvasFillStrokeStyles<CanvasRenderingContext2D>
, public CanvasRect {
AK_MAKE_NONCOPYABLE(CanvasRenderingContext2D);
AK_MAKE_NONMOVABLE(CanvasRenderingContext2D);
@ -47,9 +49,9 @@ public:
static NonnullRefPtr<CanvasRenderingContext2D> create(HTMLCanvasElement& element) { return adopt_ref(*new CanvasRenderingContext2D(element)); }
~CanvasRenderingContext2D();
void fill_rect(float x, float y, float width, float height);
void stroke_rect(float x, float y, float width, float height);
void clear_rect(float x, float y, float width, float height);
virtual void fill_rect(float x, float y, float width, float height) override;
virtual void stroke_rect(float x, float y, float width, float height) override;
virtual void clear_rect(float x, float y, float width, float height) override;
DOM::ExceptionOr<void> draw_image(CanvasImageSource const&, float destination_x, float destination_y);
DOM::ExceptionOr<void> draw_image(CanvasImageSource const&, float destination_x, float destination_y, float destination_width, float destination_height);