| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 namespace blink { | 24 namespace blink { |
| 25 | 25 |
| 26 PassRefPtr<TransformOperation> TranslateTransformOperation::blend( | 26 PassRefPtr<TransformOperation> TranslateTransformOperation::blend( |
| 27 const TransformOperation* from, | 27 const TransformOperation* from, |
| 28 double progress, | 28 double progress, |
| 29 bool blendToIdentity) { | 29 bool blendToIdentity) { |
| 30 if (from && !from->canBlendWith(*this)) | 30 if (from && !from->canBlendWith(*this)) |
| 31 return this; | 31 return this; |
| 32 | 32 |
| 33 const Length zeroLength(0, Fixed); | 33 const Length zeroLength(0, Fixed); |
| 34 if (blendToIdentity) | 34 if (blendToIdentity) { |
| 35 return TranslateTransformOperation::create( | 35 return TranslateTransformOperation::create( |
| 36 zeroLength.blend(m_x, progress, ValueRangeAll), | 36 zeroLength.blend(m_x, progress, ValueRangeAll), |
| 37 zeroLength.blend(m_y, progress, ValueRangeAll), | 37 zeroLength.blend(m_y, progress, ValueRangeAll), |
| 38 blink::blend(0., m_z, progress), m_type); | 38 blink::blend(m_z, 0., progress), m_type); |
| 39 } |
| 39 | 40 |
| 40 const TranslateTransformOperation* fromOp = | 41 const TranslateTransformOperation* fromOp = |
| 41 static_cast<const TranslateTransformOperation*>(from); | 42 static_cast<const TranslateTransformOperation*>(from); |
| 42 Length fromX = fromOp ? fromOp->m_x : zeroLength; | 43 Length fromX = fromOp ? fromOp->m_x : zeroLength; |
| 43 Length fromY = fromOp ? fromOp->m_y : zeroLength; | 44 Length fromY = fromOp ? fromOp->m_y : zeroLength; |
| 44 double fromZ = fromOp ? fromOp->m_z : 0; | 45 double fromZ = fromOp ? fromOp->m_z : 0; |
| 45 return TranslateTransformOperation::create( | 46 return TranslateTransformOperation::create( |
| 46 m_x.blend(fromX, progress, ValueRangeAll), | 47 m_x.blend(fromX, progress, ValueRangeAll), |
| 47 m_y.blend(fromY, progress, ValueRangeAll), | 48 m_y.blend(fromY, progress, ValueRangeAll), |
| 48 blink::blend(fromZ, m_z, progress), m_type); | 49 blink::blend(fromZ, m_z, progress), m_type); |
| 49 } | 50 } |
| 50 | 51 |
| 51 bool TranslateTransformOperation::canBlendWith( | 52 bool TranslateTransformOperation::canBlendWith( |
| 52 const TransformOperation& other) const { | 53 const TransformOperation& other) const { |
| 53 return other.type() == Translate || other.type() == TranslateX || | 54 return other.type() == Translate || other.type() == TranslateX || |
| 54 other.type() == TranslateY || other.type() == TranslateZ || | 55 other.type() == TranslateY || other.type() == TranslateZ || |
| 55 other.type() == Translate3D; | 56 other.type() == Translate3D; |
| 56 } | 57 } |
| 57 | 58 |
| 58 PassRefPtr<TranslateTransformOperation> | 59 PassRefPtr<TranslateTransformOperation> |
| 59 TranslateTransformOperation::zoomTranslate(double factor) { | 60 TranslateTransformOperation::zoomTranslate(double factor) { |
| 60 return create(m_x.zoom(factor), m_y.zoom(factor), m_z * factor, m_type); | 61 return create(m_x.zoom(factor), m_y.zoom(factor), m_z * factor, m_type); |
| 61 } | 62 } |
| 62 | 63 |
| 63 } // namespace blink | 64 } // namespace blink |
| OLD | NEW |