| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 SynchronousOutputSurfaceLayerTreeHost( | 77 SynchronousOutputSurfaceLayerTreeHost( |
| 78 LayerTreeHostClient* client, | 78 LayerTreeHostClient* client, |
| 79 SharedBitmapManager* manager, | 79 SharedBitmapManager* manager, |
| 80 const LayerTreeSettings& settings, | 80 const LayerTreeSettings& settings, |
| 81 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) | 81 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) |
| 82 : LayerTreeHost(client, manager, NULL, settings), | 82 : LayerTreeHost(client, manager, NULL, settings), |
| 83 output_surface_created_(false) { | 83 output_surface_created_(false) { |
| 84 LayerTreeHost::InitializeThreaded(base::MessageLoopProxy::current(), | 84 LayerTreeHost::InitializeThreaded(base::MessageLoopProxy::current(), |
| 85 impl_task_runner); | 85 impl_task_runner, |
| 86 nullptr); |
| 86 } | 87 } |
| 87 | 88 |
| 88 bool output_surface_created_; | 89 bool output_surface_created_; |
| 89 base::RunLoop run_loop_; | 90 base::RunLoop run_loop_; |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 class TiledLayerTest : public testing::Test { | 93 class TiledLayerTest : public testing::Test { |
| 93 public: | 94 public: |
| 94 TiledLayerTest() | 95 TiledLayerTest() |
| 95 : proxy_(nullptr), | 96 : proxy_(nullptr), |
| (...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 private: | 1657 private: |
| 1657 gfx::Rect painted_rect_; | 1658 gfx::Rect painted_rect_; |
| 1658 }; | 1659 }; |
| 1659 | 1660 |
| 1660 class UpdateTrackingTiledLayer : public FakeTiledLayer { | 1661 class UpdateTrackingTiledLayer : public FakeTiledLayer { |
| 1661 public: | 1662 public: |
| 1662 explicit UpdateTrackingTiledLayer(PrioritizedResourceManager* manager) | 1663 explicit UpdateTrackingTiledLayer(PrioritizedResourceManager* manager) |
| 1663 : FakeTiledLayer(manager) { | 1664 : FakeTiledLayer(manager) { |
| 1664 scoped_ptr<TrackingLayerPainter> painter(TrackingLayerPainter::Create()); | 1665 scoped_ptr<TrackingLayerPainter> painter(TrackingLayerPainter::Create()); |
| 1665 tracking_layer_painter_ = painter.get(); | 1666 tracking_layer_painter_ = painter.get(); |
| 1666 layer_updater_ = BitmapContentLayerUpdater::Create( | 1667 layer_updater_ = BitmapContentLayerUpdater::Create(painter.Pass(), 0); |
| 1667 painter.Pass(), &stats_instrumentation_, 0); | |
| 1668 } | 1668 } |
| 1669 | 1669 |
| 1670 TrackingLayerPainter* tracking_layer_painter() const { | 1670 TrackingLayerPainter* tracking_layer_painter() const { |
| 1671 return tracking_layer_painter_; | 1671 return tracking_layer_painter_; |
| 1672 } | 1672 } |
| 1673 | 1673 |
| 1674 private: | 1674 private: |
| 1675 LayerUpdater* Updater() const override { return layer_updater_.get(); } | 1675 LayerUpdater* Updater() const override { return layer_updater_.get(); } |
| 1676 ~UpdateTrackingTiledLayer() override {} | 1676 ~UpdateTrackingTiledLayer() override {} |
| 1677 | 1677 |
| 1678 TrackingLayerPainter* tracking_layer_painter_; | 1678 TrackingLayerPainter* tracking_layer_painter_; |
| 1679 scoped_refptr<BitmapContentLayerUpdater> layer_updater_; | 1679 scoped_refptr<BitmapContentLayerUpdater> layer_updater_; |
| 1680 FakeRenderingStatsInstrumentation stats_instrumentation_; | |
| 1681 }; | 1680 }; |
| 1682 | 1681 |
| 1683 TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringPaint) { | 1682 TEST_F(TiledLayerTest, NonIntegerContentsScaleIsNotDistortedDuringPaint) { |
| 1684 scoped_refptr<UpdateTrackingTiledLayer> layer = | 1683 scoped_refptr<UpdateTrackingTiledLayer> layer = |
| 1685 make_scoped_refptr(new UpdateTrackingTiledLayer(resource_manager_.get())); | 1684 make_scoped_refptr(new UpdateTrackingTiledLayer(resource_manager_.get())); |
| 1686 | 1685 |
| 1687 layer_tree_host_->root_layer()->AddChild(layer); | 1686 layer_tree_host_->root_layer()->AddChild(layer); |
| 1688 | 1687 |
| 1689 gfx::Rect layer_rect(0, 0, 30, 31); | 1688 gfx::Rect layer_rect(0, 0, 30, 31); |
| 1690 layer->SetPosition(layer_rect.origin()); | 1689 layer->SetPosition(layer_rect.origin()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1753 | 1752 |
| 1754 // Rounding leads to an extra pixel. | 1753 // Rounding leads to an extra pixel. |
| 1755 gfx::Rect expanded_layer_rect(layer_rect); | 1754 gfx::Rect expanded_layer_rect(layer_rect); |
| 1756 expanded_layer_rect.set_height(32); | 1755 expanded_layer_rect.set_height(32); |
| 1757 EXPECT_RECT_EQ(expanded_layer_rect, | 1756 EXPECT_RECT_EQ(expanded_layer_rect, |
| 1758 layer->tracking_layer_painter()->PaintedRect()); | 1757 layer->tracking_layer_painter()->PaintedRect()); |
| 1759 } | 1758 } |
| 1760 | 1759 |
| 1761 } // namespace | 1760 } // namespace |
| 1762 } // namespace cc | 1761 } // namespace cc |
| OLD | NEW |