1/*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005-2008, 2017 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 *
23 */
24
25#pragma once
26
27#include "TransformOperation.h"
28#include <wtf/Ref.h>
29
30namespace WebCore {
31
32class SkewTransformOperation final : public TransformOperation {
33public:
34 static Ref<SkewTransformOperation> create(double angleX, double angleY, OperationType type)
35 {
36 return adoptRef(*new SkewTransformOperation(angleX, angleY, type));
37 }
38
39 Ref<TransformOperation> clone() const override
40 {
41 return adoptRef(*new SkewTransformOperation(m_angleX, m_angleY, type()));
42 }
43
44 double angleX() const { return m_angleX; }
45 double angleY() const { return m_angleY; }
46
47private:
48 bool isIdentity() const override { return m_angleX == 0 && m_angleY == 0; }
49 bool isAffectedByTransformOrigin() const override { return !isIdentity(); }
50
51 bool operator==(const TransformOperation&) const override;
52
53 bool apply(TransformationMatrix& transform, const FloatSize&) const override
54 {
55 transform.skew(m_angleX, m_angleY);
56 return false;
57 }
58
59 Ref<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false) override;
60
61 void dump(WTF::TextStream&) const final;
62
63 SkewTransformOperation(double angleX, double angleY, OperationType type)
64 : TransformOperation(type)
65 , m_angleX(angleX)
66 , m_angleY(angleY)
67 {
68 ASSERT(isSkewTransformOperationType());
69 }
70
71 double m_angleX;
72 double m_angleY;
73};
74
75} // namespace WebCore
76
77SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(WebCore::SkewTransformOperation, isSkewTransformOperationType())
78