diff options
| author | crupest <crupest@outlook.com> | 2021-10-16 22:30:29 +0800 |
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2021-10-16 22:30:29 +0800 |
| commit | e9f586071a83b2551dbc7c98ccfaa8e6b3189f01 (patch) | |
| tree | 1191207902f833584517df87d4b1fa7d7ce5783b /src/osx/graphics | |
| parent | ed368423531b24e8735db0afe38c7486145caa56 (diff) | |
| download | cru-e9f586071a83b2551dbc7c98ccfaa8e6b3189f01.tar.gz cru-e9f586071a83b2551dbc7c98ccfaa8e6b3189f01.tar.bz2 cru-e9f586071a83b2551dbc7c98ccfaa8e6b3189f01.zip | |
...
Diffstat (limited to 'src/osx/graphics')
| -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) |
