| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "cc/layers/render_surface_impl.h" | 8 #include "cc/layers/render_surface_impl.h" |
| 9 #include "cc/layers/video_layer.h" | 9 #include "cc/layers/video_layer.h" |
| 10 #include "cc/layers/video_layer_impl.h" | 10 #include "cc/layers/video_layer_impl.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 void BeginTest() override { | 42 void BeginTest() override { |
| 43 num_draws_ = 0; | 43 num_draws_ = 0; |
| 44 PostSetNeedsCommitToMainThread(); | 44 PostSetNeedsCommitToMainThread(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, | 47 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, |
| 48 LayerTreeHostImpl::FrameData* frame, | 48 LayerTreeHostImpl::FrameData* frame, |
| 49 DrawResult draw_result) override { | 49 DrawResult draw_result) override { |
| 50 LayerImpl* root_layer = host_impl->active_tree()->root_layer(); | 50 LayerImpl* root_layer = host_impl->active_tree()->root_layer(); |
| 51 RenderSurfaceImpl* root_surface = root_layer->render_surface(); | 51 RenderSurfaceImpl* root_surface = root_layer->render_surface(); |
| 52 gfx::RectF damage_rect = | 52 gfx::Rect damage_rect = |
| 53 root_surface->damage_tracker()->current_damage_rect(); | 53 root_surface->damage_tracker()->current_damage_rect(); |
| 54 | 54 |
| 55 switch (num_draws_) { | 55 switch (num_draws_) { |
| 56 case 0: | 56 case 0: |
| 57 // First frame the whole viewport is damaged. | 57 // First frame the whole viewport is damaged. |
| 58 EXPECT_EQ(gfx::RectF(0.f, 0.f, 20.f, 20.f).ToString(), | 58 EXPECT_EQ(gfx::Rect(0, 0, 20, 20), damage_rect); |
| 59 damage_rect.ToString()); | |
| 60 break; | 59 break; |
| 61 case 1: | 60 case 1: |
| 62 // Second frame the video layer is damaged. | 61 // Second frame the video layer is damaged. |
| 63 EXPECT_EQ(gfx::RectF(6.f, 6.f, 8.f, 10.f).ToString(), | 62 EXPECT_EQ(gfx::Rect(6, 6, 8, 10), damage_rect); |
| 64 damage_rect.ToString()); | |
| 65 EndTest(); | 63 EndTest(); |
| 66 break; | 64 break; |
| 67 } | 65 } |
| 68 | 66 |
| 69 EXPECT_EQ(DRAW_SUCCESS, draw_result); | 67 EXPECT_EQ(DRAW_SUCCESS, draw_result); |
| 70 return draw_result; | 68 return draw_result; |
| 71 } | 69 } |
| 72 | 70 |
| 73 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 71 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
| 74 VideoLayerImpl* video = static_cast<VideoLayerImpl*>( | 72 VideoLayerImpl* video = static_cast<VideoLayerImpl*>( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 87 private: | 85 private: |
| 88 int num_draws_; | 86 int num_draws_; |
| 89 | 87 |
| 90 FakeVideoFrameProvider video_frame_provider_; | 88 FakeVideoFrameProvider video_frame_provider_; |
| 91 }; | 89 }; |
| 92 | 90 |
| 93 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostVideoTestSetNeedsDisplay); | 91 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostVideoTestSetNeedsDisplay); |
| 94 | 92 |
| 95 } // namespace | 93 } // namespace |
| 96 } // namespace cc | 94 } // namespace cc |
| OLD | NEW |