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 #include "SkArithmeticMode_gpu.h" | 8 #include "SkArithmeticMode_gpu.h" |
9 | 9 |
10 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 | 169 |
170 ~ArithmeticXP() override {}; | 170 ~ArithmeticXP() override {}; |
171 | 171 |
172 const char* name() const override { return "Arithmetic"; } | 172 const char* name() const override { return "Arithmetic"; } |
173 | 173 |
174 GrGLXferProcessor* createGLInstance() const override; | 174 GrGLXferProcessor* createGLInstance() const override; |
175 | 175 |
176 bool hasSecondaryOutput() const override { return false; } | 176 bool hasSecondaryOutput() const override { return false; } |
177 | 177 |
178 GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI, | |
179 const GrProcOptInfo& coveragePOI, | |
180 bool doesStencilWrite, | |
181 GrColor* overrideColor, | |
182 const GrDrawTargetCaps& caps) ove
rride; | |
183 | |
184 float k1() const { return fK1; } | 178 float k1() const { return fK1; } |
185 float k2() const { return fK2; } | 179 float k2() const { return fK2; } |
186 float k3() const { return fK3; } | 180 float k3() const { return fK3; } |
187 float k4() const { return fK4; } | 181 float k4() const { return fK4; } |
188 bool enforcePMColor() const { return fEnforcePMColor; } | 182 bool enforcePMColor() const { return fEnforcePMColor; } |
189 | 183 |
190 private: | 184 private: |
191 ArithmeticXP(float k1, float k2, float k3, float k4, bool enforcePMColor, | 185 ArithmeticXP(float k1, float k2, float k3, float k4, bool enforcePMColor, |
192 const GrDeviceCoordTexture* dstCopy, bool willReadDstColor); | 186 const GrDeviceCoordTexture* dstCopy, bool willReadDstColor); |
193 | 187 |
| 188 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI, |
| 189 const GrProcOptInfo& coveragePO
I, |
| 190 bool doesStencilWrite, |
| 191 GrColor* overrideColor, |
| 192 const GrDrawTargetCaps& caps) o
verride; |
| 193 |
194 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst override; | 194 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst override; |
195 | 195 |
196 bool onIsEqual(const GrXferProcessor& xpBase) const override { | 196 bool onIsEqual(const GrXferProcessor& xpBase) const override { |
197 const ArithmeticXP& xp = xpBase.cast<ArithmeticXP>(); | 197 const ArithmeticXP& xp = xpBase.cast<ArithmeticXP>(); |
198 if (fK1 != xp.fK1 || | 198 if (fK1 != xp.fK1 || |
199 fK2 != xp.fK2 || | 199 fK2 != xp.fK2 || |
200 fK3 != xp.fK3 || | 200 fK3 != xp.fK3 || |
201 fK4 != xp.fK4 || | 201 fK4 != xp.fK4 || |
202 fEnforcePMColor != xp.fEnforcePMColor) { | 202 fEnforcePMColor != xp.fEnforcePMColor) { |
203 return false; | 203 return false; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } | 274 } |
275 | 275 |
276 void ArithmeticXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBui
lder* b) const { | 276 void ArithmeticXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBui
lder* b) const { |
277 GLArithmeticXP::GenKey(*this, caps, b); | 277 GLArithmeticXP::GenKey(*this, caps, b); |
278 } | 278 } |
279 | 279 |
280 GrGLXferProcessor* ArithmeticXP::createGLInstance() const { | 280 GrGLXferProcessor* ArithmeticXP::createGLInstance() const { |
281 return SkNEW_ARGS(GLArithmeticXP, (*this)); | 281 return SkNEW_ARGS(GLArithmeticXP, (*this)); |
282 } | 282 } |
283 | 283 |
284 GrXferProcessor::OptFlags ArithmeticXP::getOptimizations(const GrProcOptInfo& co
lorPOI, | 284 GrXferProcessor::OptFlags ArithmeticXP::onGetOptimizations(const GrProcOptInfo&
colorPOI, |
285 const GrProcOptInfo& co
veragePOI, | 285 const GrProcOptInfo&
coveragePOI, |
286 bool doesStencilWrite, | 286 bool doesStencilWrite
, |
287 GrColor* overrideColor, | 287 GrColor* overrideColo
r, |
288 const GrDrawTargetCaps&
caps) { | 288 const GrDrawTargetCap
s& caps) { |
289 return GrXferProcessor::kNone_Opt; | 289 return GrXferProcessor::kNone_Opt; |
290 } | 290 } |
291 | 291 |
292 /////////////////////////////////////////////////////////////////////////////// | 292 /////////////////////////////////////////////////////////////////////////////// |
293 | 293 |
294 GrArithmeticXPFactory::GrArithmeticXPFactory(float k1, float k2, float k3, float
k4, | 294 GrArithmeticXPFactory::GrArithmeticXPFactory(float k1, float k2, float k3, float
k4, |
295 bool enforcePMColor) | 295 bool enforcePMColor) |
296 : fK1(k1), fK2(k2), fK3(k3), fK4(k4), fEnforcePMColor(enforcePMColor) { | 296 : fK1(k1), fK2(k2), fK3(k3), fK4(k4), fEnforcePMColor(enforcePMColor) { |
297 this->initClassID<GrArithmeticXPFactory>(); | 297 this->initClassID<GrArithmeticXPFactory>(); |
298 } | 298 } |
(...skipping 28 matching lines...) Expand all Loading... |
327 float k1 = random->nextF(); | 327 float k1 = random->nextF(); |
328 float k2 = random->nextF(); | 328 float k2 = random->nextF(); |
329 float k3 = random->nextF(); | 329 float k3 = random->nextF(); |
330 float k4 = random->nextF(); | 330 float k4 = random->nextF(); |
331 bool enforcePMColor = random->nextBool(); | 331 bool enforcePMColor = random->nextBool(); |
332 | 332 |
333 return GrArithmeticXPFactory::Create(k1, k2, k3, k4, enforcePMColor); | 333 return GrArithmeticXPFactory::Create(k1, k2, k3, k4, enforcePMColor); |
334 } | 334 } |
335 | 335 |
336 #endif | 336 #endif |
OLD | NEW |