| 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 "SkSweepGradient.h" | 9 #include "SkSweepGradient.h" |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 SkShader::GradientType SkSweepGradient::asAGradient(GradientInfo* info) const { | 37 SkShader::GradientType SkSweepGradient::asAGradient(GradientInfo* info) const { |
| 38 if (info) { | 38 if (info) { |
| 39 commonAsAGradient(info); | 39 commonAsAGradient(info); |
| 40 info->fPoint[0] = fCenter; | 40 info->fPoint[0] = fCenter; |
| 41 } | 41 } |
| 42 return kSweep_GradientType; | 42 return kSweep_GradientType; |
| 43 } | 43 } |
| 44 | 44 |
| 45 SkSweepGradient::SkSweepGradient(SkFlattenableReadBuffer& buffer) | 45 SkSweepGradient::SkSweepGradient(SkReadBuffer& buffer) |
| 46 : INHERITED(buffer), | 46 : INHERITED(buffer), |
| 47 fCenter(buffer.readPoint()) { | 47 fCenter(buffer.readPoint()) { |
| 48 } | 48 } |
| 49 | 49 |
| 50 void SkSweepGradient::flatten(SkFlattenableWriteBuffer& buffer) const { | 50 void SkSweepGradient::flatten(SkWriteBuffer& buffer) const { |
| 51 this->INHERITED::flatten(buffer); | 51 this->INHERITED::flatten(buffer); |
| 52 buffer.writePoint(fCenter); | 52 buffer.writePoint(fCenter); |
| 53 } | 53 } |
| 54 | 54 |
| 55 // returns angle in a circle [0..2PI) -> [0..255] | 55 // returns angle in a circle [0..2PI) -> [0..255] |
| 56 static unsigned SkATan2_255(float y, float x) { | 56 static unsigned SkATan2_255(float y, float x) { |
| 57 // static const float g255Over2PI = 255 / (2 * SK_ScalarPI); | 57 // static const float g255Over2PI = 255 / (2 * SK_ScalarPI); |
| 58 static const float g255Over2PI = 40.584510488433314f; | 58 static const float g255Over2PI = 40.584510488433314f; |
| 59 | 59 |
| 60 float result = sk_float_atan2(y, x); | 60 float result = sk_float_atan2(y, x); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 str->appendScalar(fCenter.fX); | 283 str->appendScalar(fCenter.fX); |
| 284 str->append(", "); | 284 str->append(", "); |
| 285 str->appendScalar(fCenter.fY); | 285 str->appendScalar(fCenter.fY); |
| 286 str->append(") "); | 286 str->append(") "); |
| 287 | 287 |
| 288 this->INHERITED::toString(str); | 288 this->INHERITED::toString(str); |
| 289 | 289 |
| 290 str->append(")"); | 290 str->append(")"); |
| 291 } | 291 } |
| 292 #endif | 292 #endif |
| OLD | NEW |