Chromium Code Reviews| Index: cc/tiled_layer.cc |
| diff --git a/cc/tiled_layer.cc b/cc/tiled_layer.cc |
| index df4a985c9c7183d3fe56655ca6fd63660dad3dc9..a751f06c257d6cf22c01dbe209fa37278db10a48 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,16 @@ 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); |
| + scaledDirtyRect.scale(contentsScaleX(), contentsScaleY()); |
| IntRect dirty = enclosingIntRect(scaledDirtyRect); |
|
danakj
2012/10/29 20:06:51
Can you use Layer::layerRectToContentRect() here a
wangxianzhu
2012/10/30 02:14:21
Done.
|
| invalidateContentRect(dirty); |
| - Layer::setNeedsDisplayRect(dirtyRect); |
| + ContentsScalingLayer::setNeedsDisplayRect(dirtyRect); |
| } |
| void TiledLayer::setUseLCDText(bool useLCDText) |
| { |
| - Layer::setUseLCDText(useLCDText); |
| + ContentsScalingLayer::setUseLCDText(useLCDText); |
| LayerTilingData::BorderTexelOption borderTexelOption; |
| #if OS(ANDROID) |