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

Side by Side Diff: samplecode/SampleTextAlpha.cpp

Issue 1852113003: switch maskfilters to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 | « samplecode/SampleStrokePath.cpp ('k') | samplecode/SampleTextureDomain.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 2011 Google Inc. 2 * Copyright 2011 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 #include "SampleCode.h" 7 #include "SampleCode.h"
8 #include "SkBlurMask.h" 8 #include "SkBlurMask.h"
9 #include "SkBlurMaskFilter.h" 9 #include "SkBlurMaskFilter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 void onDrawContent(SkCanvas* canvas) override { 45 void onDrawContent(SkCanvas* canvas) override {
46 const char* str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 46 const char* str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
47 SkPaint paint; 47 SkPaint paint;
48 SkScalar x = SkIntToScalar(10); 48 SkScalar x = SkIntToScalar(10);
49 SkScalar y = SkIntToScalar(20); 49 SkScalar y = SkIntToScalar(20);
50 50
51 paint.setFlags(0x105); 51 paint.setFlags(0x105);
52 52
53 paint.setARGB(fByte, 0xFF, 0xFF, 0xFF); 53 paint.setARGB(fByte, 0xFF, 0xFF, 0xFF);
54 54
55 paint.setMaskFilter(SkBlurMaskFilter::Create(kNormal_SkBlurStyle, 55 paint.setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle,
56 SkBlurMask::ConvertRadiusToSigma(SkIntToScal ar(3)))); 56 SkBlurMask::ConvertRadiusToSi gma(3)));
57 paint.getMaskFilter()->unref();
58 57
59 SkRandom rand; 58 SkRandom rand;
60 59
61 for (int ps = 6; ps <= 35; ps++) { 60 for (int ps = 6; ps <= 35; ps++) {
62 paint.setColor(rand.nextU() | (0xFF << 24)); 61 paint.setColor(rand.nextU() | (0xFF << 24));
63 paint.setTextSize(SkIntToScalar(ps)); 62 paint.setTextSize(SkIntToScalar(ps));
64 paint.setTextSize(SkIntToScalar(24)); 63 paint.setTextSize(SkIntToScalar(24));
65 canvas->drawText(str, strlen(str), x, y, paint); 64 canvas->drawText(str, strlen(str), x, y, paint);
66 y += paint.getFontMetrics(nullptr); 65 y += paint.getFontMetrics(nullptr);
67 } 66 }
(...skipping 18 matching lines...) Expand all
86 private: 85 private:
87 int fByte; 86 int fByte;
88 87
89 typedef SampleView INHERITED; 88 typedef SampleView INHERITED;
90 }; 89 };
91 90
92 ////////////////////////////////////////////////////////////////////////////// 91 //////////////////////////////////////////////////////////////////////////////
93 92
94 static SkView* MyFactory() { return new TextAlphaView; } 93 static SkView* MyFactory() { return new TextAlphaView; }
95 static SkViewRegister reg(MyFactory); 94 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleStrokePath.cpp ('k') | samplecode/SampleTextureDomain.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698