diff options
author | 2014-09-16 17:58:34 -0700 | |
---|---|---|
committer | 2014-09-16 17:58:34 -0700 | |
commit | acb882c239c0cfea738fe63ed9de48ddc2ddc76a (patch) | |
tree | 080a9d37f4da22fe2fb235e47b7aa0cf260fa6eb /gm | |
parent | d99bbb61e58e8bd34db3954147ce1c9166fe4637 (diff) |
Ensure blob typeface information survives SkGPipe serialization.
When flattening text blobs to the temp buffer, we need to collect
typeface info and ship it across the pipe explicitly.
R=mtklein@google.com, reed@google.com, robertphillips@google.com, bungeman@google.com
BUG=412445
Author: fmalita@chromium.org
Review URL: https://codereview.chromium.org/563783003
Diffstat (limited to 'gm')
-rw-r--r-- | gm/textblob.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gm/textblob.cpp b/gm/textblob.cpp index 6837363898..a0340071f7 100644 --- a/gm/textblob.cpp +++ b/gm/textblob.cpp @@ -66,8 +66,10 @@ const SkScalar kFontSize = 16; class TextBlobGM : public skiagm::GM { public: - TextBlobGM(const char* txt) { + TextBlobGM(const char* txt) + : fTypeface(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); @@ -111,6 +113,7 @@ private: font.setTextEncoding(SkPaint::kGlyphID_TextEncoding); font.setAntiAlias(true); font.setSubpixelText(true); + font.setTypeface(fTypeface); for (unsigned l = 0; l < SK_ARRAY_COUNT(blobConfigs[blobIndex]); ++l) { unsigned currentGlyph = 0; @@ -173,7 +176,8 @@ private: return builder.build(); } - SkTDArray<uint16_t> fGlyphs; + SkTDArray<uint16_t> fGlyphs; + SkAutoTUnref<SkTypeface> fTypeface; typedef skiagm::GM INHERITED; }; |