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

Side by Side Diff: gm/megalooper.cpp

Issue 1821103004: Revert of Revert[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 paint->setColorFilter(SkColorFilter::MakeModeFilter(color, SkXfermode::k SrcIn_Mode)); 178 SkColorFilter* cf = SkColorFilter::CreateModeFilter(color, SkXfermode::k SrcIn_Mode);
179 paint->setColorFilter(cf)->unref();
179 180
180 return looperBuilder.detach(); 181 return looperBuilder.detach();
181 } 182 }
182 183
183 void draw1x4(SkCanvas* canvas, SkScalar x, SkScalar y) { 184 void draw1x4(SkCanvas* canvas, SkScalar x, SkScalar y) {
184 SkRect rect = { -kHalfSquareSize, -kHalfSquareSize, kHalfSquareSize, kHa lfSquareSize }; 185 SkRect rect = { -kHalfSquareSize, -kHalfSquareSize, kHalfSquareSize, kHa lfSquareSize };
185 rect.offset(x, y); 186 rect.offset(x, y);
186 187
187 SkRect outerClip = { 188 SkRect outerClip = {
188 -kHalfOuterClipSize-kHalfSquareSize, -kHalfOuterClipSize-kHalfSquare Size, 189 -kHalfOuterClipSize-kHalfSquareSize, -kHalfOuterClipSize-kHalfSquare Size,
(...skipping 25 matching lines...) Expand all
214 info.fPostTranslate = false; 215 info.fPostTranslate = false;
215 216
216 SkPaint* paint; 217 SkPaint* paint;
217 218
218 for (int i = 3; i >= 0; --i) { 219 for (int i = 3; i >= 0; --i) {
219 info.fOffset.set(xOff+gBlurOffsets[i].fX, yOff+gBlurOffsets[i].fY); 220 info.fOffset.set(xOff+gBlurOffsets[i].fX, yOff+gBlurOffsets[i].fY);
220 paint = looperBuilder.addLayer(info); 221 paint = looperBuilder.addLayer(info);
221 222
222 paint->setMaskFilter(this->createBlur())->unref(); 223 paint->setMaskFilter(this->createBlur())->unref();
223 224
224 paint->setColorFilter(SkColorFilter::MakeModeFilter(gColors[i], 225 SkColorFilter* cf = SkColorFilter::CreateModeFilter(gColors[i], SkXf ermode::kSrcIn_Mode);
225 SkXfermode::kSrc In_Mode)); 226 paint->setColorFilter(cf)->unref();
226 } 227 }
227 228
228 return looperBuilder.detach(); 229 return looperBuilder.detach();
229 } 230 }
230 231
231 typedef GM INHERITED; 232 typedef GM INHERITED;
232 }; 233 };
233 234
234 const SkPoint MegaLooperGM::gBlurOffsets[4] = { 235 const SkPoint MegaLooperGM::gBlurOffsets[4] = {
235 { kHalfSquareSize, kHalfSquareSize }, 236 { kHalfSquareSize, kHalfSquareSize },
236 { -kHalfSquareSize, kHalfSquareSize }, 237 { -kHalfSquareSize, kHalfSquareSize },
237 { kHalfSquareSize, -kHalfSquareSize }, 238 { kHalfSquareSize, -kHalfSquareSize },
238 { -kHalfSquareSize, -kHalfSquareSize } 239 { -kHalfSquareSize, -kHalfSquareSize }
239 }; 240 };
240 241
241 const SkColor MegaLooperGM::gColors[4] = { 242 const SkColor MegaLooperGM::gColors[4] = {
242 SK_ColorGREEN, SK_ColorYELLOW, SK_ColorBLUE, SK_ColorRED 243 SK_ColorGREEN, SK_ColorYELLOW, SK_ColorBLUE, SK_ColorRED
243 }; 244 };
244 245
245 DEF_GM( return new MegaLooperGM(MegaLooperGM::k0x0_Type); ) 246 DEF_GM( return new MegaLooperGM(MegaLooperGM::k0x0_Type); )
246 DEF_GM( return new MegaLooperGM(MegaLooperGM::k4x1_Type); ) 247 DEF_GM( return new MegaLooperGM(MegaLooperGM::k4x1_Type); )
247 DEF_GM( return new MegaLooperGM(MegaLooperGM::k1x4_Type); ) 248 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