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

Side by Side Diff: gm/blurroundrect.cpp

Issue 253833002: move common blur types into central header (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 years, 7 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/blurs.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 2013 Google Inc. 2 * Copyright 2013 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 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 SkLayerDrawLooper::Builder looperBuilder; 56 SkLayerDrawLooper::Builder looperBuilder;
57 { 57 {
58 SkLayerDrawLooper::LayerInfo info; 58 SkLayerDrawLooper::LayerInfo info;
59 info.fPaintBits = SkLayerDrawLooper::kMaskFilter_Bit 59 info.fPaintBits = SkLayerDrawLooper::kMaskFilter_Bit
60 | SkLayerDrawLooper::kColorFilter_Bit; 60 | SkLayerDrawLooper::kColorFilter_Bit;
61 info.fColorMode = SkXfermode::kSrc_Mode; 61 info.fColorMode = SkXfermode::kSrc_Mode;
62 info.fOffset = SkPoint::Make(SkIntToScalar(-1), SkIntToScalar(0)); 62 info.fOffset = SkPoint::Make(SkIntToScalar(-1), SkIntToScalar(0));
63 info.fPostTranslate = false; 63 info.fPostTranslate = false;
64 SkPaint* paint = looperBuilder.addLayerOnTop(info); 64 SkPaint* paint = looperBuilder.addLayerOnTop(info);
65 SkMaskFilter* maskFilter = SkBlurMaskFilter::Create( 65 SkMaskFilter* maskFilter = SkBlurMaskFilter::Create(
66 SkBlurMaskFilter::kNormal_BlurStyle, 66 kNormal_SkBlurStyle,
67 SkBlurMask::ConvertRadiusToSigma(SK_ScalarHalf), 67 SkBlurMask::ConvertRadiusToSigma(SK_ScalarHalf),
68 SkBlurMaskFilter::kHighQuality_BlurFlag); 68 SkBlurMaskFilter::kHighQuality_BlurFlag);
69 paint->setMaskFilter(maskFilter)->unref(); 69 paint->setMaskFilter(maskFilter)->unref();
70 SkColorFilter* colorFilter = SkColorFilter::CreateModeFilter(SK_Colo rLTGRAY, 70 SkColorFilter* colorFilter = SkColorFilter::CreateModeFilter(SK_Colo rLTGRAY,
71 SkXfermode::kSrcIn_Mode); 71 SkXfermode::kSrcIn_Mode);
72 paint->setColorFilter(colorFilter)->unref(); 72 paint->setColorFilter(colorFilter)->unref();
73 paint->setColor(SK_ColorGRAY); 73 paint->setColor(SK_ColorGRAY);
74 } 74 }
75 { 75 {
76 SkLayerDrawLooper::LayerInfo info; 76 SkLayerDrawLooper::LayerInfo info;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 canvas->translate(50,50); 114 canvas->translate(50,50);
115 115
116 const float blurRadii[] = { 1,5,10,20 }; 116 const float blurRadii[] = { 1,5,10,20 };
117 const int cornerRadii[] = { 1,5,10,20 }; 117 const int cornerRadii[] = { 1,5,10,20 };
118 const SkRect r = SkRect::MakeWH(SkIntToScalar(100), SkIntToScalar(100)); 118 const SkRect r = SkRect::MakeWH(SkIntToScalar(100), SkIntToScalar(100));
119 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRadii); ++i) { 119 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRadii); ++i) {
120 SkAutoCanvasRestore autoRestore(canvas, true); 120 SkAutoCanvasRestore autoRestore(canvas, true);
121 canvas->translate(0, (r.height() + SkIntToScalar(50)) * i); 121 canvas->translate(0, (r.height() + SkIntToScalar(50)) * i);
122 for (size_t j = 0; j < SK_ARRAY_COUNT(cornerRadii); ++j) { 122 for (size_t j = 0; j < SK_ARRAY_COUNT(cornerRadii); ++j) {
123 SkMaskFilter* filter = SkBlurMaskFilter::Create( 123 SkMaskFilter* filter = SkBlurMaskFilter::Create(
124 SkBlurMaskFilter::kNormal_BlurStyle, 124 kNormal_SkBlurStyle,
125 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(blurRadii[i]) ), 125 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(blurRadii[i]) ),
126 SkBlurMaskFilter::kHighQuality_BlurFlag); 126 SkBlurMaskFilter::kHighQuality_BlurFlag);
127 SkPaint paint; 127 SkPaint paint;
128 paint.setColor(SK_ColorBLACK); 128 paint.setColor(SK_ColorBLACK);
129 paint.setMaskFilter(filter)->unref(); 129 paint.setMaskFilter(filter)->unref();
130 130
131 SkRRect rrect; 131 SkRRect rrect;
132 rrect.setRectXY(r, SkIntToScalar(cornerRadii[j]), SkIntToScalar( cornerRadii[j])); 132 rrect.setRectXY(r, SkIntToScalar(cornerRadii[j]), SkIntToScalar( cornerRadii[j]));
133 canvas->drawRRect(rrect, paint); 133 canvas->drawRRect(rrect, paint);
134 canvas->translate(r.width() + SkIntToScalar(50), 0); 134 canvas->translate(r.width() + SkIntToScalar(50), 0);
(...skipping 11 matching lines...) Expand all
146 // TODO(scroggo): Disabled in an attempt to rememdy 146 // TODO(scroggo): Disabled in an attempt to rememdy
147 // https://code.google.com/p/skia/issues/detail?id=1801 ('Win7 Test bots all fai ling GenerateGMs: 147 // https://code.google.com/p/skia/issues/detail?id=1801 ('Win7 Test bots all fai ling GenerateGMs:
148 // ran wrong number of tests') 148 // ran wrong number of tests')
149 //DEF_GM(return new BlurRoundRectGM(600, 5514, 6);) 149 //DEF_GM(return new BlurRoundRectGM(600, 5514, 6);)
150 150
151 // Rounded rect with two opposite corners with large radii, the other two 151 // Rounded rect with two opposite corners with large radii, the other two
152 // small. 152 // small.
153 DEF_GM(return new BlurRoundRectGM(100, 100);) 153 DEF_GM(return new BlurRoundRectGM(100, 100);)
154 154
155 DEF_GM(return new SimpleBlurRoundRectGM();) 155 DEF_GM(return new SimpleBlurRoundRectGM();)
OLDNEW
« no previous file with comments | « gm/blurrect.cpp ('k') | gm/blurs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698