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

Side by Side Diff: src/effects/gradients/SkSweepGradient.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 "SkSweepGradient.h" 9 #include "SkSweepGradient.h"
10 10
11 SkSweepGradient::SkSweepGradient(SkScalar cx, SkScalar cy, const SkColor colors[ ], 11 SkSweepGradient::SkSweepGradient(SkScalar cx, SkScalar cy,
12 const SkScalar pos[], int count, SkUnitMapper* mapper) 12 const Descriptor& desc)
13 : SkGradientShaderBase(colors, pos, count, SkShader::kClamp_TileMode, mapper), 13 : SkGradientShaderBase(desc),
14 fCenter(SkPoint::Make(cx, cy)) 14 fCenter(SkPoint::Make(cx, cy))
15 { 15 {
16 fPtsToUnit.setTranslate(-cx, -cy); 16 fPtsToUnit.setTranslate(-cx, -cy);
17
18 // overwrite the tilemode to a canonical value (since sweep ignores it)
19 fTileMode = SkShader::kClamp_TileMode;
17 } 20 }
18 21
19 SkShader::BitmapType SkSweepGradient::asABitmap(SkBitmap* bitmap, 22 SkShader::BitmapType SkSweepGradient::asABitmap(SkBitmap* bitmap,
20 SkMatrix* matrix, SkShader::TileMode* xy) const { 23 SkMatrix* matrix, SkShader::TileMode* xy) const {
21 if (bitmap) { 24 if (bitmap) {
22 this->getGradientTableBitmap(bitmap); 25 this->getGradientTableBitmap(bitmap);
23 } 26 }
24 if (matrix) { 27 if (matrix) {
25 *matrix = fPtsToUnit; 28 *matrix = fPtsToUnit;
26 } 29 }
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 str->appendScalar(fCenter.fX); 508 str->appendScalar(fCenter.fX);
506 str->append(", "); 509 str->append(", ");
507 str->appendScalar(fCenter.fY); 510 str->appendScalar(fCenter.fY);
508 str->append(") "); 511 str->append(") ");
509 512
510 this->INHERITED::toString(str); 513 this->INHERITED::toString(str);
511 514
512 str->append(")"); 515 str->append(")");
513 } 516 }
514 #endif 517 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698