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 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 SkShader::GradientType SkSweepGradient::asAGradient(GradientInfo* info) const { | 36 SkShader::GradientType SkSweepGradient::asAGradient(GradientInfo* info) const { |
37 if (info) { | 37 if (info) { |
38 commonAsAGradient(info); | 38 commonAsAGradient(info); |
39 info->fPoint[0] = fCenter; | 39 info->fPoint[0] = fCenter; |
40 } | 40 } |
41 return kSweep_GradientType; | 41 return kSweep_GradientType; |
42 } | 42 } |
43 | 43 |
| 44 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
44 SkSweepGradient::SkSweepGradient(SkReadBuffer& buffer) | 45 SkSweepGradient::SkSweepGradient(SkReadBuffer& buffer) |
45 : INHERITED(buffer), | 46 : INHERITED(buffer), |
46 fCenter(buffer.readPoint()) { | 47 fCenter(buffer.readPoint()) { |
47 } | 48 } |
| 49 #endif |
| 50 |
| 51 SkFlattenable* SkSweepGradient::CreateProc(SkReadBuffer& buffer) { |
| 52 DescriptorScope desc; |
| 53 if (!desc.unflatten(buffer)) { |
| 54 return NULL; |
| 55 } |
| 56 const SkPoint center = buffer.readPoint(); |
| 57 return SkGradientShader::CreateSweep(center.x(), center.y(), desc.fColors, d
esc.fPos, |
| 58 desc.fCount, desc.fGradFlags, desc.fLoc
alMatrix); |
| 59 } |
48 | 60 |
49 void SkSweepGradient::flatten(SkWriteBuffer& buffer) const { | 61 void SkSweepGradient::flatten(SkWriteBuffer& buffer) const { |
50 this->INHERITED::flatten(buffer); | 62 this->INHERITED::flatten(buffer); |
51 buffer.writePoint(fCenter); | 63 buffer.writePoint(fCenter); |
52 } | 64 } |
53 | 65 |
54 size_t SkSweepGradient::contextSize() const { | 66 size_t SkSweepGradient::contextSize() const { |
55 return sizeof(SweepGradientContext); | 67 return sizeof(SweepGradientContext); |
56 } | 68 } |
57 | 69 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 str->appendScalar(fCenter.fX); | 334 str->appendScalar(fCenter.fX); |
323 str->append(", "); | 335 str->append(", "); |
324 str->appendScalar(fCenter.fY); | 336 str->appendScalar(fCenter.fY); |
325 str->append(") "); | 337 str->append(") "); |
326 | 338 |
327 this->INHERITED::toString(str); | 339 this->INHERITED::toString(str); |
328 | 340 |
329 str->append(")"); | 341 str->append(")"); |
330 } | 342 } |
331 #endif | 343 #endif |
OLD | NEW |