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" |
11 #include "cc/resources/bitmap_content_layer_updater.h" | 11 #include "cc/resources/bitmap_content_layer_updater.h" |
12 #include "cc/resources/layer_painter.h" | 12 #include "cc/resources/content_layer_painter.h" |
13 #include "cc/resources/prioritized_resource_manager.h" | 13 #include "cc/resources/prioritized_resource_manager.h" |
14 #include "cc/resources/resource_update_controller.h" | 14 #include "cc/resources/resource_update_controller.h" |
15 #include "cc/test/animation_test_common.h" | 15 #include "cc/test/animation_test_common.h" |
16 #include "cc/test/fake_layer_tree_host_client.h" | 16 #include "cc/test/fake_layer_tree_host_client.h" |
17 #include "cc/test/fake_layer_tree_host_impl.h" | 17 #include "cc/test/fake_layer_tree_host_impl.h" |
18 #include "cc/test/fake_output_surface.h" | 18 #include "cc/test/fake_output_surface.h" |
19 #include "cc/test/fake_output_surface_client.h" | 19 #include "cc/test/fake_output_surface_client.h" |
20 #include "cc/test/fake_proxy.h" | 20 #include "cc/test/fake_proxy.h" |
21 #include "cc/test/fake_rendering_stats_instrumentation.h" | 21 #include "cc/test/fake_rendering_stats_instrumentation.h" |
22 #include "cc/test/geometry_test_utils.h" | 22 #include "cc/test/geometry_test_utils.h" |
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 EXPECT_FALSE(child2_impl->HasResourceIdForTileAt(i, 0)); | 1692 EXPECT_FALSE(child2_impl->HasResourceIdForTileAt(i, 0)); |
1693 } | 1693 } |
1694 } | 1694 } |
1695 layer_tree_host_->CommitComplete(); | 1695 layer_tree_host_->CommitComplete(); |
1696 | 1696 |
1697 ResourceManagerClearAllMemory(layer_tree_host_->contents_texture_manager(), | 1697 ResourceManagerClearAllMemory(layer_tree_host_->contents_texture_manager(), |
1698 resource_provider_.get()); | 1698 resource_provider_.get()); |
1699 layer_tree_host_->SetRootLayer(NULL); | 1699 layer_tree_host_->SetRootLayer(NULL); |
1700 } | 1700 } |
1701 | 1701 |
1702 class TrackingLayerPainter : public LayerPainter { | 1702 class TrackingLayerPainter : public ContentLayerPainter { |
1703 public: | 1703 public: |
1704 static scoped_ptr<TrackingLayerPainter> Create() { | 1704 static scoped_ptr<TrackingLayerPainter> Create(ContentLayerClient* client) { |
1705 return make_scoped_ptr(new TrackingLayerPainter()); | 1705 return make_scoped_ptr(new TrackingLayerPainter(client)); |
1706 } | 1706 } |
1707 | 1707 |
1708 virtual void Paint(SkCanvas* canvas, | 1708 virtual void Paint(SkCanvas* canvas, |
1709 const gfx::Rect& content_rect, | 1709 const gfx::Rect& content_rect, |
| 1710 bool can_paint_lcd_text, |
1710 gfx::RectF* opaque) OVERRIDE { | 1711 gfx::RectF* opaque) OVERRIDE { |
1711 painted_rect_ = content_rect; | 1712 painted_rect_ = content_rect; |
1712 } | 1713 } |
1713 | 1714 |
1714 gfx::Rect PaintedRect() const { return painted_rect_; } | 1715 gfx::Rect PaintedRect() const { return painted_rect_; } |
1715 void ResetPaintedRect() { painted_rect_ = gfx::Rect(); } | 1716 void ResetPaintedRect() { painted_rect_ = gfx::Rect(); } |
1716 | 1717 |
| 1718 protected: |
| 1719 explicit TrackingLayerPainter(ContentLayerClient* client) |
| 1720 : ContentLayerPainter(client) {} |
| 1721 |
1717 private: | 1722 private: |
1718 gfx::Rect painted_rect_; | 1723 gfx::Rect painted_rect_; |
1719 }; | 1724 }; |
1720 | 1725 |
1721 class UpdateTrackingTiledLayer : public FakeTiledLayer { | 1726 class UpdateTrackingTiledLayer : public FakeTiledLayer { |
1722 public: | 1727 public: |
1723 explicit UpdateTrackingTiledLayer(PrioritizedResourceManager* manager) | 1728 explicit UpdateTrackingTiledLayer(PrioritizedResourceManager* manager) |
1724 : FakeTiledLayer(manager) { | 1729 : FakeTiledLayer(manager) { |
1725 scoped_ptr<TrackingLayerPainter> painter(TrackingLayerPainter::Create()); | 1730 scoped_ptr<TrackingLayerPainter> painter( |
| 1731 TrackingLayerPainter::Create(NULL)); |
1726 tracking_layer_painter_ = painter.get(); | 1732 tracking_layer_painter_ = painter.get(); |
1727 layer_updater_ = | 1733 layer_updater_ = BitmapContentLayerUpdater::Create( |
1728 BitmapContentLayerUpdater::Create(painter.PassAs<LayerPainter>(), | 1734 painter.PassAs<ContentLayerPainter>(), &stats_instrumentation_, 0); |
1729 &stats_instrumentation_, | |
1730 0); | |
1731 } | 1735 } |
1732 | 1736 |
1733 TrackingLayerPainter* tracking_layer_painter() const { | 1737 TrackingLayerPainter* tracking_layer_painter() const { |
1734 return tracking_layer_painter_; | 1738 return tracking_layer_painter_; |
1735 } | 1739 } |
1736 | 1740 |
1737 private: | 1741 private: |
1738 virtual LayerUpdater* Updater() const OVERRIDE { | 1742 virtual LayerUpdater* Updater() const OVERRIDE { |
1739 return layer_updater_.get(); | 1743 return layer_updater_.get(); |
1740 } | 1744 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1810 // Invalidate the entire layer in layer space. When painting, the rect given | 1814 // Invalidate the entire layer in layer space. When painting, the rect given |
1811 // to webkit should match the layer's bounds. | 1815 // to webkit should match the layer's bounds. |
1812 layer->SetNeedsDisplayRect(layer_rect); | 1816 layer->SetNeedsDisplayRect(layer_rect); |
1813 layer->Update(queue_.get(), NULL); | 1817 layer->Update(queue_.get(), NULL); |
1814 | 1818 |
1815 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect()); | 1819 EXPECT_RECT_EQ(layer_rect, layer->tracking_layer_painter()->PaintedRect()); |
1816 } | 1820 } |
1817 | 1821 |
1818 } // namespace | 1822 } // namespace |
1819 } // namespace cc | 1823 } // namespace cc |
OLD | NEW |