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

Side by Side Diff: gm/megalooper.cpp

Issue 1827433002: Reland of [2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « gm/lumafilter.cpp ('k') | gm/modecolorfilters.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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 info.fPaintBits = SkLayerDrawLooper::kColorFilter_Bit | 168 info.fPaintBits = SkLayerDrawLooper::kColorFilter_Bit |
169 SkLayerDrawLooper::kMaskFilter_Bit; 169 SkLayerDrawLooper::kMaskFilter_Bit;
170 info.fColorMode = SkXfermode::kSrc_Mode; 170 info.fColorMode = SkXfermode::kSrc_Mode;
171 info.fOffset.set(xOff, yOff); 171 info.fOffset.set(xOff, yOff);
172 info.fPostTranslate = false; 172 info.fPostTranslate = false;
173 173
174 SkPaint* paint = looperBuilder.addLayer(info); 174 SkPaint* paint = looperBuilder.addLayer(info);
175 175
176 paint->setMaskFilter(this->createBlur())->unref(); 176 paint->setMaskFilter(this->createBlur())->unref();
177 177
178 SkColorFilter* cf = SkColorFilter::CreateModeFilter(color, SkXfermode::k SrcIn_Mode); 178 paint->setColorFilter(SkColorFilter::MakeModeFilter(color, SkXfermode::k SrcIn_Mode));
179 paint->setColorFilter(cf)->unref();
180 179
181 return looperBuilder.detach(); 180 return looperBuilder.detach();
182 } 181 }
183 182
184 void draw1x4(SkCanvas* canvas, SkScalar x, SkScalar y) { 183 void draw1x4(SkCanvas* canvas, SkScalar x, SkScalar y) {
185 SkRect rect = { -kHalfSquareSize, -kHalfSquareSize, kHalfSquareSize, kHa lfSquareSize }; 184 SkRect rect = { -kHalfSquareSize, -kHalfSquareSize, kHalfSquareSize, kHa lfSquareSize };
186 rect.offset(x, y); 185 rect.offset(x, y);
187 186
188 SkRect outerClip = { 187 SkRect outerClip = {
189 -kHalfOuterClipSize-kHalfSquareSize, -kHalfOuterClipSize-kHalfSquare Size, 188 -kHalfOuterClipSize-kHalfSquareSize, -kHalfOuterClipSize-kHalfSquare Size,
(...skipping 25 matching lines...) Expand all
215 info.fPostTranslate = false; 214 info.fPostTranslate = false;
216 215
217 SkPaint* paint; 216 SkPaint* paint;
218 217
219 for (int i = 3; i >= 0; --i) { 218 for (int i = 3; i >= 0; --i) {
220 info.fOffset.set(xOff+gBlurOffsets[i].fX, yOff+gBlurOffsets[i].fY); 219 info.fOffset.set(xOff+gBlurOffsets[i].fX, yOff+gBlurOffsets[i].fY);
221 paint = looperBuilder.addLayer(info); 220 paint = looperBuilder.addLayer(info);
222 221
223 paint->setMaskFilter(this->createBlur())->unref(); 222 paint->setMaskFilter(this->createBlur())->unref();
224 223
225 SkColorFilter* cf = SkColorFilter::CreateModeFilter(gColors[i], SkXf ermode::kSrcIn_Mode); 224 paint->setColorFilter(SkColorFilter::MakeModeFilter(gColors[i],
226 paint->setColorFilter(cf)->unref(); 225 SkXfermode::kSrc In_Mode));
227 } 226 }
228 227
229 return looperBuilder.detach(); 228 return looperBuilder.detach();
230 } 229 }
231 230
232 typedef GM INHERITED; 231 typedef GM INHERITED;
233 }; 232 };
234 233
235 const SkPoint MegaLooperGM::gBlurOffsets[4] = { 234 const SkPoint MegaLooperGM::gBlurOffsets[4] = {
236 { kHalfSquareSize, kHalfSquareSize }, 235 { kHalfSquareSize, kHalfSquareSize },
237 { -kHalfSquareSize, kHalfSquareSize }, 236 { -kHalfSquareSize, kHalfSquareSize },
238 { kHalfSquareSize, -kHalfSquareSize }, 237 { kHalfSquareSize, -kHalfSquareSize },
239 { -kHalfSquareSize, -kHalfSquareSize } 238 { -kHalfSquareSize, -kHalfSquareSize }
240 }; 239 };
241 240
242 const SkColor MegaLooperGM::gColors[4] = { 241 const SkColor MegaLooperGM::gColors[4] = {
243 SK_ColorGREEN, SK_ColorYELLOW, SK_ColorBLUE, SK_ColorRED 242 SK_ColorGREEN, SK_ColorYELLOW, SK_ColorBLUE, SK_ColorRED
244 }; 243 };
245 244
246 DEF_GM( return new MegaLooperGM(MegaLooperGM::k0x0_Type); ) 245 DEF_GM( return new MegaLooperGM(MegaLooperGM::k0x0_Type); )
247 DEF_GM( return new MegaLooperGM(MegaLooperGM::k4x1_Type); ) 246 DEF_GM( return new MegaLooperGM(MegaLooperGM::k4x1_Type); )
248 DEF_GM( return new MegaLooperGM(MegaLooperGM::k1x4_Type); ) 247 DEF_GM( return new MegaLooperGM(MegaLooperGM::k1x4_Type); )
OLDNEW
« no previous file with comments | « gm/lumafilter.cpp ('k') | gm/modecolorfilters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698