OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkTwoPointConicalGradient.h" | 8 #include "SkTwoPointConicalGradient.h" |
9 | 9 |
10 static int valid_divide(float numer, float denom, float* ratio) { | 10 static int valid_divide(float numer, float denom, float* ratio) { |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 commonAsAGradient(info); | 303 commonAsAGradient(info); |
304 info->fPoint[0] = fCenter1; | 304 info->fPoint[0] = fCenter1; |
305 info->fPoint[1] = fCenter2; | 305 info->fPoint[1] = fCenter2; |
306 info->fRadius[0] = fRadius1; | 306 info->fRadius[0] = fRadius1; |
307 info->fRadius[1] = fRadius2; | 307 info->fRadius[1] = fRadius2; |
308 } | 308 } |
309 return kConical_GradientType; | 309 return kConical_GradientType; |
310 } | 310 } |
311 | 311 |
312 SkTwoPointConicalGradient::SkTwoPointConicalGradient( | 312 SkTwoPointConicalGradient::SkTwoPointConicalGradient( |
313 SkFlattenableReadBuffer& buffer) | 313 SkReadBuffer& buffer) |
314 : INHERITED(buffer), | 314 : INHERITED(buffer), |
315 fCenter1(buffer.readPoint()), | 315 fCenter1(buffer.readPoint()), |
316 fCenter2(buffer.readPoint()), | 316 fCenter2(buffer.readPoint()), |
317 fRadius1(buffer.readScalar()), | 317 fRadius1(buffer.readScalar()), |
318 fRadius2(buffer.readScalar()) { | 318 fRadius2(buffer.readScalar()) { |
319 this->init(); | 319 this->init(); |
320 }; | 320 }; |
321 | 321 |
322 void SkTwoPointConicalGradient::flatten( | 322 void SkTwoPointConicalGradient::flatten( |
323 SkFlattenableWriteBuffer& buffer) const { | 323 SkWriteBuffer& buffer) const { |
324 this->INHERITED::flatten(buffer); | 324 this->INHERITED::flatten(buffer); |
325 buffer.writePoint(fCenter1); | 325 buffer.writePoint(fCenter1); |
326 buffer.writePoint(fCenter2); | 326 buffer.writePoint(fCenter2); |
327 buffer.writeScalar(fRadius1); | 327 buffer.writeScalar(fRadius1); |
328 buffer.writeScalar(fRadius2); | 328 buffer.writeScalar(fRadius2); |
329 } | 329 } |
330 | 330 |
331 ///////////////////////////////////////////////////////////////////// | 331 ///////////////////////////////////////////////////////////////////// |
332 | 332 |
333 #if SK_SUPPORT_GPU | 333 #if SK_SUPPORT_GPU |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 str->appendScalar(fCenter2.fY); | 728 str->appendScalar(fCenter2.fY); |
729 str->append(") radius2: "); | 729 str->append(") radius2: "); |
730 str->appendScalar(fRadius2); | 730 str->appendScalar(fRadius2); |
731 str->append(" "); | 731 str->append(" "); |
732 | 732 |
733 this->INHERITED::toString(str); | 733 this->INHERITED::toString(str); |
734 | 734 |
735 str->append(")"); | 735 str->append(")"); |
736 } | 736 } |
737 #endif | 737 #endif |
OLD | NEW |