diff options
-rw-r--r-- | src/osx/graphics/quartz/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/osx/graphics/quartz/Image.cpp | 16 |
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 |