20#define gUniqueGlyphIDs_Sentinel 0xFFFF
23 const uint16_t* curr =
start;
27 return static_cast<int>(curr -
start);
46 for (
int i = 0; i < loops; ++i) {
59static uint32_t
rotr(uint32_t value,
unsigned bits) {
60 return (
value >> bits) | (
value << (32 - bits));
78#define kMaxHashBits 12
79#define kMaxHashCount (1 << kMaxHashBits)
87 for (
int i = 0; i <
count; ++i) {
88 int index = proc(array[i]) & hashMask;
89 collisions +=
table[index];
96 for (
int i = 0; i <
count; ++i) {
106 if ((
false))
rotr(0, 0);
111 return "fontefficiency";
121 for (
int hashBits = 6; hashBits <= 12; hashBits += 1) {
122 int hashMask = ((1 << hashBits) - 1);
123 for (
int limit = 32; limit <= 1024; limit <<= 1) {
124 for (
size_t i = 0; i < std::size(
gRec); ++i) {
134 SkDebugf(
"hashBits [%d] limit [%d] collisions [%d / %d = %1.2g%%] using %s\n", hashBits, limit, collisions,
glyphs,
153 uint16_t fGlyphs[100];
155 const bool fOneAtATime;
159 fName.printf(
"font-path-%s", oneAtATime ?
"loop" :
"batch");
164 return fName.c_str();
168 return backend == Backend::kNonRendering;
173 for (
size_t i = 0; i < std::size(fGlyphs); ++i) {
180 for (
int loop = 0; loop < loops; ++loop) {
182 for (
size_t i = 0; i < std::size(fGlyphs); ++i) {
183 fFont.
getPath(fGlyphs[i], &path);
186 fFont.
getPaths(fGlyphs, std::size(fGlyphs),
189 src->transform(mx,
static_cast<SkPath*
>(ctx));
static int count_glyphs(const uint16_t start[])
static int count_collisions(const uint16_t array[], int count, HasherProc proc, unsigned hashMask)
static void dump_array(const uint16_t array[], int count)
static uint32_t rotr(uint32_t value, unsigned bits)
uint32_t(* HasherProc)(uint32_t)
static const struct @223 gRec[]
static uint32_t hasher0(uint32_t value)
#define gUniqueGlyphIDs_Sentinel
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
@ kGlyphID
uses two byte words to represent glyph indices
static void sk_bzero(void *buffer, size_t size)
#define INHERITED(method,...)
const char * onGetName() override
void onDraw(int loops, SkCanvas *canvas) override
const char * onGetName() override
void onDraw(int loops, SkCanvas *canvas) override
FontPathBench(bool oneAtATime)
void onDraw(int loops, SkCanvas *canvas) override
const char * onGetName() override
bool isSuitableFor(Backend backend) override
void onDelayedSetup() override
bool getPath(SkGlyphID glyphID, SkPath *path) const
void setSize(SkScalar textSize)
void getPaths(const SkGlyphID glyphIDs[], int count, void(*glyphPathProc)(const SkPath *pathOrNull, const SkMatrix &mx, void *ctx), void *ctx) const
@ kAntiAlias
may have transparent pixels on glyph edges
static const uint16_t gUniqueGlyphIDs[]
static uint32_t Mix(uint32_t hash)