Changeset 183274 in webkit
- Timestamp:
- Apr 24, 2015 12:01:48 PM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r183271 r183274 1 2015-04-24 Simon Fraser <simon.fraser@apple.com> 2 3 Make it possible to map a secondary quad through TransformState 4 https://bugs.webkit.org/show_bug.cgi?id=144156 5 6 Reviewed by Dean Jackson. 7 8 A future patch will need to map two quads simultaneously through TransformState, 9 so add the ability to provide an optional secondary quad. 10 11 This patch also firms up the setQuad() contract, fixing webkit.org/b/106680, 12 requiring the state to be flattened when setting the quad (and now, the secondary quad). 13 Previously, setQuad implicitly flattened but failed to update m_mapPoint when 14 doing so. 15 16 * platform/graphics/ca/GraphicsLayerCA.cpp: 17 (WebCore::GraphicsLayerCA::computeVisibleRect): Now we have to explicitly flatten 18 before setting the quad. 19 * platform/graphics/ca/GraphicsLayerCA.h: Drive-up #include removal. 20 * platform/graphics/transforms/TransformState.cpp: 21 (WebCore::TransformState::operator=): Copy the secondary quad if we have one. 22 (WebCore::TransformState::translateMappedCoordinates): Move the secondary quad 23 if we have one. 24 (WebCore::TransformState::mappedQuad): Code factored into mapQuad(). 25 (WebCore::TransformState::mappedSecondaryQuad): Return the secondary quad mapped 26 into the state's current coordinate space. 27 (WebCore::TransformState::mapQuad): Factored code. 28 * platform/graphics/transforms/TransformState.h: 29 (WebCore::TransformState::setQuad): Make the contract more explicit with assertions. 30 (WebCore::TransformState::setSecondaryQuad): Ditto when setting the secondary quad. 31 (WebCore::TransformState::lastPlanarSecondaryQuad): 32 (WebCore::TransformState::lastPlanarQuad): Deleted. 33 1 34 2015-04-24 Myles C. Maxfield <mmaxfield@apple.com> 2 35 -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
r183241 r183274 1209 1209 if (masksToBounds()) { 1210 1210 ASSERT(accumulation == TransformState::FlattenTransform); 1211 // Replace the quad in the TransformState with one that is clipped to this layer's bounds 1211 // Flatten, and replace the quad in the TransformState with one that is clipped to this layer's bounds. 1212 state.flatten(); 1212 1213 state.setQuad(clipRectForSelf); 1213 1214 } -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
r183242 r183274 35 35 #include <wtf/RetainPtr.h> 36 36 #include <wtf/text/StringHash.h> 37 38 #if PLATFORM(COCOA)39 #include "TileController.h"40 #endif41 37 42 38 // Enable this to add a light red wash over the visible portion of Tiled Layers, as computed -
trunk/Source/WebCore/platform/graphics/transforms/TransformState.cpp
r166889 r183274 36 36 if (m_mapPoint) 37 37 m_lastPlanarPoint = other.m_lastPlanarPoint; 38 if (m_mapQuad) 38 if (m_mapQuad) { 39 39 m_lastPlanarQuad = other.m_lastPlanarQuad; 40 if (other.m_lastPlanarSecondaryQuad) 41 m_lastPlanarSecondaryQuad = std::make_unique<FloatQuad>(*other.m_lastPlanarSecondaryQuad); 42 else 43 m_lastPlanarSecondaryQuad = nullptr; 44 45 } 40 46 m_accumulatingTransform = other.m_accumulatingTransform; 41 47 m_direction = other.m_direction; … … 62 68 if (m_mapPoint) 63 69 m_lastPlanarPoint.move(adjustedOffset); 64 if (m_mapQuad) 70 if (m_mapQuad) { 65 71 m_lastPlanarQuad.move(adjustedOffset); 72 if (m_lastPlanarSecondaryQuad) 73 m_lastPlanarSecondaryQuad->move(adjustedOffset); 74 } 66 75 } 67 76 … … 172 181 173 182 FloatQuad quad = m_lastPlanarQuad; 183 mapQuad(quad, wasClamped); 184 return quad; 185 } 186 187 std::unique_ptr<FloatQuad> TransformState::mappedSecondaryQuad(bool* wasClamped) const 188 { 189 if (wasClamped) 190 *wasClamped = false; 191 192 if (!m_lastPlanarSecondaryQuad) 193 return nullptr; 194 195 FloatQuad quad = *m_lastPlanarSecondaryQuad; 196 mapQuad(quad, wasClamped); 197 return std::make_unique<FloatQuad>(quad); 198 } 199 200 void TransformState::mapQuad(FloatQuad& quad, bool* wasClamped) const 201 { 174 202 quad.move((m_direction == ApplyTransformDirection) ? m_accumulatedOffset : -m_accumulatedOffset); 175 203 if (!m_accumulatedTransform) 176 return quad;204 return; 177 205 178 206 if (m_direction == ApplyTransformDirection) 179 returnm_accumulatedTransform->mapQuad(quad);180 181 returnm_accumulatedTransform->inverse().projectQuad(quad, wasClamped);207 quad = m_accumulatedTransform->mapQuad(quad); 208 209 quad = m_accumulatedTransform->inverse().projectQuad(quad, wasClamped); 182 210 } 183 211 -
trunk/Source/WebCore/platform/graphics/transforms/TransformState.h
r166889 r183274 75 75 void setQuad(const FloatQuad& quad) 76 76 { 77 // FIXME: this assumes that the quad being added is in the coordinate system of the current state. 78 // This breaks if we're simultaneously mapping a point. https://bugs.webkit.org/show_bug.cgi?id=106680 79 ASSERT(!m_mapPoint); 80 m_accumulatedOffset = LayoutSize(); 77 // We must be in a flattened state (no accumulated offset) when setting this quad. 78 ASSERT(m_accumulatedOffset == LayoutSize()); 81 79 m_lastPlanarQuad = quad; 80 } 81 82 void setSecondaryQuad(const FloatQuad* quad) 83 { 84 // We must be in a flattened state (no accumulated offset) when setting this secondary quad. 85 ASSERT(m_accumulatedOffset == LayoutSize()); 86 if (quad) 87 m_lastPlanarSecondaryQuad = std::make_unique<FloatQuad>(*quad); 88 else 89 m_lastPlanarSecondaryQuad = nullptr; 82 90 } 83 91 … … 88 96 89 97 void move(const LayoutSize&, TransformAccumulation = FlattenTransform); 90 void applyTransform(const AffineTransform& transformFromContainer, TransformAccumulation = FlattenTransform, bool* wasClamped = 0);91 void applyTransform(const TransformationMatrix& transformFromContainer, TransformAccumulation = FlattenTransform, bool* wasClamped = 0);92 void flatten(bool* wasClamped = 0);98 void applyTransform(const AffineTransform& transformFromContainer, TransformAccumulation = FlattenTransform, bool* wasClamped = nullptr); 99 void applyTransform(const TransformationMatrix& transformFromContainer, TransformAccumulation = FlattenTransform, bool* wasClamped = nullptr); 100 void flatten(bool* wasClamped = nullptr); 93 101 94 102 // Return the coords of the point or quad in the last flattened layer 95 103 FloatPoint lastPlanarPoint() const { return m_lastPlanarPoint; } 96 104 FloatQuad lastPlanarQuad() const { return m_lastPlanarQuad; } 105 FloatQuad* lastPlanarSecondaryQuad() const { return m_lastPlanarSecondaryQuad.get(); } 97 106 98 107 // Return the point or quad mapped through the current transform 99 FloatPoint mappedPoint(bool* wasClamped = 0) const; 100 FloatQuad mappedQuad(bool* wasClamped = 0) const; 108 FloatPoint mappedPoint(bool* wasClamped = nullptr) const; 109 FloatQuad mappedQuad(bool* wasClamped = nullptr) const; 110 std::unique_ptr<FloatQuad> mappedSecondaryQuad(bool* wasClamped = nullptr) const; 101 111 102 112 private: … … 106 116 void applyAccumulatedOffset(); 107 117 118 void mapQuad(FloatQuad&, bool* clamped) const; 119 108 120 FloatPoint m_lastPlanarPoint; 109 121 FloatQuad m_lastPlanarQuad; 122 std::unique_ptr<FloatQuad> m_lastPlanarSecondaryQuad; // Optional second quad to map. 110 123 111 124 // We only allocate the transform if we need to … … 113 126 LayoutSize m_accumulatedOffset; 114 127 bool m_accumulatingTransform; 115 bool m_mapPoint, m_mapQuad; 128 bool m_mapPoint; 129 bool m_mapQuad; 116 130 TransformDirection m_direction; 117 131 };
Note: See TracChangeset
for help on using the changeset viewer.