| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 SkScalar inv = mag ? SkScalarInvert(mag) : 0; | 45 SkScalar inv = mag ? SkScalarInvert(mag) : 0; |
| 46 | 46 |
| 47 vec.scale(inv); | 47 vec.scale(inv); |
| 48 matrix->setSinCos(-vec.fY, vec.fX, pts[0].fX, pts[0].fY); | 48 matrix->setSinCos(-vec.fY, vec.fX, pts[0].fX, pts[0].fY); |
| 49 matrix->postTranslate(-pts[0].fX, -pts[0].fY); | 49 matrix->postTranslate(-pts[0].fX, -pts[0].fY); |
| 50 matrix->postScale(inv, inv); | 50 matrix->postScale(inv, inv); |
| 51 } | 51 } |
| 52 | 52 |
| 53 /////////////////////////////////////////////////////////////////////////////// | 53 /////////////////////////////////////////////////////////////////////////////// |
| 54 | 54 |
| 55 SkLinearGradient::SkLinearGradient(const SkPoint pts[2], const Descriptor& desc) | 55 SkLinearGradient::SkLinearGradient(const SkPoint pts[2], const Descriptor& desc, |
| 56 : SkGradientShaderBase(desc) | 56 const SkMatrix* localMatrix) |
| 57 : SkGradientShaderBase(desc, localMatrix) |
| 57 , fStart(pts[0]) | 58 , fStart(pts[0]) |
| 58 , fEnd(pts[1]) { | 59 , fEnd(pts[1]) { |
| 59 pts_to_unit_matrix(pts, &fPtsToUnit); | 60 pts_to_unit_matrix(pts, &fPtsToUnit); |
| 60 } | 61 } |
| 61 | 62 |
| 62 SkLinearGradient::SkLinearGradient(SkReadBuffer& buffer) | 63 SkLinearGradient::SkLinearGradient(SkReadBuffer& buffer) |
| 63 : INHERITED(buffer) | 64 : INHERITED(buffer) |
| 64 , fStart(buffer.readPoint()) | 65 , fStart(buffer.readPoint()) |
| 65 , fEnd(buffer.readPoint()) { | 66 , fEnd(buffer.readPoint()) { |
| 66 } | 67 } |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 str->append("SkLinearGradient ("); | 577 str->append("SkLinearGradient ("); |
| 577 | 578 |
| 578 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); | 579 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); |
| 579 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); | 580 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); |
| 580 | 581 |
| 581 this->INHERITED::toString(str); | 582 this->INHERITED::toString(str); |
| 582 | 583 |
| 583 str->append(")"); | 584 str->append(")"); |
| 584 } | 585 } |
| 585 #endif | 586 #endif |
| OLD | NEW |