aboutsummaryrefslogtreecommitdiff
path: root/src/osx/graphics
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-01-30 20:44:57 +0800
committercrupest <crupest@outlook.com>2022-01-30 20:44:57 +0800
commit1909ee98b92ea993e6fbbdb628da0cf586db7d52 (patch)
treedff1225c2e541e0ba608e5c07699ce9645c5bc0c /src/osx/graphics
parentc1f8ea13524f398f8d1720e5f03a17dd66352ebf (diff)
downloadcru-1909ee98b92ea993e6fbbdb628da0cf586db7d52.tar.gz
cru-1909ee98b92ea993e6fbbdb628da0cf586db7d52.tar.bz2
cru-1909ee98b92ea993e6fbbdb628da0cf586db7d52.zip
...
Diffstat (limited to 'src/osx/graphics')
-rw-r--r--src/osx/graphics/quartz/CMakeLists.txt4
-rw-r--r--src/osx/graphics/quartz/Image.cpp16
2 files changed, 19 insertions, 1 deletions
diff --git a/src/osx/graphics/quartz/CMakeLists.txt b/src/osx/graphics/quartz/CMakeLists.txt
index d5260896..0f44fecf 100644
--- a/src/osx/graphics/quartz/CMakeLists.txt
+++ b/src/osx/graphics/quartz/CMakeLists.txt
@@ -4,6 +4,7 @@ add_library(cru_osx_graphics_quartz SHARED
Factory.cpp
Font.cpp
Geometry.cpp
+ Image.cpp
ImageFactory.cpp
Painter.cpp
Resource.cpp
@@ -12,6 +13,7 @@ add_library(cru_osx_graphics_quartz SHARED
find_library(CORE_GRAPHICS CoreGraphics REQUIRED)
find_library(CORE_TEXT CoreText REQUIRED)
+find_library(IMAGE_IO ImageIO REQUIRED)
-target_link_libraries(cru_osx_graphics_quartz PUBLIC ${CORE_GRAPHICS} ${CORE_TEXT})
+target_link_libraries(cru_osx_graphics_quartz PUBLIC ${CORE_GRAPHICS} ${CORE_TEXT} ${IMAGE_IO})
target_link_libraries(cru_osx_graphics_quartz PUBLIC cru_osx_base cru_platform_graphics)
diff --git a/src/osx/graphics/quartz/Image.cpp b/src/osx/graphics/quartz/Image.cpp
new file mode 100644
index 00000000..901b3ff4
--- /dev/null
+++ b/src/osx/graphics/quartz/Image.cpp
@@ -0,0 +1,16 @@
+#include "cru/osx/graphics/quartz/Image.hpp"
+
+namespace cru::platform::graphics::osx::quartz {
+QuartzImage::QuartzImage(IGraphicsFactory* graphics_factory,
+ IImageFactory* image_factory, CGImageRef image,
+ bool auto_release)
+ : OsxQuartzResource(graphics_factory),
+ image_(image),
+ auto_release_(auto_release) {}
+
+QuartzImage::~QuartzImage() {
+ if (auto_release_) {
+ CGImageRelease(image_);
+ }
+}
+} // namespace cru::platform::graphics::osx::quartz