ScaleTransformOperation.cpp [plain text]
#include "config.h"
#include "ScaleTransformOperation.h"
#include "AnimationUtilities.h"
#include "TextStream.h"
namespace WebCore {
bool ScaleTransformOperation::operator==(const TransformOperation& other) const
{
if (!isSameType(other))
return false;
const ScaleTransformOperation& s = downcast<ScaleTransformOperation>(other);
return m_x == s.m_x && m_y == s.m_y && m_z == s.m_z;
}
Ref<TransformOperation> ScaleTransformOperation::blend(const TransformOperation* from, double progress, bool blendToIdentity)
{
if (from && !from->isSameType(*this))
return *this;
if (blendToIdentity)
return ScaleTransformOperation::create(WebCore::blend(m_x, 1.0, progress),
WebCore::blend(m_y, 1.0, progress),
WebCore::blend(m_z, 1.0, progress), m_type);
const ScaleTransformOperation* fromOp = downcast<ScaleTransformOperation>(from);
double fromX = fromOp ? fromOp->m_x : 1.0;
double fromY = fromOp ? fromOp->m_y : 1.0;
double fromZ = fromOp ? fromOp->m_z : 1.0;
return ScaleTransformOperation::create(WebCore::blend(fromX, m_x, progress),
WebCore::blend(fromY, m_y, progress),
WebCore::blend(fromZ, m_z, progress), m_type);
}
void ScaleTransformOperation::dump(TextStream& ts) const
{
ts << type() << "(" << TextStream::FormatNumberRespectingIntegers(m_x) << ", " << TextStream::FormatNumberRespectingIntegers(m_y) << ", " << TextStream::FormatNumberRespectingIntegers(m_z) << ")";
}
}