SkShaper_coretext correct dependencies.

Adds proper framework dependencies and moves from using ArenaAlloc
to header only SkAutoSTArray so it can be built in a shared build.

Change-Id: I6467153915e00a28d5569869187aecc3dd1f0112
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380318
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This commit is contained in:
Ben Wagner 2021-03-05 11:26:35 -05:00 committed by Skia Commit-Bot
parent 8ef4d6c882
commit 83eed35765
2 changed files with 18 additions and 10 deletions

View File

@ -37,6 +37,16 @@ if (skia_enable_skshaper) {
sources = skia_shaper_primitive_sources
if (skia_use_fonthost_mac) {
sources += skia_shaper_coretext_sources
if (is_mac) {
frameworks = [ "ApplicationServices.framework" ]
}
if (is_ios) {
frameworks = [
"CoreFoundation.framework",
"CoreText.framework",
]
}
}
if (skia_use_icu && skia_use_harfbuzz) {
sources += skia_shaper_icu_sources

View File

@ -19,7 +19,7 @@
#endif
#include "include/ports/SkTypeface_mac.h"
#include "src/core/SkArenaAlloc.h"
#include "include/private/SkTemplates.h"
#include "src/utils/SkUTF.h"
#include "src/utils/mac/SkCGBase.h"
#include "src/utils/mac/SkUniqueCFRef.h"
@ -251,9 +251,8 @@ void SkShaper_CoreText::shape(const char* utf8, size_t utf8Bytes,
SkASSERT(sizeof(CGGlyph) == sizeof(uint16_t));
SkSTArenaAlloc<4096> arena;
CGSize* advances = arena.makeArrayDefault<CGSize>(runGlyphs);
CTRunGetAdvances(run, {0, runGlyphs}, advances);
SkAutoSTArray<4096, CGSize> advances(runGlyphs);
CTRunGetAdvances(run, {0, runGlyphs}, advances.data());
SkScalar adv = 0;
for (CFIndex k = 0; k < runGlyphs; ++k) {
adv += advances[k].width;
@ -286,13 +285,12 @@ void SkShaper_CoreText::shape(const char* utf8, size_t utf8Bytes,
CTRunGetGlyphs(run, {0, runGlyphs}, buffer.glyphs);
SkSTArenaAlloc<4096> arena;
CGPoint* positions = arena.makeArrayDefault<CGPoint>(runGlyphs);
CTRunGetPositions(run, {0, runGlyphs}, positions);
CFIndex* indices = nullptr;
SkAutoSTArray<4096, CGPoint> positions(runGlyphs);
CTRunGetPositions(run, {0, runGlyphs}, positions.data());
SkAutoSTArray<4096, CFIndex> indices;
if (buffer.clusters) {
indices = arena.makeArrayDefault<CFIndex>(runGlyphs);
CTRunGetStringIndices(run, {0, runGlyphs}, indices);
indices.reset(runGlyphs);
CTRunGetStringIndices(run, {0, runGlyphs}, indices.data());
}
for (CFIndex k = 0; k < runGlyphs; ++k) {