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

Side by Side Diff: gm/textblobtransforms.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/textblobshader.cpp ('k') | gm/textblobuseaftergpufree.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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 paint.measureText(text, strlen(text), &bounds); 43 paint.measureText(text, strlen(text), &bounds);
44 SkScalar yOffset = bounds.height(); 44 SkScalar yOffset = bounds.height();
45 45
46 // Small 46 // Small
47 paint.setTextSize(32); 47 paint.setTextSize(32);
48 text = "C"; 48 text = "C";
49 sk_tool_utils::add_to_text_blob(&builder, text, paint, xOffset, -yOffset - 10); 49 sk_tool_utils::add_to_text_blob(&builder, text, paint, xOffset, -yOffset - 10);
50 50
51 // build 51 // build
52 fBlob.reset(builder.build()); 52 fBlob = builder.make();
53 } 53 }
54 54
55 SkString onShortName() override { 55 SkString onShortName() override {
56 return SkString("textblobtransforms"); 56 return SkString("textblobtransforms");
57 } 57 }
58 58
59 SkISize onISize() override { 59 SkISize onISize() override {
60 return SkISize::Make(kWidth, kHeight); 60 return SkISize::Make(kWidth, kHeight);
61 } 61 }
62 62
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 canvas->scale(1.f, 5.f); 151 canvas->scale(1.f, 5.f);
152 canvas->drawTextBlob(fBlob, 0, 0, paint); 152 canvas->drawTextBlob(fBlob, 0, 0, paint);
153 153
154 canvas->rotate(5.f); 154 canvas->rotate(5.f);
155 canvas->translate(xOffset, 0); 155 canvas->translate(xOffset, 0);
156 canvas->scale(5.f, 1.f); 156 canvas->scale(5.f, 1.f);
157 canvas->drawTextBlob(fBlob, 0, 0, paint); 157 canvas->drawTextBlob(fBlob, 0, 0, paint);
158 } 158 }
159 159
160 private: 160 private:
161 SkAutoTUnref<const SkTextBlob> fBlob; 161 sk_sp<SkTextBlob> fBlob;
162 162
163 static constexpr int kWidth = 1000; 163 static constexpr int kWidth = 1000;
164 static constexpr int kHeight = 1200; 164 static constexpr int kHeight = 1200;
165 165
166 typedef GM INHERITED; 166 typedef GM INHERITED;
167 }; 167 };
168 168
169 ////////////////////////////////////////////////////////////////////////////// 169 //////////////////////////////////////////////////////////////////////////////
170 170
171 DEF_GM(return new TextBlobTransforms;) 171 DEF_GM(return new TextBlobTransforms;)
172 } 172 }
OLDNEW
« no previous file with comments | « gm/textblobshader.cpp ('k') | gm/textblobuseaftergpufree.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698