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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 , m_direction(mappingDirection) | 52 , m_direction(mappingDirection) |
53 { | 53 { |
54 } | 54 } |
55 | 55 |
56 TransformState(TransformDirection mappingDirection, const FloatPoint& p) | 56 TransformState(TransformDirection mappingDirection, const FloatPoint& p) |
57 : m_lastPlanarPoint(p) | 57 : m_lastPlanarPoint(p) |
58 , m_accumulatingTransform(false) | 58 , m_accumulatingTransform(false) |
59 , m_mapPoint(true) | 59 , m_mapPoint(true) |
60 , m_mapQuad(false) | 60 , m_mapQuad(false) |
61 , m_direction(mappingDirection) | 61 , m_direction(mappingDirection) |
62 , m_forceAccumulatingTransform(false) | |
62 { | 63 { |
63 } | 64 } |
64 | 65 |
65 TransformState(TransformDirection mappingDirection, const FloatQuad& quad) | 66 TransformState(TransformDirection mappingDirection, const FloatQuad& quad) |
66 : m_lastPlanarQuad(quad) | 67 : m_lastPlanarQuad(quad) |
67 , m_accumulatingTransform(false) | 68 , m_accumulatingTransform(false) |
68 , m_mapPoint(false) | 69 , m_mapPoint(false) |
69 , m_mapQuad(true) | 70 , m_mapQuad(true) |
70 , m_direction(mappingDirection) | 71 , m_direction(mappingDirection) |
72 , m_forceAccumulatingTransform(false) | |
71 { | 73 { |
72 } | 74 } |
73 | 75 |
76 // Accumulate a transform but don't map any points directly. | |
77 TransformState(TransformDirection mappingDirection) | |
78 : m_accumulatedTransform(TransformationMatrix::create()) | |
79 , m_accumulatingTransform(true) | |
80 , m_mapPoint(false) | |
81 , m_mapQuad(false) | |
82 , m_direction(mappingDirection) | |
83 , m_forceAccumulatingTransform(true) | |
84 { | |
85 } | |
86 | |
74 TransformState(const TransformState& other) { *this = other; } | 87 TransformState(const TransformState& other) { *this = other; } |
75 | 88 |
76 TransformState& operator=(const TransformState&); | 89 TransformState& operator=(const TransformState&); |
77 | 90 |
78 void setQuad(const FloatQuad& quad) | 91 void setQuad(const FloatQuad& quad) |
79 { | 92 { |
80 // FIXME: this assumes that the quad being added is in the coordinate sy stem of the current state. | 93 // FIXME: this assumes that the quad being added is in the coordinate sy stem of the current state. |
81 // This breaks if we're simultaneously mapping a point. https://bugs.web kit.org/show_bug.cgi?id=106680 | 94 // This breaks if we're simultaneously mapping a point. https://bugs.web kit.org/show_bug.cgi?id=106680 |
82 ASSERT(!m_mapPoint); | 95 ASSERT(!m_mapPoint); |
83 m_accumulatedOffset = LayoutSize(); | 96 m_accumulatedOffset = LayoutSize(); |
(...skipping 15 matching lines...) Expand all Loading... | |
99 void flatten(bool* wasClamped = 0); | 112 void flatten(bool* wasClamped = 0); |
100 | 113 |
101 // Return the coords of the point or quad in the last flattened layer | 114 // Return the coords of the point or quad in the last flattened layer |
102 FloatPoint lastPlanarPoint() const { return m_lastPlanarPoint; } | 115 FloatPoint lastPlanarPoint() const { return m_lastPlanarPoint; } |
103 FloatQuad lastPlanarQuad() const { return m_lastPlanarQuad; } | 116 FloatQuad lastPlanarQuad() const { return m_lastPlanarQuad; } |
104 | 117 |
105 // Return the point or quad mapped through the current transform | 118 // Return the point or quad mapped through the current transform |
106 FloatPoint mappedPoint(bool* wasClamped = 0) const; | 119 FloatPoint mappedPoint(bool* wasClamped = 0) const; |
107 FloatQuad mappedQuad(bool* wasClamped = 0) const; | 120 FloatQuad mappedQuad(bool* wasClamped = 0) const; |
108 | 121 |
122 // Return the accumulated transform. | |
123 const TransformationMatrix& accumulatedTransform() const; | |
124 | |
109 private: | 125 private: |
110 void translateTransform(const LayoutSize&); | 126 void translateTransform(const LayoutSize&); |
111 void translateMappedCoordinates(const LayoutSize&); | 127 void translateMappedCoordinates(const LayoutSize&); |
112 void flattenWithTransform(const TransformationMatrix&, bool* wasClamped); | 128 void flattenWithTransform(const TransformationMatrix&, bool* wasClamped); |
113 void applyAccumulatedOffset(); | 129 void applyAccumulatedOffset(); |
114 | 130 |
115 FloatPoint m_lastPlanarPoint; | 131 FloatPoint m_lastPlanarPoint; |
116 FloatQuad m_lastPlanarQuad; | 132 FloatQuad m_lastPlanarQuad; |
117 | 133 |
118 // We only allocate the transform if we need to | 134 // We only allocate the transform if we need to |
119 OwnPtr<TransformationMatrix> m_accumulatedTransform; | 135 OwnPtr<TransformationMatrix> m_accumulatedTransform; |
120 LayoutSize m_accumulatedOffset; | 136 LayoutSize m_accumulatedOffset; |
121 bool m_accumulatingTransform; | 137 bool m_accumulatingTransform; |
122 bool m_mapPoint, m_mapQuad; | 138 bool m_mapPoint, m_mapQuad; |
123 TransformDirection m_direction; | 139 TransformDirection m_direction; |
140 bool m_forceAccumulatingTransform; | |
szager1
2016/03/08 23:34:15
Please reorder to keep all the bool's together.
dmazzoni
2016/03/09 18:14:59
Done.
| |
124 }; | 141 }; |
125 | 142 |
126 } // namespace blink | 143 } // namespace blink |
127 | 144 |
128 #endif // TransformState_h | 145 #endif // TransformState_h |
OLD | NEW |