Changeset 159463 in webkit
- Timestamp:
- Nov 18, 2013, 3:33:04 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r159460 r159463 1 2013-11-18 Simon Fraser <simon.fraser@apple.com> 2 3 At some scales, opaque compositing layers have garbage pixels around the edges 4 https://bugs.webkit.org/show_bug.cgi?id=124541 5 6 Reviewed by Dean Jackson. 7 8 Layers get marked as having opaque contents when their background is 9 known to paint the entire layer. However, this failed to take into 10 account two reasons why every pixel may not get painted. 11 12 First, subpixel layout can result in non-integral RenderLayer 13 bounds, which will get rounded up to an integral GraphicsLayer 14 size. When this happens we may not paint edge pixels. 15 16 Second, at non-integral scale factors, graphics context scaling 17 may cause us to not paint edge pixels. 18 19 Fix by only marking PlatformCALayers as having opaque contents 20 when the contentsScale of the layer is integral. 21 22 Not testable, because we can't guarantee to get garbage pixels 23 in a ref test, and layer dumps show GraphicsLayer's notion of 24 content opaqueness, not the one we set on the PlatformCALayer. 25 26 * platform/graphics/ca/GraphicsLayerCA.cpp: 27 (WebCore::isIntegral): 28 (WebCore::clampedContentsScaleForScale): 29 (WebCore::GraphicsLayerCA::updateRootRelativeScale): 30 (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): 31 (WebCore::GraphicsLayerCA::updateContentsOpaque): 32 (WebCore::GraphicsLayerCA::getTransformFromAnimationsWithMaxScaleImpact): 33 Drive-by typo fix. 34 (WebCore::GraphicsLayerCA::noteChangesForScaleSensitiveProperties): 35 * platform/graphics/ca/GraphicsLayerCA.h: 36 * rendering/RenderLayerBacking.cpp: 37 (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): 38 1 39 2013-11-18 David Hyatt <hyatt@apple.com> 2 40 -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
r159027 r159463 70 70 // of 250ms. So send a very small value instead. 71 71 static const float cAnimationAlmostZeroDuration = 1e-3f; 72 73 static inline bool isIntegral(float value) 74 { 75 return static_cast<int>(value) == value; 76 } 77 78 static float clampedContentsScaleForScale(float scale) 79 { 80 // Define some limits as a sanity check for the incoming scale value 81 // those too small to see. 82 const float maxScale = 10.0f; 83 const float minScale = 0.01f; 84 return std::max(minScale, std::min(scale, maxScale)); 85 } 72 86 73 87 static bool isTransformTypeTransformationMatrix(TransformOperation::OperationType transformType) … … 1119 1133 if (rootRelativeScaleFactor != m_rootRelativeScaleFactor) { 1120 1134 m_rootRelativeScaleFactor = rootRelativeScaleFactor; 1121 m_uncommittedChanges |= ContentsScaleChanged ;1135 m_uncommittedChanges |= ContentsScaleChanged | ContentsOpaqueChanged; 1122 1136 } 1123 1137 } … … 1302 1316 updateContentsVisibility(); 1303 1317 1318 // Note that contentsScale can affect whether the layer can be opaque. 1304 1319 if (m_uncommittedChanges & ContentsOpaqueChanged) 1305 updateContentsOpaque( );1320 updateContentsOpaque(pageScaleFactor); 1306 1321 1307 1322 if (m_uncommittedChanges & BackfaceVisibilityChanged) … … 1566 1581 } 1567 1582 1568 void GraphicsLayerCA::updateContentsOpaque() 1569 { 1570 m_layer->setOpaque(m_contentsOpaque); 1583 void GraphicsLayerCA::updateContentsOpaque(float pageScaleFactor) 1584 { 1585 bool contentsOpaque = m_contentsOpaque; 1586 if (contentsOpaque) { 1587 float contentsScale = clampedContentsScaleForScale(m_rootRelativeScaleFactor * pageScaleFactor * deviceScaleFactor()); 1588 if (!isIntegral(contentsScale)) 1589 contentsOpaque = false; 1590 } 1591 1592 m_layer->setOpaque(contentsOpaque); 1571 1593 1572 1594 if (LayerMap* layerCloneMap = m_layerClones.get()) { 1573 1595 LayerMap::const_iterator end = layerCloneMap->end(); 1574 1596 for (LayerMap::const_iterator it = layerCloneMap->begin(); it != end; ++it) 1575 it->value->setOpaque( m_contentsOpaque);1597 it->value->setOpaque(contentsOpaque); 1576 1598 } 1577 1599 } … … 2304 2326 2305 2327 for (size_t i = 0; i < matrices.size(); ++i) { 2306 TransformationMatrix roo otRelativeTransformWithAnimation = parentTransformFromRoot;2328 TransformationMatrix rootRelativeTransformWithAnimation = parentTransformFromRoot; 2307 2329 TransformationMatrix layerTransformWithAnimation = layerTransform(m_position, &matrices[i]); 2308 2330 2309 roo otRelativeTransformWithAnimation.multiply(layerTransformWithAnimation);2331 rootRelativeTransformWithAnimation.multiply(layerTransformWithAnimation); 2310 2332 2311 float rootRelativeScale = maxScaleFromTransform(roo otRelativeTransformWithAnimation);2333 float rootRelativeScale = maxScaleFromTransform(rootRelativeTransformWithAnimation); 2312 2334 if (rootRelativeScale > maxScale) { 2313 2335 maxScale = rootRelativeScale; … … 2814 2836 } 2815 2837 2816 static float clampedContentsScaleForScale(float scale)2817 {2818 // Define some limits as a sanity check for the incoming scale value2819 // those too small to see.2820 const float maxScale = 10.0f;2821 const float minScale = 0.01f;2822 return std::max(minScale, std::min(scale, maxScale));2823 }2824 2825 2838 void GraphicsLayerCA::updateContentsScale(float pageScaleFactor) 2826 2839 { … … 3273 3286 void GraphicsLayerCA::noteChangesForScaleSensitiveProperties() 3274 3287 { 3275 noteLayerPropertyChanged(GeometryChanged | ContentsScaleChanged); 3276 } 3277 3278 static inline bool isIntegral(float value) 3279 { 3280 return static_cast<int>(value) == value; 3288 noteLayerPropertyChanged(GeometryChanged | ContentsScaleChanged | ContentsOpaqueChanged); 3281 3289 } 3282 3290 -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
r158859 r159463 346 346 void updateMasksToBounds(); 347 347 void updateContentsVisibility(); 348 void updateContentsOpaque( );348 void updateContentsOpaque(float pageScaleFactor); 349 349 void updateBackfaceVisibility(); 350 350 void updateStructuralLayer(); -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r159082 r159463 707 707 // For non-root layers, background is always painted by the primary graphics layer. 708 708 ASSERT(!m_backgroundLayer); 709 m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOpaqueInRect(localCompositingBounds)); 709 bool hadSubpixelRounding = LayoutSize(relativeCompositingBounds.size()) != localRawCompositingBounds.size(); 710 m_graphicsLayer->setContentsOpaque(!hadSubpixelRounding && m_owningLayer.backgroundIsKnownToBeOpaqueInRect(localCompositingBounds)); 710 711 } 711 712
Note:
See TracChangeset
for help on using the changeset viewer.