diff options
Diffstat (limited to 'src/osx/graphics/quartz/Painter.cpp')
-rw-r--r-- | src/osx/graphics/quartz/Painter.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/osx/graphics/quartz/Painter.cpp b/src/osx/graphics/quartz/Painter.cpp index 6effe9f9..4771ca47 100644 --- a/src/osx/graphics/quartz/Painter.cpp +++ b/src/osx/graphics/quartz/Painter.cpp @@ -7,6 +7,13 @@ #include "cru/platform/Exception.hpp" namespace cru::platform::graphics::osx::quartz { +QuartzCGContextPainter::~QuartzCGContextPainter() { + if (auto_release_) { + CGContextRelease(cg_context_); + cg_context_ = nullptr; + } +} + Matrix QuartzCGContextPainter::GetTransform() { return Convert(CGContextGetCTM(cg_context_)); } @@ -101,11 +108,7 @@ void QuartzCGContextPainter::PopLayer() { // TODO: Implement this. } -void QuartzCGContextPainter::EndDraw() { - CGContextRelease(cg_context_); - CGContextFlush(cg_context_); - cg_context_ = nullptr; -} +void QuartzCGContextPainter::EndDraw() { CGContextFlush(cg_context_); } void QuartzCGContextPainter::Validate() { if (cg_context_ == nullptr) |