OLD | NEW |
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 218 |
219 int index = fi >> (16 - kCache16Bits); | 219 int index = fi >> (16 - kCache16Bits); |
220 *dstC++ = cache[toggle + index]; | 220 *dstC++ = cache[toggle + index]; |
221 toggle = next_dither_toggle16(toggle); | 221 toggle = next_dither_toggle16(toggle); |
222 | 222 |
223 dstX += SK_Scalar1; | 223 dstX += SK_Scalar1; |
224 } while (--count != 0); | 224 } while (--count != 0); |
225 } | 225 } |
226 } | 226 } |
227 | 227 |
228 SkShader::BitmapType SkRadialGradient::asABitmap(SkBitmap* bitmap, | |
229 SkMatrix* matrix, SkShader::TileMode* xy) const { | |
230 if (bitmap) { | |
231 this->getGradientTableBitmap(bitmap); | |
232 } | |
233 if (matrix) { | |
234 matrix->setScale(SkIntToScalar(kCache32Count), | |
235 SkIntToScalar(kCache32Count)); | |
236 matrix->preConcat(fPtsToUnit); | |
237 } | |
238 if (xy) { | |
239 xy[0] = fTileMode; | |
240 xy[1] = kClamp_TileMode; | |
241 } | |
242 return kRadial_BitmapType; | |
243 } | |
244 | |
245 SkShader::GradientType SkRadialGradient::asAGradient(GradientInfo* info) const { | 228 SkShader::GradientType SkRadialGradient::asAGradient(GradientInfo* info) const { |
246 if (info) { | 229 if (info) { |
247 commonAsAGradient(info); | 230 commonAsAGradient(info); |
248 info->fPoint[0] = fCenter; | 231 info->fPoint[0] = fCenter; |
249 info->fRadius[0] = fRadius; | 232 info->fRadius[0] = fRadius; |
250 } | 233 } |
251 return kRadial_GradientType; | 234 return kRadial_GradientType; |
252 } | 235 } |
253 | 236 |
254 SkFlattenable* SkRadialGradient::CreateProc(SkReadBuffer& buffer) { | 237 SkFlattenable* SkRadialGradient::CreateProc(SkReadBuffer& buffer) { |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 str->appendScalar(fCenter.fY); | 561 str->appendScalar(fCenter.fY); |
579 str->append(") radius: "); | 562 str->append(") radius: "); |
580 str->appendScalar(fRadius); | 563 str->appendScalar(fRadius); |
581 str->append(" "); | 564 str->append(" "); |
582 | 565 |
583 this->INHERITED::toString(str); | 566 this->INHERITED::toString(str); |
584 | 567 |
585 str->append(")"); | 568 str->append(")"); |
586 } | 569 } |
587 #endif | 570 #endif |
OLD | NEW |