| 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 "SkLinearGradient.h" | 8 #include "SkLinearGradient.h" |
| 9 | 9 |
| 10 static inline int repeat_bits(int x, const int bits) { | 10 static inline int repeat_bits(int x, const int bits) { |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 *dstC++ = cache[toggle + index]; | 432 *dstC++ = cache[toggle + index]; |
| 433 toggle = next_dither_toggle16(toggle); | 433 toggle = next_dither_toggle16(toggle); |
| 434 | 434 |
| 435 dstX += SK_Scalar1; | 435 dstX += SK_Scalar1; |
| 436 } while (--count != 0); | 436 } while (--count != 0); |
| 437 } | 437 } |
| 438 } | 438 } |
| 439 | 439 |
| 440 #if SK_SUPPORT_GPU | 440 #if SK_SUPPORT_GPU |
| 441 | 441 |
| 442 #include "effects/GrExtractAlphaFragmentProcessor.h" | |
| 443 #include "gl/builders/GrGLProgramBuilder.h" | 442 #include "gl/builders/GrGLProgramBuilder.h" |
| 444 #include "SkGr.h" | 443 #include "SkGr.h" |
| 445 | 444 |
| 446 ///////////////////////////////////////////////////////////////////// | 445 ///////////////////////////////////////////////////////////////////// |
| 447 | 446 |
| 448 class GrGLLinearGradient : public GrGLGradientEffect { | 447 class GrGLLinearGradient : public GrGLGradientEffect { |
| 449 public: | 448 public: |
| 450 | 449 |
| 451 GrGLLinearGradient(const GrProcessor&) {} | 450 GrGLLinearGradient(const GrProcessor&) {} |
| 452 | 451 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 SkMatrix inv; | 554 SkMatrix inv; |
| 556 if (!localMatrix->invert(&inv)) { | 555 if (!localMatrix->invert(&inv)) { |
| 557 return nullptr; | 556 return nullptr; |
| 558 } | 557 } |
| 559 matrix.postConcat(inv); | 558 matrix.postConcat(inv); |
| 560 } | 559 } |
| 561 matrix.postConcat(fPtsToUnit); | 560 matrix.postConcat(fPtsToUnit); |
| 562 | 561 |
| 563 SkAutoTUnref<const GrFragmentProcessor> inner( | 562 SkAutoTUnref<const GrFragmentProcessor> inner( |
| 564 GrLinearGradient::Create(context, procDataManager, *this, matrix, fTileM
ode)); | 563 GrLinearGradient::Create(context, procDataManager, *this, matrix, fTileM
ode)); |
| 565 return GrExtractAlphaFragmentProcessor::Create(inner); | 564 return GrFragmentProcessor::MulOuputByInputAlpha(inner); |
| 566 } | 565 } |
| 567 | 566 |
| 568 | 567 |
| 569 #endif | 568 #endif |
| 570 | 569 |
| 571 #ifndef SK_IGNORE_TO_STRING | 570 #ifndef SK_IGNORE_TO_STRING |
| 572 void SkLinearGradient::toString(SkString* str) const { | 571 void SkLinearGradient::toString(SkString* str) const { |
| 573 str->append("SkLinearGradient ("); | 572 str->append("SkLinearGradient ("); |
| 574 | 573 |
| 575 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); | 574 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); |
| 576 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); | 575 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); |
| 577 | 576 |
| 578 this->INHERITED::toString(str); | 577 this->INHERITED::toString(str); |
| 579 | 578 |
| 580 str->append(")"); | 579 str->append(")"); |
| 581 } | 580 } |
| 582 #endif | 581 #endif |
| OLD | NEW |