From 2e1a82675c9dc6fe7d6884f92ae59519d5359a70 Mon Sep 17 00:00:00 2001 From: djsollen Date: Wed, 27 Aug 2014 13:12:25 -0700 Subject: Revert of Restore text alloc optimizations. (patchset #4 of https://codereview.chromium.org/466363009/) Reason for revert: GM failures on http://108.170.220.120:10115/builders/Test-Ubuntu12-ShuttleA-GTX660-x86-Release/builds/1867/ Original issue's description: > 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, jvanverth@google.com TBR=bsalomon@google.com, jvanverth@google.com, robertphillips@google.com NOTREECHECKS=true NOTRY=true Author: djsollen@google.com Review URL: https://codereview.chromium.org/510103003 --- gm/fontcache.cpp | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'gm/fontcache.cpp') diff --git a/gm/fontcache.cpp b/gm/fontcache.cpp index 1260eeb76f..74ec18a450 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" + "sans-serif", "serif", "monospace" }; const SkTypeface::Style gStyles[] = { - SkTypeface::kNormal, SkTypeface::kItalic, SkTypeface::kBold + SkTypeface::kNormal, SkTypeface::kItalic }; const SkScalar gTextSizes[] = { - 192, 194, 196, 198, 200, 202, 204, 206 + 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 }; #define TYPEFACE_COUNT (SK_ARRAY_COUNT(gFamilyNames)*SK_ARRAY_COUNT(gStyles)) @@ -52,7 +52,7 @@ protected: } virtual SkISize onISize() SK_OVERRIDE { - return SkISize::Make(1280, 640); + return SkISize::Make(640, 320); } virtual void onOnceBeforeDraw() SK_OVERRIDE { @@ -72,19 +72,35 @@ protected: paint.setLCDRenderText(true); paint.setSubpixelText(true); - SkString text("H"); + SkString text("Ham"); - // draw enough to overflow the cache + // 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 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) + 10; + x = draw_string(canvas, text, x, y, paint) + 19; } - y += 128; + y += 32; } + } virtual uint32_t onGetFlags() const SK_OVERRIDE { -- cgit v1.2.3