| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * | 22 * |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #ifndef RotateTransformOperation_h | 25 #ifndef RotateTransformOperation_h |
| 26 #define RotateTransformOperation_h | 26 #define RotateTransformOperation_h |
| 27 | 27 |
| 28 #include "platform/transforms/TransformOperation.h" | 28 #include "platform/transforms/TransformOperation.h" |
| 29 | 29 |
| 30 namespace blink { | 30 namespace blink { |
| 31 | 31 |
| 32 class PLATFORM_EXPORT RotateTransformOperation : public TransformOperation { | 32 class PLATFORM_EXPORT RotateTransformOperation final : public TransformOperation
{ |
| 33 public: | 33 public: |
| 34 static PassRefPtr<RotateTransformOperation> create(double angle, OperationTy
pe type) | 34 static PassRefPtr<RotateTransformOperation> create(double angle, OperationTy
pe type) |
| 35 { | 35 { |
| 36 return adoptRef(new RotateTransformOperation(0, 0, 1, angle, type)); | 36 return adoptRef(new RotateTransformOperation(0, 0, 1, angle, type)); |
| 37 } | 37 } |
| 38 | 38 |
| 39 static PassRefPtr<RotateTransformOperation> create(double x, double y, doubl
e z, double angle, OperationType type) | 39 static PassRefPtr<RotateTransformOperation> create(double x, double y, doubl
e z, double angle, OperationType type) |
| 40 { | 40 { |
| 41 return adoptRef(new RotateTransformOperation(x, y, z, angle, type)); | 41 return adoptRef(new RotateTransformOperation(x, y, z, angle, type)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 double x() const { return m_x; } | 44 double x() const { return m_x; } |
| 45 double y() const { return m_y; } | 45 double y() const { return m_y; } |
| 46 double z() const { return m_z; } | 46 double z() const { return m_z; } |
| 47 double angle() const { return m_angle; } | 47 double angle() const { return m_angle; } |
| 48 | 48 |
| 49 FloatPoint3D axis() const; | 49 FloatPoint3D axis() const; |
| 50 static bool shareSameAxis(const RotateTransformOperation* fromRotation, cons
t RotateTransformOperation* toRotation, FloatPoint3D* axis, double* fromAngle, d
ouble* toAngle); | 50 static bool shareSameAxis(const RotateTransformOperation* fromRotation, cons
t RotateTransformOperation* toRotation, FloatPoint3D* axis, double* fromAngle, d
ouble* toAngle); |
| 51 | 51 |
| 52 virtual bool canBlendWith(const TransformOperation& other) const; | 52 virtual bool canBlendWith(const TransformOperation& other) const; |
| 53 virtual OperationType type() const override { return m_type; } | 53 virtual OperationType type() const override { return m_type; } |
| 54 | 54 |
| 55 private: | |
| 56 virtual bool operator==(const TransformOperation& o) const override | 55 virtual bool operator==(const TransformOperation& o) const override |
| 57 { | 56 { |
| 58 if (!isSameType(o)) | 57 if (!isSameType(o)) |
| 59 return false; | 58 return false; |
| 60 const RotateTransformOperation* r = static_cast<const RotateTransformOpe
ration*>(&o); | 59 const RotateTransformOperation* r = static_cast<const RotateTransformOpe
ration*>(&o); |
| 61 return m_x == r->m_x && m_y == r->m_y && m_z == r->m_z && m_angle == r->
m_angle; | 60 return m_x == r->m_x && m_y == r->m_y && m_z == r->m_z && m_angle == r->
m_angle; |
| 62 } | 61 } |
| 63 | 62 |
| 63 private: |
| 64 virtual void apply(TransformationMatrix& transform, const FloatSize& /*borde
rBoxSize*/) const override | 64 virtual void apply(TransformationMatrix& transform, const FloatSize& /*borde
rBoxSize*/) const override |
| 65 { | 65 { |
| 66 transform.rotate3d(m_x, m_y, m_z, m_angle); | 66 transform.rotate3d(m_x, m_y, m_z, m_angle); |
| 67 } | 67 } |
| 68 | 68 |
| 69 virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from,
double progress, bool blendToIdentity = false) override; | 69 virtual PassRefPtr<TransformOperation> blend(const TransformOperation* from,
double progress, bool blendToIdentity = false) override; |
| 70 | 70 |
| 71 RotateTransformOperation(double x, double y, double z, double angle, Operati
onType type) | 71 RotateTransformOperation(double x, double y, double z, double angle, Operati
onType type) |
| 72 : m_x(x) | 72 : m_x(x) |
| 73 , m_y(y) | 73 , m_y(y) |
| 74 , m_z(z) | 74 , m_z(z) |
| 75 , m_angle(angle) | 75 , m_angle(angle) |
| 76 , m_type(type) | 76 , m_type(type) |
| 77 { | 77 { |
| 78 ASSERT(type == RotateX || type == RotateY || type == RotateZ || type ==
Rotate3D); | 78 ASSERT(type == RotateX || type == RotateY || type == RotateZ || type ==
Rotate3D); |
| 79 } | 79 } |
| 80 | 80 |
| 81 double m_x; | 81 double m_x; |
| 82 double m_y; | 82 double m_y; |
| 83 double m_z; | 83 double m_z; |
| 84 double m_angle; | 84 double m_angle; |
| 85 OperationType m_type; | 85 OperationType m_type; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 DEFINE_TRANSFORM_TYPE_CASTS(RotateTransformOperation, isRotateTransformOperation
()); |
| 89 |
| 88 } // namespace blink | 90 } // namespace blink |
| 89 | 91 |
| 90 #endif // RotateTransformOperation_h | 92 #endif // RotateTransformOperation_h |
| OLD | NEW |