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

Side by Side Diff: samplecode/SampleTextAlpha.cpp

Issue 23701006: Push sigma-based blur interface into our GMs/benches/tests/samplecode (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Cleaned up Created 7 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 virtual void onDrawContent(SkCanvas* canvas) { 62 virtual void onDrawContent(SkCanvas* canvas) {
63 const char* str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 63 const char* str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
64 SkPaint paint; 64 SkPaint paint;
65 SkScalar x = SkIntToScalar(10); 65 SkScalar x = SkIntToScalar(10);
66 SkScalar y = SkIntToScalar(20); 66 SkScalar y = SkIntToScalar(20);
67 67
68 paint.setFlags(0x105); 68 paint.setFlags(0x105);
69 69
70 paint.setARGB(fByte, 0xFF, 0xFF, 0xFF); 70 paint.setARGB(fByte, 0xFF, 0xFF, 0xFF);
71 71
72 paint.setMaskFilter(SkBlurMaskFilter::Create(SkIntToScalar(3), 72 paint.setMaskFilter(SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_B lurStyle,
73 SkBlurMaskFilter::kNormal_BlurStyle)); 73 SkFloatToScalar(2.23205f))) ;
74 paint.getMaskFilter()->unref(); 74 paint.getMaskFilter()->unref();
75 75
76 SkRandom rand; 76 SkRandom rand;
77 77
78 for (int ps = 6; ps <= 35; ps++) { 78 for (int ps = 6; ps <= 35; ps++) {
79 paint.setColor(rand.nextU() | (0xFF << 24)); 79 paint.setColor(rand.nextU() | (0xFF << 24));
80 paint.setTextSize(SkIntToScalar(ps)); 80 paint.setTextSize(SkIntToScalar(ps));
81 paint.setTextSize(SkIntToScalar(24)); 81 paint.setTextSize(SkIntToScalar(24));
82 canvas->drawText(str, strlen(str), x, y, paint); 82 canvas->drawText(str, strlen(str), x, y, paint);
83 y += paint.getFontMetrics(NULL); 83 y += paint.getFontMetrics(NULL);
(...skipping 29 matching lines...) Expand all
113 private: 113 private:
114 int fByte; 114 int fByte;
115 115
116 typedef SampleView INHERITED; 116 typedef SampleView INHERITED;
117 }; 117 };
118 118
119 ////////////////////////////////////////////////////////////////////////////// 119 //////////////////////////////////////////////////////////////////////////////
120 120
121 static SkView* MyFactory() { return new TextAlphaView; } 121 static SkView* MyFactory() { return new TextAlphaView; }
122 static SkViewRegister reg(MyFactory); 122 static SkViewRegister reg(MyFactory);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698