Title: [123814] trunk/Source/WebCore
Revision
123814
Author
[email protected]
Date
2012-07-26 16:55:10 -0700 (Thu, 26 Jul 2012)

Log Message

[chromium] When computing surface content scale, use top level device scale
https://bugs.webkit.org/show_bug.cgi?id=92328

Reviewed by Kenneth Russell.

Previously, surface scale was calculated with layer->contentsScale(),
however this value is 1 for any layer that is not ContentLayerChromium
because of layer->needsContentsScale(). This would cause any surface
created with a non-content owner layer to look fuzzy on a high DPI
device. Fix by using the top level device scale.

Additionally, remove contentsScale from CCLayerImpl as it is no longer
used.

* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::pushPropertiesTo):
* platform/graphics/chromium/cc/CCLayerImpl.cpp:
(WebCore::CCLayerImpl::CCLayerImpl):
* platform/graphics/chromium/cc/CCLayerImpl.h:
(CCLayerImpl):
* platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
(WebCore::calculateDrawTransformsInternal):
(WebCore::CCLayerTreeHostCommon::calculateDrawTransforms):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (123813 => 123814)


--- trunk/Source/WebCore/ChangeLog	2012-07-26 23:27:53 UTC (rev 123813)
+++ trunk/Source/WebCore/ChangeLog	2012-07-26 23:55:10 UTC (rev 123814)
@@ -1,3 +1,29 @@
+2012-07-26  Adrienne Walker  <[email protected]>
+
+        [chromium] When computing surface content scale, use top level device scale
+        https://bugs.webkit.org/show_bug.cgi?id=92328
+
+        Reviewed by Kenneth Russell.
+
+        Previously, surface scale was calculated with layer->contentsScale(),
+        however this value is 1 for any layer that is not ContentLayerChromium
+        because of layer->needsContentsScale(). This would cause any surface
+        created with a non-content owner layer to look fuzzy on a high DPI
+        device. Fix by using the top level device scale.
+
+        Additionally, remove contentsScale from CCLayerImpl as it is no longer
+        used.
+
+        * platform/graphics/chromium/LayerChromium.cpp:
+        (WebCore::LayerChromium::pushPropertiesTo):
+        * platform/graphics/chromium/cc/CCLayerImpl.cpp:
+        (WebCore::CCLayerImpl::CCLayerImpl):
+        * platform/graphics/chromium/cc/CCLayerImpl.h:
+        (CCLayerImpl):
+        * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
+        (WebCore::calculateDrawTransformsInternal):
+        (WebCore::CCLayerTreeHostCommon::calculateDrawTransforms):
+
 2012-07-26  Anders Carlsson  <[email protected]>
 
         HTMLAppletElement should inherit from HTMLPlugInImageElement

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp (123813 => 123814)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp	2012-07-26 23:27:53 UTC (rev 123813)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp	2012-07-26 23:55:10 UTC (rev 123814)
@@ -534,7 +534,6 @@
     layer->setBackgroundColor(m_backgroundColor);
     layer->setBounds(m_bounds);
     layer->setContentBounds(contentBounds());
-    layer->setContentsScale(contentsScale());
     layer->setDebugBorderColor(m_debugBorderColor);
     layer->setDebugBorderWidth(m_debugBorderWidth);
     layer->setDebugName(m_debugName.isolatedCopy()); // We have to use isolatedCopy() here to safely pass ownership to another thread.
@@ -615,7 +614,6 @@
     setNeedsCommit();
 }
 
-
 void LayerChromium::setContentsScale(float contentsScale)
 {
     if (!needsContentsScale() || m_contentsScale == contentsScale)

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp (123813 => 123814)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp	2012-07-26 23:27:53 UTC (rev 123813)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp	2012-07-26 23:55:10 UTC (rev 123814)
@@ -50,7 +50,6 @@
     , m_layerTreeHostImpl(0)
     , m_anchorPoint(0.5, 0.5)
     , m_anchorPointZ(0)
-    , m_contentsScale(1)
     , m_scrollable(false)
     , m_shouldScrollOnMainThread(false)
     , m_haveWheelEventHandlers(false)

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h (123813 => 123814)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h	2012-07-26 23:27:53 UTC (rev 123813)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h	2012-07-26 23:55:10 UTC (rev 123814)
@@ -187,9 +187,6 @@
     const IntSize& contentBounds() const { return m_contentBounds; }
     void setContentBounds(const IntSize&);
 
-    void setContentsScale(float contentsScale) { m_contentsScale = contentsScale; }
-    float contentsScale() const { return m_contentsScale; }
-
     const IntPoint& scrollPosition() const { return m_scrollPosition; }
     void setScrollPosition(const IntPoint&);
 
@@ -304,7 +301,6 @@
     float m_anchorPointZ;
     IntSize m_bounds;
     IntSize m_contentBounds;
-    float m_contentsScale;
     IntPoint m_scrollPosition;
     bool m_scrollable;
     bool m_shouldScrollOnMainThread;

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp (123813 => 123814)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp	2012-07-26 23:27:53 UTC (rev 123813)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp	2012-07-26 23:55:10 UTC (rev 123814)
@@ -410,7 +410,7 @@
     const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationMatrix& currentScrollCompensationMatrix,
     const IntRect& clipRectFromAncestor, bool ancestorClipsSubtree,
     RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceLayerList, LayerList& layerList,
-    LayerSorter* layerSorter, int maxTextureSize, IntRect& drawableContentRectOfSubtree)
+    LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, IntRect& drawableContentRectOfSubtree)
 {
     // This function computes the new matrix transformations recursively for this
     // layer and all its descendants. It also computes the appropriate render surfaces.
@@ -484,16 +484,16 @@
     // When a render surface has a replica layer, that layer's transform is used to draw a second copy of the surface.
     // Transforms named here are relative to the surface, unless they specify they are relative to the replica layer.
     //
-    // We will denote a scale by contents scale S[contentsScale]
+    // We will denote a scale by device scale S[deviceScale]
     //
     // The render surface draw transform to its target surface origin is:
     //        M[surfaceDraw] = M[owningLayer->Draw]
     //
     // The render surface origin transform to its the root (screen space) origin is:
-    //        M[surface2root] =  M[owningLayer->screenspace] * S[contentsScale].inverse()
+    //        M[surface2root] =  M[owningLayer->screenspace] * S[deviceScale].inverse()
     //
     // The replica draw transform to its target surface origin is:
-    //        M[replicaDraw] = S[contentsScale] * M[surfaceDraw] * Tr[replica->position() + replica->anchor()] * Tr[replica] * Tr[origin2anchor].inverse() * S[contentsScale].inverse()
+    //        M[replicaDraw] = S[deviceScale] * M[surfaceDraw] * Tr[replica->position() + replica->anchor()] * Tr[replica] * Tr[origin2anchor].inverse() * S[contentsScale].inverse()
     //
     // The replica draw transform to the root (screen space) origin is:
     //        M[replica2root] = M[surface2root] * Tr[replica->position()] * Tr[replica] * Tr[origin2anchor].inverse()
@@ -566,7 +566,6 @@
         animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAnimating();
     }
 
-    float contentsScale = layer->contentsScale();
     FloatRect contentRect(FloatPoint(), layer->contentBounds());
 
     // fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurface's space.
@@ -588,7 +587,7 @@
         // The origin of the new surface is the upper left corner of the layer.
         renderSurface->setDrawTransform(drawTransform);
         WebTransformationMatrix layerDrawTransform;
-        layerDrawTransform.scale(contentsScale);
+        layerDrawTransform.scale(deviceScaleFactor);
         if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
             layerDrawTransform.scaleNonUniform(layer->bounds().width() / static_cast<double>(layer->contentBounds().width()),
                                                layer->bounds().height() / static_cast<double>(layer->contentBounds().height()));
@@ -598,7 +597,7 @@
         // The sublayer matrix transforms centered layer rects into target
         // surface content space.
         sublayerMatrix.makeIdentity();
-        sublayerMatrix.scale(contentsScale);
+        sublayerMatrix.scale(deviceScaleFactor);
         sublayerMatrix.translate(0.5 * bounds.width(), 0.5 * bounds.height());
 
         // The opacity value is moved from the layer to its surface, so that the entire subtree properly inherits opacity.
@@ -712,7 +711,7 @@
         IntRect drawableContentRectOfChildSubtree;
         calculateDrawTransformsInternal<LayerType, LayerList, RenderSurfaceType, LayerSorter>(child, rootLayer, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensationMatrix,
                                                                                               clipRectForSubtree, subtreeShouldBeClipped, nearestAncestorThatMovesPixels,
-                                                                                              renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, drawableContentRectOfChildSubtree);
+                                                                                              renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, deviceScaleFactor, drawableContentRectOfChildSubtree);
         if (!drawableContentRectOfChildSubtree.isEmpty()) {
             accumulatedDrawableContentRectOfChildren.unite(drawableContentRectOfChildSubtree);
             if (child->renderSurface())
@@ -769,12 +768,12 @@
 
         if (layer->replicaLayer()) {
             WebTransformationMatrix surfaceOriginToReplicaOriginTransform;
-            surfaceOriginToReplicaOriginTransform.scale(contentsScale);
+            surfaceOriginToReplicaOriginTransform.scale(deviceScaleFactor);
             surfaceOriginToReplicaOriginTransform.translate(layer->replicaLayer()->position().x() + layer->replicaLayer()->anchorPoint().x() * bounds.width(),
                                                             layer->replicaLayer()->position().y() + layer->replicaLayer()->anchorPoint().y() * bounds.height());
             surfaceOriginToReplicaOriginTransform.multiply(layer->replicaLayer()->transform());
             surfaceOriginToReplicaOriginTransform.translate(-layer->replicaLayer()->anchorPoint().x() * bounds.width(), -layer->replicaLayer()->anchorPoint().y() * bounds.height());
-            surfaceOriginToReplicaOriginTransform.scale(1 / contentsScale);
+            surfaceOriginToReplicaOriginTransform.scale(1 / deviceScaleFactor);
 
             // Compute the replica's "originTransform" that maps from the replica's origin space to the target surface origin space.
             WebTransformationMatrix replicaOriginTransform = layer->renderSurface()->drawTransform() * surfaceOriginToReplicaOriginTransform;
@@ -863,7 +862,7 @@
 
     WebCore::calculateDrawTransformsInternal<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, void>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix,
                                                                                                                          rootLayer->renderSurface()->contentRect(), true, 0, renderSurfaceLayerList,
-                                                                                                                         rootLayer->renderSurface()->layerList(), 0, maxTextureSize, totalDrawableContentRect);
+                                                                                                                         rootLayer->renderSurface()->layerList(), 0, maxTextureSize, deviceScaleFactor, totalDrawableContentRect);
 }
 
 void CCLayerTreeHostCommon::calculateDrawTransforms(CCLayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, CCLayerSorter* layerSorter, int maxTextureSize, Vector<CCLayerImpl*>& renderSurfaceLayerList)
@@ -877,7 +876,7 @@
 
     WebCore::calculateDrawTransformsInternal<CCLayerImpl, Vector<CCLayerImpl*>, CCRenderSurface, CCLayerSorter>(rootLayer, rootLayer, deviceScaleTransform, identityMatrix, identityMatrix,
                                                                                                                 rootLayer->renderSurface()->contentRect(), true, 0, renderSurfaceLayerList,
-                                                                                                                rootLayer->renderSurface()->layerList(), layerSorter, maxTextureSize, totalDrawableContentRect);
+                                                                                                                rootLayer->renderSurface()->layerList(), layerSorter, maxTextureSize, deviceScaleFactor, totalDrawableContentRect);
 }
 
 void CCLayerTreeHostCommon::calculateVisibleAndScissorRects(Vector<RefPtr<LayerChromium> >& renderSurfaceLayerList, const FloatRect& rootScissorRect)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to