hide SkFont::containsText

Bug: skia:
Change-Id: I197addb0ea1da57083283b30e19e290cdaf8dac6
Reviewed-on: https://skia-review.googlesource.com/c/188581
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2019-02-01 04:53:03 -05:00 committed by Skia Commit-Bot
parent 72a0e3347c
commit 569dda7216
4 changed files with 4 additions and 14 deletions

View File

@ -17,13 +17,6 @@ enum {
typedef void (*TypefaceProc)(int loops, const SkFont&, const void* text, size_t len,
int glyphCount);
static void containsText_proc(int loops, const SkFont& font, const void* text, size_t len,
int glyphCount) {
for (int i = 0; i < loops; ++i) {
font.containsText(text, len, kUTF8_SkTextEncoding);
}
}
static void textToGlyphs_proc(int loops, const SkFont& font, const void* text, size_t len,
int glyphCount) {
uint16_t glyphs[NGLYPHS];
@ -87,7 +80,6 @@ private:
//////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return new CMAPBench(containsText_proc, "paint_containsText"); )
DEF_BENCH( return new CMAPBench(textToGlyphs_proc, "paint_textToGlyphs"); )
DEF_BENCH( return new CMAPBench(charsToGlyphs_proc, "face_charsToGlyphs"); )
DEF_BENCH( return new CMAPBench(charsToGlyphsNull_proc, "face_charsToGlyphs_null"); )

View File

@ -320,6 +320,7 @@ public:
return this->textToGlyphs(text, byteLength, encoding, nullptr, 0);
}
#ifdef SK_SUPPORT_LEGACY_CONTAINSTEXT
/** Returns true if all text corresponds to a non-zero glyph index.
Returns false if any characters in text are not supported in
SkTypeface.
@ -336,6 +337,7 @@ public:
@return true if all text corresponds to a non-zero glyph index
*/
bool containsText(const void* text, size_t byteLength, SkTextEncoding encoding) const;
#endif
#ifdef SK_SUPPORT_LEGACY_BREAKTEXT
/** Deprecated.

View File

@ -219,6 +219,7 @@ void SkFont::glyphsToUnichars(const SkGlyphID glyphs[], int count, SkUnichar tex
}
}
#ifdef SK_SUPPORT_LEGACY_CONTAINSTEXT
static SkTypeface::Encoding to_encoding(SkTextEncoding e) {
static_assert((int)SkTypeface::kUTF8_Encoding == (int)kUTF8_SkTextEncoding, "");
static_assert((int)SkTypeface::kUTF16_Encoding == (int)kUTF16_SkTextEncoding, "");
@ -255,6 +256,7 @@ bool SkFont::containsText(const void* textData, size_t byteLength, SkTextEncodin
}
return true;
}
#endif
#ifdef SK_SUPPORT_LEGACY_BREAKTEXT
size_t SkFont::breakText(const void* textD, size_t length, SkTextEncoding encoding,

View File

@ -93,7 +93,6 @@ DEF_TEST(Paint_cmap, reporter) {
uint16_t glyphs0[NGLYPHS], glyphs1[NGLYPHS];
bool contains = font.containsText(dst, len, gRec[k].fEncoding);
int nglyphs = font.textToGlyphs(dst, len, gRec[k].fEncoding, glyphs0, NGLYPHS);
int first = face->charsToGlyphs(dst, (SkTypeface::Encoding)gRec[k].fEncoding,
glyphs1, NGLYPHS);
@ -102,11 +101,6 @@ DEF_TEST(Paint_cmap, reporter) {
REPORTER_ASSERT(reporter, NGLYPHS == nglyphs);
REPORTER_ASSERT(reporter, index == first);
REPORTER_ASSERT(reporter, 0 == memcmp(glyphs0, glyphs1, NGLYPHS * sizeof(uint16_t)));
if (contains) {
REPORTER_ASSERT(reporter, NGLYPHS == first);
} else {
REPORTER_ASSERT(reporter, NGLYPHS > first);
}
}
}
}