OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "platform/transforms/IdentityTransformOperation.h" | 26 #include "platform/transforms/IdentityTransformOperation.h" |
27 #include "platform/transforms/InterpolatedTransformOperation.h" | 27 #include "platform/transforms/InterpolatedTransformOperation.h" |
28 #include "platform/transforms/Matrix3DTransformOperation.h" | 28 #include "platform/transforms/Matrix3DTransformOperation.h" |
29 #include "platform/transforms/RotateTransformOperation.h" | 29 #include "platform/transforms/RotateTransformOperation.h" |
30 #include <algorithm> | 30 #include <algorithm> |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 TransformOperations::TransformOperations(bool makeIdentity) { | 34 TransformOperations::TransformOperations(bool makeIdentity) { |
35 if (makeIdentity) | 35 if (makeIdentity) |
36 m_operations.append(IdentityTransformOperation::create()); | 36 m_operations.push_back(IdentityTransformOperation::create()); |
37 } | 37 } |
38 | 38 |
39 bool TransformOperations::operator==(const TransformOperations& o) const { | 39 bool TransformOperations::operator==(const TransformOperations& o) const { |
40 if (m_operations.size() != o.m_operations.size()) | 40 if (m_operations.size() != o.m_operations.size()) |
41 return false; | 41 return false; |
42 | 42 |
43 unsigned s = m_operations.size(); | 43 unsigned s = m_operations.size(); |
44 for (unsigned i = 0; i < s; i++) { | 44 for (unsigned i = 0; i < s; i++) { |
45 if (*m_operations[i] != *o.m_operations[i]) | 45 if (*m_operations[i] != *o.m_operations[i]) |
46 return false; | 46 return false; |
(...skipping 28 matching lines...) Expand all Loading... |
75 for (unsigned i = 0; i < size; i++) { | 75 for (unsigned i = 0; i < size; i++) { |
76 RefPtr<TransformOperation> fromOperation = | 76 RefPtr<TransformOperation> fromOperation = |
77 (i < fromSize) ? from.operations()[i].get() : 0; | 77 (i < fromSize) ? from.operations()[i].get() : 0; |
78 RefPtr<TransformOperation> toOperation = | 78 RefPtr<TransformOperation> toOperation = |
79 (i < toSize) ? operations()[i].get() : 0; | 79 (i < toSize) ? operations()[i].get() : 0; |
80 RefPtr<TransformOperation> blendedOperation = | 80 RefPtr<TransformOperation> blendedOperation = |
81 toOperation ? toOperation->blend(fromOperation.get(), progress) | 81 toOperation ? toOperation->blend(fromOperation.get(), progress) |
82 : (fromOperation ? fromOperation->blend(0, progress, true) | 82 : (fromOperation ? fromOperation->blend(0, progress, true) |
83 : nullptr); | 83 : nullptr); |
84 if (blendedOperation) | 84 if (blendedOperation) |
85 result.operations().append(blendedOperation); | 85 result.operations().push_back(blendedOperation); |
86 else { | 86 else { |
87 RefPtr<TransformOperation> identityOperation = | 87 RefPtr<TransformOperation> identityOperation = |
88 IdentityTransformOperation::create(); | 88 IdentityTransformOperation::create(); |
89 if (progress > 0.5) | 89 if (progress > 0.5) |
90 result.operations().append(toOperation ? toOperation | 90 result.operations().push_back(toOperation ? toOperation |
91 : identityOperation); | 91 : identityOperation); |
92 else | 92 else |
93 result.operations().append(fromOperation ? fromOperation | 93 result.operations().push_back(fromOperation ? fromOperation |
94 : identityOperation); | 94 : identityOperation); |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 return result; | 98 return result; |
99 } | 99 } |
100 | 100 |
101 PassRefPtr<TransformOperation> | 101 PassRefPtr<TransformOperation> |
102 TransformOperations::blendByUsingMatrixInterpolation( | 102 TransformOperations::blendByUsingMatrixInterpolation( |
103 const TransformOperations& from, | 103 const TransformOperations& from, |
104 double progress) const { | 104 double progress) const { |
(...skipping 15 matching lines...) Expand all Loading... |
120 double progress) const { | 120 double progress) const { |
121 if (from == *this || (!from.size() && !size())) | 121 if (from == *this || (!from.size() && !size())) |
122 return *this; | 122 return *this; |
123 | 123 |
124 // If either list is empty, use blendByMatchingOperations which has special | 124 // If either list is empty, use blendByMatchingOperations which has special |
125 // logic for this case. | 125 // logic for this case. |
126 if (!from.size() || !size() || from.operationsMatch(*this)) | 126 if (!from.size() || !size() || from.operationsMatch(*this)) |
127 return blendByMatchingOperations(from, progress); | 127 return blendByMatchingOperations(from, progress); |
128 | 128 |
129 TransformOperations result; | 129 TransformOperations result; |
130 result.operations().append(blendByUsingMatrixInterpolation(from, progress)); | 130 result.operations().push_back( |
| 131 blendByUsingMatrixInterpolation(from, progress)); |
131 return result; | 132 return result; |
132 } | 133 } |
133 | 134 |
134 static void findCandidatesInPlane(double px, | 135 static void findCandidatesInPlane(double px, |
135 double py, | 136 double py, |
136 double nz, | 137 double nz, |
137 double* candidates, | 138 double* candidates, |
138 int* numCandidates) { | 139 int* numCandidates) { |
139 // The angle that this point is rotated with respect to the plane nz | 140 // The angle that this point is rotated with respect to the plane nz |
140 double phi = atan2(px, py); | 141 double phi = atan2(px, py); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 const TransformOperations& addend) const { | 425 const TransformOperations& addend) const { |
425 TransformOperations result; | 426 TransformOperations result; |
426 result.m_operations = operations(); | 427 result.m_operations = operations(); |
427 result.m_operations.appendVector(addend.operations()); | 428 result.m_operations.appendVector(addend.operations()); |
428 return result; | 429 return result; |
429 } | 430 } |
430 | 431 |
431 TransformOperations TransformOperations::zoom(double factor) const { | 432 TransformOperations TransformOperations::zoom(double factor) const { |
432 TransformOperations result; | 433 TransformOperations result; |
433 for (auto& transformOperation : m_operations) | 434 for (auto& transformOperation : m_operations) |
434 result.m_operations.append(transformOperation->zoom(factor)); | 435 result.m_operations.push_back(transformOperation->zoom(factor)); |
435 return result; | 436 return result; |
436 } | 437 } |
437 | 438 |
438 } // namespace blink | 439 } // namespace blink |
OLD | NEW |