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 "SkDrawMatrix.h" | 10 #include "SkDrawMatrix.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 SkDebugf("skew-x=\"%g\" ", SkScalarToFloat(result)); | 112 SkDebugf("skew-x=\"%g\" ", SkScalarToFloat(result)); |
113 result = fMatrix.getSkewY(); | 113 result = fMatrix.getSkewY(); |
114 if (result) | 114 if (result) |
115 SkDebugf("skew-y=\"%g\" ", SkScalarToFloat(result)); | 115 SkDebugf("skew-y=\"%g\" ", SkScalarToFloat(result)); |
116 result = fMatrix.getTranslateX(); | 116 result = fMatrix.getTranslateX(); |
117 if (result) | 117 if (result) |
118 SkDebugf("tx=\"%g\" ", SkScalarToFloat(result)); | 118 SkDebugf("tx=\"%g\" ", SkScalarToFloat(result)); |
119 result = fMatrix.getTranslateY(); | 119 result = fMatrix.getTranslateY(); |
120 if (result) | 120 if (result) |
121 SkDebugf("ty=\"%g\" ", SkScalarToFloat(result)); | 121 SkDebugf("ty=\"%g\" ", SkScalarToFloat(result)); |
122 result = SkPerspToScalar(fMatrix.getPerspX()); | 122 result = fMatrix.getPerspX(); |
123 if (result) | 123 if (result) |
124 SkDebugf("perspect-x=\"%g\" ", SkScalarToFloat(result)); | 124 SkDebugf("perspect-x=\"%g\" ", SkScalarToFloat(result)); |
125 result = SkPerspToScalar(fMatrix.getPerspY()); | 125 result = fMatrix.getPerspY(); |
126 if (result) | 126 if (result) |
127 SkDebugf("perspect-y=\"%g\" ", SkScalarToFloat(result)); | 127 SkDebugf("perspect-y=\"%g\" ", SkScalarToFloat(result)); |
128 SkDebugf("/>\n"); | 128 SkDebugf("/>\n"); |
129 } | 129 } |
130 #endif | 130 #endif |
131 | 131 |
132 SkMatrix& SkDrawMatrix::getMatrix() { | 132 SkMatrix& SkDrawMatrix::getMatrix() { |
133 if (fDirty == false) | 133 if (fDirty == false) |
134 return fConcat; | 134 return fConcat; |
135 fMatrix.reset(); | 135 fMatrix.reset(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 void SkDrawMatrix::onEndElement(SkAnimateMaker& ) { | 184 void SkDrawMatrix::onEndElement(SkAnimateMaker& ) { |
185 if (matrix.count() > 0) { | 185 if (matrix.count() > 0) { |
186 SkScalar* vals = matrix.begin(); | 186 SkScalar* vals = matrix.begin(); |
187 fMatrix.setScaleX(vals[0]); | 187 fMatrix.setScaleX(vals[0]); |
188 fMatrix.setSkewX(vals[1]); | 188 fMatrix.setSkewX(vals[1]); |
189 fMatrix.setTranslateX(vals[2]); | 189 fMatrix.setTranslateX(vals[2]); |
190 fMatrix.setSkewY(vals[3]); | 190 fMatrix.setSkewY(vals[3]); |
191 fMatrix.setScaleY(vals[4]); | 191 fMatrix.setScaleY(vals[4]); |
192 fMatrix.setTranslateY(vals[5]); | 192 fMatrix.setTranslateY(vals[5]); |
193 fMatrix.setPerspX(SkScalarToPersp(vals[6])); | 193 fMatrix.setPerspX(vals[6]); |
194 fMatrix.setPerspY(SkScalarToPersp(vals[7])); | 194 fMatrix.setPerspY(vals[7]); |
195 // fMatrix.setPerspW(SkScalarToPersp(vals[8])); | 195 // fMatrix.setPerspW(vals[8]); |
196 goto setConcat; | 196 goto setConcat; |
197 } | 197 } |
198 if (fChildHasID == false) { | 198 if (fChildHasID == false) { |
199 { | 199 { |
200 for (SkMatrixPart** part = fParts.begin(); part < fParts.end(); par
t++) | 200 for (SkMatrixPart** part = fParts.begin(); part < fParts.end(); par
t++) |
201 delete *part; | 201 delete *part; |
202 } | 202 } |
203 fParts.reset(); | 203 fParts.reset(); |
204 setConcat: | 204 setConcat: |
205 fConcat = fMatrix; | 205 fConcat = fMatrix; |
(...skipping 11 matching lines...) Expand all Loading... |
217 case SK_PROPERTY(translate): | 217 case SK_PROPERTY(translate): |
218 // SkScalar xy[2]; | 218 // SkScalar xy[2]; |
219 SkASSERT(scriptValue.fType == SkType_Array); | 219 SkASSERT(scriptValue.fType == SkType_Array); |
220 SkASSERT(scriptValue.fOperand.fArray->getType() == SkType_Float); | 220 SkASSERT(scriptValue.fOperand.fArray->getType() == SkType_Float); |
221 SkASSERT(scriptValue.fOperand.fArray->count() == 2); | 221 SkASSERT(scriptValue.fOperand.fArray->count() == 2); |
222 // SkParse::FindScalars(scriptValue.fOperand.fString->c_str(), xy, 2); | 222 // SkParse::FindScalars(scriptValue.fOperand.fString->c_str(), xy, 2); |
223 fMatrix.setTranslateX((*scriptValue.fOperand.fArray)[0].fScalar); | 223 fMatrix.setTranslateX((*scriptValue.fOperand.fArray)[0].fScalar); |
224 fMatrix.setTranslateY((*scriptValue.fOperand.fArray)[1].fScalar); | 224 fMatrix.setTranslateY((*scriptValue.fOperand.fArray)[1].fScalar); |
225 return true; | 225 return true; |
226 case SK_PROPERTY(perspectX): | 226 case SK_PROPERTY(perspectX): |
227 fMatrix.setPerspX(SkScalarToPersp((number))); | 227 fMatrix.setPerspX(number); |
228 break; | 228 break; |
229 case SK_PROPERTY(perspectY): | 229 case SK_PROPERTY(perspectY): |
230 fMatrix.setPerspY(SkScalarToPersp((number))); | 230 fMatrix.setPerspY(number); |
231 break; | 231 break; |
232 case SK_PROPERTY(rotate): { | 232 case SK_PROPERTY(rotate): { |
233 SkMatrix temp; | 233 SkMatrix temp; |
234 temp.setRotate(number, 0, 0); | 234 temp.setRotate(number, 0, 0); |
235 fMatrix.setScaleX(temp.getScaleX()); | 235 fMatrix.setScaleX(temp.getScaleX()); |
236 fMatrix.setScaleY(temp.getScaleY()); | 236 fMatrix.setScaleY(temp.getScaleY()); |
237 fMatrix.setSkewX(temp.getSkewX()); | 237 fMatrix.setSkewX(temp.getSkewX()); |
238 fMatrix.setSkewY(temp.getSkewY()); | 238 fMatrix.setSkewY(temp.getSkewY()); |
239 } break; | 239 } break; |
240 case SK_PROPERTY(scale): | 240 case SK_PROPERTY(scale): |
(...skipping 18 matching lines...) Expand all Loading... |
259 case SK_PROPERTY(translateY): | 259 case SK_PROPERTY(translateY): |
260 fMatrix.setTranslateY(number); | 260 fMatrix.setTranslateY(number); |
261 break; | 261 break; |
262 default: | 262 default: |
263 SkASSERT(0); | 263 SkASSERT(0); |
264 return false; | 264 return false; |
265 } | 265 } |
266 fConcat = fMatrix; | 266 fConcat = fMatrix; |
267 return true; | 267 return true; |
268 } | 268 } |
OLD | NEW |