TranslateTransformOperation.cpp [plain text]
#include "config.h"
#include "TranslateTransformOperation.h"
#include "FloatConversion.h"
#include "TextStream.h"
namespace WebCore {
bool TranslateTransformOperation::operator==(const TransformOperation& other) const
{
if (!isSameType(other))
return false;
const TranslateTransformOperation& t = downcast<TranslateTransformOperation>(other);
return m_x == t.m_x && m_y == t.m_y && m_z == t.m_z;
}
Ref<TransformOperation> TranslateTransformOperation::blend(const TransformOperation* from, double progress, bool blendToIdentity)
{
if (from && !from->isSameType(*this))
return *this;
Length zeroLength(0, Fixed);
if (blendToIdentity)
return TranslateTransformOperation::create(WebCore::blend(m_x, zeroLength, progress), WebCore::blend(m_y, zeroLength, progress), WebCore::blend(m_z, zeroLength, progress), m_type);
const TranslateTransformOperation* fromOp = downcast<TranslateTransformOperation>(from);
Length fromX = fromOp ? fromOp->m_x : zeroLength;
Length fromY = fromOp ? fromOp->m_y : zeroLength;
Length fromZ = fromOp ? fromOp->m_z : zeroLength;
return TranslateTransformOperation::create(WebCore::blend(fromX, x(), progress), WebCore::blend(fromY, y(), progress), WebCore::blend(fromZ, z(), progress), m_type);
}
void TranslateTransformOperation::dump(TextStream& ts) const
{
ts << type() << "(" << m_x << ", " << m_y << ", " << m_z << ")";
}
}