Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(683)

Unified Diff: cc/tiled_layer.cc

Issue 11276060: Pass accurate contentsScale to LayerImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/tiled_layer.h ('k') | cc/tiled_layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiled_layer.cc
diff --git a/cc/tiled_layer.cc b/cc/tiled_layer.cc
index b21d9115435c38b7b345da1300e3e8fe41829fec..7232042dec28cb639050764f2aa41122323db1f8 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)
« no previous file with comments | « cc/tiled_layer.h ('k') | cc/tiled_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698