OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 "SkRadialGradient.h" | 9 #include "SkRadialGradient.h" |
10 #include "SkRadialGradient_Table.h" | 10 #include "SkRadialGradient_Table.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 commonAsAGradient(info); | 230 commonAsAGradient(info); |
231 info->fPoint[0] = fCenter; | 231 info->fPoint[0] = fCenter; |
232 info->fRadius[0] = fRadius; | 232 info->fRadius[0] = fRadius; |
233 } | 233 } |
234 return kRadial_GradientType; | 234 return kRadial_GradientType; |
235 } | 235 } |
236 | 236 |
237 SkFlattenable* SkRadialGradient::CreateProc(SkReadBuffer& buffer) { | 237 SkFlattenable* SkRadialGradient::CreateProc(SkReadBuffer& buffer) { |
238 DescriptorScope desc; | 238 DescriptorScope desc; |
239 if (!desc.unflatten(buffer)) { | 239 if (!desc.unflatten(buffer)) { |
240 return NULL; | 240 return nullptr; |
241 } | 241 } |
242 const SkPoint center = buffer.readPoint(); | 242 const SkPoint center = buffer.readPoint(); |
243 const SkScalar radius = buffer.readScalar(); | 243 const SkScalar radius = buffer.readScalar(); |
244 return SkGradientShader::CreateRadial(center, radius, desc.fColors, desc.fPo
s, desc.fCount, | 244 return SkGradientShader::CreateRadial(center, radius, desc.fColors, desc.fPo
s, desc.fCount, |
245 desc.fTileMode, desc.fGradFlags, desc.
fLocalMatrix); | 245 desc.fTileMode, desc.fGradFlags, desc.
fLocalMatrix); |
246 } | 246 } |
247 | 247 |
248 void SkRadialGradient::flatten(SkWriteBuffer& buffer) const { | 248 void SkRadialGradient::flatten(SkWriteBuffer& buffer) const { |
249 this->INHERITED::flatten(buffer); | 249 this->INHERITED::flatten(buffer); |
250 buffer.writePoint(fCenter); | 250 buffer.writePoint(fCenter); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 SkScalar* stops = stopsArray; | 488 SkScalar* stops = stopsArray; |
489 SkShader::TileMode tm; | 489 SkShader::TileMode tm; |
490 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); | 490 int colorCount = RandomGradientParams(d->fRandom, colors, &stops, &tm); |
491 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateRadial(center, radius, | 491 SkAutoTUnref<SkShader> shader(SkGradientShader::CreateRadial(center, radius, |
492 colors, stops,
colorCount, | 492 colors, stops,
colorCount, |
493 tm)); | 493 tm)); |
494 SkPaint paint; | 494 SkPaint paint; |
495 GrColor paintColor; | 495 GrColor paintColor; |
496 GrFragmentProcessor* fp; | 496 GrFragmentProcessor* fp; |
497 SkAssertResult(shader->asFragmentProcessor(d->fContext, paint, | 497 SkAssertResult(shader->asFragmentProcessor(d->fContext, paint, |
498 GrTest::TestMatrix(d->fRandom), N
ULL, | 498 GrTest::TestMatrix(d->fRandom), n
ullptr, |
499 &paintColor, d->fProcDataManager,
&fp)); | 499 &paintColor, d->fProcDataManager,
&fp)); |
500 return fp; | 500 return fp; |
501 } | 501 } |
502 | 502 |
503 ///////////////////////////////////////////////////////////////////// | 503 ///////////////////////////////////////////////////////////////////// |
504 | 504 |
505 void GrGLRadialGradient::emitCode(EmitArgs& args) { | 505 void GrGLRadialGradient::emitCode(EmitArgs& args) { |
506 const GrRadialGradient& ge = args.fFp.cast<GrRadialGradient>(); | 506 const GrRadialGradient& ge = args.fFp.cast<GrRadialGradient>(); |
507 this->emitUniforms(args.fBuilder, ge); | 507 this->emitUniforms(args.fBuilder, ge); |
508 SkString t("length("); | 508 SkString t("length("); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 str->appendScalar(fCenter.fY); | 561 str->appendScalar(fCenter.fY); |
562 str->append(") radius: "); | 562 str->append(") radius: "); |
563 str->appendScalar(fRadius); | 563 str->appendScalar(fRadius); |
564 str->append(" "); | 564 str->append(" "); |
565 | 565 |
566 this->INHERITED::toString(str); | 566 this->INHERITED::toString(str); |
567 | 567 |
568 str->append(")"); | 568 str->append(")"); |
569 } | 569 } |
570 #endif | 570 #endif |
OLD | NEW |