| OLD | NEW |
| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 static const char* Name() { return "Arithmetic"; } | 289 static const char* Name() { return "Arithmetic"; } |
| 290 GrTexture* backgroundTexture() const { return fBackgroundAccess.getTexture()
; } | 290 GrTexture* backgroundTexture() const { return fBackgroundAccess.getTexture()
; } |
| 291 | 291 |
| 292 float k1() const { return fK1; } | 292 float k1() const { return fK1; } |
| 293 float k2() const { return fK2; } | 293 float k2() const { return fK2; } |
| 294 float k3() const { return fK3; } | 294 float k3() const { return fK3; } |
| 295 float k4() const { return fK4; } | 295 float k4() const { return fK4; } |
| 296 bool enforcePMColor() const { return fEnforcePMColor; } | 296 bool enforcePMColor() const { return fEnforcePMColor; } |
| 297 | 297 |
| 298 private: | 298 private: |
| 299 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; | 299 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; |
| 300 | 300 |
| 301 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; | 301 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; |
| 302 | 302 |
| 303 GrArithmeticEffect(float k1, float k2, float k3, float k4, bool enforcePMCol
or, | 303 GrArithmeticEffect(float k1, float k2, float k3, float k4, bool enforcePMCol
or, |
| 304 GrTexture* background); | 304 GrTexture* background); |
| 305 float fK1, fK2, fK3, fK4; | 305 float fK1, fK2, fK3, fK4; |
| 306 bool fEnforcePMColor; | 306 bool fEnforcePMColor; |
| 307 GrCoordTransform fBackgroundTransform; | 307 GrCoordTransform fBackgroundTransform; |
| 308 GrTextureAccess fBackgroundAccess; | 308 GrTextureAccess fBackgroundAccess; |
| 309 | 309 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 323 fBackgroundAccess.reset(background); | 323 fBackgroundAccess.reset(background); |
| 324 this->addTextureAccess(&fBackgroundAccess); | 324 this->addTextureAccess(&fBackgroundAccess); |
| 325 } else { | 325 } else { |
| 326 this->setWillReadDstColor(); | 326 this->setWillReadDstColor(); |
| 327 } | 327 } |
| 328 } | 328 } |
| 329 | 329 |
| 330 GrArithmeticEffect::~GrArithmeticEffect() { | 330 GrArithmeticEffect::~GrArithmeticEffect() { |
| 331 } | 331 } |
| 332 | 332 |
| 333 bool GrArithmeticEffect::onIsEqual(const GrProcessor& sBase) const { | 333 bool GrArithmeticEffect::onIsEqual(const GrFragmentProcessor& sBase) const { |
| 334 const GrArithmeticEffect& s = sBase.cast<GrArithmeticEffect>(); | 334 const GrArithmeticEffect& s = sBase.cast<GrArithmeticEffect>(); |
| 335 return fK1 == s.fK1 && | 335 return fK1 == s.fK1 && |
| 336 fK2 == s.fK2 && | 336 fK2 == s.fK2 && |
| 337 fK3 == s.fK3 && | 337 fK3 == s.fK3 && |
| 338 fK4 == s.fK4 && | 338 fK4 == s.fK4 && |
| 339 fEnforcePMColor == s.fEnforcePMColor && | 339 fEnforcePMColor == s.fEnforcePMColor && |
| 340 backgroundTexture() == s.backgroundTexture(); | 340 backgroundTexture() == s.backgroundTexture(); |
| 341 } | 341 } |
| 342 | 342 |
| 343 const GrBackendFragmentProcessorFactory& GrArithmeticEffect::getFactory() const
{ | 343 const GrBackendFragmentProcessorFactory& GrArithmeticEffect::getFactory() const
{ |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 background); | 452 background); |
| 453 } | 453 } |
| 454 return true; | 454 return true; |
| 455 } | 455 } |
| 456 | 456 |
| 457 #endif | 457 #endif |
| 458 | 458 |
| 459 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) | 459 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) |
| 460 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) | 460 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) |
| 461 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 461 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |