| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 if (*m_operations[i] != *o.m_operations[i]) | 45 if (*m_operations[i] != *o.m_operations[i]) |
| 46 return false; | 46 return false; |
| 47 } | 47 } |
| 48 | 48 |
| 49 return true; | 49 return true; |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool TransformOperations::operationsMatch( | 52 bool TransformOperations::operationsMatch( |
| 53 const TransformOperations& other) const { | 53 const TransformOperations& other) const { |
| 54 size_t numOperations = operations().size(); | 54 size_t numOperations = operations().size(); |
| 55 // If the sizes of the function lists don't match, the lists don't match | |
| 56 if (numOperations != other.operations().size()) | 55 if (numOperations != other.operations().size()) |
| 57 return false; | 56 return false; |
| 58 | 57 |
| 59 // If the types of each function are not the same, the lists don't match | |
| 60 for (size_t i = 0; i < numOperations; ++i) { | 58 for (size_t i = 0; i < numOperations; ++i) { |
| 61 if (!operations()[i]->isSameType(*other.operations()[i])) | 59 if (operations()[i]->primitiveType() != |
| 60 other.operations()[i]->primitiveType()) { |
| 62 return false; | 61 return false; |
| 62 } |
| 63 } | 63 } |
| 64 return true; | 64 return true; |
| 65 } | 65 } |
| 66 | 66 |
| 67 TransformOperations TransformOperations::blendByMatchingOperations( | 67 TransformOperations TransformOperations::blendByMatchingOperations( |
| 68 const TransformOperations& from, | 68 const TransformOperations& from, |
| 69 const double& progress) const { | 69 const double& progress) const { |
| 70 TransformOperations result; | 70 TransformOperations result; |
| 71 | 71 |
| 72 unsigned fromSize = from.operations().size(); | 72 unsigned fromSize = from.operations().size(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // Evaluate blended matrix here to avoid creating a nested data structure of | 108 // Evaluate blended matrix here to avoid creating a nested data structure of |
| 109 // unbounded depth. | 109 // unbounded depth. |
| 110 TransformationMatrix fromTransform; | 110 TransformationMatrix fromTransform; |
| 111 TransformationMatrix toTransform; | 111 TransformationMatrix toTransform; |
| 112 from.apply(FloatSize(), fromTransform); | 112 from.apply(FloatSize(), fromTransform); |
| 113 apply(FloatSize(), toTransform); | 113 apply(FloatSize(), toTransform); |
| 114 toTransform.blend(fromTransform, progress); | 114 toTransform.blend(fromTransform, progress); |
| 115 return Matrix3DTransformOperation::create(toTransform); | 115 return Matrix3DTransformOperation::create(toTransform); |
| 116 } | 116 } |
| 117 | 117 |
| 118 // https://drafts.csswg.org/css-transforms-1/#interpolation-of-transforms |
| 118 TransformOperations TransformOperations::blend(const TransformOperations& from, | 119 TransformOperations TransformOperations::blend(const TransformOperations& from, |
| 119 double progress) const { | 120 double progress) const { |
| 120 if (from == *this || (!from.size() && !size())) | 121 if (from == *this || (!from.size() && !size())) |
| 121 return *this; | 122 return *this; |
| 122 | 123 |
| 123 // If either list is empty, use blendByMatchingOperations which has special | 124 // If either list is empty, use blendByMatchingOperations which has special |
| 124 // logic for this case. | 125 // logic for this case. |
| 125 if (!from.size() || !size() || from.operationsMatch(*this)) | 126 if (!from.size() || !size() || from.operationsMatch(*this)) |
| 126 return blendByMatchingOperations(from, progress); | 127 return blendByMatchingOperations(from, progress); |
| 127 | 128 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 } | 429 } |
| 429 | 430 |
| 430 TransformOperations TransformOperations::zoom(double factor) const { | 431 TransformOperations TransformOperations::zoom(double factor) const { |
| 431 TransformOperations result; | 432 TransformOperations result; |
| 432 for (auto& transformOperation : m_operations) | 433 for (auto& transformOperation : m_operations) |
| 433 result.m_operations.append(transformOperation->zoom(factor)); | 434 result.m_operations.append(transformOperation->zoom(factor)); |
| 434 return result; | 435 return result; |
| 435 } | 436 } |
| 436 | 437 |
| 437 } // namespace blink | 438 } // namespace blink |
| OLD | NEW |