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

Side by Side Diff: gm/textblobrandomfont.cpp

Issue 2335493005: Use sk_sp text blob APIs (Closed)
Patch Set: SK_SUPPORT_LEGACY_TEXTBLOB_BUILDER Created 4 years, 3 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/textblobmixedsizes.cpp ('k') | gm/textblobshader.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 2015 Google Inc. 2 * Copyright 2015 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 "Resources.h" 10 #include "Resources.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // The mac emoji string will break us 70 // The mac emoji string will break us
71 if (origEmoji && (!strcmp(osName, "Android") || !strcmp(osName, "Ubuntu" ))) { 71 if (origEmoji && (!strcmp(osName, "Android") || !strcmp(osName, "Ubuntu" ))) {
72 const char* emojiText = sk_tool_utils::emoji_sample_text(); 72 const char* emojiText = sk_tool_utils::emoji_sample_text();
73 paint.measureText(emojiText, strlen(emojiText), &bounds); 73 paint.measureText(emojiText, strlen(emojiText), &bounds);
74 offset += bounds.height(); 74 offset += bounds.height();
75 paint.setTypeface(sk_make_sp<SkRandomTypeface>(orig, paint, false)); 75 paint.setTypeface(sk_make_sp<SkRandomTypeface>(orig, paint, false));
76 sk_tool_utils::add_to_text_blob(&builder, emojiText, paint, 0, offse t); 76 sk_tool_utils::add_to_text_blob(&builder, emojiText, paint, 0, offse t);
77 } 77 }
78 78
79 // build 79 // build
80 fBlob.reset(builder.build()); 80 fBlob = builder.make();
81 } 81 }
82 82
83 SkString onShortName() override { 83 SkString onShortName() override {
84 return SkString("textblobrandomfont"); 84 return SkString("textblobrandomfont");
85 } 85 }
86 86
87 SkISize onISize() override { 87 SkISize onISize() override {
88 return SkISize::Make(kWidth, kHeight); 88 return SkISize::Make(kWidth, kHeight);
89 } 89 }
90 90
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 } else { 130 } else {
131 const char* text = "This test requires a surface"; 131 const char* text = "This test requires a surface";
132 size_t len = strlen(text); 132 size_t len = strlen(text);
133 SkPaint paint; 133 SkPaint paint;
134 canvas->drawText(text, len, 10, 100, paint); 134 canvas->drawText(text, len, 10, 100, paint);
135 } 135 }
136 } 136 }
137 137
138 private: 138 private:
139 SkAutoTUnref<const SkTextBlob> fBlob; 139 sk_sp<SkTextBlob> fBlob;
140 140
141 static constexpr int kWidth = 2000; 141 static constexpr int kWidth = 2000;
142 static constexpr int kHeight = 1600; 142 static constexpr int kHeight = 1600;
143 143
144 typedef GM INHERITED; 144 typedef GM INHERITED;
145 }; 145 };
146 146
147 ////////////////////////////////////////////////////////////////////////////// 147 //////////////////////////////////////////////////////////////////////////////
148 148
149 DEF_GM(return new TextBlobRandomFont;) 149 DEF_GM(return new TextBlobRandomFont;)
150 } 150 }
151 #endif 151 #endif
OLDNEW
« no previous file with comments | « gm/textblobmixedsizes.cpp ('k') | gm/textblobshader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698