| Index: gm/textblob.cpp
|
| diff --git a/gm/textblob.cpp b/gm/textblob.cpp
|
| index 7c0fd875462cba46574636a53e7a94355649f159..e85571f898f8a2a9038f69fa5256c6c56b47aa82 100644
|
| --- a/gm/textblob.cpp
|
| +++ b/gm/textblob.cpp
|
| @@ -67,17 +67,21 @@ const SkScalar kFontSize = 16;
|
| class TextBlobGM : public skiagm::GM {
|
| public:
|
| TextBlobGM(const char* txt)
|
| - : fTypeface(sk_tool_utils::create_portable_typeface("Times", SkTypeface::kNormal)) {
|
| + : fText(txt) {
|
| + }
|
| +
|
| +protected:
|
| + void onOnceBeforeDraw() override {
|
| + fTypeface.reset(sk_tool_utils::create_portable_typeface("Times", SkTypeface::kNormal));
|
| SkPaint p;
|
| p.setTypeface(fTypeface);
|
| - size_t txtLen = strlen(txt);
|
| - int glyphCount = p.textToGlyphs(txt, txtLen, NULL);
|
| + size_t txtLen = strlen(fText);
|
| + int glyphCount = p.textToGlyphs(fText, txtLen, NULL);
|
|
|
| fGlyphs.append(glyphCount);
|
| - p.textToGlyphs(txt, txtLen, fGlyphs.begin());
|
| + p.textToGlyphs(fText, txtLen, fGlyphs.begin());
|
| }
|
|
|
| -protected:
|
| SkString onShortName() override {
|
| return SkString("textblob");
|
| }
|
| @@ -178,7 +182,7 @@ private:
|
|
|
| SkTDArray<uint16_t> fGlyphs;
|
| SkAutoTUnref<SkTypeface> fTypeface;
|
| -
|
| + const char* fText;
|
| typedef skiagm::GM INHERITED;
|
| };
|
|
|
|
|