| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 return PerspectiveTransformOperation::create(clampTo<int>(p, 0)); | 41 return PerspectiveTransformOperation::create(clampTo<int>(p, 0)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 const PerspectiveTransformOperation* fromOp = static_cast<const PerspectiveT
ransformOperation*>(from); | 44 const PerspectiveTransformOperation* fromOp = static_cast<const PerspectiveT
ransformOperation*>(from); |
| 45 | 45 |
| 46 TransformationMatrix fromT; | 46 TransformationMatrix fromT; |
| 47 TransformationMatrix toT; | 47 TransformationMatrix toT; |
| 48 fromT.applyPerspective(fromOp ? fromOp->m_p : 0); | 48 fromT.applyPerspective(fromOp ? fromOp->m_p : 0); |
| 49 toT.applyPerspective(m_p); | 49 toT.applyPerspective(m_p); |
| 50 toT.blend(fromT, progress); | 50 toT.blend(fromT, progress); |
| 51 |
| 51 TransformationMatrix::DecomposedType decomp; | 52 TransformationMatrix::DecomposedType decomp; |
| 52 toT.decompose(decomp); | 53 if (!toT.decompose(decomp)) { |
| 54 // If we can't decompose, bail out of interpolation. |
| 55 const PerspectiveTransformOperation* usedOperation = progress > 0.5 ? th
is : fromOp; |
| 56 return PerspectiveTransformOperation::create(usedOperation->perspective(
)); |
| 57 } |
| 53 | 58 |
| 54 if (decomp.perspectiveZ) { | 59 if (decomp.perspectiveZ) { |
| 55 double val = -1.0 / decomp.perspectiveZ; | 60 double val = -1.0 / decomp.perspectiveZ; |
| 56 return PerspectiveTransformOperation::create(clampTo<int>(val, 0)); | 61 return PerspectiveTransformOperation::create(clampTo<int>(val, 0)); |
| 57 } | 62 } |
| 58 return PerspectiveTransformOperation::create(0); | 63 return PerspectiveTransformOperation::create(0); |
| 59 } | 64 } |
| 60 | 65 |
| 61 } // namespace blink | 66 } // namespace blink |
| OLD | NEW |