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:
parent
72a0e3347c
commit
569dda7216
@ -17,13 +17,6 @@ enum {
|
|||||||
typedef void (*TypefaceProc)(int loops, const SkFont&, const void* text, size_t len,
|
typedef void (*TypefaceProc)(int loops, const SkFont&, const void* text, size_t len,
|
||||||
int glyphCount);
|
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,
|
static void textToGlyphs_proc(int loops, const SkFont& font, const void* text, size_t len,
|
||||||
int glyphCount) {
|
int glyphCount) {
|
||||||
uint16_t glyphs[NGLYPHS];
|
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(textToGlyphs_proc, "paint_textToGlyphs"); )
|
||||||
DEF_BENCH( return new CMAPBench(charsToGlyphs_proc, "face_charsToGlyphs"); )
|
DEF_BENCH( return new CMAPBench(charsToGlyphs_proc, "face_charsToGlyphs"); )
|
||||||
DEF_BENCH( return new CMAPBench(charsToGlyphsNull_proc, "face_charsToGlyphs_null"); )
|
DEF_BENCH( return new CMAPBench(charsToGlyphsNull_proc, "face_charsToGlyphs_null"); )
|
||||||
|
@ -320,6 +320,7 @@ public:
|
|||||||
return this->textToGlyphs(text, byteLength, encoding, nullptr, 0);
|
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 true if all text corresponds to a non-zero glyph index.
|
||||||
Returns false if any characters in text are not supported in
|
Returns false if any characters in text are not supported in
|
||||||
SkTypeface.
|
SkTypeface.
|
||||||
@ -336,6 +337,7 @@ public:
|
|||||||
@return true if all text corresponds to a non-zero glyph index
|
@return true if all text corresponds to a non-zero glyph index
|
||||||
*/
|
*/
|
||||||
bool containsText(const void* text, size_t byteLength, SkTextEncoding encoding) const;
|
bool containsText(const void* text, size_t byteLength, SkTextEncoding encoding) const;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SK_SUPPORT_LEGACY_BREAKTEXT
|
#ifdef SK_SUPPORT_LEGACY_BREAKTEXT
|
||||||
/** Deprecated.
|
/** Deprecated.
|
||||||
|
@ -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 SkTypeface::Encoding to_encoding(SkTextEncoding e) {
|
||||||
static_assert((int)SkTypeface::kUTF8_Encoding == (int)kUTF8_SkTextEncoding, "");
|
static_assert((int)SkTypeface::kUTF8_Encoding == (int)kUTF8_SkTextEncoding, "");
|
||||||
static_assert((int)SkTypeface::kUTF16_Encoding == (int)kUTF16_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;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SK_SUPPORT_LEGACY_BREAKTEXT
|
#ifdef SK_SUPPORT_LEGACY_BREAKTEXT
|
||||||
size_t SkFont::breakText(const void* textD, size_t length, SkTextEncoding encoding,
|
size_t SkFont::breakText(const void* textD, size_t length, SkTextEncoding encoding,
|
||||||
|
@ -93,7 +93,6 @@ DEF_TEST(Paint_cmap, reporter) {
|
|||||||
|
|
||||||
uint16_t glyphs0[NGLYPHS], glyphs1[NGLYPHS];
|
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 nglyphs = font.textToGlyphs(dst, len, gRec[k].fEncoding, glyphs0, NGLYPHS);
|
||||||
int first = face->charsToGlyphs(dst, (SkTypeface::Encoding)gRec[k].fEncoding,
|
int first = face->charsToGlyphs(dst, (SkTypeface::Encoding)gRec[k].fEncoding,
|
||||||
glyphs1, NGLYPHS);
|
glyphs1, NGLYPHS);
|
||||||
@ -102,11 +101,6 @@ DEF_TEST(Paint_cmap, reporter) {
|
|||||||
REPORTER_ASSERT(reporter, NGLYPHS == nglyphs);
|
REPORTER_ASSERT(reporter, NGLYPHS == nglyphs);
|
||||||
REPORTER_ASSERT(reporter, index == first);
|
REPORTER_ASSERT(reporter, index == first);
|
||||||
REPORTER_ASSERT(reporter, 0 == memcmp(glyphs0, glyphs1, NGLYPHS * sizeof(uint16_t)));
|
REPORTER_ASSERT(reporter, 0 == memcmp(glyphs0, glyphs1, NGLYPHS * sizeof(uint16_t)));
|
||||||
if (contains) {
|
|
||||||
REPORTER_ASSERT(reporter, NGLYPHS == first);
|
|
||||||
} else {
|
|
||||||
REPORTER_ASSERT(reporter, NGLYPHS > first);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user