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 const float kInv255Float = 1.0f / 255; | 10 static const float kInv255Float = 1.0f / 255; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 return SkGradientShader::CreateLinear(pts, desc.fColors, desc.fPos, desc.fCo
unt, | 62 return SkGradientShader::CreateLinear(pts, desc.fColors, desc.fPos, desc.fCo
unt, |
63 desc.fTileMode, desc.fGradFlags, desc.
fLocalMatrix); | 63 desc.fTileMode, desc.fGradFlags, desc.
fLocalMatrix); |
64 } | 64 } |
65 | 65 |
66 void SkLinearGradient::flatten(SkWriteBuffer& buffer) const { | 66 void SkLinearGradient::flatten(SkWriteBuffer& buffer) const { |
67 this->INHERITED::flatten(buffer); | 67 this->INHERITED::flatten(buffer); |
68 buffer.writePoint(fStart); | 68 buffer.writePoint(fStart); |
69 buffer.writePoint(fEnd); | 69 buffer.writePoint(fEnd); |
70 } | 70 } |
71 | 71 |
72 size_t SkLinearGradient::contextSize() const { | 72 size_t SkLinearGradient::contextSize(const ContextRec&) const { |
73 return sizeof(LinearGradientContext); | 73 return sizeof(LinearGradientContext); |
74 } | 74 } |
75 | 75 |
76 SkShader::Context* SkLinearGradient::onCreateContext(const ContextRec& rec, void
* storage) const { | 76 SkShader::Context* SkLinearGradient::onCreateContext(const ContextRec& rec, void
* storage) const { |
77 return new (storage) LinearGradientContext(*this, rec); | 77 return new (storage) LinearGradientContext(*this, rec); |
78 } | 78 } |
79 | 79 |
80 // This swizzles SkColor into the same component order as SkPMColor, but does no
t actually | 80 // This swizzles SkColor into the same component order as SkPMColor, but does no
t actually |
81 // "pre" multiply the color components. | 81 // "pre" multiply the color components. |
82 // | 82 // |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe
r); | 739 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe
r); |
740 } | 740 } |
741 } else { | 741 } else { |
742 if (fApplyAlphaAfterInterp) { | 742 if (fApplyAlphaAfterInterp) { |
743 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe
r); | 743 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe
r); |
744 } else { | 744 } else { |
745 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith
er); | 745 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith
er); |
746 } | 746 } |
747 } | 747 } |
748 } | 748 } |
OLD | NEW |