aboutsummaryrefslogtreecommitdiff
path: root/src/platform/graphics
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-08-16 19:24:11 +0800
committerYuqian Yang <crupest@crupest.life>2025-08-16 19:24:11 +0800
commit600307d3d0133accc3aaceed694e897ad48cd584 (patch)
tree21296dcabd1868872b0e2ab06c17ce1d6cbf1df3 /src/platform/graphics
parentd868d7b0d463ede80b761f87f10d4e25f52989c3 (diff)
downloadcru-600307d3d0133accc3aaceed694e897ad48cd584.tar.gz
cru-600307d3d0133accc3aaceed694e897ad48cd584.tar.bz2
cru-600307d3d0133accc3aaceed694e897ad48cd584.zip
Move Core Foundation string out of cru String. Still error.
Diffstat (limited to 'src/platform/graphics')
-rw-r--r--src/platform/graphics/quartz/Font.cpp3
-rw-r--r--src/platform/graphics/quartz/ImageFactory.cpp11
-rw-r--r--src/platform/graphics/quartz/TextLayout.cpp3
3 files changed, 10 insertions, 7 deletions
diff --git a/src/platform/graphics/quartz/Font.cpp b/src/platform/graphics/quartz/Font.cpp
index 8821062f..4d03c56e 100644
--- a/src/platform/graphics/quartz/Font.cpp
+++ b/src/platform/graphics/quartz/Font.cpp
@@ -1,12 +1,13 @@
#include "cru/platform/graphics/quartz/Font.h"
+#include "cru/base/Osx.h"
#include "cru/platform/graphics/quartz/Resource.h"
namespace cru::platform::graphics::quartz {
OsxCTFont::OsxCTFont(IGraphicsFactory* graphics_factory, const String& name,
float size)
: OsxQuartzResource(graphics_factory), name_(name) {
- auto n = name.ToCFStringRef();
+ auto n = ToCFStringRef(name);
if (name.empty()) {
ct_font_ =
diff --git a/src/platform/graphics/quartz/ImageFactory.cpp b/src/platform/graphics/quartz/ImageFactory.cpp
index 1f354155..1fb04132 100644
--- a/src/platform/graphics/quartz/ImageFactory.cpp
+++ b/src/platform/graphics/quartz/ImageFactory.cpp
@@ -1,9 +1,10 @@
#include "cru/platform/graphics/quartz/ImageFactory.h"
#include "cru/base/Exception.h"
-#include "cru/platform/graphics/quartz/Convert.h"
-#include "cru/platform/graphics/quartz/Image.h"
+#include "cru/base/Osx.h"
#include "cru/platform/Check.h"
#include "cru/platform/graphics/Image.h"
+#include "cru/platform/graphics/quartz/Convert.h"
+#include "cru/platform/graphics/quartz/Image.h"
#include <ImageIO/ImageIO.h>
@@ -51,10 +52,10 @@ void QuartzImageFactory::EncodeToStream(IImage* image, io::Stream* stream,
auto quartz_image = CheckPlatform<QuartzImage>(image, GetPlatformId());
auto cg_image = quartz_image->GetCGImage();
- auto uti = GetImageFormatUniformTypeIdentifier(format).ToCFStringRef();
+ auto uti = ToCFStringRef(GetImageFormatUniformTypeIdentifier(format));
CGDataConsumerRef data_consumer = ConvertStreamToCGDataConsumer(stream);
- CGImageDestinationRef destination =
- CGImageDestinationCreateWithDataConsumer(data_consumer, uti.ref, 1, nullptr);
+ CGImageDestinationRef destination = CGImageDestinationCreateWithDataConsumer(
+ data_consumer, uti.ref, 1, nullptr);
CFMutableDictionaryRef properties =
CFDictionaryCreateMutable(nullptr, 0, nullptr, nullptr);
diff --git a/src/platform/graphics/quartz/TextLayout.cpp b/src/platform/graphics/quartz/TextLayout.cpp
index 1d49d6c0..7b3e6da8 100644
--- a/src/platform/graphics/quartz/TextLayout.cpp
+++ b/src/platform/graphics/quartz/TextLayout.cpp
@@ -1,5 +1,6 @@
#include "cru/platform/graphics/quartz/TextLayout.h"
#include "cru/base/Base.h"
+#include "cru/base/Osx.h"
#include "cru/base/Format.h"
#include "cru/platform/graphics/quartz/Convert.h"
#include "cru/platform/graphics/quartz/Resource.h"
@@ -71,7 +72,7 @@ void OsxCTTextLayout::DoSetText(String text) {
}
}
- auto s = actual_text_.ToCFStringRef();
+ auto s = ToCFStringRef(actual_text_);
cf_attributed_text_ = CFAttributedStringCreateMutable(nullptr, 0);
CFAttributedStringReplaceString(cf_attributed_text_, CFRangeMake(0, 0), s.ref);
Ensures(cf_attributed_text_);