Title: [150047] trunk/Source/WebCore
Revision
150047
Author
[email protected]
Date
2013-05-13 19:11:16 -0700 (Mon, 13 May 2013)

Log Message

[Mac] Use pageScaleFactor * deviceScaleFactor in requiresTiledLayer() and computePixelAlignment() of GraphicsLayerCA.
https://bugs.webkit.org/show_bug.cgi?id=107359

Patch by Huang Dongsung <[email protected]> on 2013-05-13
Reviewed by Darin Adler.

Currently GraphicsLayerCA uses pageScaleFactor in requiresTiledLayer() and
computePixelAlignment(), but we must use pageScaleFactor * deviceScaleFactor in
them.
It is because:
1. requiresTiledLayer() uses the scale to compute an actual layer size in the device
pixel unit.
2. computePixelAlignment() uses the scale to compute an aligned layer position
in the device pixel unit.

No new tests. We can not test about requiresTiledLayer() because it depends on
gpu. computePixelAlignment() is correct now because fortunately Mac uses
only 2 (for retina display) as a deviceScaleFactor.

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::requiresTiledLayer):
(WebCore::GraphicsLayerCA::computePixelAlignment):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (150046 => 150047)


--- trunk/Source/WebCore/ChangeLog	2013-05-14 02:00:00 UTC (rev 150046)
+++ trunk/Source/WebCore/ChangeLog	2013-05-14 02:11:16 UTC (rev 150047)
@@ -1,3 +1,27 @@
+2013-05-13  Huang Dongsung  <[email protected]>
+
+        [Mac] Use pageScaleFactor * deviceScaleFactor in requiresTiledLayer() and computePixelAlignment() of GraphicsLayerCA.
+        https://bugs.webkit.org/show_bug.cgi?id=107359
+
+        Reviewed by Darin Adler.
+
+        Currently GraphicsLayerCA uses pageScaleFactor in requiresTiledLayer() and
+        computePixelAlignment(), but we must use pageScaleFactor * deviceScaleFactor in
+        them.
+        It is because:
+        1. requiresTiledLayer() uses the scale to compute an actual layer size in the device
+        pixel unit.
+        2. computePixelAlignment() uses the scale to compute an aligned layer position
+        in the device pixel unit.
+
+        No new tests. We can not test about requiresTiledLayer() because it depends on
+        gpu. computePixelAlignment() is correct now because fortunately Mac uses
+        only 2 (for retina display) as a deviceScaleFactor.
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::requiresTiledLayer):
+        (WebCore::GraphicsLayerCA::computePixelAlignment):
+
 2013-05-13  Christophe Dumez  <[email protected]>
 
         Rename BarInfo to BarProp and remove [NoInterfaceObject]

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (150046 => 150047)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2013-05-14 02:00:00 UTC (rev 150046)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2013-05-14 02:11:16 UTC (rev 150047)
@@ -2676,8 +2676,10 @@
     if (!m_drawsContent || !m_allowTiledLayer || m_isPageTiledBackingLayer)
         return false;
 
+    float effectiveScale = pageScaleFactor * deviceScaleFactor();
+
     // FIXME: catch zero-size height or width here (or earlier)?
-    return m_size.width() * pageScaleFactor > cMaxPixelDimension || m_size.height() * pageScaleFactor > cMaxPixelDimension;
+    return m_size.width() * effectiveScale > cMaxPixelDimension || m_size.height() * effectiveScale > cMaxPixelDimension;
 }
 
 void GraphicsLayerCA::swapFromOrToTiledLayer(bool useTiledLayer)
@@ -3008,7 +3010,8 @@
 void GraphicsLayerCA::computePixelAlignment(float pageScaleFactor, const FloatPoint& positionRelativeToBase,
     FloatPoint& position, FloatSize& size, FloatPoint3D& anchorPoint, FloatSize& alignmentOffset) const
 {
-    if (!m_maintainsPixelAlignment || isIntegral(pageScaleFactor) || !m_drawsContent || m_masksToBounds) {
+    float effectiveScale = pageScaleFactor * deviceScaleFactor();
+    if (!m_maintainsPixelAlignment || isIntegral(effectiveScale) || !m_drawsContent || m_masksToBounds) {
         position = m_position;
         size = m_size;
         anchorPoint = m_anchorPoint;
@@ -3019,12 +3022,12 @@
     FloatRect baseRelativeBounds(positionRelativeToBase, m_size);
     FloatRect scaledBounds = baseRelativeBounds;
     // Scale by the page scale factor to compute the screen-relative bounds.
-    scaledBounds.scale(pageScaleFactor);
+    scaledBounds.scale(effectiveScale);
     // Round to integer boundaries.
     FloatRect alignedBounds = enclosingIntRect(scaledBounds);
     
     // Convert back to layer coordinates.
-    alignedBounds.scale(1 / pageScaleFactor);
+    alignedBounds.scale(1 / effectiveScale);
     
     // Epsilon is necessary to ensure that backing store size computation in CA, which involves integer truncation,
     // will match our aligned bounds.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to