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 "SkTwoPointConicalGradient.h" | 8 #include "SkTwoPointConicalGradient.h" |
9 | 9 |
10 #include "SkTwoPointConicalGradient_gpu.h" | 10 #include "SkTwoPointConicalGradient_gpu.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 this->INHERITED::flatten(buffer); | 373 this->INHERITED::flatten(buffer); |
374 buffer.writePoint(fCenter1); | 374 buffer.writePoint(fCenter1); |
375 buffer.writePoint(fCenter2); | 375 buffer.writePoint(fCenter2); |
376 buffer.writeScalar(fRadius1); | 376 buffer.writeScalar(fRadius1); |
377 buffer.writeScalar(fRadius2); | 377 buffer.writeScalar(fRadius2); |
378 buffer.writeBool(fFlippedGrad); | 378 buffer.writeBool(fFlippedGrad); |
379 } | 379 } |
380 | 380 |
381 #if SK_SUPPORT_GPU | 381 #if SK_SUPPORT_GPU |
382 | 382 |
383 GrEffectRef* SkTwoPointConicalGradient::asNewEffect(GrContext* context, const Sk
Paint&, | 383 bool SkTwoPointConicalGradient::asNewEffect(GrContext* context, const SkPaint& p
aint, |
384 const SkMatrix* localMatrix)
const { | 384 const SkMatrix* localMatrix, GrColo
r* grColor, |
| 385 GrEffectRef** grEffect) const { |
385 SkASSERT(NULL != context); | 386 SkASSERT(NULL != context); |
386 SkASSERT(fPtsToUnit.isIdentity()); | 387 SkASSERT(fPtsToUnit.isIdentity()); |
387 | 388 |
388 return Gr2PtConicalGradientEffect::Create(context, *this, fTileMode, localMa
trix); | 389 *grEffect = Gr2PtConicalGradientEffect::Create(context, *this, fTileMode, lo
calMatrix); |
| 390 *grColor = this->getColorAsAlpha(paint); |
| 391 return NULL != *grEffect; |
389 } | 392 } |
390 | 393 |
391 #else | 394 #else |
392 | 395 |
393 GrEffectRef* SkTwoPointConicalGradient::asNewEffect(GrContext*, const SkPaint&, | 396 bool SkTwoPointConicalGradient::asNewEffect(GrContext* context, const SkPaint& p
aint, |
394 const SkMatrix*) const { | 397 const SkMatrix* localMatrix, GrColor
* grColor, |
| 398 GrEffectRef** grEffect) const { |
395 SkDEBUGFAIL("Should not call in GPU-less build"); | 399 SkDEBUGFAIL("Should not call in GPU-less build"); |
396 return NULL; | 400 return false; |
397 } | 401 } |
398 | 402 |
399 #endif | 403 #endif |
400 | 404 |
401 #ifndef SK_IGNORE_TO_STRING | 405 #ifndef SK_IGNORE_TO_STRING |
402 void SkTwoPointConicalGradient::toString(SkString* str) const { | 406 void SkTwoPointConicalGradient::toString(SkString* str) const { |
403 str->append("SkTwoPointConicalGradient: ("); | 407 str->append("SkTwoPointConicalGradient: ("); |
404 | 408 |
405 str->append("center1: ("); | 409 str->append("center1: ("); |
406 str->appendScalar(fCenter1.fX); | 410 str->appendScalar(fCenter1.fX); |
407 str->append(", "); | 411 str->append(", "); |
408 str->appendScalar(fCenter1.fY); | 412 str->appendScalar(fCenter1.fY); |
409 str->append(") radius1: "); | 413 str->append(") radius1: "); |
410 str->appendScalar(fRadius1); | 414 str->appendScalar(fRadius1); |
411 str->append(" "); | 415 str->append(" "); |
412 | 416 |
413 str->append("center2: ("); | 417 str->append("center2: ("); |
414 str->appendScalar(fCenter2.fX); | 418 str->appendScalar(fCenter2.fX); |
415 str->append(", "); | 419 str->append(", "); |
416 str->appendScalar(fCenter2.fY); | 420 str->appendScalar(fCenter2.fY); |
417 str->append(") radius2: "); | 421 str->append(") radius2: "); |
418 str->appendScalar(fRadius2); | 422 str->appendScalar(fRadius2); |
419 str->append(" "); | 423 str->append(" "); |
420 | 424 |
421 this->INHERITED::toString(str); | 425 this->INHERITED::toString(str); |
422 | 426 |
423 str->append(")"); | 427 str->append(")"); |
424 } | 428 } |
425 #endif | 429 #endif |
OLD | NEW |