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

Side by Side Diff: src/effects/gradients/SkRadialGradient.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 "SkRadialGradient.h" 9 #include "SkRadialGradient.h"
10 #include "SkRadialGradient_Table.h" 10 #include "SkRadialGradient_Table.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 *dstC++ = cache[toggle + (fi >> SkGradientShaderBase::kCache16Shift)]; 146 *dstC++ = cache[toggle + (fi >> SkGradientShaderBase::kCache16Shift)];
147 toggle = next_dither_toggle16(toggle); 147 toggle = next_dither_toggle16(toggle);
148 } while (--count != 0); 148 } while (--count != 0);
149 } 149 }
150 150
151 } 151 }
152 152
153 ///////////////////////////////////////////////////////////////////// 153 /////////////////////////////////////////////////////////////////////
154 154
155 SkRadialGradient::SkRadialGradient(const SkPoint& center, SkScalar radius, 155 SkRadialGradient::SkRadialGradient(const SkPoint& center, SkScalar radius,
156 const SkColor colors[], const SkScalar pos[], int colorCount, 156 const Descriptor& desc)
157 SkShader::TileMode mode, SkUnitMapper* mapper) 157 : SkGradientShaderBase(desc),
158 : SkGradientShaderBase(colors, pos, colorCount, mode, mapper),
159 fCenter(center), 158 fCenter(center),
160 fRadius(radius) 159 fRadius(radius)
161 { 160 {
162 // make sure our table is insync with our current #define for kSQRT_TABLE_SI ZE 161 // make sure our table is insync with our current #define for kSQRT_TABLE_SI ZE
163 SkASSERT(sizeof(gSqrt8Table) == kSQRT_TABLE_SIZE); 162 SkASSERT(sizeof(gSqrt8Table) == kSQRT_TABLE_SIZE);
164 163
165 rad_to_unit_matrix(center, radius, &fPtsToUnit); 164 rad_to_unit_matrix(center, radius, &fPtsToUnit);
166 } 165 }
167 166
168 void SkRadialGradient::shadeSpan16(int x, int y, uint16_t* dstCParam, 167 void SkRadialGradient::shadeSpan16(int x, int y, uint16_t* dstCParam,
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 str->appendScalar(fCenter.fY); 599 str->appendScalar(fCenter.fY);
601 str->append(") radius: "); 600 str->append(") radius: ");
602 str->appendScalar(fRadius); 601 str->appendScalar(fRadius);
603 str->append(" "); 602 str->append(" ");
604 603
605 this->INHERITED::toString(str); 604 this->INHERITED::toString(str);
606 605
607 str->append(")"); 606 str->append(")");
608 } 607 }
609 #endif 608 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698