| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 if (m_mapPoint) | 37 if (m_mapPoint) |
| 38 m_lastPlanarPoint = other.m_lastPlanarPoint; | 38 m_lastPlanarPoint = other.m_lastPlanarPoint; |
| 39 if (m_mapQuad) | 39 if (m_mapQuad) |
| 40 m_lastPlanarQuad = other.m_lastPlanarQuad; | 40 m_lastPlanarQuad = other.m_lastPlanarQuad; |
| 41 m_accumulatingTransform = other.m_accumulatingTransform; | 41 m_accumulatingTransform = other.m_accumulatingTransform; |
| 42 m_direction = other.m_direction; | 42 m_direction = other.m_direction; |
| 43 | 43 |
| 44 m_accumulatedTransform.clear(); | 44 m_accumulatedTransform.clear(); |
| 45 | 45 |
| 46 if (other.m_accumulatedTransform) | 46 if (other.m_accumulatedTransform) |
| 47 m_accumulatedTransform = adoptPtr(new TransformationMatrix(*other.m_accu
mulatedTransform)); | 47 m_accumulatedTransform = TransformationMatrix::create(*other.m_accumulat
edTransform); |
| 48 | 48 |
| 49 return *this; | 49 return *this; |
| 50 } | 50 } |
| 51 | 51 |
| 52 void TransformState::translateTransform(const LayoutSize& offset) | 52 void TransformState::translateTransform(const LayoutSize& offset) |
| 53 { | 53 { |
| 54 if (m_direction == ApplyTransformDirection) | 54 if (m_direction == ApplyTransformDirection) |
| 55 m_accumulatedTransform->translateRight(offset.width().toDouble(), offset
.height().toDouble()); | 55 m_accumulatedTransform->translateRight(offset.width().toDouble(), offset
.height().toDouble()); |
| 56 else | 56 else |
| 57 m_accumulatedTransform->translate(offset.width().toDouble(), offset.heig
ht().toDouble()); | 57 m_accumulatedTransform->translate(offset.width().toDouble(), offset.heig
ht().toDouble()); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 if (transformFromContainer.isIntegerTranslation()) { | 111 if (transformFromContainer.isIntegerTranslation()) { |
| 112 move(LayoutSize(transformFromContainer.e(), transformFromContainer.f()),
accumulate); | 112 move(LayoutSize(transformFromContainer.e(), transformFromContainer.f()),
accumulate); |
| 113 return; | 113 return; |
| 114 } | 114 } |
| 115 | 115 |
| 116 applyAccumulatedOffset(); | 116 applyAccumulatedOffset(); |
| 117 | 117 |
| 118 // If we have an accumulated transform from last time, multiply in this tran
sform | 118 // If we have an accumulated transform from last time, multiply in this tran
sform |
| 119 if (m_accumulatedTransform) { | 119 if (m_accumulatedTransform) { |
| 120 if (m_direction == ApplyTransformDirection) | 120 if (m_direction == ApplyTransformDirection) |
| 121 m_accumulatedTransform = adoptPtr(new TransformationMatrix(transform
FromContainer * *m_accumulatedTransform)); | 121 m_accumulatedTransform = TransformationMatrix::create(transformFromC
ontainer * *m_accumulatedTransform); |
| 122 else | 122 else |
| 123 m_accumulatedTransform->multiply(transformFromContainer); | 123 m_accumulatedTransform->multiply(transformFromContainer); |
| 124 } else if (accumulate == AccumulateTransform) { | 124 } else if (accumulate == AccumulateTransform) { |
| 125 // Make one if we started to accumulate | 125 // Make one if we started to accumulate |
| 126 m_accumulatedTransform = adoptPtr(new TransformationMatrix(transformFrom
Container)); | 126 m_accumulatedTransform = TransformationMatrix::create(transformFromConta
iner); |
| 127 } | 127 } |
| 128 | 128 |
| 129 if (accumulate == FlattenTransform) { | 129 if (accumulate == FlattenTransform) { |
| 130 const TransformationMatrix* finalTransform = m_accumulatedTransform ? m_
accumulatedTransform.get() : &transformFromContainer; | 130 const TransformationMatrix* finalTransform = m_accumulatedTransform ? m_
accumulatedTransform.get() : &transformFromContainer; |
| 131 flattenWithTransform(*finalTransform, wasClamped); | 131 flattenWithTransform(*finalTransform, wasClamped); |
| 132 } | 132 } |
| 133 m_accumulatingTransform = accumulate == AccumulateTransform; | 133 m_accumulatingTransform = accumulate == AccumulateTransform; |
| 134 } | 134 } |
| 135 | 135 |
| 136 void TransformState::flatten(bool* wasClamped) | 136 void TransformState::flatten(bool* wasClamped) |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 197 |
| 198 // We could throw away m_accumulatedTransform if we wanted to here, but that | 198 // We could throw away m_accumulatedTransform if we wanted to here, but that |
| 199 // would cause thrash when traversing hierarchies with alternating | 199 // would cause thrash when traversing hierarchies with alternating |
| 200 // preserve-3d and flat elements. | 200 // preserve-3d and flat elements. |
| 201 if (m_accumulatedTransform) | 201 if (m_accumulatedTransform) |
| 202 m_accumulatedTransform->makeIdentity(); | 202 m_accumulatedTransform->makeIdentity(); |
| 203 m_accumulatingTransform = false; | 203 m_accumulatingTransform = false; |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace blink | 206 } // namespace blink |
| OLD | NEW |