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

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

Issue 837633005: Add Arithmetic mode xp. (Closed) Base URL: https://skia.googlesource.com/skia.git@arithGpuFile
Patch Set: Cleanup Created 5 years, 11 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 | « no previous file | src/effects/SkArithmeticMode_gpu.h » ('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 13 matching lines...) Expand all
24 return SkNEW_ARGS(SkArithmeticMode_scalar, (k1, k2, k3, k4, enforcePMCol or)); 24 return SkNEW_ARGS(SkArithmeticMode_scalar, (k1, k2, k3, k4, enforcePMCol or));
25 } 25 }
26 26
27 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count, 27 virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
28 const SkAlpha aa[]) const SK_OVERRIDE; 28 const SkAlpha aa[]) const SK_OVERRIDE;
29 29
30 SK_TO_STRING_OVERRIDE() 30 SK_TO_STRING_OVERRIDE()
31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar) 31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar)
32 32
33 #if SK_SUPPORT_GPU 33 #if SK_SUPPORT_GPU
34 virtual bool asFragmentProcessor(GrFragmentProcessor**, 34 bool asFragmentProcessor(GrFragmentProcessor**,
bsalomon 2015/01/14 18:07:43 can we one-line this guy?
35 GrTexture* background) const SK_OVERRIDE; 35 GrTexture* background) const SK_OVERRIDE;
36
37 bool asXPFactory(GrXPFactory**) const SK_OVERRIDE;
36 #endif 38 #endif
37 39
38 private: 40 private:
39 SkArithmeticMode_scalar(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4, bool enforcePMColor) { 41 SkArithmeticMode_scalar(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4, bool enforcePMColor) {
40 fK[0] = k1; 42 fK[0] = k1;
41 fK[1] = k2; 43 fK[1] = k2;
42 fK[2] = k3; 44 fK[2] = k3;
43 fK[3] = k4; 45 fK[3] = k4;
44 fEnforcePMColor = enforcePMColor; 46 fEnforcePMColor = enforcePMColor;
45 } 47 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 *fp = GrArithmeticFP::Create(SkScalarToFloat(fK[0]), 241 *fp = GrArithmeticFP::Create(SkScalarToFloat(fK[0]),
240 SkScalarToFloat(fK[1]), 242 SkScalarToFloat(fK[1]),
241 SkScalarToFloat(fK[2]), 243 SkScalarToFloat(fK[2]),
242 SkScalarToFloat(fK[3]), 244 SkScalarToFloat(fK[3]),
243 fEnforcePMColor, 245 fEnforcePMColor,
244 background); 246 background);
245 } 247 }
246 return true; 248 return true;
247 } 249 }
248 250
251 bool SkArithmeticMode_scalar::asXPFactory(GrXPFactory** xpf) const {
252 if (xpf) {
253 *xpf = GrArithmeticXPFactory::Create(SkScalarToFloat(fK[0]),
254 SkScalarToFloat(fK[1]),
255 SkScalarToFloat(fK[2]),
256 SkScalarToFloat(fK[3]),
257 fEnforcePMColor);
258 }
259 return true;
260 }
261
249 #endif 262 #endif
250 263
251 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) 264 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode)
252 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) 265 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar)
253 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 266 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « no previous file | src/effects/SkArithmeticMode_gpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698