diff --git a/gm/textblobshader.cpp b/gm/textblobshader.cpp index 3d1b0a5f23..971f6288fa 100644 --- a/gm/textblobshader.cpp +++ b/gm/textblobshader.cpp @@ -19,16 +19,18 @@ // This GM exercises drawTextBlob offset vs. shader space behavior. class TextBlobShaderGM : public skiagm::GM { public: - TextBlobShaderGM(const char* txt) { - SkFont font(sk_tool_utils::create_portable_typeface()); - size_t txtLen = strlen(txt); - fGlyphs.append(font.countText(txt, txtLen, kUTF8_SkTextEncoding)); - font.textToGlyphs(txt, txtLen, kUTF8_SkTextEncoding, fGlyphs.begin(), fGlyphs.count()); - } - -protected: + TextBlobShaderGM() {} +private: void onOnceBeforeDraw() override { + { + SkFont font(sk_tool_utils::create_portable_typeface()); + const char* txt = "Blobber"; + size_t txtLen = strlen(txt); + fGlyphs.append(font.countText(txt, txtLen, kUTF8_SkTextEncoding)); + font.textToGlyphs(txt, txtLen, kUTF8_SkTextEncoding, fGlyphs.begin(), fGlyphs.count()); + } + SkFont font; font.setSubpixel(true); font.setEdging(SkFont::Edging::kAntiAlias); @@ -101,7 +103,6 @@ protected: } } -private: SkTDArray fGlyphs; sk_sp fBlob; sk_sp fShader; @@ -109,4 +110,4 @@ private: typedef skiagm::GM INHERITED; }; -DEF_GM(return new TextBlobShaderGM("Blobber");) +DEF_GM(return new TextBlobShaderGM;)