Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: cc/transform_operations.h

Issue 11876016: Define cc::TransformOperations and webkit::WebTransformOperationsImpl (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Put TransformOperation into its own header Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/transform_operation.cc ('k') | cc/transform_operations.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_TRANSFORM_OPERATIONS_H_
6 #define CC_TRANSFORM_OPERATIONS_H_
7
8 #include <vector>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/cc_export.h"
12 #include "cc/transform_operation.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMa trix.h"
14
15 namespace cc {
16
17 // Transform operations are a decomposed transformation matrix. It can be
18 // applied to obtain a WebTransformationMatrix at any time, and can be blended
19 // intelligently with other transform operations, so long as they represent the
20 // same decomposition. For example, if we have a transform that is made up of
21 // a rotation followed by skew, it can be blended intelligently with another
22 // transform made up of a rotation followed by a skew. Blending is possible if
23 // we have two dissimilar sets of transform operations, but the effect may not
24 // be what was intended. For more information, see the comments for the blend
25 // function below.
26 class CC_EXPORT TransformOperations {
27 public:
28 TransformOperations();
29 TransformOperations(const TransformOperations& other);
30 ~TransformOperations();
31
32 // Returns a transformation matrix representing these transform operations.
33 WebKit::WebTransformationMatrix Apply() const;
34
35 // Given another set of transform operations and a progress in the range
36 // [0, 1], returns a transformation matrix representing the intermediate
37 // value. If this->MatchesTypes(from), then each of the operations are
38 // blended separately and then combined. Otherwise, the two sets of
39 // transforms are baked to matrices (using apply), and the matrices are
40 // then decomposed and interpolated. For more information, see
41 // http://www.w3.org/TR/2011/WD-css3-2d-transforms-20111215/#matrix-decomposit ion.
42 WebKit::WebTransformationMatrix Blend(
43 const TransformOperations& from, double progress) const;
44
45 // Returns true if this operation and its descendants have the same types
46 // as other and its descendants.
47 bool MatchesTypes(const TransformOperations& other) const;
48
49 // Returns true if these operations can be blended. It will only return
50 // false if we must resort to matrix interpolation, and matrix interpolation
51 // fails (this can happen if either matrix cannot be decomposed).
52 bool CanBlendWith(const TransformOperations& other) const;
53
54 void AppendTranslate(double x, double y, double z);
55 void AppendRotate(double x, double y, double z, double degrees);
56 void AppendScale(double x, double y, double z);
57 void AppendSkew(double x, double y);
58 void AppendPerspective(double depth);
59 void AppendMatrix(const WebKit::WebTransformationMatrix& matrix);
60 void AppendIdentity();
61 bool IsIdentity() const;
62
63 private:
64 bool BlendInternal(const TransformOperations& from, double progress,
65 WebKit::WebTransformationMatrix& result) const;
66
67 std::vector<TransformOperation> operations_;
68 };
69
70 } // namespace cc
71
72 #endif // CC_TRANSFORM_OPERATIONS_H_
OLDNEW
« no previous file with comments | « cc/transform_operation.cc ('k') | cc/transform_operations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698