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