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 #include "effects/GrPorterDuffXferProcessor.h" | 8 #include "effects/GrPorterDuffXferProcessor.h" |
9 | 9 |
10 #include "GrDrawState.h" | 10 #include "GrDrawState.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 GrGLFragmentProcessor* GrPorterDuffXferProcessor::createGLInstance() const { | 58 GrGLFragmentProcessor* GrPorterDuffXferProcessor::createGLInstance() const { |
59 return SkNEW_ARGS(GrGLPorterDuffXferProcessor, (*this)); | 59 return SkNEW_ARGS(GrGLPorterDuffXferProcessor, (*this)); |
60 } | 60 } |
61 | 61 |
62 void GrPorterDuffXferProcessor::onComputeInvariantOutput(GrInvariantOutput* inou
t) const { | 62 void GrPorterDuffXferProcessor::onComputeInvariantOutput(GrInvariantOutput* inou
t) const { |
63 inout->setToUnknown(GrInvariantOutput::kWillNot_ReadInput); | 63 inout->setToUnknown(GrInvariantOutput::kWillNot_ReadInput); |
64 } | 64 } |
65 | 65 |
66 /////////////////////////////////////////////////////////////////////////////// | 66 /////////////////////////////////////////////////////////////////////////////// |
67 | 67 |
| 68 GrPorterDuffXPFactory::GrPorterDuffXPFactory(GrBlendCoeff src, GrBlendCoeff dst) |
| 69 : fSrc(src), fDst(dst) { |
| 70 this->initClassID<GrPorterDuffXPFactory>(); |
| 71 } |
| 72 |
68 GrXPFactory* GrPorterDuffXPFactory::Create(SkXfermode::Mode mode) { | 73 GrXPFactory* GrPorterDuffXPFactory::Create(SkXfermode::Mode mode) { |
69 switch (mode) { | 74 switch (mode) { |
70 case SkXfermode::kClear_Mode: { | 75 case SkXfermode::kClear_Mode: { |
71 static GrPorterDuffXPFactory gClearPDXPF(kZero_GrBlendCoeff, kZero_G
rBlendCoeff); | 76 static GrPorterDuffXPFactory gClearPDXPF(kZero_GrBlendCoeff, kZero_G
rBlendCoeff); |
72 return SkRef(&gClearPDXPF); | 77 return SkRef(&gClearPDXPF); |
73 break; | 78 break; |
74 } | 79 } |
75 case SkXfermode::kSrc_Mode: { | 80 case SkXfermode::kSrc_Mode: { |
76 static GrPorterDuffXPFactory gSrcPDXPF(kOne_GrBlendCoeff, kZero_GrBl
endCoeff); | 81 static GrPorterDuffXPFactory gSrcPDXPF(kOne_GrBlendCoeff, kZero_GrBl
endCoeff); |
77 return SkRef(&gSrcPDXPF); | 82 return SkRef(&gSrcPDXPF); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 158 |
154 bool GrPorterDuffXPFactory::supportsRGBCoverage(GrColor /*knownColor*/, | 159 bool GrPorterDuffXPFactory::supportsRGBCoverage(GrColor /*knownColor*/, |
155 uint32_t knownColorFlags) const
{ | 160 uint32_t knownColorFlags) const
{ |
156 if (kOne_GrBlendCoeff == fSrc && kISA_GrBlendCoeff == fDst && | 161 if (kOne_GrBlendCoeff == fSrc && kISA_GrBlendCoeff == fDst && |
157 kRGBA_GrColorComponentFlags == knownColorFlags) { | 162 kRGBA_GrColorComponentFlags == knownColorFlags) { |
158 return true; | 163 return true; |
159 } | 164 } |
160 return false; | 165 return false; |
161 } | 166 } |
162 | 167 |
OLD | NEW |