diff options
author | wangxianzhu@chromium.org <wangxianzhu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-01 00:12:47 +0000 |
---|---|---|
committer | wangxianzhu@chromium.org <wangxianzhu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-01 00:12:47 +0000 |
commit | 904e9138fb2ca78ba6ae1f1054f9ce8cfe19eda5 (patch) | |
tree | 931236a109d66ef40f169888e95b47b17da6d9ea /cc/tiled_layer.cc | |
parent | e2946a407e60e0334292644310fb53a93badf70c (diff) | |
download | chromium_src-904e9138fb2ca78ba6ae1f1054f9ce8cfe19eda5.zip chromium_src-904e9138fb2ca78ba6ae1f1054f9ce8cfe19eda5.tar.gz chromium_src-904e9138fb2ca78ba6ae1f1054f9ce8cfe19eda5.tar.bz2 |
Pass accurate contentsScale to LayerImpl.
This is the first part of fixing fuzzy content issue in composited layers in
scaled pages.
There are two reasons of fuzzy content:
1) Inaccurate scale: The scale in transformation is calculated with
contentBounds.width / bounds.width
contentBounds.height / bounds.height
in layer_tree_host_common.cc and other places.
However, contentBounds is a IntSize which is calculated from bounds
and contentsScale in layer.cc:
IntRect(lroundf(bounds.width * contentsScale),
lroundf(bounds.height * contentsScale))
This causes the scale like 0.993 or 1.007 in the drawTransformation etc.
where identity transformation is expected.
To resolve the issue, instead of calculating scale using contentBounds,
pass the accurate contentsScale from Layer to LayerImpl.
2) Pixel on surfaces are not aligned. Will describe this in the CL for the
second part.
(See https://bugs.webkit.org/show_bug.cgi?id=84187 for more details).
Change-Id: I8f59f0460e1b212223e2c8c551b4127d8239e5cc
BUG=bugs.webkit.org/show_bug.cgi?id=84187
TEST=ContentsScalingLayerTest.checkContentBounds, LayerTreeHostCommonTest.verifyLayerTransformsInHighDPIAccurateScaleZeroPosition, LayerTreeHostCommonTest.verifyRenderSurfaceTransformsInHighDPIAccurateScaleZeroPosition
Review URL: https://chromiumcodereview.appspot.com/11276060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165269 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/tiled_layer.cc')
-rw-r--r-- | cc/tiled_layer.cc | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/cc/tiled_layer.cc b/cc/tiled_layer.cc index b21d911..7232042 100644 --- a/cc/tiled_layer.cc +++ b/cc/tiled_layer.cc @@ -84,7 +84,7 @@ private: }; TiledLayer::TiledLayer() - : Layer() + : ContentsScalingLayer() , m_textureFormat(GL_INVALID_ENUM) , m_skipsDraw(false) , m_failedUpdate(false) @@ -166,7 +166,7 @@ void TiledLayer::setBorderTexelOption(LayerTilingData::BorderTexelOption borderT bool TiledLayer::drawsContent() const { - if (!Layer::drawsContent()) + if (!ContentsScalingLayer::drawsContent()) return false; bool hasMoreThanOneTile = m_tiler->numTilesX() > 1 || m_tiler->numTilesY() > 1; @@ -176,16 +176,6 @@ bool TiledLayer::drawsContent() const return true; } -bool TiledLayer::needsContentsScale() const -{ - return true; -} - -IntSize TiledLayer::contentBounds() const -{ - return IntSize(lroundf(bounds().width() * contentsScale()), lroundf(bounds().height() * contentsScale())); -} - void TiledLayer::setTilingOption(TilingOption tilingOption) { m_tilingOption = tilingOption; @@ -198,7 +188,7 @@ void TiledLayer::setIsMask(bool isMask) void TiledLayer::pushPropertiesTo(LayerImpl* layer) { - Layer::pushPropertiesTo(layer); + ContentsScalingLayer::pushPropertiesTo(layer); TiledLayerImpl* tiledLayer = static_cast<TiledLayerImpl*>(layer); @@ -250,7 +240,7 @@ void TiledLayer::setLayerTreeHost(LayerTreeHost* host) tile->managedTexture()->setTextureManager(host->contentsTextureManager()); } } - Layer::setLayerTreeHost(host); + ContentsScalingLayer::setLayerTreeHost(host); } UpdatableTile* TiledLayer::tileAt(int i, int j) const @@ -281,18 +271,13 @@ UpdatableTile* TiledLayer::createTile(int i, int j) void TiledLayer::setNeedsDisplayRect(const FloatRect& dirtyRect) { - float contentsWidthScale = static_cast<float>(contentBounds().width()) / bounds().width(); - float contentsHeightScale = static_cast<float>(contentBounds().height()) / bounds().height(); - FloatRect scaledDirtyRect(dirtyRect); - scaledDirtyRect.scale(contentsWidthScale, contentsHeightScale); - IntRect dirty = enclosingIntRect(scaledDirtyRect); - invalidateContentRect(dirty); - Layer::setNeedsDisplayRect(dirtyRect); + invalidateContentRect(layerRectToContentRect(dirtyRect)); + ContentsScalingLayer::setNeedsDisplayRect(dirtyRect); } void TiledLayer::setUseLCDText(bool useLCDText) { - Layer::setUseLCDText(useLCDText); + ContentsScalingLayer::setUseLCDText(useLCDText); LayerTilingData::BorderTexelOption borderTexelOption; #if OS(ANDROID) |