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 | 9 |
10 #include "Sk2DPathEffect.h" | 10 #include "Sk2DPathEffect.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 dst->moveTo(dstP[0]); | 105 dst->moveTo(dstP[0]); |
106 dst->lineTo(dstP[1]); | 106 dst->lineTo(dstP[1]); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 SkFlattenable* SkLine2DPathEffect::CreateProc(SkReadBuffer& buffer) { | 110 SkFlattenable* SkLine2DPathEffect::CreateProc(SkReadBuffer& buffer) { |
111 SkMatrix matrix; | 111 SkMatrix matrix; |
112 buffer.readMatrix(&matrix); | 112 buffer.readMatrix(&matrix); |
113 SkScalar width = buffer.readScalar(); | 113 SkScalar width = buffer.readScalar(); |
114 return SkLine2DPathEffect::Create(width, matrix); | 114 return SkLine2DPathEffect::Make(width, matrix).release(); |
115 } | 115 } |
116 | 116 |
117 void SkLine2DPathEffect::flatten(SkWriteBuffer &buffer) const { | 117 void SkLine2DPathEffect::flatten(SkWriteBuffer &buffer) const { |
118 buffer.writeMatrix(this->getMatrix()); | 118 buffer.writeMatrix(this->getMatrix()); |
119 buffer.writeScalar(fWidth); | 119 buffer.writeScalar(fWidth); |
120 } | 120 } |
121 | 121 |
122 | 122 |
123 #ifndef SK_IGNORE_TO_STRING | 123 #ifndef SK_IGNORE_TO_STRING |
124 void SkLine2DPathEffect::toString(SkString* str) const { | 124 void SkLine2DPathEffect::toString(SkString* str) const { |
125 str->appendf("SkLine2DPathEffect: ("); | 125 str->appendf("SkLine2DPathEffect: ("); |
126 this->INHERITED::toString(str); | 126 this->INHERITED::toString(str); |
127 str->appendf("width: %f", fWidth); | 127 str->appendf("width: %f", fWidth); |
128 str->appendf(")"); | 128 str->appendf(")"); |
129 } | 129 } |
130 #endif | 130 #endif |
131 | 131 |
132 /////////////////////////////////////////////////////////////////////////////// | 132 /////////////////////////////////////////////////////////////////////////////// |
133 | 133 |
134 SkPath2DPathEffect::SkPath2DPathEffect(const SkMatrix& m, const SkPath& p) | 134 SkPath2DPathEffect::SkPath2DPathEffect(const SkMatrix& m, const SkPath& p) |
135 : INHERITED(m), fPath(p) { | 135 : INHERITED(m), fPath(p) { |
136 } | 136 } |
137 | 137 |
138 SkFlattenable* SkPath2DPathEffect::CreateProc(SkReadBuffer& buffer) { | 138 SkFlattenable* SkPath2DPathEffect::CreateProc(SkReadBuffer& buffer) { |
139 SkMatrix matrix; | 139 SkMatrix matrix; |
140 buffer.readMatrix(&matrix); | 140 buffer.readMatrix(&matrix); |
141 SkPath path; | 141 SkPath path; |
142 buffer.readPath(&path); | 142 buffer.readPath(&path); |
143 return SkPath2DPathEffect::Create(matrix, path); | 143 return SkPath2DPathEffect::Make(matrix, path).release(); |
144 } | 144 } |
145 | 145 |
146 void SkPath2DPathEffect::flatten(SkWriteBuffer& buffer) const { | 146 void SkPath2DPathEffect::flatten(SkWriteBuffer& buffer) const { |
147 buffer.writeMatrix(this->getMatrix()); | 147 buffer.writeMatrix(this->getMatrix()); |
148 buffer.writePath(fPath); | 148 buffer.writePath(fPath); |
149 } | 149 } |
150 | 150 |
151 void SkPath2DPathEffect::next(const SkPoint& loc, int u, int v, | 151 void SkPath2DPathEffect::next(const SkPoint& loc, int u, int v, |
152 SkPath* dst) const { | 152 SkPath* dst) const { |
153 dst->addPath(fPath, loc.fX, loc.fY); | 153 dst->addPath(fPath, loc.fX, loc.fY); |
154 } | 154 } |
155 | 155 |
156 #ifndef SK_IGNORE_TO_STRING | 156 #ifndef SK_IGNORE_TO_STRING |
157 void SkPath2DPathEffect::toString(SkString* str) const { | 157 void SkPath2DPathEffect::toString(SkString* str) const { |
158 str->appendf("SkPath2DPathEffect: ("); | 158 str->appendf("SkPath2DPathEffect: ("); |
159 this->INHERITED::toString(str); | 159 this->INHERITED::toString(str); |
160 // TODO: print out path information | 160 // TODO: print out path information |
161 str->appendf(")"); | 161 str->appendf(")"); |
162 } | 162 } |
163 #endif | 163 #endif |
OLD | NEW |