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

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

Issue 1720933002: Add ContextRec param to SkShader::contextSize() (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: ContextRec plumbing only Created 4 years, 10 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/gradients/SkLinearGradient.h ('k') | src/effects/gradients/SkRadialGradient.h » ('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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 return SkGradientShader::CreateLinear(pts, desc.fColors, desc.fPos, desc.fCo unt, 74 return SkGradientShader::CreateLinear(pts, desc.fColors, desc.fPos, desc.fCo unt,
75 desc.fTileMode, desc.fGradFlags, desc. fLocalMatrix); 75 desc.fTileMode, desc.fGradFlags, desc. fLocalMatrix);
76 } 76 }
77 77
78 void SkLinearGradient::flatten(SkWriteBuffer& buffer) const { 78 void SkLinearGradient::flatten(SkWriteBuffer& buffer) const {
79 this->INHERITED::flatten(buffer); 79 this->INHERITED::flatten(buffer);
80 buffer.writePoint(fStart); 80 buffer.writePoint(fStart);
81 buffer.writePoint(fEnd); 81 buffer.writePoint(fEnd);
82 } 82 }
83 83
84 size_t SkLinearGradient::contextSize() const { 84 size_t SkLinearGradient::contextSize(const ContextRec&) const {
85 return use_4f_context(fGradFlags) 85 return use_4f_context(fGradFlags)
86 ? sizeof(LinearGradient4fContext) 86 ? sizeof(LinearGradient4fContext)
87 : sizeof(LinearGradientContext); 87 : sizeof(LinearGradientContext);
88 } 88 }
89 89
90 SkShader::Context* SkLinearGradient::onCreateContext(const ContextRec& rec, void * storage) const { 90 SkShader::Context* SkLinearGradient::onCreateContext(const ContextRec& rec, void * storage) const {
91 return use_4f_context(fGradFlags) 91 return use_4f_context(fGradFlags)
92 ? static_cast<SkShader::Context*>(new (storage) LinearGradient4fContext( *this, rec)) 92 ? static_cast<SkShader::Context*>(new (storage) LinearGradient4fContext( *this, rec))
93 : static_cast<SkShader::Context*>(new (storage) LinearGradientContext(*t his, rec)); 93 : static_cast<SkShader::Context*>(new (storage) LinearGradientContext(*t his, rec));
94 } 94 }
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe r); 755 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe r);
756 } 756 }
757 } else { 757 } else {
758 if (fApplyAlphaAfterInterp) { 758 if (fApplyAlphaAfterInterp) {
759 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe r); 759 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe r);
760 } else { 760 } else {
761 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith er); 761 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith er);
762 } 762 }
763 } 763 }
764 } 764 }
OLDNEW
« no previous file with comments | « src/effects/gradients/SkLinearGradient.h ('k') | src/effects/gradients/SkRadialGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698