blob: 328f58809047079d232ea7827d6114ef65240fa4 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
2/*
3 * Copyright 2006 The Android Open Source Project
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
reed@android.com8a1c16f2008-12-17 15:59:43 +00009
10#include "SkCamera.h"
11
12static SkScalar SkScalarDotDiv(int count, const SkScalar a[], int step_a,
13 const SkScalar b[], int step_b,
reed@google.com91408cc2011-04-18 18:47:46 +000014 SkScalar denom) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000015#ifdef SK_SCALAR_IS_FLOAT
16 float prod = 0;
reed@google.com91408cc2011-04-18 18:47:46 +000017 for (int i = 0; i < count; i++) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000018 prod += a[0] * b[0];
19 a += step_a;
20 b += step_b;
21 }
22 return prod / denom;
23#else
24 Sk64 prod, tmp;
25
26 prod.set(0);
reed@google.com91408cc2011-04-18 18:47:46 +000027 for (int i = 0; i < count; i++) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000028 tmp.setMul(a[0], b[0]);
29 prod.add(tmp);
30 a += step_a;
31 b += step_b;
32 }
33 prod.div(denom, Sk64::kRound_DivOption);
34 return prod.get32();
35#endif
36}
37
38static SkScalar SkScalarDot(int count, const SkScalar a[], int step_a,
reed@google.com91408cc2011-04-18 18:47:46 +000039 const SkScalar b[], int step_b) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000040#ifdef SK_SCALAR_IS_FLOAT
41 float prod = 0;
reed@google.com91408cc2011-04-18 18:47:46 +000042 for (int i = 0; i < count; i++) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000043 prod += a[0] * b[0];
44 a += step_a;
45 b += step_b;
46 }
47 return prod;
48#else
49 Sk64 prod, tmp;
50
51 prod.set(0);
reed@google.com91408cc2011-04-18 18:47:46 +000052 for (int i = 0; i < count; i++) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000053 tmp.setMul(a[0], b[0]);
54 prod.add(tmp);
55 a += step_a;
56 b += step_b;
57 }
58 return prod.getFixed();
59#endif
60}
61
reed@google.com91408cc2011-04-18 18:47:46 +000062///////////////////////////////////////////////////////////////////////////////
reed@android.com8a1c16f2008-12-17 15:59:43 +000063
reed@google.com91408cc2011-04-18 18:47:46 +000064SkUnitScalar SkPoint3D::normalize(SkUnit3D* unit) const {
reed@android.com8a1c16f2008-12-17 15:59:43 +000065#ifdef SK_SCALAR_IS_FLOAT
66 float mag = sk_float_sqrt(fX*fX + fY*fY + fZ*fZ);
reed@google.com91408cc2011-04-18 18:47:46 +000067 if (mag) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000068 float scale = 1.0f / mag;
69 unit->fX = fX * scale;
70 unit->fY = fY * scale;
71 unit->fZ = fZ * scale;
reed@google.com91408cc2011-04-18 18:47:46 +000072 } else {
73 unit->fX = unit->fY = unit->fZ = 0;
reed@android.com8a1c16f2008-12-17 15:59:43 +000074 }
75#else
76 Sk64 tmp1, tmp2;
77
78 tmp1.setMul(fX, fX);
79 tmp2.setMul(fY, fY);
80 tmp1.add(tmp2);
81 tmp2.setMul(fZ, fZ);
82 tmp1.add(tmp2);
83
84 SkFixed mag = tmp1.getSqrt();
reed@google.com91408cc2011-04-18 18:47:46 +000085 if (mag) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000086 // what if mag < SK_Fixed1 ??? we will underflow the fixdiv
87 SkFixed scale = SkFixedDiv(SK_Fract1, mag);
88 unit->fX = SkFixedMul(fX, scale);
89 unit->fY = SkFixedMul(fY, scale);
90 unit->fZ = SkFixedMul(fZ, scale);
reed@google.com91408cc2011-04-18 18:47:46 +000091 } else {
92 unit->fX = unit->fY = unit->fZ = 0;
reed@android.com8a1c16f2008-12-17 15:59:43 +000093 }
94#endif
95 return mag;
96}
97
reed@google.com91408cc2011-04-18 18:47:46 +000098SkUnitScalar SkUnit3D::Dot(const SkUnit3D& a, const SkUnit3D& b) {
reed@android.com8a1c16f2008-12-17 15:59:43 +000099 return SkUnitScalarMul(a.fX, b.fX) +
100 SkUnitScalarMul(a.fY, b.fY) +
101 SkUnitScalarMul(a.fZ, b.fZ);
102}
103
reed@google.com91408cc2011-04-18 18:47:46 +0000104void SkUnit3D::Cross(const SkUnit3D& a, const SkUnit3D& b, SkUnit3D* cross) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000105 SkASSERT(cross);
106
107 // use x,y,z, in case &a == cross or &b == cross
108
reed@android.com8a1c16f2008-12-17 15:59:43 +0000109 SkScalar x = SkUnitScalarMul(a.fY, b.fZ) - SkUnitScalarMul(a.fZ, b.fY);
110 SkScalar y = SkUnitScalarMul(a.fZ, b.fX) - SkUnitScalarMul(a.fX, b.fY);
111 SkScalar z = SkUnitScalarMul(a.fX, b.fY) - SkUnitScalarMul(a.fY, b.fX);
112
113 cross->set(x, y, z);
114}
115
reed@google.com91408cc2011-04-18 18:47:46 +0000116///////////////////////////////////////////////////////////////////////////////
reed@android.com8a1c16f2008-12-17 15:59:43 +0000117
reed@google.com91408cc2011-04-18 18:47:46 +0000118SkPatch3D::SkPatch3D() {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000119 this->reset();
120}
121
reed@google.com91408cc2011-04-18 18:47:46 +0000122void SkPatch3D::reset() {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000123 fOrigin.set(0, 0, 0);
124 fU.set(SK_Scalar1, 0, 0);
125 fV.set(0, -SK_Scalar1, 0);
126}
127
reed@google.com91408cc2011-04-18 18:47:46 +0000128void SkPatch3D::transform(const SkMatrix3D& m, SkPatch3D* dst) const {
129 if (dst == NULL) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000130 dst = (SkPatch3D*)this;
reed@google.com91408cc2011-04-18 18:47:46 +0000131 }
reed@android.com8a1c16f2008-12-17 15:59:43 +0000132 m.mapVector(fU, &dst->fU);
133 m.mapVector(fV, &dst->fV);
134 m.mapPoint(fOrigin, &dst->fOrigin);
135}
136
reed@google.com91408cc2011-04-18 18:47:46 +0000137SkScalar SkPatch3D::dotWith(SkScalar dx, SkScalar dy, SkScalar dz) const {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000138 SkScalar cx = SkScalarMul(fU.fY, fV.fZ) - SkScalarMul(fU.fZ, fV.fY);
139 SkScalar cy = SkScalarMul(fU.fZ, fV.fX) - SkScalarMul(fU.fX, fV.fY);
140 SkScalar cz = SkScalarMul(fU.fX, fV.fY) - SkScalarMul(fU.fY, fV.fX);
141
142 return SkScalarMul(cx, dx) + SkScalarMul(cy, dy) + SkScalarMul(cz, dz);
143}
144
reed@google.com91408cc2011-04-18 18:47:46 +0000145///////////////////////////////////////////////////////////////////////////////
reed@android.com8a1c16f2008-12-17 15:59:43 +0000146
reed@google.com91408cc2011-04-18 18:47:46 +0000147void SkMatrix3D::reset() {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000148 memset(fMat, 0, sizeof(fMat));
149 fMat[0][0] = fMat[1][1] = fMat[2][2] = SK_Scalar1;
150}
151
reed@google.com91408cc2011-04-18 18:47:46 +0000152void SkMatrix3D::setTranslate(SkScalar x, SkScalar y, SkScalar z) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000153 memset(fMat, 0, sizeof(fMat));
154 fMat[0][0] = x;
155 fMat[1][1] = y;
156 fMat[2][2] = z;
157}
158
reed@google.com91408cc2011-04-18 18:47:46 +0000159void SkMatrix3D::setRotateX(SkScalar degX) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000160 SkScalar s, c;
161
162 s = SkScalarSinCos(SkDegreesToRadians(degX), &c);
163 this->setRow(0, SK_Scalar1, 0, 0);
164 this->setRow(1, 0, c, -s);
165 this->setRow(2, 0, s, c);
166}
167
reed@google.com91408cc2011-04-18 18:47:46 +0000168void SkMatrix3D::setRotateY(SkScalar degY) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000169 SkScalar s, c;
170
171 s = SkScalarSinCos(SkDegreesToRadians(degY), &c);
172 this->setRow(0, c, 0, -s);
173 this->setRow(1, 0, SK_Scalar1, 0);
174 this->setRow(2, s, 0, c);
175}
176
reed@google.com91408cc2011-04-18 18:47:46 +0000177void SkMatrix3D::setRotateZ(SkScalar degZ) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000178 SkScalar s, c;
179
180 s = SkScalarSinCos(SkDegreesToRadians(degZ), &c);
181 this->setRow(0, c, -s, 0);
182 this->setRow(1, s, c, 0);
183 this->setRow(2, 0, 0, SK_Scalar1);
184}
185
reed@google.com91408cc2011-04-18 18:47:46 +0000186void SkMatrix3D::preTranslate(SkScalar x, SkScalar y, SkScalar z) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000187 SkScalar col[3] = { x, y, z};
188
reed@google.com91408cc2011-04-18 18:47:46 +0000189 for (int i = 0; i < 3; i++) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000190 fMat[i][3] += SkScalarDot(3, &fMat[i][0], 1, col, 1);
reed@google.com91408cc2011-04-18 18:47:46 +0000191 }
reed@android.com8a1c16f2008-12-17 15:59:43 +0000192}
193
reed@google.com91408cc2011-04-18 18:47:46 +0000194void SkMatrix3D::preRotateX(SkScalar degX) {
195 SkMatrix3D m;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000196 m.setRotateX(degX);
197 this->setConcat(*this, m);
198}
199
reed@google.com91408cc2011-04-18 18:47:46 +0000200void SkMatrix3D::preRotateY(SkScalar degY) {
201 SkMatrix3D m;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000202 m.setRotateY(degY);
203 this->setConcat(*this, m);
204}
205
reed@google.com91408cc2011-04-18 18:47:46 +0000206void SkMatrix3D::preRotateZ(SkScalar degZ) {
207 SkMatrix3D m;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000208 m.setRotateZ(degZ);
209 this->setConcat(*this, m);
210}
211
reed@google.com91408cc2011-04-18 18:47:46 +0000212void SkMatrix3D::setConcat(const SkMatrix3D& a, const SkMatrix3D& b) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000213 SkMatrix3D tmp;
214 SkMatrix3D* c = this;
215
reed@google.com91408cc2011-04-18 18:47:46 +0000216 if (this == &a || this == &b) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000217 c = &tmp;
reed@google.com91408cc2011-04-18 18:47:46 +0000218 }
reed@android.com8a1c16f2008-12-17 15:59:43 +0000219 for (int i = 0; i < 3; i++) {
reed@google.com91408cc2011-04-18 18:47:46 +0000220 for (int j = 0; j < 3; j++) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000221 c->fMat[i][j] = SkScalarDot(3, &a.fMat[i][0], 1, &b.fMat[0][j], 4);
reed@google.com91408cc2011-04-18 18:47:46 +0000222 }
223 c->fMat[i][3] = SkScalarDot(3, &a.fMat[i][0], 1,
224 &b.fMat[0][3], 4) + a.fMat[i][3];
reed@android.com8a1c16f2008-12-17 15:59:43 +0000225 }
226
reed@google.com91408cc2011-04-18 18:47:46 +0000227 if (c == &tmp) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000228 *this = tmp;
reed@google.com91408cc2011-04-18 18:47:46 +0000229 }
reed@android.com8a1c16f2008-12-17 15:59:43 +0000230}
231
reed@google.com91408cc2011-04-18 18:47:46 +0000232void SkMatrix3D::mapPoint(const SkPoint3D& src, SkPoint3D* dst) const {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000233 SkScalar x = SkScalarDot(3, &fMat[0][0], 1, &src.fX, 1) + fMat[0][3];
234 SkScalar y = SkScalarDot(3, &fMat[1][0], 1, &src.fX, 1) + fMat[1][3];
235 SkScalar z = SkScalarDot(3, &fMat[2][0], 1, &src.fX, 1) + fMat[2][3];
236 dst->set(x, y, z);
237}
238
reed@google.com91408cc2011-04-18 18:47:46 +0000239void SkMatrix3D::mapVector(const SkVector3D& src, SkVector3D* dst) const {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000240 SkScalar x = SkScalarDot(3, &fMat[0][0], 1, &src.fX, 1);
241 SkScalar y = SkScalarDot(3, &fMat[1][0], 1, &src.fX, 1);
242 SkScalar z = SkScalarDot(3, &fMat[2][0], 1, &src.fX, 1);
243 dst->set(x, y, z);
244}
245
reed@google.com91408cc2011-04-18 18:47:46 +0000246///////////////////////////////////////////////////////////////////////////////
reed@android.com8a1c16f2008-12-17 15:59:43 +0000247
reed@google.com91408cc2011-04-18 18:47:46 +0000248SkCamera3D::SkCamera3D() {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000249 this->reset();
250}
251
reed@google.com91408cc2011-04-18 18:47:46 +0000252void SkCamera3D::reset() {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000253 fLocation.set(0, 0, -SkIntToScalar(576)); // 8 inches backward
254 fAxis.set(0, 0, SK_Scalar1); // forward
255 fZenith.set(0, -SK_Scalar1, 0); // up
256
257 fObserver.set(0, 0, fLocation.fZ);
258
259 fNeedToUpdate = true;
260}
261
reed@google.com91408cc2011-04-18 18:47:46 +0000262void SkCamera3D::update() {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000263 fNeedToUpdate = true;
264}
265
reed@google.com91408cc2011-04-18 18:47:46 +0000266void SkCamera3D::doUpdate() const {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000267 SkUnit3D axis, zenith, cross;
268
269 fAxis.normalize(&axis);
270
271 {
272 SkScalar dot = SkUnit3D::Dot(*(const SkUnit3D*)(const void*)&fZenith, axis);
273
274 zenith.fX = fZenith.fX - SkUnitScalarMul(dot, axis.fX);
275 zenith.fY = fZenith.fY - SkUnitScalarMul(dot, axis.fY);
276 zenith.fZ = fZenith.fZ - SkUnitScalarMul(dot, axis.fZ);
277
278 (void)((SkPoint3D*)(void*)&zenith)->normalize(&zenith);
279 }
280
281 SkUnit3D::Cross(axis, zenith, &cross);
282
283 {
284 SkMatrix* orien = &fOrientation;
285 SkScalar x = fObserver.fX;
286 SkScalar y = fObserver.fY;
287 SkScalar z = fObserver.fZ;
288
289 orien->set(SkMatrix::kMScaleX, SkUnitScalarMul(x, axis.fX) - SkUnitScalarMul(z, cross.fX));
290 orien->set(SkMatrix::kMSkewX, SkUnitScalarMul(x, axis.fY) - SkUnitScalarMul(z, cross.fY));
291 orien->set(SkMatrix::kMTransX, SkUnitScalarMul(x, axis.fZ) - SkUnitScalarMul(z, cross.fZ));
292 orien->set(SkMatrix::kMSkewY, SkUnitScalarMul(y, axis.fX) - SkUnitScalarMul(z, zenith.fX));
293 orien->set(SkMatrix::kMScaleY, SkUnitScalarMul(y, axis.fY) - SkUnitScalarMul(z, zenith.fY));
294 orien->set(SkMatrix::kMTransY, SkUnitScalarMul(y, axis.fZ) - SkUnitScalarMul(z, zenith.fZ));
295 orien->set(SkMatrix::kMPersp0, axis.fX);
296 orien->set(SkMatrix::kMPersp1, axis.fY);
297 orien->set(SkMatrix::kMPersp2, axis.fZ);
298 }
299}
300
reed@google.com91408cc2011-04-18 18:47:46 +0000301void SkCamera3D::patchToMatrix(const SkPatch3D& quilt, SkMatrix* matrix) const {
302 if (fNeedToUpdate) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000303 this->doUpdate();
304 fNeedToUpdate = false;
305 }
306
307 const SkScalar* mapPtr = (const SkScalar*)(const void*)&fOrientation;
308 const SkScalar* patchPtr;
309 SkPoint3D diff;
310 SkScalar dot;
311
312 diff.fX = quilt.fOrigin.fX - fLocation.fX;
313 diff.fY = quilt.fOrigin.fY - fLocation.fY;
314 diff.fZ = quilt.fOrigin.fZ - fLocation.fZ;
315
316 dot = SkUnit3D::Dot(*(const SkUnit3D*)(const void*)&diff,
317 *(const SkUnit3D*)(((const SkScalar*)(const void*)&fOrientation) + 6));
318
319 patchPtr = (const SkScalar*)&quilt;
320 matrix->set(SkMatrix::kMScaleX, SkScalarDotDiv(3, patchPtr, 1, mapPtr, 1, dot));
321 matrix->set(SkMatrix::kMSkewY, SkScalarDotDiv(3, patchPtr, 1, mapPtr+3, 1, dot));
322 matrix->set(SkMatrix::kMPersp0, SkScalarDotDiv(3, patchPtr, 1, mapPtr+6, 1, dot));
323
324 patchPtr += 3;
325 matrix->set(SkMatrix::kMSkewX, SkScalarDotDiv(3, patchPtr, 1, mapPtr, 1, dot));
326 matrix->set(SkMatrix::kMScaleY, SkScalarDotDiv(3, patchPtr, 1, mapPtr+3, 1, dot));
327 matrix->set(SkMatrix::kMPersp1, SkScalarDotDiv(3, patchPtr, 1, mapPtr+6, 1, dot));
328
329 patchPtr = (const SkScalar*)(const void*)&diff;
330 matrix->set(SkMatrix::kMTransX, SkScalarDotDiv(3, patchPtr, 1, mapPtr, 1, dot));
331 matrix->set(SkMatrix::kMTransY, SkScalarDotDiv(3, patchPtr, 1, mapPtr+3, 1, dot));
332 matrix->set(SkMatrix::kMPersp2, SK_UnitScalar1);
333}
334
reed@google.com91408cc2011-04-18 18:47:46 +0000335///////////////////////////////////////////////////////////////////////////////
reed@android.com8a1c16f2008-12-17 15:59:43 +0000336
reed@google.com91408cc2011-04-18 18:47:46 +0000337Sk3DView::Sk3DView() {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000338 fInitialRec.fMatrix.reset();
339 fRec = &fInitialRec;
340}
341
reed@google.com91408cc2011-04-18 18:47:46 +0000342Sk3DView::~Sk3DView() {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000343 Rec* rec = fRec;
344 while (rec != &fInitialRec) {
345 Rec* next = rec->fNext;
346 SkDELETE(rec);
347 rec = next;
348 }
349}
350
reed@google.com91408cc2011-04-18 18:47:46 +0000351void Sk3DView::save() {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000352 Rec* rec = SkNEW(Rec);
353 rec->fNext = fRec;
354 rec->fMatrix = fRec->fMatrix;
355 fRec = rec;
356}
357
reed@google.com91408cc2011-04-18 18:47:46 +0000358void Sk3DView::restore() {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000359 SkASSERT(fRec != &fInitialRec);
360 Rec* next = fRec->fNext;
361 SkDELETE(fRec);
362 fRec = next;
363}
364
djsollen@google.comcd9d69b2011-03-14 20:30:14 +0000365#ifdef ANDROID
reed@google.com91408cc2011-04-18 18:47:46 +0000366void Sk3DView::setCameraLocation(SkScalar x, SkScalar y, SkScalar z) {
djsollen@google.comcd9d69b2011-03-14 20:30:14 +0000367 // the camera location is passed in inches, set in pt
368 SkScalar lz = z * SkFloatToScalar(72.0f);
369 fCamera.fLocation.set(x * SkFloatToScalar(72.0f), y * SkFloatToScalar(72.0f), lz);
370 fCamera.fObserver.set(0, 0, lz);
371 fCamera.update();
372
373}
374#endif
375
reed@google.com91408cc2011-04-18 18:47:46 +0000376void Sk3DView::translate(SkScalar x, SkScalar y, SkScalar z) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000377 fRec->fMatrix.preTranslate(x, y, z);
378}
379
reed@google.com91408cc2011-04-18 18:47:46 +0000380void Sk3DView::rotateX(SkScalar deg) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000381 fRec->fMatrix.preRotateX(deg);
382}
383
reed@google.com91408cc2011-04-18 18:47:46 +0000384void Sk3DView::rotateY(SkScalar deg) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000385 fRec->fMatrix.preRotateY(deg);
386}
387
reed@google.com91408cc2011-04-18 18:47:46 +0000388void Sk3DView::rotateZ(SkScalar deg) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000389 fRec->fMatrix.preRotateZ(deg);
390}
391
reed@google.com91408cc2011-04-18 18:47:46 +0000392SkScalar Sk3DView::dotWithNormal(SkScalar x, SkScalar y, SkScalar z) const {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000393 SkPatch3D patch;
394 patch.transform(fRec->fMatrix);
395 return patch.dotWith(x, y, z);
396}
397
reed@google.com91408cc2011-04-18 18:47:46 +0000398void Sk3DView::getMatrix(SkMatrix* matrix) const {
399 if (matrix != NULL) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000400 SkPatch3D patch;
401 patch.transform(fRec->fMatrix);
402 fCamera.patchToMatrix(patch, matrix);
403 }
404}
405
406#include "SkCanvas.h"
407
reed@google.com91408cc2011-04-18 18:47:46 +0000408void Sk3DView::applyToCanvas(SkCanvas* canvas) const {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000409 SkMatrix matrix;
410
411 this->getMatrix(&matrix);
412 canvas->concat(matrix);
413}
414