OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
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 "SkPathEffect.h" | 9 #include "SkPathEffect.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
11 #include "SkFlattenableBuffers.h" | 11 #include "SkReadBuffer.h" |
| 12 #include "SkWriteBuffer.h" |
12 | 13 |
13 /////////////////////////////////////////////////////////////////////////////// | 14 /////////////////////////////////////////////////////////////////////////////// |
14 | 15 |
15 void SkPathEffect::computeFastBounds(SkRect* dst, const SkRect& src) const { | 16 void SkPathEffect::computeFastBounds(SkRect* dst, const SkRect& src) const { |
16 *dst = src; | 17 *dst = src; |
17 } | 18 } |
18 | 19 |
19 bool SkPathEffect::asPoints(PointData* results, const SkPath& src, | 20 bool SkPathEffect::asPoints(PointData* results, const SkPath& src, |
20 const SkStrokeRec&, const SkMatrix&, const SkRect*) const { | 21 const SkStrokeRec&, const SkMatrix&, const SkRect*) const { |
21 return false; | 22 return false; |
(...skipping 10 matching lines...) Expand all Loading... |
32 } | 33 } |
33 | 34 |
34 SkPairPathEffect::~SkPairPathEffect() { | 35 SkPairPathEffect::~SkPairPathEffect() { |
35 SkSafeUnref(fPE0); | 36 SkSafeUnref(fPE0); |
36 SkSafeUnref(fPE1); | 37 SkSafeUnref(fPE1); |
37 } | 38 } |
38 | 39 |
39 /* | 40 /* |
40 Format: [oe0-factory][pe1-factory][pe0-size][pe0-data][pe1-data] | 41 Format: [oe0-factory][pe1-factory][pe0-size][pe0-data][pe1-data] |
41 */ | 42 */ |
42 void SkPairPathEffect::flatten(SkFlattenableWriteBuffer& buffer) const { | 43 void SkPairPathEffect::flatten(SkWriteBuffer& buffer) const { |
43 this->INHERITED::flatten(buffer); | 44 this->INHERITED::flatten(buffer); |
44 buffer.writeFlattenable(fPE0); | 45 buffer.writeFlattenable(fPE0); |
45 buffer.writeFlattenable(fPE1); | 46 buffer.writeFlattenable(fPE1); |
46 } | 47 } |
47 | 48 |
48 SkPairPathEffect::SkPairPathEffect(SkFlattenableReadBuffer& buffer) { | 49 SkPairPathEffect::SkPairPathEffect(SkReadBuffer& buffer) { |
49 fPE0 = buffer.readPathEffect(); | 50 fPE0 = buffer.readPathEffect(); |
50 fPE1 = buffer.readPathEffect(); | 51 fPE1 = buffer.readPathEffect(); |
51 // either of these may fail, so we have to check for nulls later on | 52 // either of these may fail, so we have to check for nulls later on |
52 } | 53 } |
53 | 54 |
54 /////////////////////////////////////////////////////////////////////////////// | 55 /////////////////////////////////////////////////////////////////////////////// |
55 | 56 |
56 bool SkComposePathEffect::filterPath(SkPath* dst, const SkPath& src, | 57 bool SkComposePathEffect::filterPath(SkPath* dst, const SkPath& src, |
57 SkStrokeRec* rec, const SkRect* cullRect) const { | 58 SkStrokeRec* rec, const SkRect* cullRect) const { |
58 // we may have failed to unflatten these, so we have to check | 59 // we may have failed to unflatten these, so we have to check |
(...skipping 11 matching lines...) Expand all Loading... |
70 } | 71 } |
71 | 72 |
72 /////////////////////////////////////////////////////////////////////////////// | 73 /////////////////////////////////////////////////////////////////////////////// |
73 | 74 |
74 bool SkSumPathEffect::filterPath(SkPath* dst, const SkPath& src, | 75 bool SkSumPathEffect::filterPath(SkPath* dst, const SkPath& src, |
75 SkStrokeRec* rec, const SkRect* cullRect) const { | 76 SkStrokeRec* rec, const SkRect* cullRect) const { |
76 // use bit-or so that we always call both, even if the first one succeeds | 77 // use bit-or so that we always call both, even if the first one succeeds |
77 return fPE0->filterPath(dst, src, rec, cullRect) | | 78 return fPE0->filterPath(dst, src, rec, cullRect) | |
78 fPE1->filterPath(dst, src, rec, cullRect); | 79 fPE1->filterPath(dst, src, rec, cullRect); |
79 } | 80 } |
OLD | NEW |