| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrPaint.h" | 9 #include "GrPaint.h" |
| 10 | 10 |
| 11 #include "GrBlend.h" | 11 #include "GrBlend.h" |
| 12 #include "GrInvariantOutput.h" |
| 12 #include "effects/GrSimpleTextureEffect.h" | 13 #include "effects/GrSimpleTextureEffect.h" |
| 13 | 14 |
| 14 void GrPaint::addColorTextureProcessor(GrTexture* texture, const SkMatrix& matri
x) { | 15 void GrPaint::addColorTextureProcessor(GrTexture* texture, const SkMatrix& matri
x) { |
| 15 this->addColorProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unr
ef(); | 16 this->addColorProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unr
ef(); |
| 16 } | 17 } |
| 17 | 18 |
| 18 void GrPaint::addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& ma
trix) { | 19 void GrPaint::addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& ma
trix) { |
| 19 this->addCoverageProcessor(GrSimpleTextureEffect::Create(texture, matrix))->
unref(); | 20 this->addCoverageProcessor(GrSimpleTextureEffect::Create(texture, matrix))->
unref(); |
| 20 } | 21 } |
| 21 | 22 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 45 } | 46 } |
| 46 } | 47 } |
| 47 return false; | 48 return false; |
| 48 } | 49 } |
| 49 | 50 |
| 50 bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor, | 51 bool GrPaint::getOpaqueAndKnownColor(GrColor* solidColor, |
| 51 uint32_t* solidColorKnownComponents) const
{ | 52 uint32_t* solidColorKnownComponents) const
{ |
| 52 | 53 |
| 53 // TODO: Share this implementation with GrDrawState | 54 // TODO: Share this implementation with GrDrawState |
| 54 | 55 |
| 55 GrProcessor::InvariantOutput inout; | 56 GrInvariantOutput inout; |
| 56 inout.fColor = GrColorPackRGBA(fCoverage, fCoverage, fCoverage, fCoverage); | 57 inout.fColor = GrColorPackRGBA(fCoverage, fCoverage, fCoverage, fCoverage); |
| 57 inout.fValidFlags = kRGBA_GrColorComponentFlags; | 58 inout.fValidFlags = kRGBA_GrColorComponentFlags; |
| 58 inout.fIsSingleComponent = true; | 59 inout.fIsSingleComponent = true; |
| 59 int count = fCoverageStages.count(); | 60 int count = fCoverageStages.count(); |
| 60 for (int i = 0; i < count; ++i) { | 61 for (int i = 0; i < count; ++i) { |
| 61 fCoverageStages[i].getProcessor()->computeInvariantOutput(&inout); | 62 fCoverageStages[i].getProcessor()->computeInvariantOutput(&inout); |
| 62 } | 63 } |
| 63 if (!inout.isSolidWhite()) { | 64 if (!inout.isSolidWhite()) { |
| 64 return false; | 65 return false; |
| 65 } | 66 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 case kIConstA_GrBlendCoeff: | 115 case kIConstA_GrBlendCoeff: |
| 115 *solidColorKnownComponents = 0; | 116 *solidColorKnownComponents = 0; |
| 116 break; | 117 break; |
| 117 } | 118 } |
| 118 } else { | 119 } else { |
| 119 solidColorKnownComponents = 0; | 120 solidColorKnownComponents = 0; |
| 120 } | 121 } |
| 121 } | 122 } |
| 122 return opaque; | 123 return opaque; |
| 123 } | 124 } |
| OLD | NEW |