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/GrCoverageSetOpXP.h" | 12 #include "effects/GrCoverageSetOpXP.h" |
13 #include "effects/GrPorterDuffXferProcessor.h" | 13 #include "effects/GrPorterDuffXferProcessor.h" |
14 #include "effects/GrSimpleTextureEffect.h" | 14 #include "effects/GrSimpleTextureEffect.h" |
15 | 15 |
16 GrPaint::GrPaint() | 16 GrPaint::GrPaint() |
17 : fAntiAlias(false) | 17 : fAntiAlias(false) |
18 , fDither(false) | 18 , fDither(false) |
19 , fColor(GrColor_WHITE) { | 19 , fColor(GrColor_WHITE) { |
20 } | 20 } |
21 | 21 |
22 void GrPaint::setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCovera
ge) { | 22 void GrPaint::setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCovera
ge) { |
23 fXPFactory.reset(GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage))
; | 23 fXPFactory.reset(GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage))
; |
24 } | 24 } |
25 | 25 |
26 void GrPaint::addColorTextureProcessor(GrTexture* texture, const SkMatrix& matri
x) { | 26 void GrPaint::addColorTextureProcessor(GrTexture* texture, const SkMatrix& matri
x) { |
27 this->addColorProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unr
ef(); | 27 this->addColorProcessor(GrSimpleTextureEffect::Create(&fProcDataManager, tex
ture, |
| 28 matrix))->unref(); |
28 } | 29 } |
29 | 30 |
30 void GrPaint::addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& ma
trix) { | 31 void GrPaint::addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& ma
trix) { |
31 this->addCoverageProcessor(GrSimpleTextureEffect::Create(texture, matrix))->
unref(); | 32 this->addCoverageProcessor(GrSimpleTextureEffect::Create(&fProcDataManager,
texture, |
| 33 matrix))->unref(); |
32 } | 34 } |
33 | 35 |
34 void GrPaint::addColorTextureProcessor(GrTexture* texture, | 36 void GrPaint::addColorTextureProcessor(GrTexture* texture, |
35 const SkMatrix& matrix, | 37 const SkMatrix& matrix, |
36 const GrTextureParams& params) { | 38 const GrTextureParams& params) { |
37 this->addColorProcessor(GrSimpleTextureEffect::Create(texture, matrix, param
s))->unref(); | 39 this->addColorProcessor(GrSimpleTextureEffect::Create(&fProcDataManager, tex
ture, matrix, |
| 40 params))->unref(); |
38 } | 41 } |
39 | 42 |
40 void GrPaint::addCoverageTextureProcessor(GrTexture* texture, | 43 void GrPaint::addCoverageTextureProcessor(GrTexture* texture, |
41 const SkMatrix& matrix, | 44 const SkMatrix& matrix, |
42 const GrTextureParams& params) { | 45 const GrTextureParams& params) { |
43 this->addCoverageProcessor(GrSimpleTextureEffect::Create(texture, matrix, pa
rams))->unref(); | 46 this->addCoverageProcessor(GrSimpleTextureEffect::Create(&fProcDataManager,
texture, matrix, |
| 47 params))->unref(); |
44 } | 48 } |
45 | 49 |
46 bool GrPaint::isConstantBlendedColor(GrColor* color) const { | 50 bool GrPaint::isConstantBlendedColor(GrColor* color) const { |
47 GrProcOptInfo colorProcInfo; | 51 GrProcOptInfo colorProcInfo; |
48 colorProcInfo.calcWithInitialValues(fColorStages.begin(), this->numColorStag
es(), fColor, | 52 colorProcInfo.calcWithInitialValues(fColorStages.begin(), this->numColorStag
es(), fColor, |
49 kRGBA_GrColorComponentFlags, false); | 53 kRGBA_GrColorComponentFlags, false); |
50 | 54 |
51 GrXPFactory::InvariantBlendedColor blendedColor; | 55 GrXPFactory::InvariantBlendedColor blendedColor; |
52 fXPFactory->getInvariantBlendedColor(colorProcInfo, &blendedColor); | 56 fXPFactory->getInvariantBlendedColor(colorProcInfo, &blendedColor); |
53 | 57 |
54 if (kRGBA_GrColorComponentFlags == blendedColor.fKnownColorFlags) { | 58 if (kRGBA_GrColorComponentFlags == blendedColor.fKnownColorFlags) { |
55 *color = blendedColor.fKnownColor; | 59 *color = blendedColor.fKnownColor; |
56 return true; | 60 return true; |
57 } | 61 } |
58 return false; | 62 return false; |
59 } | 63 } |
OLD | NEW |