aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/CmapBench.cpp
diff options
context:
space:
mode:
authorGravatar mtklein@google.com <mtklein@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-10 19:23:38 +0000
committerGravatar mtklein@google.com <mtklein@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-10 19:23:38 +0000
commitc289743864e2ab926a95e617a5cd1d29b26d1825 (patch)
tree2c559da19185181efd8bd92791fb758af5969800 /bench/CmapBench.cpp
parent55ebe8eca0063ab1f3979d629749bc41ec409ac1 (diff)
Major bench refactoring.
- Use FLAGS_. - Remove outer repeat loop. - Tune inner loop automatically. BUG=skia:1590 R=epoger@google.com, scroggo@google.com Review URL: https://codereview.chromium.org/23478013 git-svn-id: http://skia.googlecode.com/svn/trunk@11187 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/CmapBench.cpp')
-rw-r--r--bench/CmapBench.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/bench/CmapBench.cpp b/bench/CmapBench.cpp
index 49c2aee70e..c721e9c4a9 100644
--- a/bench/CmapBench.cpp
+++ b/bench/CmapBench.cpp
@@ -11,7 +11,6 @@
#include "SkTypeface.h"
enum {
- LOOP = SkBENCHLOOP(1000),
NGLYPHS = 100
};
@@ -21,44 +20,44 @@ static SkTypeface::Encoding paint2Encoding(const SkPaint& paint) {
return (SkTypeface::Encoding)enc;
}
-typedef void (*TypefaceProc)(const SkPaint&, const void* text, size_t len,
+typedef void (*TypefaceProc)(int loops, const SkPaint&, const void* text, size_t len,
int glyphCount);
-static void containsText_proc(const SkPaint& paint, const void* text, size_t len,
+static void containsText_proc(int loops, const SkPaint& paint, const void* text, size_t len,
int glyphCount) {
- for (int i = 0; i < LOOP; ++i) {
+ for (int i = 0; i < loops; ++i) {
paint.containsText(text, len);
}
}
-static void textToGlyphs_proc(const SkPaint& paint, const void* text, size_t len,
+static void textToGlyphs_proc(int loops, const SkPaint& paint, const void* text, size_t len,
int glyphCount) {
uint16_t glyphs[NGLYPHS];
SkASSERT(glyphCount <= NGLYPHS);
- for (int i = 0; i < LOOP; ++i) {
+ for (int i = 0; i < loops; ++i) {
paint.textToGlyphs(text, len, glyphs);
}
}
-static void charsToGlyphs_proc(const SkPaint& paint, const void* text,
+static void charsToGlyphs_proc(int loops, const SkPaint& paint, const void* text,
size_t len, int glyphCount) {
SkTypeface::Encoding encoding = paint2Encoding(paint);
uint16_t glyphs[NGLYPHS];
SkASSERT(glyphCount <= NGLYPHS);
SkTypeface* face = paint.getTypeface();
- for (int i = 0; i < LOOP; ++i) {
+ for (int i = 0; i < loops; ++i) {
face->charsToGlyphs(text, encoding, glyphs, glyphCount);
}
}
-static void charsToGlyphsNull_proc(const SkPaint& paint, const void* text,
+static void charsToGlyphsNull_proc(int loops, const SkPaint& paint, const void* text,
size_t len, int glyphCount) {
SkTypeface::Encoding encoding = paint2Encoding(paint);
SkTypeface* face = paint.getTypeface();
- for (int i = 0; i < LOOP; ++i) {
+ for (int i = 0; i < loops; ++i) {
face->charsToGlyphs(text, encoding, NULL, glyphCount);
}
}
@@ -87,7 +86,7 @@ protected:
}
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
- fProc(fPaint, fText, sizeof(fText), NGLYPHS);
+ fProc(this->getLoops(), fPaint, fText, sizeof(fText), NGLYPHS);
}
private: