diff options
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(); |