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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 SkString t = builder->getFragmentShaderBuilder()->ensureFSCoords2D(coords, 0
); | 562 SkString t = builder->getFragmentShaderBuilder()->ensureFSCoords2D(coords, 0
); |
563 t.append(".x"); | 563 t.append(".x"); |
564 this->emitColor(builder, t.c_str(), baseKey, outputColor, inputColor, sample
rs); | 564 this->emitColor(builder, t.c_str(), baseKey, outputColor, inputColor, sample
rs); |
565 } | 565 } |
566 | 566 |
567 ///////////////////////////////////////////////////////////////////// | 567 ///////////////////////////////////////////////////////////////////// |
568 | 568 |
569 bool SkLinearGradient::asNewEffect(GrContext* context, const SkPaint& paint, | 569 bool SkLinearGradient::asNewEffect(GrContext* context, const SkPaint& paint, |
570 const SkMatrix* localMatrix, GrColor* paintCo
lor, | 570 const SkMatrix* localMatrix, GrColor* paintCo
lor, |
571 GrEffect** effect) const { | 571 GrEffect** effect) const { |
572 SkASSERT(NULL != context); | 572 SkASSERT(context); |
573 | 573 |
574 SkMatrix matrix; | 574 SkMatrix matrix; |
575 if (!this->getLocalMatrix().invert(&matrix)) { | 575 if (!this->getLocalMatrix().invert(&matrix)) { |
576 return false; | 576 return false; |
577 } | 577 } |
578 if (localMatrix) { | 578 if (localMatrix) { |
579 SkMatrix inv; | 579 SkMatrix inv; |
580 if (!localMatrix->invert(&inv)) { | 580 if (!localMatrix->invert(&inv)) { |
581 return false; | 581 return false; |
582 } | 582 } |
(...skipping 23 matching lines...) Expand all Loading... |
606 str->append("SkLinearGradient ("); | 606 str->append("SkLinearGradient ("); |
607 | 607 |
608 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); | 608 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); |
609 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); | 609 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); |
610 | 610 |
611 this->INHERITED::toString(str); | 611 this->INHERITED::toString(str); |
612 | 612 |
613 str->append(")"); | 613 str->append(")"); |
614 } | 614 } |
615 #endif | 615 #endif |
OLD | NEW |