| 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 "SkRadialGradient.h" | 8 #include "SkRadialGradient.h" |
| 9 #include "SkNx.h" | 9 #include "SkNx.h" |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 return nullptr; | 66 return nullptr; |
| 67 } | 67 } |
| 68 const SkPoint center = buffer.readPoint(); | 68 const SkPoint center = buffer.readPoint(); |
| 69 const SkScalar radius = buffer.readScalar(); | 69 const SkScalar radius = buffer.readScalar(); |
| 70 return SkGradientShader::MakeRadial(center, radius, desc.fColors, desc.fPos,
desc.fCount, | 70 return SkGradientShader::MakeRadial(center, radius, desc.fColors, desc.fPos,
desc.fCount, |
| 71 desc.fTileMode, desc.fGradFlags, desc.fL
ocalMatrix); | 71 desc.fTileMode, desc.fGradFlags, desc.fL
ocalMatrix); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void SkRadialGradient::flatten(SkWriteBuffer& buffer) const { | 74 void SkRadialGradient::flatten(SkWriteBuffer& buffer) const { |
| 75 this->INHERITED::flatten(buffer); | 75 this->INHERITED::flatten(buffer); |
| 76 buffer.writePoint(fCenter); | 76 buffer.writePoint("fCenter", fCenter); |
| 77 buffer.writeScalar(fRadius); | 77 buffer.writeScalar("fRadius", fRadius); |
| 78 } | 78 } |
| 79 | 79 |
| 80 namespace { | 80 namespace { |
| 81 | 81 |
| 82 inline bool radial_completely_pinned(SkScalar fx, SkScalar dx, SkScalar fy, SkSc
alar dy) { | 82 inline bool radial_completely_pinned(SkScalar fx, SkScalar dx, SkScalar fy, SkSc
alar dy) { |
| 83 // fast, overly-conservative test: checks unit square instead of unit circle | 83 // fast, overly-conservative test: checks unit square instead of unit circle |
| 84 bool xClamped = (fx >= 1 && dx >= 0) || (fx <= -1 && dx <= 0); | 84 bool xClamped = (fx >= 1 && dx >= 0) || (fx <= -1 && dx <= 0); |
| 85 bool yClamped = (fy >= 1 && dy >= 0) || (fy <= -1 && dy <= 0); | 85 bool yClamped = (fy >= 1 && dy >= 0) || (fy <= -1 && dy <= 0); |
| 86 return xClamped || yClamped; | 86 return xClamped || yClamped; |
| 87 } | 87 } |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 str->appendScalar(fCenter.fY); | 373 str->appendScalar(fCenter.fY); |
| 374 str->append(") radius: "); | 374 str->append(") radius: "); |
| 375 str->appendScalar(fRadius); | 375 str->appendScalar(fRadius); |
| 376 str->append(" "); | 376 str->append(" "); |
| 377 | 377 |
| 378 this->INHERITED::toString(str); | 378 this->INHERITED::toString(str); |
| 379 | 379 |
| 380 str->append(")"); | 380 str->append(")"); |
| 381 } | 381 } |
| 382 #endif | 382 #endif |
| OLD | NEW |