#ifndef ScaleTransformOperation_h
#define ScaleTransformOperation_h
#include "platform/transforms/TransformOperation.h"
namespace WebCore {
class PLATFORM_EXPORT ScaleTransformOperation : public TransformOperation {
public:
    static PassRefPtr<ScaleTransformOperation> create(double sx, double sy, OperationType type)
    {
        return adoptRef(new ScaleTransformOperation(sx, sy, 1, type));
    }
    static PassRefPtr<ScaleTransformOperation> create(double sx, double sy, double sz, OperationType type)
    {
        return adoptRef(new ScaleTransformOperation(sx, sy, sz, type));
    }
    double x() const { return m_x; }
    double y() const { return m_y; }
    double z() const { return m_z; }
private:
    virtual bool isIdentity() const OVERRIDE { return m_x == 1 &&  m_y == 1 &&  m_z == 1; }
    virtual OperationType type() const OVERRIDE { return m_type; }
    virtual bool operator==(const TransformOperation& o) const OVERRIDE
    {
        if (!isSameType(o))
            return false;
        const ScaleTransformOperation* s = static_cast<const ScaleTransformOperation*>(&o);
        return m_x == s->m_x && m_y == s->m_y && m_z == s->m_z;
    }
    virtual void apply(TransformationMatrix& transform, const FloatSize&) const OVERRIDE
    {
        transform.scale3d(m_x, m_y, m_z);
    }
    virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false) OVERRIDE;
    ScaleTransformOperation(double sx, double sy, double sz, OperationType type)
        : m_x(sx)
        , m_y(sy)
        , m_z(sz)
        , m_type(type)
    {
        ASSERT(type == ScaleX || type == ScaleY || type == ScaleZ || type == Scale || type == Scale3D);
    }
    double m_x;
    double m_y;
    double m_z;
    OperationType m_type;
};
} 
#endif