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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 void setAntiAlias(bool aa) { fAntiAlias = aa; } | 56 void setAntiAlias(bool aa) { fAntiAlias = aa; } |
57 bool isAntiAlias() const { return fAntiAlias; } | 57 bool isAntiAlias() const { return fAntiAlias; } |
58 | 58 |
59 /** | 59 /** |
60 * Should shader output conversion from linear to sRGB be disabled. | 60 * Should shader output conversion from linear to sRGB be disabled. |
61 * Only relevant if the destination is sRGB. Defaults to false. | 61 * Only relevant if the destination is sRGB. Defaults to false. |
62 */ | 62 */ |
63 void setDisableOutputConversionToSRGB(bool srgb) { fDisableOutputConversionT
oSRGB = srgb; } | 63 void setDisableOutputConversionToSRGB(bool srgb) { fDisableOutputConversionT
oSRGB = srgb; } |
64 bool getDisableOutputConversionToSRGB() const { return fDisableOutputConvers
ionToSRGB; } | 64 bool getDisableOutputConversionToSRGB() const { return fDisableOutputConvers
ionToSRGB; } |
65 | 65 |
| 66 /** |
| 67 * Should sRGB inputs be allowed to perform sRGB to linear conversion. With
this flag |
| 68 * set to false, sRGB textures will be treated as linear (including filterin
g). |
| 69 */ |
| 70 void setAllowSRGBInputs(bool allowSRGBInputs) { fAllowSRGBInputs = allowSRGB
Inputs; } |
| 71 bool getAllowSRGBInputs() const { return fAllowSRGBInputs; } |
| 72 |
66 const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) { | 73 const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) { |
67 fXPFactory.reset(SkSafeRef(xpFactory)); | 74 fXPFactory.reset(SkSafeRef(xpFactory)); |
68 return xpFactory; | 75 return xpFactory; |
69 } | 76 } |
70 | 77 |
71 void setPorterDuffXPFactory(SkXfermode::Mode mode) { | 78 void setPorterDuffXPFactory(SkXfermode::Mode mode) { |
72 fXPFactory.reset(GrPorterDuffXPFactory::Create(mode)); | 79 fXPFactory.reset(GrPorterDuffXPFactory::Create(mode)); |
73 } | 80 } |
74 | 81 |
75 void setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage =
false); | 82 void setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage =
false); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 const GrFragmentProcessor* getColorFragmentProcessor(int i) const { | 120 const GrFragmentProcessor* getColorFragmentProcessor(int i) const { |
114 return fColorFragmentProcessors[i]; | 121 return fColorFragmentProcessors[i]; |
115 } | 122 } |
116 const GrFragmentProcessor* getCoverageFragmentProcessor(int i) const { | 123 const GrFragmentProcessor* getCoverageFragmentProcessor(int i) const { |
117 return fCoverageFragmentProcessors[i]; | 124 return fCoverageFragmentProcessors[i]; |
118 } | 125 } |
119 | 126 |
120 GrPaint& operator=(const GrPaint& paint) { | 127 GrPaint& operator=(const GrPaint& paint) { |
121 fAntiAlias = paint.fAntiAlias; | 128 fAntiAlias = paint.fAntiAlias; |
122 fDisableOutputConversionToSRGB = paint.fDisableOutputConversionToSRGB; | 129 fDisableOutputConversionToSRGB = paint.fDisableOutputConversionToSRGB; |
| 130 fAllowSRGBInputs = paint.fAllowSRGBInputs; |
123 | 131 |
124 fColor = paint.fColor; | 132 fColor = paint.fColor; |
125 this->resetFragmentProcessors(); | 133 this->resetFragmentProcessors(); |
126 fColorFragmentProcessors = paint.fColorFragmentProcessors; | 134 fColorFragmentProcessors = paint.fColorFragmentProcessors; |
127 fCoverageFragmentProcessors = paint.fCoverageFragmentProcessors; | 135 fCoverageFragmentProcessors = paint.fCoverageFragmentProcessors; |
128 for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { | 136 for (int i = 0; i < fColorFragmentProcessors.count(); ++i) { |
129 fColorFragmentProcessors[i]->ref(); | 137 fColorFragmentProcessors[i]->ref(); |
130 } | 138 } |
131 for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { | 139 for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) { |
132 fCoverageFragmentProcessors[i]->ref(); | 140 fCoverageFragmentProcessors[i]->ref(); |
(...skipping 23 matching lines...) Expand all Loading... |
156 fColorFragmentProcessors.reset(); | 164 fColorFragmentProcessors.reset(); |
157 fCoverageFragmentProcessors.reset(); | 165 fCoverageFragmentProcessors.reset(); |
158 } | 166 } |
159 | 167 |
160 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; | 168 mutable SkAutoTUnref<const GrXPFactory> fXPFactory; |
161 SkSTArray<4, const GrFragmentProcessor*, true> fColorFragmentProcessors; | 169 SkSTArray<4, const GrFragmentProcessor*, true> fColorFragmentProcessors; |
162 SkSTArray<2, const GrFragmentProcessor*, true> fCoverageFragmentProcessors; | 170 SkSTArray<2, const GrFragmentProcessor*, true> fCoverageFragmentProcessors; |
163 | 171 |
164 bool fAntiAlias; | 172 bool fAntiAlias; |
165 bool fDisableOutputConversionToSR
GB; | 173 bool fDisableOutputConversionToSR
GB; |
| 174 bool fAllowSRGBInputs; |
166 | 175 |
167 GrColor fColor; | 176 GrColor fColor; |
168 }; | 177 }; |
169 | 178 |
170 #endif | 179 #endif |
OLD | NEW |