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

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

Issue 264843006: create struct to hold all the params passed around for shader::context (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address review comments Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/gradients/SkRadialGradient.h ('k') | src/effects/gradients/SkSweepGradient.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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkRadialGradient.h" 9 #include "SkRadialGradient.h"
10 #include "SkRadialGradient_Table.h" 10 #include "SkRadialGradient_Table.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // make sure our table is insync with our current #define for kSQRT_TABLE_SI ZE 154 // make sure our table is insync with our current #define for kSQRT_TABLE_SI ZE
155 SkASSERT(sizeof(gSqrt8Table) == kSQRT_TABLE_SIZE); 155 SkASSERT(sizeof(gSqrt8Table) == kSQRT_TABLE_SIZE);
156 156
157 rad_to_unit_matrix(center, radius, &fPtsToUnit); 157 rad_to_unit_matrix(center, radius, &fPtsToUnit);
158 } 158 }
159 159
160 size_t SkRadialGradient::contextSize() const { 160 size_t SkRadialGradient::contextSize() const {
161 return sizeof(RadialGradientContext); 161 return sizeof(RadialGradientContext);
162 } 162 }
163 163
164 SkShader::Context* SkRadialGradient::createContext(const SkBitmap& device, const SkPaint& paint, 164 SkShader::Context* SkRadialGradient::createContext(const ContextRec& rec, void* storage) const {
165 const SkMatrix& matrix, void* storage) const { 165 if (!this->validContext(rec)) {
166 if (!this->validContext(device, paint, matrix)) {
167 return NULL; 166 return NULL;
168 } 167 }
169 168
170 return SkNEW_PLACEMENT_ARGS(storage, RadialGradientContext, (*this, device, paint, matrix)); 169 return SkNEW_PLACEMENT_ARGS(storage, RadialGradientContext, (*this, rec));
171 } 170 }
172 171
173 SkRadialGradient::RadialGradientContext::RadialGradientContext( 172 SkRadialGradient::RadialGradientContext::RadialGradientContext(
174 const SkRadialGradient& shader, const SkBitmap& device, 173 const SkRadialGradient& shader, const ContextRec& rec)
175 const SkPaint& paint, const SkMatrix& matrix) 174 : INHERITED(shader, rec) {}
176 : INHERITED(shader, device, paint, matrix) {}
177 175
178 void SkRadialGradient::RadialGradientContext::shadeSpan16(int x, int y, uint16_t * dstCParam, 176 void SkRadialGradient::RadialGradientContext::shadeSpan16(int x, int y, uint16_t * dstCParam,
179 int count) { 177 int count) {
180 SkASSERT(count > 0); 178 SkASSERT(count > 0);
181 179
182 const SkRadialGradient& radialGradient = static_cast<const SkRadialGradient& >(fShader); 180 const SkRadialGradient& radialGradient = static_cast<const SkRadialGradient& >(fShader);
183 181
184 uint16_t* SK_RESTRICT dstC = dstCParam; 182 uint16_t* SK_RESTRICT dstC = dstCParam;
185 183
186 SkPoint srcPt; 184 SkPoint srcPt;
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 str->appendScalar(fCenter.fY); 593 str->appendScalar(fCenter.fY);
596 str->append(") radius: "); 594 str->append(") radius: ");
597 str->appendScalar(fRadius); 595 str->appendScalar(fRadius);
598 str->append(" "); 596 str->append(" ");
599 597
600 this->INHERITED::toString(str); 598 this->INHERITED::toString(str);
601 599
602 str->append(")"); 600 str->append(")");
603 } 601 }
604 #endif 602 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkRadialGradient.h ('k') | src/effects/gradients/SkSweepGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698