| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 | 48 |
| 49 /////////////////////////////////////////////////////////////////////////////// | 49 /////////////////////////////////////////////////////////////////////////////// |
| 50 | 50 |
| 51 SkLinearGradient::SkLinearGradient(const SkPoint pts[2], const Descriptor& desc) | 51 SkLinearGradient::SkLinearGradient(const SkPoint pts[2], const Descriptor& desc) |
| 52 : SkGradientShaderBase(desc, pts_to_unit_matrix(pts)) | 52 : SkGradientShaderBase(desc, pts_to_unit_matrix(pts)) |
| 53 , fStart(pts[0]) | 53 , fStart(pts[0]) |
| 54 , fEnd(pts[1]) { | 54 , fEnd(pts[1]) { |
| 55 } | 55 } |
| 56 | 56 |
| 57 SkFlattenable* SkLinearGradient::CreateProc(SkReadBuffer& buffer) { | 57 sk_sp<SkFlattenable> SkLinearGradient::CreateProc(SkReadBuffer& buffer) { |
| 58 DescriptorScope desc; | 58 DescriptorScope desc; |
| 59 if (!desc.unflatten(buffer)) { | 59 if (!desc.unflatten(buffer)) { |
| 60 return nullptr; | 60 return nullptr; |
| 61 } | 61 } |
| 62 SkPoint pts[2]; | 62 SkPoint pts[2]; |
| 63 pts[0] = buffer.readPoint(); | 63 pts[0] = buffer.readPoint(); |
| 64 pts[1] = buffer.readPoint(); | 64 pts[1] = buffer.readPoint(); |
| 65 return SkGradientShader::MakeLinear(pts, desc.fColors, desc.fPos, desc.fCoun
t, desc.fTileMode, | 65 return SkGradientShader::MakeLinear(pts, desc.fColors, desc.fPos, desc.fCoun
t, desc.fTileMode, |
| 66 desc.fGradFlags, desc.fLocalMatrix).rele
ase(); | 66 desc.fGradFlags, desc.fLocalMatrix); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void SkLinearGradient::flatten(SkWriteBuffer& buffer) const { | 69 void SkLinearGradient::flatten(SkWriteBuffer& buffer) const { |
| 70 this->INHERITED::flatten(buffer); | 70 this->INHERITED::flatten(buffer); |
| 71 buffer.writePoint(fStart); | 71 buffer.writePoint(fStart); |
| 72 buffer.writePoint(fEnd); | 72 buffer.writePoint(fEnd); |
| 73 } | 73 } |
| 74 | 74 |
| 75 size_t SkLinearGradient::onContextSize(const ContextRec& rec) const { | 75 size_t SkLinearGradient::onContextSize(const ContextRec& rec) const { |
| 76 return use_4f_context(rec, fGradFlags) | 76 return use_4f_context(rec, fGradFlags) |
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe
r); | 744 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe
r); |
| 745 } | 745 } |
| 746 } else { | 746 } else { |
| 747 if (fApplyAlphaAfterInterp) { | 747 if (fApplyAlphaAfterInterp) { |
| 748 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe
r); | 748 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe
r); |
| 749 } else { | 749 } else { |
| 750 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith
er); | 750 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith
er); |
| 751 } | 751 } |
| 752 } | 752 } |
| 753 } | 753 } |
| OLD | NEW |