| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 | 9 |
| 10 #ifndef GrPaint_DEFINED | 10 #ifndef GrPaint_DEFINED |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 */ | 50 */ |
| 51 void setColor(GrColor color) { fColor = color; } | 51 void setColor(GrColor color) { fColor = color; } |
| 52 GrColor getColor() const { return fColor; } | 52 GrColor getColor() const { return fColor; } |
| 53 | 53 |
| 54 /** | 54 /** |
| 55 * Should primitives be anti-aliased or not. Defaults to false. | 55 * Should primitives be anti-aliased or not. Defaults to false. |
| 56 */ | 56 */ |
| 57 void setAntiAlias(bool aa) { fAntiAlias = aa; } | 57 void setAntiAlias(bool aa) { fAntiAlias = aa; } |
| 58 bool isAntiAlias() const { return fAntiAlias; } | 58 bool isAntiAlias() const { return fAntiAlias; } |
| 59 | 59 |
| 60 /** | |
| 61 * Should dithering be applied. Defaults to false. | |
| 62 */ | |
| 63 void setDither(bool dither) { fDither = dither; } | |
| 64 bool isDither() const { return fDither; } | |
| 65 | |
| 66 const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) { | 60 const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) { |
| 67 fXPFactory.reset(SkRef(xpFactory)); | 61 fXPFactory.reset(SkRef(xpFactory)); |
| 68 return xpFactory; | 62 return xpFactory; |
| 69 } | 63 } |
| 70 | 64 |
| 71 void setPorterDuffXPFactory(SkXfermode::Mode mode) { | 65 void setPorterDuffXPFactory(SkXfermode::Mode mode) { |
| 72 fXPFactory.reset(GrPorterDuffXPFactory::Create(mode)); | 66 fXPFactory.reset(GrPorterDuffXPFactory::Create(mode)); |
| 73 } | 67 } |
| 74 | 68 |
| 75 void setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage =
false); | 69 void setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage =
false); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 109 |
| 116 const GrFragmentProcessor* getColorFragmentProcessor(int i) const { | 110 const GrFragmentProcessor* getColorFragmentProcessor(int i) const { |
| 117 return fColorFragmentProcessors[i]; | 111 return fColorFragmentProcessors[i]; |
| 118 } | 112 } |
| 119 const GrFragmentProcessor* getCoverageFragmentProcessor(int i) const { | 113 const GrFragmentProcessor* getCoverageFragmentProcessor(int i) const { |
| 120 return fCoverageFragmentProcessors[i]; | 114 return fCoverageFragmentProcessors[i]; |
| 121 } | 115 } |
| 122 | 116 |
| 123 GrPaint& operator=(const GrPaint& paint) { | 117 GrPaint& operator=(const GrPaint& paint) { |
| 124 fAntiAlias = paint.fAntiAlias; | 118 fAntiAlias = paint.fAntiAlias; |
| 125 fDither = paint.fDither; | |
| 126 | 119 |
| 127 fColor = paint.fColor; | 120 fColor = paint.fColor; |
| 128 this->resetFragmentProcessors(); | 121 this->resetFragmentProcessors(); |
| 129 fColorFragmentProcessors = paint.fColorFragmentProcessors; | 122 fColorFragmentProcessors = paint.fColorFragmentProcessors; |
| 130 fCoverageFragmentProcessors = paint.fCoverageFragmentProcessors; | 123 fCoverageFragmentProcessors = paint.fCoverageFragmentProcessors; |
| 131 for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { | 124 for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { |
| 132 fColorFragmentProcessors[i]->ref(); | 125 fColorFragmentProcessors[i]->ref(); |
| 133 } | 126 } |
| 134 for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { | 127 for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { |
| 135 fCoverageFragmentProcessors[i]->ref(); | 128 fCoverageFragmentProcessors[i]->ref(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 162 } | 155 } |
| 163 fColorFragmentProcessors.reset(); | 156 fColorFragmentProcessors.reset(); |
| 164 fCoverageFragmentProcessors.reset(); | 157 fCoverageFragmentProcessors.reset(); |
| 165 } | 158 } |
| 166 | 159 |
| 167 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; | 160 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; |
| 168 SkSTArray<4, const GrFragmentProcessor*, true> fColorFragmentProcessors; | 161 SkSTArray<4, const GrFragmentProcessor*, true> fColorFragmentProcessors; |
| 169 SkSTArray<2, const GrFragmentProcessor*, true> fCoverageFragmentProcessors; | 162 SkSTArray<2, const GrFragmentProcessor*, true> fCoverageFragmentProcessors; |
| 170 | 163 |
| 171 bool fAntiAlias; | 164 bool fAntiAlias; |
| 172 bool fDither; | |
| 173 | 165 |
| 174 GrColor fColor; | 166 GrColor fColor; |
| 175 GrProcessorDataManager fProcDataManager; | 167 GrProcessorDataManager fProcDataManager; |
| 176 }; | 168 }; |
| 177 | 169 |
| 178 #endif | 170 #endif |
| OLD | NEW |