[Mac] Use pageScaleFactor * deviceScaleFactor in requiresTiledLayer() and...

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

Patch by Huang Dongsung <luxtella@company100.net> 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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@150047 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3928ca47
2013-05-13 Huang Dongsung <luxtella@company100.net>
[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 <ch.dumez@sisa.samsung.com>
Rename BarInfo to BarProp and remove [NoInterfaceObject]
......
......@@ -2676,8 +2676,10 @@ bool GraphicsLayerCA::requiresTiledLayer(float pageScaleFactor) const
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 @@ static inline bool isIntegral(float value)
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 @@ void GraphicsLayerCA::computePixelAlignment(float pageScaleFactor, const FloatPo
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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment