| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/layers/tiled_layer.h" | 5 #include "cc/layers/tiled_layer.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 private: | 1656 private: |
| 1657 gfx::Rect painted_rect_; | 1657 gfx::Rect painted_rect_; |
| 1658 }; | 1658 }; |
| 1659 | 1659 |
| 1660 class UpdateTrackingTiledLayer : public FakeTiledLayer { | 1660 class UpdateTrackingTiledLayer : public FakeTiledLayer { |
| 1661 public: | 1661 public: |
| 1662 explicit UpdateTrackingTiledLayer(PrioritizedResourceManager* manager) | 1662 explicit UpdateTrackingTiledLayer(PrioritizedResourceManager* manager) |
| 1663 : FakeTiledLayer(manager) { | 1663 : FakeTiledLayer(manager) { |
| 1664 scoped_ptr<TrackingLayerPainter> painter(TrackingLayerPainter::Create()); | 1664 scoped_ptr<TrackingLayerPainter> painter(TrackingLayerPainter::Create()); |
| 1665 tracking_layer_painter_ = painter.get(); | 1665 tracking_layer_painter_ = painter.get(); |
| 1666 layer_updater_ = BitmapContentLayerUpdater::Create( | 1666 layer_updater_ = BitmapContentLayerUpdater::Create(painter.Pass(), 0); |
| 1667 painter.Pass(), &stats_instrumentation_, 0); | |
| 1668 } | 1667 } |
| 1669 | 1668 |
| 1670 TrackingLayerPainter* tracking_layer_painter() const { | 1669 TrackingLayerPainter* tracking_layer_painter() const { |
| 1671 return tracking_layer_painter_; | 1670 return tracking_layer_painter_; |
| 1672 } | 1671 } |
| 1673 | 1672 |
| 1674 private: | 1673 private: |
| 1675 LayerUpdater* Updater() const override { return layer_updater_.get(); } | 1674 LayerUpdater* Updater() const override { return layer_updater_.get(); } |
| 1676 ~UpdateTrackingTiledLayer() override {} | 1675 ~UpdateTrackingTiledLayer() override {} |
| 1677 | 1676 |
| 1678 TrackingLayerPainter* tracking_layer_painter_; | 1677 TrackingLayerPainter* tracking_layer_painter_; |
| 1679 scoped_refptr<BitmapContentLayerUpdater> layer_updater_; | 1678 scoped_refptr<BitmapContentLayerUpdater> layer_updater_; |
| 1680 FakeRenderingStatsInstrumentation stats_instrumentation_; | |
| 1681 }; | 1679 }; |
| 1682 | 1680 |
| 1683 TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringPaint) { | 1681 TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringPaint) { |
| 1684 scoped_refptr<UpdateTrackingTiledLayer> layer = | 1682 scoped_refptr<UpdateTrackingTiledLayer> layer = |
| 1685 make_scoped_refptr(new UpdateTrackingTiledLayer(resource_manager_.get())); | 1683 make_scoped_refptr(new UpdateTrackingTiledLayer(resource_manager_.get())); |
| 1686 | 1684 |
| 1687 layer_tree_host_->root_layer()->AddChild(layer); | 1685 layer_tree_host_->root_layer()->AddChild(layer); |
| 1688 | 1686 |
| 1689 gfx::Rect layer_rect(0, 0, 30, 31); | 1687 gfx::Rect layer_rect(0, 0, 30, 31); |
| 1690 layer->SetPosition(layer_rect.origin()); | 1688 layer->SetPosition(layer_rect.origin()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1753 | 1751 |
| 1754 // Rounding leads to an extra pixel. | 1752 // Rounding leads to an extra pixel. |
| 1755 gfx::Rect expanded_layer_rect(layer_rect); | 1753 gfx::Rect expanded_layer_rect(layer_rect); |
| 1756 expanded_layer_rect.set_height(32); | 1754 expanded_layer_rect.set_height(32); |
| 1757 EXPECT_RECT_EQ(expanded_layer_rect, | 1755 EXPECT_RECT_EQ(expanded_layer_rect, |
| 1758 layer->tracking_layer_painter()->PaintedRect()); | 1756 layer->tracking_layer_painter()->PaintedRect()); |
| 1759 } | 1757 } |
| 1760 | 1758 |
| 1761 } // namespace | 1759 } // namespace |
| 1762 } // namespace cc | 1760 } // namespace cc |
| OLD | NEW |