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 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); | 194 SkMatrix viewMatrix = GrTest::TestMatrix(d->fRandom); |
195 sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPAr
gs( | 195 sk_sp<GrFragmentProcessor> fp = shader->asFragmentProcessor(SkShader::AsFPAr
gs( |
196 d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, SkSourceGammaTrea
tment::kRespect)); | 196 d->fContext, &viewMatrix, NULL, kNone_SkFilterQuality, nullptr, |
| 197 SkSourceGammaTreatment::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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 str->appendScalar(fCenter.fX); | 256 str->appendScalar(fCenter.fX); |
256 str->append(", "); | 257 str->append(", "); |
257 str->appendScalar(fCenter.fY); | 258 str->appendScalar(fCenter.fY); |
258 str->append(") "); | 259 str->append(") "); |
259 | 260 |
260 this->INHERITED::toString(str); | 261 this->INHERITED::toString(str); |
261 | 262 |
262 str->append(")"); | 263 str->append(")"); |
263 } | 264 } |
264 #endif | 265 #endif |
OLD | NEW |