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

Side by Side Diff: src/effects/gradients/SkSweepGradient.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
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 "SkSweepGradient.h" 9 #include "SkSweepGradient.h"
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 void SkSweepGradient::flatten(SkWriteBuffer& buffer) const { 50 void SkSweepGradient::flatten(SkWriteBuffer& buffer) const {
51 this->INHERITED::flatten(buffer); 51 this->INHERITED::flatten(buffer);
52 buffer.writePoint(fCenter); 52 buffer.writePoint(fCenter);
53 } 53 }
54 54
55 size_t SkSweepGradient::contextSize() const { 55 size_t SkSweepGradient::contextSize() const {
56 return sizeof(SweepGradientContext); 56 return sizeof(SweepGradientContext);
57 } 57 }
58 58
59 SkShader::Context* SkSweepGradient::createContext(const ContextRec& rec, void* s torage) const { 59 SkShader::Context* SkSweepGradient::onCreateContext(const ContextRec& rec, void* storage) const {
60 if (!this->validContext(rec)) {
61 return NULL;
62 }
63
64 return SkNEW_PLACEMENT_ARGS(storage, SweepGradientContext, (*this, rec)); 60 return SkNEW_PLACEMENT_ARGS(storage, SweepGradientContext, (*this, rec));
65 } 61 }
66 62
67 SkSweepGradient::SweepGradientContext::SweepGradientContext( 63 SkSweepGradient::SweepGradientContext::SweepGradientContext(
68 const SkSweepGradient& shader, const ContextRec& rec) 64 const SkSweepGradient& shader, const ContextRec& rec)
69 : INHERITED(shader, rec) {} 65 : INHERITED(shader, rec) {}
70 66
71 // returns angle in a circle [0..2PI) -> [0..255] 67 // returns angle in a circle [0..2PI) -> [0..255]
72 static unsigned SkATan2_255(float y, float x) { 68 static unsigned SkATan2_255(float y, float x) {
73 // static const float g255Over2PI = 255 / (2 * SK_ScalarPI); 69 // static const float g255Over2PI = 255 / (2 * SK_ScalarPI);
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 str->appendScalar(fCenter.fX); 305 str->appendScalar(fCenter.fX);
310 str->append(", "); 306 str->append(", ");
311 str->appendScalar(fCenter.fY); 307 str->appendScalar(fCenter.fY);
312 str->append(") "); 308 str->append(") ");
313 309
314 this->INHERITED::toString(str); 310 this->INHERITED::toString(str);
315 311
316 str->append(")"); 312 str->append(")");
317 } 313 }
318 #endif 314 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkSweepGradient.h ('k') | src/effects/gradients/SkTwoPointConicalGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698