aboutsummaryrefslogtreecommitdiff
path: root/include/cru/win/graph/direct/painter.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/win/graph/direct/painter.hpp')
-rw-r--r--include/cru/win/graph/direct/painter.hpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/include/cru/win/graph/direct/painter.hpp b/include/cru/win/graph/direct/painter.hpp
index d8791c7f..5a1fe03f 100644
--- a/include/cru/win/graph/direct/painter.hpp
+++ b/include/cru/win/graph/direct/painter.hpp
@@ -1,24 +1,21 @@
#pragma once
#include "com_resource.hpp"
-#include "platform_id.hpp"
+#include "resource.hpp"
#include "cru/platform/graph/painter.hpp"
namespace cru::platform::graph::win::direct {
-class D2DPainter : public Painter, public IComResource<ID2D1RenderTarget> {
+class D2DPainter : public DirectResource,
+ public virtual IPainter,
+ public virtual IComResource<ID2D1RenderTarget> {
public:
explicit D2DPainter(ID2D1RenderTarget* render_target);
- D2DPainter(const D2DPainter& other) = delete;
- D2DPainter& operator=(const D2DPainter& other) = delete;
-
- D2DPainter(D2DPainter&& other) = delete;
- D2DPainter& operator=(D2DPainter&& other) = delete;
+ CRU_DELETE_COPY(D2DPainter)
+ CRU_DELETE_MOVE(D2DPainter)
~D2DPainter() override = default;
- CRU_PLATFORMID_IMPLEMENT_DIRECT
-
public:
ID2D1RenderTarget* GetComInterface() const override { return render_target_; }
@@ -28,15 +25,15 @@ class D2DPainter : public Painter, public IComResource<ID2D1RenderTarget> {
void Clear(const Color& color) override;
- void StrokeRectangle(const Rect& rectangle, Brush* brush,
+ void StrokeRectangle(const Rect& rectangle, IBrush* brush,
float width) override;
- void FillRectangle(const Rect& rectangle, Brush* brush) override;
+ void FillRectangle(const Rect& rectangle, IBrush* brush) override;
- void StrokeGeometry(Geometry* geometry, Brush* brush, float width) override;
- void FillGeometry(Geometry* geometry, Brush* brush) override;
+ void StrokeGeometry(IGeometry* geometry, IBrush* brush, float width) override;
+ void FillGeometry(IGeometry* geometry, IBrush* brush) override;
- void DrawText(const Point& offset, TextLayout* text_layout,
- Brush* brush) override;
+ void DrawText(const Point& offset, ITextLayout* text_layout,
+ IBrush* brush) override;
void EndDraw() override final;
@@ -45,6 +42,7 @@ class D2DPainter : public Painter, public IComResource<ID2D1RenderTarget> {
private:
bool IsValid() { return is_drawing_; }
+ void CheckValidation();
private:
ID2D1RenderTarget* render_target_;