diff options
author | scroggo <scroggo@google.com> | 2016-05-12 06:22:30 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-12 06:22:30 -0700 |
commit | 9a9a7b29e5e5916a7b6453cd124ca437f14b9da4 (patch) | |
tree | ad5b560f6ed5da12040e5665282fd2227c305ff8 /tests/FontHostTest.cpp | |
parent | a1b283345b27fef91908b104a30cb89e6fbdaade (diff) |
Revert of Move SkTypeface to sk_sp. (patchset #5 id:80001 of https://codereview.chromium.org/1933393002/ )
Reason for revert:
fontmgr_iterAndroid failing to draw emoji. E.g. 6296da736fbf40aae881650c239420f64e576c3f&unt=true&head=true&query=source_type%3Dgm">https://gold.skia.org/search2?blame=6296da736fbf40aae881650c239420f64e576c3f&unt=true&head=true&query=source_type%3Dgm
Original issue's description:
> Move SkTypeface to sk_sp.
>
> Committed: https://skia.googlesource.com/skia/+/6296da736fbf40aae881650c239420f64e576c3f
TBR=reed@google.com,fmalita@chromium.org,tomhudson@google.com,bungeman@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review-Url: https://codereview.chromium.org/1974783002
Diffstat (limited to 'tests/FontHostTest.cpp')
-rw-r--r-- | tests/FontHostTest.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/tests/FontHostTest.cpp b/tests/FontHostTest.cpp index ebcc4ab2ae..d9a3df414a 100644 --- a/tests/FontHostTest.cpp +++ b/tests/FontHostTest.cpp @@ -31,7 +31,7 @@ static const struct TagSize { // Test that getUnitsPerEm() agrees with a direct lookup in the 'head' table // (if that table is available). -static void test_unitsPerEm(skiatest::Reporter* reporter, const sk_sp<SkTypeface>& face) { +static void test_unitsPerEm(skiatest::Reporter* reporter, SkTypeface* face) { int nativeUPEM = face->getUnitsPerEm(); int tableUPEM = -1; @@ -50,7 +50,7 @@ static void test_unitsPerEm(skiatest::Reporter* reporter, const sk_sp<SkTypeface // Test that countGlyphs() agrees with a direct lookup in the 'maxp' table // (if that table is available). -static void test_countGlyphs(skiatest::Reporter* reporter, const sk_sp<SkTypeface>& face) { +static void test_countGlyphs(skiatest::Reporter* reporter, SkTypeface* face) { int nativeGlyphs = face->countGlyphs(); int tableGlyphs = -1; @@ -86,7 +86,7 @@ struct CharsToGlyphs_TestData { }; // Test that SkPaint::textToGlyphs agrees with SkTypeface::charsToGlyphs. -static void test_charsToGlyphs(skiatest::Reporter* reporter, const sk_sp<SkTypeface>& face) { +static void test_charsToGlyphs(skiatest::Reporter* reporter, SkTypeface* face) { uint16_t paintGlyphIds[256]; uint16_t faceGlyphIds[256]; @@ -154,22 +154,22 @@ static void test_fontstream(skiatest::Reporter* reporter) { } static void test_symbolfont(skiatest::Reporter* reporter) { + SkAutoTUnref<SkTypeface> typeface(GetResourceAsTypeface("/fonts/SpiderSymbol.ttf")); + if (!typeface) { + SkDebugf("Skipping FontHostTest::test_symbolfont\n"); + return; + } + SkUnichar c = 0xf021; uint16_t g; SkPaint paint; - paint.setTypeface(MakeResourceAsTypeface("/fonts/SpiderSymbol.ttf")); + paint.setTypeface(typeface); paint.setTextEncoding(SkPaint::kUTF32_TextEncoding); paint.textToGlyphs(&c, 4, &g); - - if (!paint.getTypeface()) { - SkDebugf("Skipping FontHostTest::test_symbolfont\n"); - return; - } - REPORTER_ASSERT(reporter, g == 3); } -static void test_tables(skiatest::Reporter* reporter, const sk_sp<SkTypeface>& face) { +static void test_tables(skiatest::Reporter* reporter, SkTypeface* face) { if (false) { // avoid bit rot, suppress warning SkFontID fontID = face->uniqueID(); REPORTER_ASSERT(reporter, fontID); @@ -223,7 +223,7 @@ static void test_tables(skiatest::Reporter* reporter) { }; for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); ++i) { - sk_sp<SkTypeface> face(SkTypeface::MakeFromName(gNames[i], SkTypeface::kNormal)); + SkAutoTUnref<SkTypeface> face(SkTypeface::CreateFromName(gNames[i], SkTypeface::kNormal)); if (face) { #ifdef DUMP_TABLES SkDebugf("%s\n", gNames[i]); @@ -277,7 +277,8 @@ static void test_advances(skiatest::Reporter* reporter) { char txt[] = "long.text.with.lots.of.dots."; for (size_t i = 0; i < SK_ARRAY_COUNT(faces); i++) { - paint.setTypeface(SkTypeface::MakeFromName(faces[i], SkTypeface::kNormal)); + SkAutoTUnref<SkTypeface> face(SkTypeface::CreateFromName(faces[i], SkTypeface::kNormal)); + paint.setTypeface(face); for (size_t j = 0; j < SK_ARRAY_COUNT(settings); j++) { paint.setHinting(settings[j].hinting); |