| 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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1889 had_incomplete_tile, | 1889 had_incomplete_tile, |
| 1890 animating, | 1890 animating, |
| 1891 resource_provider)); | 1891 resource_provider)); |
| 1892 } | 1892 } |
| 1893 | 1893 |
| 1894 virtual void AppendQuads(RenderPass* render_pass, | 1894 virtual void AppendQuads(RenderPass* render_pass, |
| 1895 const OcclusionTracker<LayerImpl>& occlusion_tracker, | 1895 const OcclusionTracker<LayerImpl>& occlusion_tracker, |
| 1896 AppendQuadsData* append_quads_data) OVERRIDE { | 1896 AppendQuadsData* append_quads_data) OVERRIDE { |
| 1897 LayerImpl::AppendQuads(render_pass, occlusion_tracker, append_quads_data); | 1897 LayerImpl::AppendQuads(render_pass, occlusion_tracker, append_quads_data); |
| 1898 if (had_incomplete_tile_) | 1898 if (had_incomplete_tile_) |
| 1899 append_quads_data->had_incomplete_tile = true; | 1899 append_quads_data->num_incomplete_tiles++; |
| 1900 if (tile_missing_) | 1900 if (tile_missing_) |
| 1901 append_quads_data->num_missing_tiles++; | 1901 append_quads_data->num_missing_tiles++; |
| 1902 } | 1902 } |
| 1903 | 1903 |
| 1904 private: | 1904 private: |
| 1905 MissingTextureAnimatingLayer(LayerTreeImpl* tree_impl, | 1905 MissingTextureAnimatingLayer(LayerTreeImpl* tree_impl, |
| 1906 int id, | 1906 int id, |
| 1907 bool tile_missing, | 1907 bool tile_missing, |
| 1908 bool had_incomplete_tile, | 1908 bool had_incomplete_tile, |
| 1909 bool animating, | 1909 bool animating, |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2095 host_impl_->resource_provider())); | 2095 host_impl_->resource_provider())); |
| 2096 host_impl_->active_tree()->SetRequiresHighResToDraw(); | 2096 host_impl_->active_tree()->SetRequiresHighResToDraw(); |
| 2097 LayerTreeHostImpl::FrameData frame; | 2097 LayerTreeHostImpl::FrameData frame; |
| 2098 EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, | 2098 EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, |
| 2099 host_impl_->PrepareToDraw(&frame)); | 2099 host_impl_->PrepareToDraw(&frame)); |
| 2100 host_impl_->DrawLayers(&frame); | 2100 host_impl_->DrawLayers(&frame); |
| 2101 host_impl_->DidDrawAllLayers(frame); | 2101 host_impl_->DidDrawAllLayers(frame); |
| 2102 } | 2102 } |
| 2103 | 2103 |
| 2104 TEST_F(LayerTreeHostImplTest, | 2104 TEST_F(LayerTreeHostImplTest, |
| 2105 PrepareToDrawSucceedsWhenHighResRequiredAndMissingTile) { | 2105 PrepareToDrawFailsWhenHighResRequiredAndMissingTile) { |
| 2106 host_impl_->active_tree()->SetRootLayer( | 2106 host_impl_->active_tree()->SetRootLayer( |
| 2107 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); | 2107 DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); |
| 2108 DidDrawCheckLayer* root = | 2108 DidDrawCheckLayer* root = |
| 2109 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); | 2109 static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
| 2110 bool tile_missing = true; | 2110 bool tile_missing = true; |
| 2111 bool had_incomplete_tile = false; | 2111 bool had_incomplete_tile = false; |
| 2112 bool is_animating = false; | 2112 bool is_animating = false; |
| 2113 root->AddChild( | 2113 root->AddChild( |
| 2114 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), | 2114 MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
| 2115 8, | 2115 8, |
| 2116 tile_missing, | 2116 tile_missing, |
| 2117 had_incomplete_tile, | 2117 had_incomplete_tile, |
| 2118 is_animating, | 2118 is_animating, |
| 2119 host_impl_->resource_provider())); | 2119 host_impl_->resource_provider())); |
| 2120 host_impl_->active_tree()->SetRequiresHighResToDraw(); | 2120 host_impl_->active_tree()->SetRequiresHighResToDraw(); |
| 2121 LayerTreeHostImpl::FrameData frame; | 2121 LayerTreeHostImpl::FrameData frame; |
| 2122 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 2122 EXPECT_EQ(DRAW_ABORTED_MISSING_HIGH_RES_CONTENT, |
| 2123 host_impl_->PrepareToDraw(&frame)); |
| 2123 host_impl_->DrawLayers(&frame); | 2124 host_impl_->DrawLayers(&frame); |
| 2124 host_impl_->DidDrawAllLayers(frame); | 2125 host_impl_->DidDrawAllLayers(frame); |
| 2125 } | 2126 } |
| 2126 | 2127 |
| 2127 TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) { | 2128 TEST_F(LayerTreeHostImplTest, ScrollRootIgnored) { |
| 2128 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); | 2129 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_->active_tree(), 1); |
| 2129 root->SetScrollClipLayer(Layer::INVALID_ID); | 2130 root->SetScrollClipLayer(Layer::INVALID_ID); |
| 2130 host_impl_->active_tree()->SetRootLayer(root.Pass()); | 2131 host_impl_->active_tree()->SetRootLayer(root.Pass()); |
| 2131 DrawFrame(); | 2132 DrawFrame(); |
| 2132 | 2133 |
| (...skipping 4628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6761 | 6762 |
| 6762 host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(200)); | 6763 host_impl_->Animate(start_time + base::TimeDelta::FromMilliseconds(200)); |
| 6763 host_impl_->UpdateAnimationState(true); | 6764 host_impl_->UpdateAnimationState(true); |
| 6764 | 6765 |
| 6765 EXPECT_EQ(gfx::Vector2dF(0, 50), scrolling_layer->TotalScrollOffset()); | 6766 EXPECT_EQ(gfx::Vector2dF(0, 50), scrolling_layer->TotalScrollOffset()); |
| 6766 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); | 6767 EXPECT_EQ(NULL, host_impl_->CurrentlyScrollingLayer()); |
| 6767 } | 6768 } |
| 6768 | 6769 |
| 6769 } // namespace | 6770 } // namespace |
| 6770 } // namespace cc | 6771 } // namespace cc |
| OLD | NEW |