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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 root_layer_ = FakePictureLayer::Create(&client_); | 1746 root_layer_ = FakePictureLayer::Create(&client_); |
1747 root_layer_->SetIsDrawable(true); | 1747 root_layer_->SetIsDrawable(true); |
1748 root_layer_->SetBounds(bounds_); | 1748 root_layer_->SetBounds(bounds_); |
1749 layer_tree()->SetRootLayer(root_layer_); | 1749 layer_tree()->SetRootLayer(root_layer_); |
1750 layer_tree()->SetViewportSize(bounds_); | 1750 layer_tree()->SetViewportSize(bounds_); |
1751 PostSetNeedsCommitToMainThread(); | 1751 PostSetNeedsCommitToMainThread(); |
1752 client_.set_bounds(root_layer_->bounds()); | 1752 client_.set_bounds(root_layer_->bounds()); |
1753 } | 1753 } |
1754 | 1754 |
1755 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 1755 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
1756 if (num_draws_ == 3) | 1756 if (num_draws_ == 3) { |
1757 host_impl->SetNeedsRedrawRect(invalid_rect_); | 1757 host_impl->SetViewportDamage(invalid_rect_); |
| 1758 host_impl->SetNeedsRedraw(); |
| 1759 } |
1758 } | 1760 } |
1759 | 1761 |
1760 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 1762 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
1761 LayerTreeHostImpl::FrameData* frame_data, | 1763 LayerTreeHostImpl::FrameData* frame_data, |
1762 DrawResult draw_result) override { | 1764 DrawResult draw_result) override { |
1763 EXPECT_EQ(DRAW_SUCCESS, draw_result); | 1765 EXPECT_EQ(DRAW_SUCCESS, draw_result); |
1764 | 1766 |
1765 gfx::Rect root_damage_rect; | 1767 gfx::Rect root_damage_rect; |
1766 if (!frame_data->render_passes.empty()) | 1768 if (!frame_data->render_passes.empty()) |
1767 root_damage_rect = frame_data->render_passes.back()->damage_rect; | 1769 root_damage_rect = frame_data->render_passes.back()->damage_rect; |
1768 | 1770 |
1769 switch (num_draws_) { | 1771 switch (num_draws_) { |
1770 case 0: | 1772 case 0: |
1771 EXPECT_EQ(gfx::Rect(bounds_), root_damage_rect); | 1773 EXPECT_EQ(gfx::Rect(bounds_), root_damage_rect); |
1772 break; | 1774 break; |
1773 case 1: | 1775 case 1: |
1774 case 2: | 1776 case 2: |
1775 EXPECT_EQ(gfx::Rect(0, 0, 0, 0), root_damage_rect); | 1777 EXPECT_EQ(gfx::Rect(), root_damage_rect); |
1776 break; | 1778 break; |
1777 case 3: | 1779 case 3: |
1778 EXPECT_EQ(invalid_rect_, root_damage_rect); | 1780 EXPECT_EQ(invalid_rect_, root_damage_rect); |
1779 break; | 1781 break; |
1780 case 4: | 1782 case 4: |
1781 EXPECT_EQ(gfx::Rect(bounds_), root_damage_rect); | 1783 EXPECT_EQ(gfx::Rect(bounds_), root_damage_rect); |
1782 break; | 1784 break; |
1783 default: | 1785 default: |
1784 NOTREACHED(); | 1786 NOTREACHED(); |
1785 } | 1787 } |
(...skipping 5262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7048 EndTest(); | 7050 EndTest(); |
7049 } | 7051 } |
7050 | 7052 |
7051 void AfterTest() override {} | 7053 void AfterTest() override {} |
7052 }; | 7054 }; |
7053 | 7055 |
7054 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); | 7056 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); |
7055 | 7057 |
7056 } // namespace | 7058 } // namespace |
7057 } // namespace cc | 7059 } // namespace cc |
OLD | NEW |