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

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

Issue 261773005: Remove SkShader virtual method validContext (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: correctly call shaderA/B in composeshader 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/SkTwoPointRadialGradient.h ('k') | no next file » | 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 "SkTwoPointRadialGradient.h" 9 #include "SkTwoPointRadialGradient.h"
10 10
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 info->fRadius[0] = fRadius1; 217 info->fRadius[0] = fRadius1;
218 info->fRadius[1] = fRadius2; 218 info->fRadius[1] = fRadius2;
219 } 219 }
220 return kRadial2_GradientType; 220 return kRadial2_GradientType;
221 } 221 }
222 222
223 size_t SkTwoPointRadialGradient::contextSize() const { 223 size_t SkTwoPointRadialGradient::contextSize() const {
224 return sizeof(TwoPointRadialGradientContext); 224 return sizeof(TwoPointRadialGradientContext);
225 } 225 }
226 226
227 bool SkTwoPointRadialGradient::validContext(const ContextRec& rec, SkMatrix* tot alInverse) const { 227 SkShader::Context* SkTwoPointRadialGradient::onCreateContext(const ContextRec& r ec,
228 void* storage) cons t {
228 // For now, we might have divided by zero, so detect that. 229 // For now, we might have divided by zero, so detect that.
229 if (0 == fDiffRadius) { 230 if (0 == fDiffRadius) {
230 return false;
231 }
232
233 return this->INHERITED::validContext(rec, totalInverse);
234 }
235
236 SkShader::Context* SkTwoPointRadialGradient::createContext(const ContextRec& rec ,
237 void* storage) const {
238 if (!this->validContext(rec, NULL)) {
239 return NULL; 231 return NULL;
240 } 232 }
241
242 return SkNEW_PLACEMENT_ARGS(storage, TwoPointRadialGradientContext, (*this, rec)); 233 return SkNEW_PLACEMENT_ARGS(storage, TwoPointRadialGradientContext, (*this, rec));
243 } 234 }
244 235
245 SkTwoPointRadialGradient::TwoPointRadialGradientContext::TwoPointRadialGradientC ontext( 236 SkTwoPointRadialGradient::TwoPointRadialGradientContext::TwoPointRadialGradientC ontext(
246 const SkTwoPointRadialGradient& shader, const ContextRec& rec) 237 const SkTwoPointRadialGradient& shader, const ContextRec& rec)
247 : INHERITED(shader, rec) 238 : INHERITED(shader, rec)
248 { 239 {
249 // we don't have a span16 proc 240 // we don't have a span16 proc
250 fFlags &= ~kHasSpan16_Flag; 241 fFlags &= ~kHasSpan16_Flag;
251 } 242 }
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 } 692 }
702 693
703 #else 694 #else
704 695
705 GrEffectRef* SkTwoPointRadialGradient::asNewEffect(GrContext*, const SkPaint&) c onst { 696 GrEffectRef* SkTwoPointRadialGradient::asNewEffect(GrContext*, const SkPaint&) c onst {
706 SkDEBUGFAIL("Should not call in GPU-less build"); 697 SkDEBUGFAIL("Should not call in GPU-less build");
707 return NULL; 698 return NULL;
708 } 699 }
709 700
710 #endif 701 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkTwoPointRadialGradient.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698