Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: gm/textblobshader.cpp

Issue 1263593004: gm missed portable text in textblobshader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 9
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkGradientShader.h" 11 #include "SkGradientShader.h"
12 #include "SkPoint.h" 12 #include "SkPoint.h"
13 #include "SkShader.h" 13 #include "SkShader.h"
14 #include "SkTextBlob.h" 14 #include "SkTextBlob.h"
15 #include "SkTDArray.h" 15 #include "SkTDArray.h"
16 #include "SkTypeface.h" 16 #include "SkTypeface.h"
17 17
18 // This GM exercises drawTextBlob offset vs. shader space behavior. 18 // This GM exercises drawTextBlob offset vs. shader space behavior.
19 class TextBlobShaderGM : public skiagm::GM { 19 class TextBlobShaderGM : public skiagm::GM {
20 public: 20 public:
21 TextBlobShaderGM(const char* txt) { 21 TextBlobShaderGM(const char* txt) {
22 SkPaint p; 22 SkPaint p;
23 sk_tool_utils::set_portable_typeface(&p);
23 size_t txtLen = strlen(txt); 24 size_t txtLen = strlen(txt);
24 fGlyphs.append(p.textToGlyphs(txt, txtLen, NULL)); 25 fGlyphs.append(p.textToGlyphs(txt, txtLen, NULL));
25 p.textToGlyphs(txt, txtLen, fGlyphs.begin()); 26 p.textToGlyphs(txt, txtLen, fGlyphs.begin());
26 } 27 }
27 28
28 protected: 29 protected:
29 30
30 void onOnceBeforeDraw() override { 31 void onOnceBeforeDraw() override {
31 SkPaint p; 32 SkPaint p;
32 p.setAntiAlias(true); 33 p.setAntiAlias(true);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 103
103 private: 104 private:
104 SkTDArray<uint16_t> fGlyphs; 105 SkTDArray<uint16_t> fGlyphs;
105 SkAutoTUnref<const SkTextBlob> fBlob; 106 SkAutoTUnref<const SkTextBlob> fBlob;
106 SkAutoTUnref<SkShader> fShader; 107 SkAutoTUnref<SkShader> fShader;
107 108
108 typedef skiagm::GM INHERITED; 109 typedef skiagm::GM INHERITED;
109 }; 110 };
110 111
111 DEF_GM( return SkNEW_ARGS(TextBlobShaderGM, ("Blobber")); ) 112 DEF_GM( return SkNEW_ARGS(TextBlobShaderGM, ("Blobber")); )
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698