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

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

Issue 15733007: use Descriptor struct to encapsulate all the common paramaeters between our various gradient types.… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 "SkTwoPointConicalGradient.h" 9 #include "SkTwoPointConicalGradient.h"
10 10
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 void SkTwoPointConicalGradient::init() { 170 void SkTwoPointConicalGradient::init() {
171 fRec.init(fCenter1, fRadius1, fCenter2, fRadius2); 171 fRec.init(fCenter1, fRadius1, fCenter2, fRadius2);
172 fPtsToUnit.reset(); 172 fPtsToUnit.reset();
173 } 173 }
174 174
175 ///////////////////////////////////////////////////////////////////// 175 /////////////////////////////////////////////////////////////////////
176 176
177 SkTwoPointConicalGradient::SkTwoPointConicalGradient( 177 SkTwoPointConicalGradient::SkTwoPointConicalGradient(
178 const SkPoint& start, SkScalar startRadius, 178 const SkPoint& start, SkScalar startRadius,
179 const SkPoint& end, SkScalar endRadius, 179 const SkPoint& end, SkScalar endRadius,
180 const SkColor colors[], const SkScalar pos[], 180 const Descriptor& desc)
181 int colorCount, SkShader::TileMode mode, 181 : SkGradientShaderBase(desc),
182 SkUnitMapper* mapper)
183 : SkGradientShaderBase(colors, pos, colorCount, mode, mapper),
184 fCenter1(start), 182 fCenter1(start),
185 fCenter2(end), 183 fCenter2(end),
186 fRadius1(startRadius), 184 fRadius1(startRadius),
187 fRadius2(endRadius) { 185 fRadius2(endRadius) {
188 // this is degenerate, and should be caught by our caller 186 // this is degenerate, and should be caught by our caller
189 SkASSERT(fCenter1 != fCenter2 || fRadius1 != fRadius2); 187 SkASSERT(fCenter1 != fCenter2 || fRadius1 != fRadius2);
190 this->init(); 188 this->init();
191 } 189 }
192 190
193 bool SkTwoPointConicalGradient::isOpaque() const { 191 bool SkTwoPointConicalGradient::isOpaque() const {
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 str->appendScalar(fCenter2.fY); 756 str->appendScalar(fCenter2.fY);
759 str->append(") radius2: "); 757 str->append(") radius2: ");
760 str->appendScalar(fRadius2); 758 str->appendScalar(fRadius2);
761 str->append(" "); 759 str->append(" ");
762 760
763 this->INHERITED::toString(str); 761 this->INHERITED::toString(str);
764 762
765 str->append(")"); 763 str->append(")");
766 } 764 }
767 #endif 765 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698