Changeset 168227 in webkit
- Timestamp:
- May 3, 2014 1:32:24 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r168223 r168227 1 2014-05-03 Simon Fraser <simon.fraser@apple.com> 2 3 Very fuzzy layers under non-decompasable matrices 4 https://bugs.webkit.org/show_bug.cgi?id=132516 5 <rdar://problem/16717478> 6 7 Reviewed by Sam Weinig. 8 9 Compare scaling under non-decomposable and decomposable matrices. 10 11 * compositing/contents-scale/non-decomposable-matrix-expected.html: Added. 12 * compositing/contents-scale/non-decomposable-matrix.html: Added. 13 1 14 2014-05-03 Zalan Bujtas <zalan@apple.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r168226 r168227 1 2014-05-03 Simon Fraser <simon.fraser@apple.com> 2 3 Very fuzzy layers under non-decompasable matrices 4 https://bugs.webkit.org/show_bug.cgi?id=132516 5 <rdar://problem/16717478> 6 7 Reviewed by Sam Weinig. 8 9 r155977 added code to modify layer contentsScale based on a root-relative 10 scale, so that scaled-up layers remained sharp. It does this by decomposing 11 an accumulated matrix, but failed to test whether the decomposition 12 succeeded. This would result in contentsScale of 0, which is clamped to 0.1, 13 resulting in very fuzzy layers. 14 15 Fix by testing for success of decomposition. 16 17 Test: compositing/contents-scale/non-decomposable-matrix.html 18 19 * platform/graphics/ca/GraphicsLayerCA.cpp: 20 (WebCore::maxScaleFromTransform): 21 * platform/graphics/transforms/TransformationMatrix.cpp: 22 (WebCore::TransformationMatrix::decompose2): Return early for identity matrices, 23 with fix for m11 and m22. 24 (WebCore::TransformationMatrix::decompose4): Return early for identity matrices. 25 * platform/graphics/transforms/TransformationMatrix.h: 26 Make Decomposed2Type and Decomposed4Type into C++ structs. 27 (WebCore::TransformationMatrix::Decomposed2Type::operator==): Added to make it easier 28 to write code that asserts that decomposition is correct. 29 (WebCore::TransformationMatrix::Decomposed4Type::operator==): Ditto. 30 1 31 2014-05-03 Simon Fraser <simon.fraser@apple.com> 2 32 -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
r168219 r168227 294 294 295 295 TransformationMatrix::Decomposed4Type decomposeData; 296 t.decompose4(decomposeData); 296 if (!t.decompose4(decomposeData)) 297 return 1; 298 297 299 return std::max(fabsf(narrowPrecisionToFloat(decomposeData.scaleX)), fabsf(narrowPrecisionToFloat(decomposeData.scaleY))); 298 300 } -
trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
r166233 r168227 1580 1580 decomp.scaleX = 1; 1581 1581 decomp.scaleY = 1; 1582 decomp.m11 = 1; 1583 decomp.m22 = 1; 1584 return true; 1582 1585 } 1583 1586 … … 1593 1596 decomp.scaleY = 1; 1594 1597 decomp.scaleZ = 1; 1598 return true; 1595 1599 } 1596 1600 -
trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h
r165676 r168227 127 127 } 128 128 129 // This form preserves the double math from input to output 129 // This form preserves the double math from input to output. 130 130 void map(double x, double y, double& x2, double& y2) const { multVecMatrix(x, y, x2, y2); } 131 131 132 // Map a 3D point through the transform, returning a 3D point.132 // Maps a 3D point through the transform, returning a 3D point. 133 133 FloatPoint3D mapPoint(const FloatPoint3D&) const; 134 134 135 // Map a 2D point through the transform, returning a 2D point.135 // Maps a 2D point through the transform, returning a 2D point. 136 136 // Note that this ignores the z component, effectively projecting the point into the z=0 plane. 137 137 FloatPoint mapPoint(const FloatPoint&) const; … … 144 144 145 145 // If the matrix has 3D components, the z component of the result is 146 // dropped, effectively projecting the rect into the z=0 plane 146 // dropped, effectively projecting the rect into the z=0 plane. 147 147 FloatRect mapRect(const FloatRect&) const; 148 148 … … 153 153 154 154 // If the matrix has 3D components, the z component of the result is 155 // dropped, effectively projecting the quad into the z=0 plane 155 // dropped, effectively projecting the quad into the z=0 plane. 156 156 FloatQuad mapQuad(const FloatQuad&) const; 157 157 158 // Map a point on the z=0 plane into a point on 159 // the plane with with the transform applied, by extending 160 // a ray perpendicular to the source plane and computing 161 // the local x,y position of the point where that ray intersects 162 // with the destination plane. 158 // Maps a point on the z=0 plane into a point on the plane with with the transform applied, by 159 // extending a ray perpendicular to the source plane and computing the local x,y position of 160 // the point where that ray intersects with the destination plane. 163 161 FloatPoint projectPoint(const FloatPoint&, bool* clamped = 0) const; 164 // Projects the four corners of the quad 162 // Projects the four corners of the quad. 165 163 FloatQuad projectQuad(const FloatQuad&, bool* clamped = 0) const; 166 164 // Projects the four corners of the quad and takes a bounding box, … … 231 229 TransformationMatrix& rotate3d(double rx, double ry, double rz); 232 230 233 // The vector (x,y,z) is normalized if it's not already. A vector of 234 // (0,0,0) uses a vector of (0,0,1). 231 // The vector (x,y,z) is normalized if it's not already. A vector of (0,0,0) uses a vector of (0,0,1). 235 232 TransformationMatrix& rotate3d(double x, double y, double z, double angle); 236 233 … … 251 248 bool hasPerspective() const { return m_matrix[2][3] != 0.0f; } 252 249 253 // returns a transformation that maps a rect to a rect250 // Returns a transformation that maps a rect to a rect. 254 251 static TransformationMatrix rectToRect(const FloatRect&, const FloatRect&); 255 252 256 253 bool isInvertible() const; 257 254 258 // This method returns the identity matrix if it is not invertible.255 // Returns the identity matrix if it is not invertible. 259 256 // Use isInvertible() before calling this if you need to know. 260 257 TransformationMatrix inverse() const; 261 258 262 // decompose the matrix into its component parts263 typedef struct{259 // Decompose the matrix into its component parts. 260 struct Decomposed2Type { 264 261 double scaleX, scaleY; 265 262 double translateX, translateY; 266 263 double angle; 267 264 double m11, m12, m21, m22; 268 } Decomposed2Type; 269 270 typedef struct { 265 266 bool operator==(const Decomposed2Type& other) const 267 { 268 return scaleX == other.scaleX && scaleY == other.scaleY 269 && translateX == other.translateX && translateY == other.translateY 270 && angle == other.angle 271 && m11 == other.m11 && m12 == other.m12 && m21 == other.m21 && m22 == other.m22; 272 } 273 }; 274 275 struct Decomposed4Type { 271 276 double scaleX, scaleY, scaleZ; 272 277 double skewXY, skewXZ, skewYZ; … … 274 279 double translateX, translateY, translateZ; 275 280 double perspectiveX, perspectiveY, perspectiveZ, perspectiveW; 276 } Decomposed4Type; 281 282 bool operator==(const Decomposed4Type& other) const 283 { 284 return scaleX == other.scaleX && scaleY == other.scaleY && scaleZ == other.scaleZ 285 && skewXY == other.skewXY && skewXZ == other.skewXZ && skewYZ == other.skewYZ 286 && quaternionX == other.quaternionX && quaternionY == other.quaternionY && quaternionZ == other.quaternionZ && quaternionW == other.quaternionW 287 && translateX == other.translateX && translateY == other.translateY && translateZ == other.translateZ 288 && perspectiveX == other.perspectiveX && perspectiveY == other.perspectiveY && perspectiveZ == other.perspectiveZ && perspectiveW == other.perspectiveW; 289 } 290 }; 277 291 278 292 bool decompose2(Decomposed2Type&) const; … … 292 306 } 293 307 294 // Throw away the non-affine parts of the matrix (lossy!) 308 // Throw away the non-affine parts of the matrix (lossy!). 295 309 void makeAffine(); 296 310 … … 358 372 bool isIntegerTranslation() const; 359 373 360 // This method returns the matrix without 3D components.374 // Returns the matrix without 3D components. 361 375 TransformationMatrix to2dTransform() const; 362 376 … … 381 395 } 382 396 383 // multiply passed 3D point by matrix384 397 void multVecMatrix(double x, double y, double z, double& dstX, double& dstY, double& dstZ) const; 385 398 FloatPoint3D internalMapPoint(const FloatPoint3D& sourcePoint) const
Note: See TracChangeset
for help on using the changeset viewer.