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

Side by Side Diff: samplecode/SampleTextAlpha.cpp

Issue 21835004: Blur refactoring (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: hide constant Created 7 years, 4 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(SkIntToScalar(3),
73 SkBlurMaskFilter::kNormal_BlurStyle)); 73 SkBlurMaskFilter::kNormal_B lurStyle,
74 SkBlurMaskFilter::kNone_Blu rFlag));
74 paint.getMaskFilter()->unref(); 75 paint.getMaskFilter()->unref();
75 76
76 SkRandom rand; 77 SkRandom rand;
77 78
78 for (int ps = 6; ps <= 35; ps++) { 79 for (int ps = 6; ps <= 35; ps++) {
79 paint.setColor(rand.nextU() | (0xFF << 24)); 80 paint.setColor(rand.nextU() | (0xFF << 24));
80 paint.setTextSize(SkIntToScalar(ps)); 81 paint.setTextSize(SkIntToScalar(ps));
81 paint.setTextSize(SkIntToScalar(24)); 82 paint.setTextSize(SkIntToScalar(24));
82 canvas->drawText(str, strlen(str), x, y, paint); 83 canvas->drawText(str, strlen(str), x, y, paint);
83 y += paint.getFontMetrics(NULL); 84 y += paint.getFontMetrics(NULL);
(...skipping 29 matching lines...) Expand all
113 private: 114 private:
114 int fByte; 115 int fByte;
115 116
116 typedef SampleView INHERITED; 117 typedef SampleView INHERITED;
117 }; 118 };
118 119
119 ////////////////////////////////////////////////////////////////////////////// 120 //////////////////////////////////////////////////////////////////////////////
120 121
121 static SkView* MyFactory() { return new TextAlphaView; } 122 static SkView* MyFactory() { return new TextAlphaView; }
122 static SkViewRegister reg(MyFactory); 123 static SkViewRegister reg(MyFactory);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698