aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/fontcache.cpp
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2014-08-28 10:39:40 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-28 10:39:40 -0700
commit63b9dc82474a4daf195c6157a711be401f7a0ddd (patch)
tree2913bdfaf3c0f5c7ec63d0ec0003655eb4314a23 /gm/fontcache.cpp
parent60cc7d353b2adc8fcc1712e1f7a965e70121ebcc (diff)
Restore text vertex buffer alloc and other optimizations.
Modifies the fontcache GM to ensure that the font cache is forced to flush. Committed: https://skia.googlesource.com/skia/+/9c3d24b9d1ba3d955094ff0cb1ba2d11e1c1adca R=bsalomon@google.com, robertphillips@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/466363009
Diffstat (limited to 'gm/fontcache.cpp')
-rw-r--r--gm/fontcache.cpp32
1 files changed, 8 insertions, 24 deletions
diff --git a/gm/fontcache.cpp b/gm/fontcache.cpp
index 74ec18a450..1260eeb76f 100644
--- a/gm/fontcache.cpp
+++ b/gm/fontcache.cpp
@@ -13,15 +13,15 @@
// GM to stress the GPU font cache
const char* gFamilyNames[] = {
- "sans-serif", "serif", "monospace"
+ "sans-serif", "serif"
};
const SkTypeface::Style gStyles[] = {
- SkTypeface::kNormal, SkTypeface::kItalic
+ SkTypeface::kNormal, SkTypeface::kItalic, SkTypeface::kBold
};
const SkScalar gTextSizes[] = {
- 12, 14, 16, 18, 20, 22, 24, 26, 28, 30
+ 192, 194, 196, 198, 200, 202, 204, 206
};
#define TYPEFACE_COUNT (SK_ARRAY_COUNT(gFamilyNames)*SK_ARRAY_COUNT(gStyles))
@@ -52,7 +52,7 @@ protected:
}
virtual SkISize onISize() SK_OVERRIDE {
- return SkISize::Make(640, 320);
+ return SkISize::Make(1280, 640);
}
virtual void onOnceBeforeDraw() SK_OVERRIDE {
@@ -72,35 +72,19 @@ protected:
paint.setLCDRenderText(true);
paint.setSubpixelText(true);
- SkString text("Ham");
+ SkString text("H");
- // draw some initial text to partially fill the GPU cache
- for (size_t i = 0; i < 2; ++i) {
- paint.setTypeface(fTypefaces[i]);
- SkScalar x = 20;
-
- for (size_t j = 0; j < SK_ARRAY_COUNT(gTextSizes); ++j) {
- paint.setTextSize(gTextSizes[j]);
- x = draw_string(canvas, text, x, y, paint) + 19;
- }
- y += 32;
- }
-
- // force a flush
- canvas->flush();
-
- // draw again, and more to overflow the cache
+ // draw enough to overflow the cache
for (size_t i = 0; i < TYPEFACE_COUNT; ++i) {
paint.setTypeface(fTypefaces[i]);
SkScalar x = 20;
for (size_t j = 0; j < SK_ARRAY_COUNT(gTextSizes); ++j) {
paint.setTextSize(gTextSizes[j]);
- x = draw_string(canvas, text, x, y, paint) + 19;
+ x = draw_string(canvas, text, x, y, paint) + 10;
}
- y += 32;
+ y += 128;
}
-
}
virtual uint32_t onGetFlags() const SK_OVERRIDE {