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

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: Fix compile 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**, GrTexture* background) const SK_OVERRIDE;
35 GrTexture* background) const SK_OVERRIDE; 35
36 bool asXPFactory(GrXPFactory**) const SK_OVERRIDE;
36 #endif 37 #endif
37 38
38 private: 39 private:
39 SkArithmeticMode_scalar(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4, bool enforcePMColor) { 40 SkArithmeticMode_scalar(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4, bool enforcePMColor) {
40 fK[0] = k1; 41 fK[0] = k1;
41 fK[1] = k2; 42 fK[1] = k2;
42 fK[2] = k3; 43 fK[2] = k3;
43 fK[3] = k4; 44 fK[3] = k4;
44 fEnforcePMColor = enforcePMColor; 45 fEnforcePMColor = enforcePMColor;
45 } 46 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 *fp = GrArithmeticFP::Create(SkScalarToFloat(fK[0]), 240 *fp = GrArithmeticFP::Create(SkScalarToFloat(fK[0]),
240 SkScalarToFloat(fK[1]), 241 SkScalarToFloat(fK[1]),
241 SkScalarToFloat(fK[2]), 242 SkScalarToFloat(fK[2]),
242 SkScalarToFloat(fK[3]), 243 SkScalarToFloat(fK[3]),
243 fEnforcePMColor, 244 fEnforcePMColor,
244 background); 245 background);
245 } 246 }
246 return true; 247 return true;
247 } 248 }
248 249
250 bool SkArithmeticMode_scalar::asXPFactory(GrXPFactory** xpf) const {
251 if (xpf) {
252 *xpf = GrArithmeticXPFactory::Create(SkScalarToFloat(fK[0]),
253 SkScalarToFloat(fK[1]),
254 SkScalarToFloat(fK[2]),
255 SkScalarToFloat(fK[3]),
256 fEnforcePMColor);
257 }
258 return true;
259 }
260
249 #endif 261 #endif
250 262
251 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) 263 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode)
252 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) 264 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar)
253 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 265 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