move work out of GM ctor
Change-Id: I6e29e08a1bfaeafe98c8a61f8ce5c279839f4b3c Reviewed-on: https://skia-review.googlesource.com/c/180301 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
e3fc85315e
commit
0fe39bae6b
@ -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<uint16_t> fGlyphs;
|
||||
sk_sp<SkTextBlob> fBlob;
|
||||
sk_sp<SkShader> fShader;
|
||||
@ -109,4 +110,4 @@ private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
|
||||
DEF_GM(return new TextBlobShaderGM("Blobber");)
|
||||
DEF_GM(return new TextBlobShaderGM;)
|
||||
|
Loading…
Reference in New Issue
Block a user