| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Torch Mobile, Inc. | 3 * Copyright (C) 2009 Torch Mobile, Inc. |
| 4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 } | 1357 } |
| 1358 | 1358 |
| 1359 void TransformationMatrix::blend(const TransformationMatrix& from, double progre
ss) | 1359 void TransformationMatrix::blend(const TransformationMatrix& from, double progre
ss) |
| 1360 { | 1360 { |
| 1361 if (from.isIdentity() && isIdentity()) | 1361 if (from.isIdentity() && isIdentity()) |
| 1362 return; | 1362 return; |
| 1363 | 1363 |
| 1364 // decompose | 1364 // decompose |
| 1365 DecomposedType fromDecomp; | 1365 DecomposedType fromDecomp; |
| 1366 DecomposedType toDecomp; | 1366 DecomposedType toDecomp; |
| 1367 from.decompose(fromDecomp); | 1367 if (!from.decompose(fromDecomp) || !decompose(toDecomp)) { |
| 1368 decompose(toDecomp); | 1368 if (progress < 0.5) |
| 1369 *this = from; |
| 1370 return; |
| 1371 } |
| 1369 | 1372 |
| 1370 // interpolate | 1373 // interpolate |
| 1371 blendFloat(fromDecomp.scaleX, toDecomp.scaleX, progress); | 1374 blendFloat(fromDecomp.scaleX, toDecomp.scaleX, progress); |
| 1372 blendFloat(fromDecomp.scaleY, toDecomp.scaleY, progress); | 1375 blendFloat(fromDecomp.scaleY, toDecomp.scaleY, progress); |
| 1373 blendFloat(fromDecomp.scaleZ, toDecomp.scaleZ, progress); | 1376 blendFloat(fromDecomp.scaleZ, toDecomp.scaleZ, progress); |
| 1374 blendFloat(fromDecomp.skewXY, toDecomp.skewXY, progress); | 1377 blendFloat(fromDecomp.skewXY, toDecomp.skewXY, progress); |
| 1375 blendFloat(fromDecomp.skewXZ, toDecomp.skewXZ, progress); | 1378 blendFloat(fromDecomp.skewXZ, toDecomp.skewXZ, progress); |
| 1376 blendFloat(fromDecomp.skewYZ, toDecomp.skewYZ, progress); | 1379 blendFloat(fromDecomp.skewYZ, toDecomp.skewYZ, progress); |
| 1377 blendFloat(fromDecomp.translateX, toDecomp.translateX, progress); | 1380 blendFloat(fromDecomp.translateX, toDecomp.translateX, progress); |
| 1378 blendFloat(fromDecomp.translateY, toDecomp.translateY, progress); | 1381 blendFloat(fromDecomp.translateY, toDecomp.translateY, progress); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 ret.setDouble(2, 2, matrix.m33()); | 1549 ret.setDouble(2, 2, matrix.m33()); |
| 1547 ret.setDouble(2, 3, matrix.m43()); | 1550 ret.setDouble(2, 3, matrix.m43()); |
| 1548 ret.setDouble(3, 0, matrix.m14()); | 1551 ret.setDouble(3, 0, matrix.m14()); |
| 1549 ret.setDouble(3, 1, matrix.m24()); | 1552 ret.setDouble(3, 1, matrix.m24()); |
| 1550 ret.setDouble(3, 2, matrix.m34()); | 1553 ret.setDouble(3, 2, matrix.m34()); |
| 1551 ret.setDouble(3, 3, matrix.m44()); | 1554 ret.setDouble(3, 3, matrix.m44()); |
| 1552 return ret; | 1555 return ret; |
| 1553 } | 1556 } |
| 1554 | 1557 |
| 1555 } | 1558 } |
| OLD | NEW |