Changeset 116332 in webkit
- Timestamp:
- May 7, 2012 11:48:06 AM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r116331 r116332 1 2012-05-07 Shawn Singh <shawnsingh@chromium.org> 2 3 [chromium] CCMathUtil projectPoint needs to avoid divide-by-zero 4 https://bugs.webkit.org/show_bug.cgi?id=85560 5 6 Reviewed by Adrienne Walker. 7 8 Unit test added: CCMathUtilTest.cpp - verifyProjectionOfPerpendicularPlane 9 Unit test updated/renamed: CCLayerTreeHostCommonTest.cpp - verifyVisibleRectFor3dPerspectiveWhenClippedByW 10 11 The divide-by-zero occurs in an innocuous case where the layers 12 are probably invisible anyway. However, producing Infs and NaNs 13 could cause values to be used when un-intended, so its appropriate 14 to handle the divide-by-zero correctly. 15 16 * platform/graphics/chromium/cc/CCMathUtil.cpp: 17 (WebCore::projectPoint): 18 1 19 2012-05-07 Pravin D <pravind.2k4@gmail.com> 2 20 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCMathUtil.cpp
r113637 r116332 67 67 static HomogeneousCoordinate projectPoint(const TransformationMatrix& transform, const FloatPoint& p) 68 68 { 69 // In this case, the layer we are trying to project onto is perpendicular to ray 70 // (point p and z-axis direction) that we are trying to project. This happens when the 71 // layer is rotated so that it is infinitesimally thin, or when it is co-planar with 72 // the camera origin -- i.e. when the layer is invisible anyway. 73 if (!transform.m33()) 74 return HomogeneousCoordinate(0, 0, 0, 1); 75 69 76 double x = p.x(); 70 77 double y = p.y(); -
trunk/Source/WebKit/chromium/ChangeLog
r116319 r116332 1 2012-05-07 Shawn Singh <shawnsingh@chromium.org> 2 3 [chromium] CCMathUtil projectPoint needs to avoid divide-by-zero 4 https://bugs.webkit.org/show_bug.cgi?id=85560 5 6 Reviewed by Adrienne Walker. 7 8 * tests/CCLayerTreeHostCommonTest.cpp: 9 (WebKitTests::TEST): 10 * tests/CCMathUtilTest.cpp: 11 (WebCore::TEST): 12 (WebCore): 13 1 14 2012-05-07 Nat Duca <nduca@chromium.org> 2 15 -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp
r116142 r116332 1173 1173 } 1174 1174 1175 TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspective IsClipped)1175 TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW) 1176 1176 { 1177 1177 // Test the calculateVisibleRect() function works correctly when projecting a surface … … 1191 1191 layerToSurfaceTransform.makeIdentity(); 1192 1192 layerToSurfaceTransform.applyPerspective(1); 1193 layerToSurfaceTransform.translate3d( 0, 0, 1);1193 layerToSurfaceTransform.translate3d(-1, 0, 1); 1194 1194 layerToSurfaceTransform.rotate3d(0, 45, 0); 1195 1195 … … 1200 1200 ASSERT_TRUE(clipped); 1201 1201 1202 int expectedXPosition = -10;1202 int expectedXPosition = 0; 1203 1203 int expectedWidth = 10; 1204 1204 IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); -
trunk/Source/WebKit/chromium/tests/CCMathUtilTest.cpp
r115386 r116332 100 100 } 101 101 102 TEST(CCMathUtilTest, verifyProjectionOfPerpendicularPlane) 103 { 104 // In this case, the m33() element of the transform becomes zero, which could cause a 105 // divide-by-zero when projecting points/quads. 106 107 TransformationMatrix transform; 108 transform.makeIdentity(); 109 transform.setM33(0); 110 111 FloatRect rect = FloatRect(0, 0, 1, 1); 112 FloatRect projectedRect = CCMathUtil::projectClippedRect(transform, rect); 113 114 EXPECT_EQ(0, projectedRect.x()); 115 EXPECT_EQ(0, projectedRect.y()); 116 EXPECT_TRUE(projectedRect.isEmpty()); 117 } 118 102 119 } // namespace
Note: See TracChangeset
for help on using the changeset viewer.