aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/platform/graphics')
-rw-r--r--include/cru/platform/graphics/quartz/Base.h (renamed from include/cru/platform/graphics/quartz/Convert.h)19
-rw-r--r--include/cru/platform/graphics/quartz/Brush.h14
-rw-r--r--include/cru/platform/graphics/quartz/Factory.h13
-rw-r--r--include/cru/platform/graphics/quartz/Font.h13
-rw-r--r--include/cru/platform/graphics/quartz/Geometry.h32
-rw-r--r--include/cru/platform/graphics/quartz/Image.h10
-rw-r--r--include/cru/platform/graphics/quartz/ImageFactory.h9
-rw-r--r--include/cru/platform/graphics/quartz/Painter.h12
-rw-r--r--include/cru/platform/graphics/quartz/Resource.h24
-rw-r--r--include/cru/platform/graphics/quartz/TextLayout.h18
10 files changed, 58 insertions, 106 deletions
diff --git a/include/cru/platform/graphics/quartz/Convert.h b/include/cru/platform/graphics/quartz/Base.h
index fd6159a6..271d4035 100644
--- a/include/cru/platform/graphics/quartz/Convert.h
+++ b/include/cru/platform/graphics/quartz/Base.h
@@ -1,10 +1,25 @@
#pragma once
-#include "cru/base/io/Stream.h"
-#include "cru/platform/Matrix.h"
+#include <cru/base/Base.h>
+#include <cru/base/io/Stream.h>
+#include <cru/platform/graphics/Base.h>
#include <CoreGraphics/CoreGraphics.h>
namespace cru::platform::graphics::quartz {
+class OsxQuartzResource : public Object, public virtual IGraphicsResource {
+ public:
+ explicit OsxQuartzResource(IGraphicsFactory* graphics_factory)
+ : graphics_factory_(graphics_factory) {}
+
+ public:
+ std::string GetPlatformId() const override { return "OSX Quartz"; }
+
+ IGraphicsFactory* GetGraphicsFactory() override { return graphics_factory_; }
+
+ private:
+ IGraphicsFactory* graphics_factory_;
+};
+
CGAffineTransform Convert(const Matrix& matrix);
Matrix Convert(const CGAffineTransform& matrix);
diff --git a/include/cru/platform/graphics/quartz/Brush.h b/include/cru/platform/graphics/quartz/Brush.h
index 73aa2f6d..da303940 100644
--- a/include/cru/platform/graphics/quartz/Brush.h
+++ b/include/cru/platform/graphics/quartz/Brush.h
@@ -1,8 +1,7 @@
#pragma once
-#include "Resource.h"
-#include "cru/base/Base.h"
-#include "cru/platform/graphics/Base.h"
-#include "cru/platform/graphics/Brush.h"
+#include "Base.h"
+
+#include <cru/platform/graphics/Brush.h>
#include <CoreGraphics/CoreGraphics.h>
@@ -11,9 +10,6 @@ class QuartzBrush : public OsxQuartzResource, public virtual IBrush {
public:
QuartzBrush(IGraphicsFactory* graphics_factory)
: OsxQuartzResource(graphics_factory) {}
- CRU_DELETE_COPY(QuartzBrush)
- CRU_DELETE_MOVE(QuartzBrush)
- ~QuartzBrush() override = default;
public:
virtual void Select(CGContextRef context) = 0;
@@ -23,10 +19,6 @@ class QuartzSolidColorBrush : public QuartzBrush,
public virtual ISolidColorBrush {
public:
QuartzSolidColorBrush(IGraphicsFactory* graphics_factory, const Color& color);
-
- CRU_DELETE_COPY(QuartzSolidColorBrush)
- CRU_DELETE_MOVE(QuartzSolidColorBrush)
-
~QuartzSolidColorBrush() override;
Color GetColor() override { return color_; }
diff --git a/include/cru/platform/graphics/quartz/Factory.h b/include/cru/platform/graphics/quartz/Factory.h
index 61d8dbdb..f79b475d 100644
--- a/include/cru/platform/graphics/quartz/Factory.h
+++ b/include/cru/platform/graphics/quartz/Factory.h
@@ -1,19 +1,14 @@
#pragma once
-#include "Resource.h"
-#include "cru/base/Base.h"
-#include "cru/platform/graphics/quartz/ImageFactory.h"
-#include "cru/platform/graphics/Factory.h"
-#include "cru/platform/graphics/ImageFactory.h"
+#include "Base.h"
+#include "ImageFactory.h"
+
+#include <cru/platform/graphics/Factory.h>
namespace cru::platform::graphics::quartz {
class QuartzGraphicsFactory : public OsxQuartzResource,
public virtual IGraphicsFactory {
public:
QuartzGraphicsFactory();
-
- CRU_DELETE_COPY(QuartzGraphicsFactory)
- CRU_DELETE_MOVE(QuartzGraphicsFactory)
-
~QuartzGraphicsFactory() override;
public:
diff --git a/include/cru/platform/graphics/quartz/Font.h b/include/cru/platform/graphics/quartz/Font.h
index d110b59b..49792956 100644
--- a/include/cru/platform/graphics/quartz/Font.h
+++ b/include/cru/platform/graphics/quartz/Font.h
@@ -1,18 +1,15 @@
#pragma once
-#include "Resource.h"
-#include "cru/base/Base.h"
-#include "cru/platform/graphics/Font.h"
+#include "Base.h"
+
+#include <cru/platform/graphics/Font.h>
#include <CoreText/CoreText.h>
namespace cru::platform::graphics::quartz {
class OsxCTFont : public OsxQuartzResource, public virtual IFont {
public:
- OsxCTFont(IGraphicsFactory* graphics_factory, const std::string& name, float size);
-
- CRU_DELETE_COPY(OsxCTFont)
- CRU_DELETE_MOVE(OsxCTFont)
-
+ OsxCTFont(IGraphicsFactory* graphics_factory, const std::string& name,
+ float size);
~OsxCTFont() override;
CTFontRef GetCTFont() const { return ct_font_; }
diff --git a/include/cru/platform/graphics/quartz/Geometry.h b/include/cru/platform/graphics/quartz/Geometry.h
index 18e2e25e..e13d268e 100644
--- a/include/cru/platform/graphics/quartz/Geometry.h
+++ b/include/cru/platform/graphics/quartz/Geometry.h
@@ -1,27 +1,23 @@
#pragma once
-#include "Resource.h"
-#include "cru/platform/graphics/Geometry.h"
+#include "Base.h"
-#include <memory>
+#include <cru/platform/graphics/Geometry.h>
#include <CoreGraphics/CoreGraphics.h>
+#include <memory>
namespace cru::platform::graphics::quartz {
class QuartzGeometry : public OsxQuartzResource, public virtual IGeometry {
public:
- QuartzGeometry(IGraphicsFactory *graphics_factory, CGPathRef cg_path);
-
- CRU_DELETE_COPY(QuartzGeometry)
- CRU_DELETE_MOVE(QuartzGeometry)
-
+ QuartzGeometry(IGraphicsFactory* graphics_factory, CGPathRef cg_path);
~QuartzGeometry() override;
CGPathRef GetCGPath() const { return cg_path_; }
- bool FillContains(const Point &point) override;
+ bool FillContains(const Point& point) override;
Rect GetBounds() override;
- std::unique_ptr<IGeometry> Transform(const Matrix &matrix) override;
+ std::unique_ptr<IGeometry> Transform(const Matrix& matrix) override;
std::unique_ptr<IGeometry> CreateStrokeGeometry(float width) override;
private:
@@ -31,7 +27,7 @@ class QuartzGeometry : public OsxQuartzResource, public virtual IGeometry {
class QuartzGeometryBuilder : public OsxQuartzResource,
public virtual IGeometryBuilder {
public:
- explicit QuartzGeometryBuilder(IGraphicsFactory *graphics_factory);
+ explicit QuartzGeometryBuilder(IGraphicsFactory* graphics_factory);
CRU_DELETE_COPY(QuartzGeometryBuilder)
CRU_DELETE_MOVE(QuartzGeometryBuilder)
@@ -40,13 +36,13 @@ class QuartzGeometryBuilder : public OsxQuartzResource,
Point GetCurrentPosition() override;
- void MoveTo(const Point &point) override;
- void LineTo(const Point &point) override;
- void CubicBezierTo(const Point &start_control_point,
- const Point &end_control_point,
- const Point &end_point) override;
- void QuadraticBezierTo(const Point &control_point,
- const Point &end_point) override;
+ void MoveTo(const Point& point) override;
+ void LineTo(const Point& point) override;
+ void CubicBezierTo(const Point& start_control_point,
+ const Point& end_control_point,
+ const Point& end_point) override;
+ void QuadraticBezierTo(const Point& control_point,
+ const Point& end_point) override;
void CloseFigure(bool close) override;
std::unique_ptr<IGeometry> Build() override;
diff --git a/include/cru/platform/graphics/quartz/Image.h b/include/cru/platform/graphics/quartz/Image.h
index 1dd8f0a6..e21c9a857 100644
--- a/include/cru/platform/graphics/quartz/Image.h
+++ b/include/cru/platform/graphics/quartz/Image.h
@@ -1,7 +1,7 @@
#pragma once
-#include "Resource.h"
-#include "cru/platform/graphics/Image.h"
-#include "cru/platform/graphics/ImageFactory.h"
+#include "Base.h"
+
+#include <cru/platform/graphics/Image.h>
#include <CoreGraphics/CoreGraphics.h>
@@ -11,10 +11,6 @@ class QuartzImage : public OsxQuartzResource, public virtual IImage {
QuartzImage(IGraphicsFactory* graphics_factory, IImageFactory* image_factory,
CGImageRef image, bool auto_release,
unsigned char* buffer = nullptr);
-
- CRU_DELETE_COPY(QuartzImage)
- CRU_DELETE_MOVE(QuartzImage)
-
~QuartzImage() override;
public:
diff --git a/include/cru/platform/graphics/quartz/ImageFactory.h b/include/cru/platform/graphics/quartz/ImageFactory.h
index bd2a929f..2874a9bb 100644
--- a/include/cru/platform/graphics/quartz/ImageFactory.h
+++ b/include/cru/platform/graphics/quartz/ImageFactory.h
@@ -1,16 +1,13 @@
#pragma once
-#include "Resource.h"
-#include "cru/platform/graphics/ImageFactory.h"
+#include "Base.h"
+
+#include <cru/platform/graphics/ImageFactory.h>
namespace cru::platform::graphics::quartz {
class QuartzImageFactory : public OsxQuartzResource,
public virtual IImageFactory {
public:
explicit QuartzImageFactory(IGraphicsFactory* graphics_factory);
-
- CRU_DELETE_COPY(QuartzImageFactory)
- CRU_DELETE_MOVE(QuartzImageFactory)
-
~QuartzImageFactory() override;
public:
diff --git a/include/cru/platform/graphics/quartz/Painter.h b/include/cru/platform/graphics/quartz/Painter.h
index ec0e57af..7e86222d 100644
--- a/include/cru/platform/graphics/quartz/Painter.h
+++ b/include/cru/platform/graphics/quartz/Painter.h
@@ -1,11 +1,9 @@
#pragma once
-#include "Resource.h"
-#include "cru/base/Base.h"
-#include "cru/platform/graphics/Base.h"
-#include "cru/platform/graphics/Painter.h"
+#include "Base.h"
-#include <CoreGraphics/CoreGraphics.h>
+#include <cru/platform/graphics/Painter.h>
+#include <CoreGraphics/CoreGraphics.h>
#include <functional>
namespace cru::platform::graphics::quartz {
@@ -18,10 +16,6 @@ class QuartzCGContextPainter : public OsxQuartzResource,
IGraphicsFactory* graphics_factory, CGContextRef cg_context,
bool auto_release, const Size& size,
std::function<void(QuartzCGContextPainter*)> on_end_draw);
-
- CRU_DELETE_COPY(QuartzCGContextPainter)
- CRU_DELETE_MOVE(QuartzCGContextPainter)
-
~QuartzCGContextPainter() override;
public:
diff --git a/include/cru/platform/graphics/quartz/Resource.h b/include/cru/platform/graphics/quartz/Resource.h
deleted file mode 100644
index f683e5ad..00000000
--- a/include/cru/platform/graphics/quartz/Resource.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-#include "cru/platform/graphics/Base.h"
-#include "cru/platform/osx/Resource.h"
-
-namespace cru::platform::graphics::quartz {
-class OsxQuartzResource : public platform::osx::OsxResource,
- public virtual IGraphicsResource {
- public:
- explicit OsxQuartzResource(IGraphicsFactory* graphics_factory)
- : graphics_factory_(graphics_factory) {}
-
- CRU_DELETE_COPY(OsxQuartzResource)
- CRU_DELETE_MOVE(OsxQuartzResource)
- ~OsxQuartzResource() override = default;
-
- public:
- std::string GetPlatformId() const override { return "OSX Quartz"; }
-
- IGraphicsFactory* GetGraphicsFactory() override { return graphics_factory_; }
-
- private:
- IGraphicsFactory* graphics_factory_;
-};
-} // namespace cru::platform::graphics::quartz
diff --git a/include/cru/platform/graphics/quartz/TextLayout.h b/include/cru/platform/graphics/quartz/TextLayout.h
index e53ee464..5174c0dd 100644
--- a/include/cru/platform/graphics/quartz/TextLayout.h
+++ b/include/cru/platform/graphics/quartz/TextLayout.h
@@ -1,21 +1,16 @@
#pragma once
-#include "Resource.h"
-
+#include "Base.h"
#include "Font.h"
-#include "cru/base/Base.h"
-#include "cru/platform/graphics/TextLayout.h"
+
+#include <cru/platform/graphics/TextLayout.h>
#include <memory>
namespace cru::platform::graphics::quartz {
class OsxCTTextLayout : public OsxQuartzResource, public virtual ITextLayout {
public:
- OsxCTTextLayout(IGraphicsFactory* graphics_factory,
- std::shared_ptr<OsxCTFont> font, const std::string& str);
-
- CRU_DELETE_COPY(OsxCTTextLayout)
- CRU_DELETE_MOVE(OsxCTTextLayout)
-
+ OsxCTTextLayout(IGraphicsFactory* graphics_factory, std::shared_ptr<OsxCTFont> font,
+ const std::string& str);
~OsxCTTextLayout() override;
public:
@@ -55,8 +50,7 @@ class OsxCTTextLayout : public OsxQuartzResource, public virtual ITextLayout {
void RecreateFrame();
CGRect DoGetTextBounds(bool includingTrailingSpace = false);
- CGRect DoGetTextBoundsIncludingEmptyLines(
- bool includingTrailingSpace = false);
+ CGRect DoGetTextBoundsIncludingEmptyLines(bool includingTrailingSpace = false);
std::vector<CGRect> DoTextRangeRect(const TextRange& text_range);
CGRect DoTextSinglePoint(Index position, bool trailing);