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

Side by Side Diff: src/effects/SkArithmeticMode.cpp

Issue 1674673002: Alter SkXfermode's asFragmentProcessor & asXPFactory contracts (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix unit test bug Created 4 years, 10 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 | « src/core/SkXfermode_proccoeff.h ('k') | src/effects/SkAvoidXfermode.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 "SkArithmeticMode.h" 8 #include "SkArithmeticMode.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 21 matching lines...) Expand all
32 return new SkArithmeticMode_scalar(k1, k2, k3, k4, enforcePMColor); 32 return new SkArithmeticMode_scalar(k1, k2, k3, k4, enforcePMColor);
33 } 33 }
34 34
35 void xfer32(SkPMColor dst[], const SkPMColor src[], int count, 35 void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
36 const SkAlpha aa[]) const override; 36 const SkAlpha aa[]) const override;
37 37
38 SK_TO_STRING_OVERRIDE() 38 SK_TO_STRING_OVERRIDE()
39 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar) 39 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar)
40 40
41 #if SK_SUPPORT_GPU 41 #if SK_SUPPORT_GPU
42 bool asFragmentProcessor(const GrFragmentProcessor**, 42 const GrFragmentProcessor* getFragmentProcessorForImageFilter(
43 const GrFragmentProcessor* dst) const override; 43 const GrFragmentProcessor* dst) const override;
44 44 GrXPFactory* asXPFactory() const override;
45 bool asXPFactory(GrXPFactory**) const override;
46 #endif 45 #endif
47 46
48 private: 47 private:
49 SkArithmeticMode_scalar(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4, bool enforcePMColor) { 48 SkArithmeticMode_scalar(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4, bool enforcePMColor) {
50 fK[0] = k1; 49 fK[0] = k1;
51 fK[1] = k2; 50 fK[1] = k2;
52 fK[2] = k3; 51 fK[2] = k3;
53 fK[3] = k4; 52 fK[3] = k4;
54 fEnforcePMColor = enforcePMColor; 53 fEnforcePMColor = enforcePMColor;
55 } 54 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 return new SkArithmeticMode_linear (i2, i3, i4); 236 return new SkArithmeticMode_linear (i2, i3, i4);
238 #endif 237 #endif
239 } 238 }
240 return SkArithmeticMode_scalar::Create(k1, k2, k3, k4, enforcePMColor); 239 return SkArithmeticMode_scalar::Create(k1, k2, k3, k4, enforcePMColor);
241 } 240 }
242 241
243 242
244 ////////////////////////////////////////////////////////////////////////////// 243 //////////////////////////////////////////////////////////////////////////////
245 244
246 #if SK_SUPPORT_GPU 245 #if SK_SUPPORT_GPU
247 bool SkArithmeticMode_scalar::asFragmentProcessor(const GrFragmentProcessor** fp , 246 const GrFragmentProcessor* SkArithmeticMode_scalar::getFragmentProcessorForImage Filter(
248 const GrFragmentProcessor* dst ) const { 247 const GrFragmentProc essor* dst) const {
249 if (fp) { 248 return GrArithmeticFP::Create(SkScalarToFloat(fK[0]),
250 *fp = GrArithmeticFP::Create(SkScalarToFloat(fK[0]), 249 SkScalarToFloat(fK[1]),
251 SkScalarToFloat(fK[1]), 250 SkScalarToFloat(fK[2]),
252 SkScalarToFloat(fK[2]), 251 SkScalarToFloat(fK[3]),
253 SkScalarToFloat(fK[3]), 252 fEnforcePMColor,
254 fEnforcePMColor, 253 dst);
255 dst);
256 }
257 return true;
258 } 254 }
259 255
260 bool SkArithmeticMode_scalar::asXPFactory(GrXPFactory** xpf) const { 256 GrXPFactory* SkArithmeticMode_scalar::asXPFactory() const {
261 if (xpf) { 257 return GrArithmeticXPFactory::Create(SkScalarToFloat(fK[0]),
262 *xpf = GrArithmeticXPFactory::Create(SkScalarToFloat(fK[0]), 258 SkScalarToFloat(fK[1]),
263 SkScalarToFloat(fK[1]), 259 SkScalarToFloat(fK[2]),
264 SkScalarToFloat(fK[2]), 260 SkScalarToFloat(fK[3]),
265 SkScalarToFloat(fK[3]), 261 fEnforcePMColor);
266 fEnforcePMColor);
267 }
268 return true;
269 } 262 }
270 263
271 #endif 264 #endif
272 265
273 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) 266 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode)
274 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) 267 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar)
275 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 268 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/core/SkXfermode_proccoeff.h ('k') | src/effects/SkAvoidXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698