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

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: 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
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 canvas->scale(1.5f, 1.5f); 113 canvas->scale(1.5f, 1.5f);
114 114
115 const int blurRadii[] = { 1, 3, 6, 10 }; 115 const int blurRadii[] = { 1, 3, 6, 10 };
116 const int cornerRadii[] = { 1, 3, 6, 10 }; 116 const int cornerRadii[] = { 1, 3, 6, 10 };
117 const SkRect r = SkRect::MakeWH(SkIntToScalar(100), SkIntToScalar(100)); 117 const SkRect r = SkRect::MakeWH(SkIntToScalar(100), SkIntToScalar(100));
118 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRadii); ++i) { 118 for (size_t i = 0; i < SK_ARRAY_COUNT(blurRadii); ++i) {
119 SkAutoCanvasRestore autoRestore(canvas, true); 119 SkAutoCanvasRestore autoRestore(canvas, true);
120 canvas->translate(0, (r.height() + SkIntToScalar(20)) * i); 120 canvas->translate(0, (r.height() + SkIntToScalar(20)) * i);
121 for (size_t j = 0; j < SK_ARRAY_COUNT(cornerRadii); ++j) { 121 for (size_t j = 0; j < SK_ARRAY_COUNT(cornerRadii); ++j) {
122 SkMaskFilter* filter = SkBlurMaskFilter::Create( 122 SkMaskFilter* filter = SkBlurMaskFilter::Create(
123 SkBlurMaskFilter::kNormal_BlurStyle, 123 kNormal_SkBlurStyle,
124 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(blurRadii[i]) )); 124 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(blurRadii[i]) ));
125 SkPaint paint; 125 SkPaint paint;
126 paint.setColor(SK_ColorBLUE); 126 paint.setColor(SK_ColorBLUE);
127 paint.setMaskFilter(filter)->unref(); 127 paint.setMaskFilter(filter)->unref();
128 128
129 SkRRect rrect; 129 SkRRect rrect;
130 rrect.setRectXY(r, SkIntToScalar(cornerRadii[j]), SkIntToScalar( cornerRadii[j])); 130 rrect.setRectXY(r, SkIntToScalar(cornerRadii[j]), SkIntToScalar( cornerRadii[j]));
131 canvas->drawRRect(rrect, paint); 131 canvas->drawRRect(rrect, paint);
132 canvas->translate(r.width() + SkIntToScalar(10), 0); 132 canvas->translate(r.width() + SkIntToScalar(10), 0);
133 } 133 }
(...skipping 10 matching lines...) Expand all
144 // TODO(scroggo): Disabled in an attempt to rememdy 144 // TODO(scroggo): Disabled in an attempt to rememdy
145 // https://code.google.com/p/skia/issues/detail?id=1801 ('Win7 Test bots all fai ling GenerateGMs: 145 // https://code.google.com/p/skia/issues/detail?id=1801 ('Win7 Test bots all fai ling GenerateGMs:
146 // ran wrong number of tests') 146 // ran wrong number of tests')
147 //DEF_GM(return new BlurRoundRectGM(600, 5514, 6);) 147 //DEF_GM(return new BlurRoundRectGM(600, 5514, 6);)
148 148
149 // Rounded rect with two opposite corners with large radii, the other two 149 // Rounded rect with two opposite corners with large radii, the other two
150 // small. 150 // small.
151 DEF_GM(return new BlurRoundRectGM(100, 100);) 151 DEF_GM(return new BlurRoundRectGM(100, 100);)
152 152
153 DEF_GM(return new SimpleBlurRoundRectGM();) 153 DEF_GM(return new SimpleBlurRoundRectGM();)
OLDNEW
« no previous file with comments | « gm/blurrect.cpp ('k') | gm/blurs.cpp » ('j') | gyp/skia_for_chromium_defines.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698