| 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 "GrProcOptInfo.h" | 11 #include "GrProcOptInfo.h" |
| 12 #include "effects/GrPorterDuffXferProcessor.h" | 12 #include "effects/GrPorterDuffXferProcessor.h" |
| 13 #include "effects/GrSimpleTextureEffect.h" | 13 #include "effects/GrSimpleTextureEffect.h" |
| 14 | 14 |
| 15 GrPaint::GrPaint() |
| 16 : fAntiAlias(false) |
| 17 , fDither(false) |
| 18 , fColor(GrColor_WHITE) { |
| 19 } |
| 20 |
| 15 void GrPaint::addColorTextureProcessor(GrTexture* texture, const SkMatrix& matri
x) { | 21 void GrPaint::addColorTextureProcessor(GrTexture* texture, const SkMatrix& matri
x) { |
| 16 this->addColorProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unr
ef(); | 22 this->addColorProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unr
ef(); |
| 17 } | 23 } |
| 18 | 24 |
| 19 void GrPaint::addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& ma
trix) { | 25 void GrPaint::addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& ma
trix) { |
| 20 this->addCoverageProcessor(GrSimpleTextureEffect::Create(texture, matrix))->
unref(); | 26 this->addCoverageProcessor(GrSimpleTextureEffect::Create(texture, matrix))->
unref(); |
| 21 } | 27 } |
| 22 | 28 |
| 23 void GrPaint::addColorTextureProcessor(GrTexture* texture, | 29 void GrPaint::addColorTextureProcessor(GrTexture* texture, |
| 24 const SkMatrix& matrix, | 30 const SkMatrix& matrix, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 43 GrXPFactory::InvariantOutput output; | 49 GrXPFactory::InvariantOutput output; |
| 44 fXPFactory->getInvariantOutput(colorProcInfo, coverageProcInfo, &output); | 50 fXPFactory->getInvariantOutput(colorProcInfo, coverageProcInfo, &output); |
| 45 | 51 |
| 46 if (kRGBA_GrColorComponentFlags == output.fBlendedColorFlags && | 52 if (kRGBA_GrColorComponentFlags == output.fBlendedColorFlags && |
| 47 0xFF == GrColorUnpackA(output.fBlendedColor)) { | 53 0xFF == GrColorUnpackA(output.fBlendedColor)) { |
| 48 *color = output.fBlendedColor; | 54 *color = output.fBlendedColor; |
| 49 return true; | 55 return true; |
| 50 } | 56 } |
| 51 return false; | 57 return false; |
| 52 } | 58 } |
| 53 | |
| 54 void GrPaint::resetStages() { | |
| 55 fColorStages.reset(); | |
| 56 fCoverageStages.reset(); | |
| 57 fXPFactory.reset(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode)); | |
| 58 } | |
| 59 | |
| OLD | NEW |