diff options
author | crupest <crupest@outlook.com> | 2021-10-19 22:33:01 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-10-19 22:33:01 +0800 |
commit | fd2e84640b2be52f97f48d818d26fc1289a50c7a (patch) | |
tree | ab94a27fae4b4bb47a6124a478b20c82a1393b9b /include/cru/osx | |
parent | 44f24f8ece48fd4acc2e8d5f5a052cbc1981768c (diff) | |
download | cru-fd2e84640b2be52f97f48d818d26fc1289a50c7a.tar.gz cru-fd2e84640b2be52f97f48d818d26fc1289a50c7a.tar.bz2 cru-fd2e84640b2be52f97f48d818d26fc1289a50c7a.zip |
...
Diffstat (limited to 'include/cru/osx')
-rw-r--r-- | include/cru/osx/graphics/quartz/Painter.hpp | 20 | ||||
-rw-r--r-- | include/cru/osx/graphics/quartz/TextLayout.hpp | 2 |
2 files changed, 15 insertions, 7 deletions
diff --git a/include/cru/osx/graphics/quartz/Painter.hpp b/include/cru/osx/graphics/quartz/Painter.hpp index 8d693d8b..ea64c3d5 100644 --- a/include/cru/osx/graphics/quartz/Painter.hpp +++ b/include/cru/osx/graphics/quartz/Painter.hpp @@ -6,17 +6,19 @@ #include <CoreGraphics/CoreGraphics.h> +#include <functional> + namespace cru::platform::graphics::osx::quartz { class QuartzCGContextPainter : public OsxQuartzResource, public virtual IPainter { + CRU_DEFINE_CLASS_LOG_TAG( + u"cru::platform::graphics::osx::quartz::QuartzCGContextPainter") + public: - explicit QuartzCGContextPainter(IGraphicsFactory* graphics_factory, - CGContextRef cg_context, bool auto_release, - const Size& size) - : OsxQuartzResource(graphics_factory), - cg_context_(cg_context), - auto_release_(auto_release), - size_(size) {} + explicit QuartzCGContextPainter( + 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) @@ -48,6 +50,8 @@ class QuartzCGContextPainter : public OsxQuartzResource, void EndDraw() override; private: + void DoEndDraw(); + void Validate(); private: @@ -56,5 +60,7 @@ class QuartzCGContextPainter : public OsxQuartzResource, bool auto_release_; Size size_; + + std::function<void(QuartzCGContextPainter*)> on_end_draw_; }; } // namespace cru::platform::graphics::osx::quartz diff --git a/include/cru/osx/graphics/quartz/TextLayout.hpp b/include/cru/osx/graphics/quartz/TextLayout.hpp index 4d23a76e..dd170142 100644 --- a/include/cru/osx/graphics/quartz/TextLayout.hpp +++ b/include/cru/osx/graphics/quartz/TextLayout.hpp @@ -33,6 +33,8 @@ class OsxCTTextLayout : public OsxQuartzResource, public virtual ITextLayout { Point TextSinglePoint(Index position, bool trailing) override; TextHitTestResult HitTest(const Point& point) override; + CTFrameRef GetCTFrameRef() const { return ct_frame_; } + private: void RecreateFrame(); |