| 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 "Sk4fLinearGradient.h" | 8 #include "Sk4fLinearGradient.h" |
| 9 #include "SkLinearGradient.h" | 9 #include "SkLinearGradient.h" |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 return SkGradientShader::CreateLinear(pts, desc.fColors, desc.fPos, desc.fCo
unt, | 81 return SkGradientShader::CreateLinear(pts, desc.fColors, desc.fPos, desc.fCo
unt, |
| 82 desc.fTileMode, desc.fGradFlags, desc.
fLocalMatrix); | 82 desc.fTileMode, desc.fGradFlags, desc.
fLocalMatrix); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void SkLinearGradient::flatten(SkWriteBuffer& buffer) const { | 85 void SkLinearGradient::flatten(SkWriteBuffer& buffer) const { |
| 86 this->INHERITED::flatten(buffer); | 86 this->INHERITED::flatten(buffer); |
| 87 buffer.writePoint(fStart); | 87 buffer.writePoint(fStart); |
| 88 buffer.writePoint(fEnd); | 88 buffer.writePoint(fEnd); |
| 89 } | 89 } |
| 90 | 90 |
| 91 size_t SkLinearGradient::contextSize(const ContextRec& rec) const { | 91 size_t SkLinearGradient::onContextSize(const ContextRec& rec) const { |
| 92 return use_4f_context(rec, fGradFlags) | 92 return use_4f_context(rec, fGradFlags) |
| 93 ? sizeof(LinearGradient4fContext) | 93 ? SkAlign16(sizeof(LinearGradient4fContext)) |
| 94 : sizeof(LinearGradientContext); | 94 : SkAlign16(sizeof(LinearGradientContext)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 SkShader::Context* SkLinearGradient::onCreateContext(const ContextRec& rec, void
* storage) const { | 97 SkShader::Context* SkLinearGradient::onCreateContext(const ContextRec& rec, void
* storage) const { |
| 98 return use_4f_context(rec, fGradFlags) | 98 return use_4f_context(rec, fGradFlags) |
| 99 ? static_cast<SkShader::Context*>(new (storage) LinearGradient4fContext(
*this, rec)) | 99 ? static_cast<SkShader::Context*>(new (storage) LinearGradient4fContext(
*this, rec)) |
| 100 : static_cast<SkShader::Context*>(new (storage) LinearGradientContext(*t
his, rec)); | 100 : static_cast<SkShader::Context*>(new (storage) LinearGradientContext(*t
his, rec)); |
| 101 } | 101 } |
| 102 | 102 |
| 103 // This swizzles SkColor into the same component order as SkPMColor, but does no
t actually | 103 // This swizzles SkColor into the same component order as SkPMColor, but does no
t actually |
| 104 // "pre" multiply the color components. | 104 // "pre" multiply the color components. |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe
r); | 762 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe
r); |
| 763 } | 763 } |
| 764 } else { | 764 } else { |
| 765 if (fApplyAlphaAfterInterp) { | 765 if (fApplyAlphaAfterInterp) { |
| 766 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe
r); | 766 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe
r); |
| 767 } else { | 767 } else { |
| 768 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith
er); | 768 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith
er); |
| 769 } | 769 } |
| 770 } | 770 } |
| 771 } | 771 } |
| OLD | NEW |