| 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 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 /////////////////////////////////////////////////////////////////////////// | 34 /////////////////////////////////////////////////////////////////////////// |
| 35 /// @name Stage Output Types | 35 /// @name Stage Output Types |
| 36 //// | 36 //// |
| 37 | 37 |
| 38 enum PrimaryOutputType { | 38 enum PrimaryOutputType { |
| 39 kNone_PrimaryOutputType, | 39 kNone_PrimaryOutputType, |
| 40 kColor_PrimaryOutputType, | 40 kColor_PrimaryOutputType, |
| 41 kCoverage_PrimaryOutputType, | 41 kCoverage_PrimaryOutputType, |
| 42 // Modulate color and coverage, write result as the color output. | 42 // Modulate color and coverage, write result as the color output. |
| 43 kModulate_PrimaryOutputType, | 43 kModulate_PrimaryOutputType, |
| 44 // Combines the coverage, dst, and color as coverage * color + (1 - cove
rage) * dst. This | |
| 45 // can only be set if fDstReadKey is non-zero. | |
| 46 kCombineWithDst_PrimaryOutputType, | |
| 47 }; | 44 }; |
| 48 | 45 |
| 49 enum SecondaryOutputType { | 46 enum SecondaryOutputType { |
| 50 // There is no secondary output | 47 // There is no secondary output |
| 51 kNone_SecondaryOutputType, | 48 kNone_SecondaryOutputType, |
| 52 // Writes coverage as the secondary output. Only set if dual source blen
ding is supported | 49 // Writes coverage as the secondary output. Only set if dual source blen
ding is supported |
| 53 // and primary output is kModulate. | 50 // and primary output is kModulate. |
| 54 kCoverage_SecondaryOutputType, | 51 kCoverage_SecondaryOutputType, |
| 55 // Writes coverage * (1 - colorA) as the secondary output. Only set if d
ual source blending | 52 // Writes coverage * (1 - colorA) as the secondary output. Only set if d
ual source blending |
| 56 // is supported and primary output is kModulate. | 53 // is supported and primary output is kModulate. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 return false; | 87 return false; |
| 91 } | 88 } |
| 92 return true; | 89 return true; |
| 93 } | 90 } |
| 94 | 91 |
| 95 GrXferProcessor::OptFlags internalGetOptimizations(const GrProcOptInfo& colo
rPOI, | 92 GrXferProcessor::OptFlags internalGetOptimizations(const GrProcOptInfo& colo
rPOI, |
| 96 const GrProcOptInfo& cove
ragePOI, | 93 const GrProcOptInfo& cove
ragePOI, |
| 97 bool doesStencilWrite); | 94 bool doesStencilWrite); |
| 98 | 95 |
| 99 void calcOutputTypes(GrXferProcessor::OptFlags blendOpts, const GrDrawTarget
Caps& caps, | 96 void calcOutputTypes(GrXferProcessor::OptFlags blendOpts, const GrDrawTarget
Caps& caps, |
| 100 bool hasSolidCoverage, bool readDst); | 97 bool hasSolidCoverage); |
| 101 | 98 |
| 102 GrBlendCoeff fSrcBlend; | 99 GrBlendCoeff fSrcBlend; |
| 103 GrBlendCoeff fDstBlend; | 100 GrBlendCoeff fDstBlend; |
| 104 GrColor fBlendConstant; | 101 GrColor fBlendConstant; |
| 105 PrimaryOutputType fPrimaryOutputType; | 102 PrimaryOutputType fPrimaryOutputType; |
| 106 SecondaryOutputType fSecondaryOutputType; | 103 SecondaryOutputType fSecondaryOutputType; |
| 107 | 104 |
| 108 typedef GrXferProcessor INHERITED; | 105 typedef GrXferProcessor INHERITED; |
| 109 }; | 106 }; |
| 110 | 107 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 128 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const
SK_OVERRIDE; | 125 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const
SK_OVERRIDE; |
| 129 | 126 |
| 130 bool canApplyCoverage(const GrProcOptInfo& colorPOI, | 127 bool canApplyCoverage(const GrProcOptInfo& colorPOI, |
| 131 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE; | 128 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE; |
| 132 | 129 |
| 133 bool canTweakAlphaForCoverage() const SK_OVERRIDE; | 130 bool canTweakAlphaForCoverage() const SK_OVERRIDE; |
| 134 | 131 |
| 135 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo&
coveragePOI, | 132 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo&
coveragePOI, |
| 136 GrXPFactory::InvariantOutput*) const SK_OVERRIDE; | 133 GrXPFactory::InvariantOutput*) const SK_OVERRIDE; |
| 137 | 134 |
| 138 bool willReadDst(const GrProcOptInfo& colorPOI, | 135 bool willReadDst() const SK_OVERRIDE { return false; } |
| 139 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE; | |
| 140 | 136 |
| 141 private: | 137 private: |
| 142 GrPorterDuffXPFactory(GrBlendCoeff src, GrBlendCoeff dst); | 138 GrPorterDuffXPFactory(GrBlendCoeff src, GrBlendCoeff dst); |
| 143 | 139 |
| 144 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { | 140 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { |
| 145 const GrPorterDuffXPFactory& xpf = xpfBase.cast<GrPorterDuffXPFactory>()
; | 141 const GrPorterDuffXPFactory& xpf = xpfBase.cast<GrPorterDuffXPFactory>()
; |
| 146 return (fSrcCoeff == xpf.fSrcCoeff && fDstCoeff == xpf.fDstCoeff); | 142 return (fSrcCoeff == xpf.fSrcCoeff && fDstCoeff == xpf.fDstCoeff); |
| 147 } | 143 } |
| 148 | 144 |
| 149 GR_DECLARE_XP_FACTORY_TEST; | 145 GR_DECLARE_XP_FACTORY_TEST; |
| 150 | 146 |
| 151 GrBlendCoeff fSrcCoeff; | 147 GrBlendCoeff fSrcCoeff; |
| 152 GrBlendCoeff fDstCoeff; | 148 GrBlendCoeff fDstCoeff; |
| 153 | 149 |
| 154 typedef GrXPFactory INHERITED; | 150 typedef GrXPFactory INHERITED; |
| 155 }; | 151 }; |
| 156 | 152 |
| 157 #endif | 153 #endif |
| OLD | NEW |