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 "SkSweepGradient.h" | 8 #include "SkSweepGradient.h" |
9 | 9 |
10 static SkMatrix translate(SkScalar dx, SkScalar dy) { | 10 static SkMatrix translate(SkScalar dx, SkScalar dy) { |
(...skipping 23 matching lines...) Expand all Loading... |
34 if (!desc.unflatten(buffer)) { | 34 if (!desc.unflatten(buffer)) { |
35 return nullptr; | 35 return nullptr; |
36 } | 36 } |
37 const SkPoint center = buffer.readPoint(); | 37 const SkPoint center = buffer.readPoint(); |
38 return SkGradientShader::MakeSweep(center.x(), center.y(), desc.fColors, des
c.fPos, | 38 return SkGradientShader::MakeSweep(center.x(), center.y(), desc.fColors, des
c.fPos, |
39 desc.fCount, desc.fGradFlags, desc.fLocal
Matrix); | 39 desc.fCount, desc.fGradFlags, desc.fLocal
Matrix); |
40 } | 40 } |
41 | 41 |
42 void SkSweepGradient::flatten(SkWriteBuffer& buffer) const { | 42 void SkSweepGradient::flatten(SkWriteBuffer& buffer) const { |
43 this->INHERITED::flatten(buffer); | 43 this->INHERITED::flatten(buffer); |
44 buffer.writePoint(fCenter); | 44 buffer.writePoint("fCenter", fCenter); |
45 } | 45 } |
46 | 46 |
47 size_t SkSweepGradient::onContextSize(const ContextRec&) const { | 47 size_t SkSweepGradient::onContextSize(const ContextRec&) const { |
48 return sizeof(SweepGradientContext); | 48 return sizeof(SweepGradientContext); |
49 } | 49 } |
50 | 50 |
51 SkShader::Context* SkSweepGradient::onCreateContext(const ContextRec& rec, void*
storage) const { | 51 SkShader::Context* SkSweepGradient::onCreateContext(const ContextRec& rec, void*
storage) const { |
52 return new (storage) SweepGradientContext(*this, rec); | 52 return new (storage) SweepGradientContext(*this, rec); |
53 } | 53 } |
54 | 54 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 str->appendScalar(fCenter.fX); | 260 str->appendScalar(fCenter.fX); |
261 str->append(", "); | 261 str->append(", "); |
262 str->appendScalar(fCenter.fY); | 262 str->appendScalar(fCenter.fY); |
263 str->append(") "); | 263 str->append(") "); |
264 | 264 |
265 this->INHERITED::toString(str); | 265 this->INHERITED::toString(str); |
266 | 266 |
267 str->append(")"); | 267 str->append(")"); |
268 } | 268 } |
269 #endif | 269 #endif |
OLD | NEW |