OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkSweepGradient.h" | 8 #include "SkSweepGradient.h" |
9 | 9 |
10 static SkMatrix translate(SkScalar dx, SkScalar dy) { | 10 static SkMatrix translate(SkScalar dx, SkScalar dy) { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 186 |
187 SkColor colors[kMaxRandomGradientColors]; | 187 SkColor colors[kMaxRandomGradientColors]; |
188 SkScalar stopsArray[kMaxRandomGradientColors]; | 188 SkScalar stopsArray[kMaxRandomGradientColors]; |
189 SkScalar* stops = stopsArray; | 189 SkScalar* stops = stopsArray; |
190 SkShader::TileMode tmIgnored; | 190 SkShader::TileMode tmIgnored; |
191 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tmIgnored
); | 191 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tmIgnored
); |
192 sk_sp<SkShader> shader(SkGradientShader::MakeSweep(center.fX, center.fY, co
lors, stops, | 192 sk_sp<SkShader> shader(SkGradientShader::MakeSweep(center.fX, center.fY, co
lors, stops, |
193 colorCount)); | 193 colorCount)); |
194 const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, | 194 const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext, |
195 GrTest::TestMatr
ix(d->fRandom), | 195 GrTest::TestMatr
ix(d->fRandom), |
196 NULL, kNone_SkFi
lterQuality); | 196 NULL, kNone_SkFi
lterQuality, |
| 197 SkSourceGammaTre
atment::kRespect); |
197 GrAlwaysAssert(fp); | 198 GrAlwaysAssert(fp); |
198 return fp; | 199 return fp; |
199 } | 200 } |
200 | 201 |
201 ///////////////////////////////////////////////////////////////////// | 202 ///////////////////////////////////////////////////////////////////// |
202 | 203 |
203 void GrGLSweepGradient::emitCode(EmitArgs& args) { | 204 void GrGLSweepGradient::emitCode(EmitArgs& args) { |
204 const GrSweepGradient& ge = args.fFp.cast<GrSweepGradient>(); | 205 const GrSweepGradient& ge = args.fFp.cast<GrSweepGradient>(); |
205 this->emitUniforms(args.fUniformHandler, ge); | 206 this->emitUniforms(args.fUniformHandler, ge); |
206 SkString coords2D = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0); | 207 SkString coords2D = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0); |
(...skipping 16 matching lines...) Expand all Loading... |
223 args.fInputColor, | 224 args.fInputColor, |
224 args.fTexSamplers); | 225 args.fTexSamplers); |
225 } | 226 } |
226 | 227 |
227 ///////////////////////////////////////////////////////////////////// | 228 ///////////////////////////////////////////////////////////////////// |
228 | 229 |
229 const GrFragmentProcessor* SkSweepGradient::asFragmentProcessor( | 230 const GrFragmentProcessor* SkSweepGradient::asFragmentProcessor( |
230 GrContext* context, | 231 GrContext* context, |
231 const SkMatrix& viewM, | 232 const SkMatrix& viewM, |
232 const SkMatrix* localMatrix, | 233 const SkMatrix* localMatrix, |
233 SkFilterQuality) const { | 234 SkFilterQuality, |
| 235 SkSourceGammaTreatment) cons
t { |
234 | 236 |
235 SkMatrix matrix; | 237 SkMatrix matrix; |
236 if (!this->getLocalMatrix().invert(&matrix)) { | 238 if (!this->getLocalMatrix().invert(&matrix)) { |
237 return nullptr; | 239 return nullptr; |
238 } | 240 } |
239 if (localMatrix) { | 241 if (localMatrix) { |
240 SkMatrix inv; | 242 SkMatrix inv; |
241 if (!localMatrix->invert(&inv)) { | 243 if (!localMatrix->invert(&inv)) { |
242 return nullptr; | 244 return nullptr; |
243 } | 245 } |
(...skipping 16 matching lines...) Expand all Loading... |
260 str->appendScalar(fCenter.fX); | 262 str->appendScalar(fCenter.fX); |
261 str->append(", "); | 263 str->append(", "); |
262 str->appendScalar(fCenter.fY); | 264 str->appendScalar(fCenter.fY); |
263 str->append(") "); | 265 str->append(") "); |
264 | 266 |
265 this->INHERITED::toString(str); | 267 this->INHERITED::toString(str); |
266 | 268 |
267 str->append(")"); | 269 str->append(")"); |
268 } | 270 } |
269 #endif | 271 #endif |
OLD | NEW |