OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #ifndef SkArithmeticMode_gpu_DEFINED | 8 #ifndef SkArithmeticMode_gpu_DEFINED |
9 #define SkArithmeticMode_gpu_DEFINED | 9 #define SkArithmeticMode_gpu_DEFINED |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 class GrGLArtithmeticFP; | 30 class GrGLArtithmeticFP; |
31 | 31 |
32 class GrArithmeticFP : public GrFragmentProcessor { | 32 class GrArithmeticFP : public GrFragmentProcessor { |
33 public: | 33 public: |
34 static GrFragmentProcessor* Create(float k1, float k2, float k3, float k4, b
ool enforcePMColor, | 34 static GrFragmentProcessor* Create(float k1, float k2, float k3, float k4, b
ool enforcePMColor, |
35 GrTexture* background) { | 35 GrTexture* background) { |
36 return SkNEW_ARGS(GrArithmeticFP, (k1, k2, k3, k4, enforcePMColor, backg
round)); | 36 return SkNEW_ARGS(GrArithmeticFP, (k1, k2, k3, k4, enforcePMColor, backg
round)); |
37 } | 37 } |
38 | 38 |
39 ~GrArithmeticFP() SK_OVERRIDE {}; | 39 ~GrArithmeticFP() override {}; |
40 | 40 |
41 const char* name() const SK_OVERRIDE { return "Arithmetic"; } | 41 const char* name() const override { return "Arithmetic"; } |
42 | 42 |
43 void getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const
SK_OVERRIDE; | 43 void getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const
override; |
44 | 44 |
45 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; | 45 GrGLFragmentProcessor* createGLInstance() const override; |
46 | 46 |
47 float k1() const { return fK1; } | 47 float k1() const { return fK1; } |
48 float k2() const { return fK2; } | 48 float k2() const { return fK2; } |
49 float k3() const { return fK3; } | 49 float k3() const { return fK3; } |
50 float k4() const { return fK4; } | 50 float k4() const { return fK4; } |
51 bool enforcePMColor() const { return fEnforcePMColor; } | 51 bool enforcePMColor() const { return fEnforcePMColor; } |
52 | 52 |
53 private: | 53 private: |
54 bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; | 54 bool onIsEqual(const GrFragmentProcessor&) const override; |
55 | 55 |
56 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE; | 56 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
57 | 57 |
58 GrArithmeticFP(float k1, float k2, float k3, float k4, bool enforcePMColor, | 58 GrArithmeticFP(float k1, float k2, float k3, float k4, bool enforcePMColor, |
59 GrTexture* background); | 59 GrTexture* background); |
60 | 60 |
61 float fK1, fK2, fK3, fK4; | 61 float fK1, fK2, fK3, fK4; |
62 bool fEnforcePMColor; | 62 bool fEnforcePMColor; |
63 GrCoordTransform fBackgroundTransform; | 63 GrCoordTransform fBackgroundTransform; |
64 GrTextureAccess fBackgroundAccess; | 64 GrTextureAccess fBackgroundAccess; |
65 | 65 |
66 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 66 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
67 typedef GrFragmentProcessor INHERITED; | 67 typedef GrFragmentProcessor INHERITED; |
68 }; | 68 }; |
69 | 69 |
70 /////////////////////////////////////////////////////////////////////////////// | 70 /////////////////////////////////////////////////////////////////////////////// |
71 // Xfer Processor | 71 // Xfer Processor |
72 /////////////////////////////////////////////////////////////////////////////// | 72 /////////////////////////////////////////////////////////////////////////////// |
73 | 73 |
74 class GrArithmeticXPFactory : public GrXPFactory { | 74 class GrArithmeticXPFactory : public GrXPFactory { |
75 public: | 75 public: |
76 static GrXPFactory* Create(float k1, float k2, float k3, float k4, bool enfo
rcePMColor) { | 76 static GrXPFactory* Create(float k1, float k2, float k3, float k4, bool enfo
rcePMColor) { |
77 return SkNEW_ARGS(GrArithmeticXPFactory, (k1, k2, k3, k4, enforcePMColor
)); | 77 return SkNEW_ARGS(GrArithmeticXPFactory, (k1, k2, k3, k4, enforcePMColor
)); |
78 } | 78 } |
79 | 79 |
80 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const
SK_OVERRIDE { | 80 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const
override { |
81 return true; | 81 return true; |
82 } | 82 } |
83 | 83 |
84 bool canTweakAlphaForCoverage() const SK_OVERRIDE { | 84 bool canTweakAlphaForCoverage() const override { |
85 return false; | 85 return false; |
86 } | 86 } |
87 | 87 |
88 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo&
coveragePOI, | 88 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo&
coveragePOI, |
89 GrXPFactory::InvariantOutput*) const SK_OVERRIDE; | 89 GrXPFactory::InvariantOutput*) const override; |
90 | 90 |
91 private: | 91 private: |
92 GrArithmeticXPFactory(float k1, float k2, float k3, float k4, bool enforcePM
Color); | 92 GrArithmeticXPFactory(float k1, float k2, float k3, float k4, bool enforcePM
Color); |
93 | 93 |
94 GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps, | 94 GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps, |
95 const GrProcOptInfo& colorPOI, | 95 const GrProcOptInfo& colorPOI, |
96 const GrProcOptInfo& coveragePOI, | 96 const GrProcOptInfo& coveragePOI, |
97 const GrDeviceCoordTexture* dstCopy)
const SK_OVERRIDE; | 97 const GrDeviceCoordTexture* dstCopy)
const override; |
98 | 98 |
99 bool willReadDstColor(const GrDrawTargetCaps& caps, | 99 bool willReadDstColor(const GrDrawTargetCaps& caps, |
100 const GrProcOptInfo& colorPOI, | 100 const GrProcOptInfo& colorPOI, |
101 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE { | 101 const GrProcOptInfo& coveragePOI) const override { |
102 return true; | 102 return true; |
103 } | 103 } |
104 | 104 |
105 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { | 105 bool onIsEqual(const GrXPFactory& xpfBase) const override { |
106 const GrArithmeticXPFactory& xpf = xpfBase.cast<GrArithmeticXPFactory>()
; | 106 const GrArithmeticXPFactory& xpf = xpfBase.cast<GrArithmeticXPFactory>()
; |
107 if (fK1 != xpf.fK1 || | 107 if (fK1 != xpf.fK1 || |
108 fK2 != xpf.fK2 || | 108 fK2 != xpf.fK2 || |
109 fK3 != xpf.fK3 || | 109 fK3 != xpf.fK3 || |
110 fK4 != xpf.fK4 || | 110 fK4 != xpf.fK4 || |
111 fEnforcePMColor != xpf.fEnforcePMColor) { | 111 fEnforcePMColor != xpf.fEnforcePMColor) { |
112 return false; | 112 return false; |
113 } | 113 } |
114 return true; | 114 return true; |
115 } | 115 } |
116 | 116 |
117 GR_DECLARE_XP_FACTORY_TEST; | 117 GR_DECLARE_XP_FACTORY_TEST; |
118 | 118 |
119 float fK1, fK2, fK3, fK4; | 119 float fK1, fK2, fK3, fK4; |
120 bool fEnforcePMColor; | 120 bool fEnforcePMColor; |
121 | 121 |
122 typedef GrXPFactory INHERITED; | 122 typedef GrXPFactory INHERITED; |
123 }; | 123 }; |
124 | 124 |
125 #endif | 125 #endif |
126 #endif | 126 #endif |
OLD | NEW |