Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: src/effects/gradients/SkLinearGradient.cpp

Issue 1855733002: change flattenable factory to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkXfermodeImageFilter.cpp ('k') | src/effects/gradients/SkRadialGradient.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/effects/SkXfermodeImageFilter.cpp ('k') | src/effects/gradients/SkRadialGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698