summaryrefslogtreecommitdiff
path: root/chromium/cc/animation/transform_operation.h
blob: 74673ab48cb27d9d79311cf9dba7927d3534da89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CC_ANIMATION_TRANSFORM_OPERATION_H_
#define CC_ANIMATION_TRANSFORM_OPERATION_H_

#include "ui/gfx/transform.h"

namespace cc {

struct TransformOperation {
  enum Type {
    TransformOperationTranslate,
    TransformOperationRotate,
    TransformOperationScale,
    TransformOperationSkew,
    TransformOperationPerspective,
    TransformOperationMatrix,
    TransformOperationIdentity
  };

  TransformOperation()
      : type(TransformOperationIdentity) {
  }

  Type type;
  gfx::Transform matrix;

  union {
    double perspective_depth;

    struct {
      double x, y;
    } skew;

    struct {
      double x, y, z;
    } scale;

    struct {
      double x, y, z;
    } translate;

    struct {
      struct {
        double x, y, z;
      } axis;

      double angle;
    } rotate;
  };

  bool IsIdentity() const;
  static bool BlendTransformOperations(const TransformOperation* from,
                                       const TransformOperation* to,
                                       double progress,
                                       gfx::Transform* result);
};

}  // namespace cc

#endif  // CC_ANIMATION_TRANSFORM_OPERATION_H_