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

Side by Side Diff: gm/blurs.cpp

Issue 21835004: Blur refactoring (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Removed unneeded #includes 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
« no previous file with comments | « gm/blurrect.cpp ('k') | gm/circles.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 /* 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 "gm.h" 8 #include "gm.h"
9 #include "SkBlurMaskFilter.h" 9 #include "SkBlurMaskFilter.h"
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 paint.setTextSize(SkIntToScalar(25)); 53 paint.setTextSize(SkIntToScalar(25));
54 canvas->translate(SkIntToScalar(-40), SkIntToScalar(0)); 54 canvas->translate(SkIntToScalar(-40), SkIntToScalar(0));
55 55
56 SkBlurMaskFilter::BlurFlags flags = SkBlurMaskFilter::kNone_BlurFlag; 56 SkBlurMaskFilter::BlurFlags flags = SkBlurMaskFilter::kNone_BlurFlag;
57 for (int j = 0; j < 2; j++) { 57 for (int j = 0; j < 2; j++) {
58 canvas->save(); 58 canvas->save();
59 paint.setColor(SK_ColorBLUE); 59 paint.setColor(SK_ColorBLUE);
60 for (size_t i = 0; i < SK_ARRAY_COUNT(gRecs); i++) { 60 for (size_t i = 0; i < SK_ARRAY_COUNT(gRecs); i++) {
61 if (gRecs[i].fStyle != NONE) { 61 if (gRecs[i].fStyle != NONE) {
62 SkMaskFilter* mf = SkBlurMaskFilter::Create( 62 SkMaskFilter* mf = SkBlurMaskFilter::Create(
63 SkIntToScalar(20), gRecs[i].fStyle, flags 63 SkIntToScalar(20), gRecs[i].fStyle, flags);
64 );
65 paint.setMaskFilter(mf)->unref(); 64 paint.setMaskFilter(mf)->unref();
66 } else { 65 } else {
67 paint.setMaskFilter(NULL); 66 paint.setMaskFilter(NULL);
68 } 67 }
69 canvas->drawCircle(SkIntToScalar(200 + gRecs[i].fCx*100) 68 canvas->drawCircle(SkIntToScalar(200 + gRecs[i].fCx*100),
70 , SkIntToScalar(200 + gRecs[i].fCy*100) 69 SkIntToScalar(200 + gRecs[i].fCy*100),
71 , SkIntToScalar(50) 70 SkIntToScalar(50),
72 , paint); 71 paint);
73 } 72 }
74 // draw text 73 // draw text
75 { 74 {
76 SkMaskFilter* mf = SkBlurMaskFilter::Create( 75 SkMaskFilter* mf = SkBlurMaskFilter::Create(
77 SkIntToScalar(4) 76 SkIntToScalar(4),
78 , SkBlurMaskFilter::kNormal_BlurStyle 77 SkBlurMaskFilter::kNormal_BlurStyle,
79 , flags 78 flags);
80 );
81 paint.setMaskFilter(mf)->unref(); 79 paint.setMaskFilter(mf)->unref();
82 SkScalar x = SkIntToScalar(70); 80 SkScalar x = SkIntToScalar(70);
83 SkScalar y = SkIntToScalar(400); 81 SkScalar y = SkIntToScalar(400);
84 paint.setColor(SK_ColorBLACK); 82 paint.setColor(SK_ColorBLACK);
85 canvas->drawText("Hamburgefons Style", 18, x, y, paint); 83 canvas->drawText("Hamburgefons Style", 18, x, y, paint);
86 canvas->drawText("Hamburgefons Style", 18 84 canvas->drawText("Hamburgefons Style", 18,
87 , x, y + SkIntToScalar(50), paint); 85 x, y + SkIntToScalar(50), paint);
88 paint.setMaskFilter(NULL); 86 paint.setMaskFilter(NULL);
89 paint.setColor(SK_ColorWHITE); 87 paint.setColor(SK_ColorWHITE);
90 x -= SkIntToScalar(2); 88 x -= SkIntToScalar(2);
91 y -= SkIntToScalar(2); 89 y -= SkIntToScalar(2);
92 canvas->drawText("Hamburgefons Style", 18, x, y, paint); 90 canvas->drawText("Hamburgefons Style", 18, x, y, paint);
93 } 91 }
94 canvas->restore(); 92 canvas->restore();
95 flags = SkBlurMaskFilter::kHighQuality_BlurFlag; 93 flags = SkBlurMaskFilter::kHighQuality_BlurFlag;
96 canvas->translate(SkIntToScalar(350), SkIntToScalar(0)); 94 canvas->translate(SkIntToScalar(350), SkIntToScalar(0));
97 } 95 }
98 } 96 }
99 97
100 private: 98 private:
101 typedef GM INHERITED; 99 typedef GM INHERITED;
102 }; 100 };
103 101
104 ////////////////////////////////////////////////////////////////////////////// 102 //////////////////////////////////////////////////////////////////////////////
105 103
106 static GM* MyFactory(void*) { return new BlursGM; } 104 static GM* MyFactory(void*) { return new BlursGM; }
107 static GMRegistry reg(MyFactory); 105 static GMRegistry reg(MyFactory);
108 106
109 } 107 }
OLDNEW
« no previous file with comments | « gm/blurrect.cpp ('k') | gm/circles.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698