| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrPorterDuffXferProcessor_DEFINED | 8 #ifndef GrPorterDuffXferProcessor_DEFINED |
| 9 #define GrPorterDuffXferProcessor_DEFINED | 9 #define GrPorterDuffXferProcessor_DEFINED |
| 10 | 10 |
| 11 #include "GrTypes.h" | 11 #include "GrTypes.h" |
| 12 #include "GrXferProcessor.h" | 12 #include "GrXferProcessor.h" |
| 13 #include "SkXfermode.h" | 13 #include "SkXfermode.h" |
| 14 | 14 |
| 15 class GrBackendFragmentProcessorFactory; | |
| 16 class GrDrawState; | 15 class GrDrawState; |
| 17 class GrGLPorterDuffXferProcessor; | |
| 18 class GrInvariantOutput; | 16 class GrInvariantOutput; |
| 19 | 17 |
| 20 class GrPorterDuffXferProcessor : public GrXferProcessor { | 18 class GrPorterDuffXferProcessor : public GrXferProcessor { |
| 21 public: | 19 public: |
| 22 static GrXferProcessor* Create(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend)
{ | 20 static GrXferProcessor* Create(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend)
{ |
| 23 return SkNEW_ARGS(GrPorterDuffXferProcessor, (srcBlend, dstBlend)); | 21 return SkNEW_ARGS(GrPorterDuffXferProcessor, (srcBlend, dstBlend)); |
| 24 } | 22 } |
| 25 | 23 |
| 26 virtual ~GrPorterDuffXferProcessor(); | 24 virtual ~GrPorterDuffXferProcessor(); |
| 27 | 25 |
| 28 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; | 26 virtual const char* name() const { return "Porter Duff"; } |
| 29 | 27 |
| 30 typedef GrGLPorterDuffXferProcessor GLProcessor; | 28 virtual void getGLProcessorKey(const GrGLCaps& caps, |
| 31 static const char* Name() { return "Porter Duff"; } | 29 GrProcessorKeyBuilder* b) const SK_OVERRIDE; |
| 30 |
| 31 virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 GrPorterDuffXferProcessor(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend); | 34 GrPorterDuffXferProcessor(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend); |
| 35 | 35 |
| 36 virtual bool onIsEqual(const GrFragmentProcessor& fpBase) const SK_OVERRIDE
{ | 36 virtual bool onIsEqual(const GrFragmentProcessor& fpBase) const SK_OVERRIDE
{ |
| 37 const GrPorterDuffXferProcessor& xp = fpBase.cast<GrPorterDuffXferProces
sor>(); | 37 const GrPorterDuffXferProcessor& xp = fpBase.cast<GrPorterDuffXferProces
sor>(); |
| 38 if (fSrcBlend != xp.fSrcBlend || fDstBlend != xp.fDstBlend) { | 38 if (fSrcBlend != xp.fSrcBlend || fDstBlend != xp.fDstBlend) { |
| 39 return false; | 39 return false; |
| 40 } | 40 } |
| 41 return true; | 41 return true; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 71 GrPorterDuffXPFactory(GrBlendCoeff src, GrBlendCoeff dst) | 71 GrPorterDuffXPFactory(GrBlendCoeff src, GrBlendCoeff dst) |
| 72 : fSrc(src), fDst(dst) {} | 72 : fSrc(src), fDst(dst) {} |
| 73 | 73 |
| 74 GrBlendCoeff fSrc; | 74 GrBlendCoeff fSrc; |
| 75 GrBlendCoeff fDst; | 75 GrBlendCoeff fDst; |
| 76 | 76 |
| 77 typedef GrXPFactory INHERITED; | 77 typedef GrXPFactory INHERITED; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 #endif | 80 #endif |
| OLD | NEW |