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

Side by Side Diff: gm/textblob.cpp

Issue 1933393002: Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Restore deleted Android code. Created 4 years, 7 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 | « gm/poly2poly.cpp ('k') | gm/textblobmixedsizes.cpp » ('j') | 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"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 class TextBlobGM : public skiagm::GM { 67 class TextBlobGM : public skiagm::GM {
68 public: 68 public:
69 TextBlobGM(const char* txt) 69 TextBlobGM(const char* txt)
70 : fText(txt) { 70 : fText(txt) {
71 } 71 }
72 72
73 protected: 73 protected:
74 void onOnceBeforeDraw() override { 74 void onOnceBeforeDraw() override {
75 fTypeface.reset(sk_tool_utils::create_portable_typeface("serif", SkTypef ace::kNormal)); 75 fTypeface = sk_tool_utils::create_portable_typeface("serif", SkTypeface: :kNormal);
76 SkPaint p; 76 SkPaint p;
77 p.setTypeface(fTypeface); 77 p.setTypeface(fTypeface);
78 size_t txtLen = strlen(fText); 78 size_t txtLen = strlen(fText);
79 int glyphCount = p.textToGlyphs(fText, txtLen, nullptr); 79 int glyphCount = p.textToGlyphs(fText, txtLen, nullptr);
80 80
81 fGlyphs.append(glyphCount); 81 fGlyphs.append(glyphCount);
82 p.textToGlyphs(fText, txtLen, fGlyphs.begin()); 82 p.textToGlyphs(fText, txtLen, fGlyphs.begin());
83 } 83 }
84 84
85 SkString onShortName() override { 85 SkString onShortName() override {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 SK_ABORT("unhandled pos value"); 173 SK_ABORT("unhandled pos value");
174 } 174 }
175 175
176 currentGlyph += count; 176 currentGlyph += count;
177 } 177 }
178 } 178 }
179 179
180 return builder.build(); 180 return builder.build();
181 } 181 }
182 182
183 SkTDArray<uint16_t> fGlyphs; 183 SkTDArray<uint16_t> fGlyphs;
184 SkAutoTUnref<SkTypeface> fTypeface; 184 sk_sp<SkTypeface> fTypeface;
185 const char* fText; 185 const char* fText;
186 typedef skiagm::GM INHERITED; 186 typedef skiagm::GM INHERITED;
187 }; 187 };
188 188
189 DEF_GM(return new TextBlobGM("hamburgefons");) 189 DEF_GM(return new TextBlobGM("hamburgefons");)
OLDNEW
« no previous file with comments | « gm/poly2poly.cpp ('k') | gm/textblobmixedsizes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698