aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-08-31 00:54:12 +0800
committercrupest <crupest@outlook.com>2021-08-31 00:54:12 +0800
commit312bfa625dd02b59ceb5d1a9f9e5c5189446781b (patch)
treef10e7c00f98d9f4cdd77941642e9a362f17e360c /include
parent45ecfd5699e4949952cc71178521d1a238736ac6 (diff)
downloadcru-312bfa625dd02b59ceb5d1a9f9e5c5189446781b.tar.gz
cru-312bfa625dd02b59ceb5d1a9f9e5c5189446781b.tar.bz2
cru-312bfa625dd02b59ceb5d1a9f9e5c5189446781b.zip
...
Diffstat (limited to 'include')
-rw-r--r--include/cru/osx/graphics/quartz/Geometry.hpp61
1 files changed, 8 insertions, 53 deletions
diff --git a/include/cru/osx/graphics/quartz/Geometry.hpp b/include/cru/osx/graphics/quartz/Geometry.hpp
index 33a2d8a8..0c8f840f 100644
--- a/include/cru/osx/graphics/quartz/Geometry.hpp
+++ b/include/cru/osx/graphics/quartz/Geometry.hpp
@@ -9,8 +9,7 @@
namespace cru::platform::graphics::osx::quartz {
class QuartzGeometry : public OsxQuartzResource, public virtual IGeometry {
public:
- QuartzGeometry(IGraphFactory *graphics_factory, CGContextRef cg_context,
- CGPathRef cg_path);
+ QuartzGeometry(IGraphFactory *graphics_factory, CGPathRef cg_path);
CRU_DELETE_COPY(QuartzGeometry)
CRU_DELETE_MOVE(QuartzGeometry)
@@ -22,72 +21,28 @@ class QuartzGeometry : public OsxQuartzResource, public virtual IGeometry {
bool FillContains(const Point &point) override;
private:
- CGContextRef cg_context_;
CGPathRef cg_path_;
};
-namespace details {
-struct GeometryBeginFigureAction : Object {
- explicit GeometryBeginFigureAction(Point point) : point(point) {}
-
- Point point;
-};
-
-struct GeometryCloseFigureAction : Object {
- explicit GeometryCloseFigureAction(bool close) : close(close) {}
-
- bool close;
-};
-
-struct GeometryLineToAction : Object {
- explicit GeometryLineToAction(Point point) : point(point) {}
-
- Point point;
-};
-
-struct GeometryQuadraticBezierToAction : Object {
- GeometryQuadraticBezierToAction(Point control_point, Point end_point)
- : control_point(control_point), end_point(end_point) {}
-
- Point control_point;
- Point end_point;
-};
-} // namespace details
-
class QuartzGeometryBuilder : public OsxQuartzResource,
public virtual IGeometryBuilder {
public:
- explicit QuartzGeometryBuilder(IGraphFactory *graphics_factory,
- CGContextRef cg_context);
+ explicit QuartzGeometryBuilder(IGraphFactory *graphics_factory);
CRU_DELETE_COPY(QuartzGeometryBuilder)
CRU_DELETE_MOVE(QuartzGeometryBuilder)
- ~QuartzGeometryBuilder() override = default;
+ ~QuartzGeometryBuilder() override;
- void BeginFigure(const Point &point) override {
- actions_.push_back(
- std::make_unique<details::GeometryBeginFigureAction>(point));
- }
- void CloseFigure(bool close) override {
- actions_.push_back(
- std::make_unique<details::GeometryCloseFigureAction>(close));
- }
- void LineTo(const Point &point) override {
- actions_.push_back(std::make_unique<details::GeometryLineToAction>(point));
- }
+ void BeginFigure(const Point &point) override;
+ void CloseFigure(bool close) override;
+ void LineTo(const Point &point) override;
void QuadraticBezierTo(const Point &control_point,
- const Point &end_point) override {
- actions_.push_back(
- std::make_unique<details::GeometryQuadraticBezierToAction>(
- control_point, end_point));
- }
+ const Point &end_point) override;
std::unique_ptr<IGeometry> Build() override;
private:
- CGContextRef cg_context_;
-
- std::vector<std::unique_ptr<Object>> actions_;
+ CGMutablePathRef cg_mutable_path_;
};
} // namespace cru::platform::graphics::osx::quartz