OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/texture_layer_impl.h" | 5 #include "cc/layers/texture_layer_impl.h" |
6 | 6 |
7 #include "cc/output/context_provider.h" | 7 #include "cc/output/context_provider.h" |
8 #include "cc/output/output_surface.h" | 8 #include "cc/output/output_surface.h" |
9 #include "cc/test/layer_test_common.h" | 9 #include "cc/test/layer_test_common.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 namespace { | 13 namespace { |
14 | 14 |
15 void IgnoreCallback(uint32 sync_point, bool lost) {} | 15 void IgnoreCallback(uint32 sync_point, |
| 16 bool lost, |
| 17 BlockingTaskRunner* main_thread_task_runner) { |
| 18 } |
16 | 19 |
17 TEST(TextureLayerImplTest, Occlusion) { | 20 TEST(TextureLayerImplTest, Occlusion) { |
18 gfx::Size layer_size(1000, 1000); | 21 gfx::Size layer_size(1000, 1000); |
19 gfx::Size viewport_size(1000, 1000); | 22 gfx::Size viewport_size(1000, 1000); |
20 | 23 |
21 LayerTestCommon::LayerImplTest impl; | 24 LayerTestCommon::LayerImplTest impl; |
22 | 25 |
23 gpu::Mailbox mailbox; | 26 gpu::Mailbox mailbox; |
24 impl.output_surface()->context_provider()->ContextGL()->GenMailboxCHROMIUM( | 27 impl.output_surface()->context_provider()->ContextGL()->GenMailboxCHROMIUM( |
25 mailbox.name); | 28 mailbox.name); |
26 TextureMailbox texture_mailbox(mailbox, GL_TEXTURE_2D, 0); | 29 TextureMailbox texture_mailbox(mailbox, GL_TEXTURE_2D, 0); |
27 | 30 |
28 TextureLayerImpl* texture_layer_impl = | 31 TextureLayerImpl* texture_layer_impl = |
29 impl.AddChildToRoot<TextureLayerImpl>(); | 32 impl.AddChildToRoot<TextureLayerImpl>(); |
30 texture_layer_impl->SetBounds(layer_size); | 33 texture_layer_impl->SetBounds(layer_size); |
31 texture_layer_impl->SetContentBounds(layer_size); | 34 texture_layer_impl->SetContentBounds(layer_size); |
32 texture_layer_impl->SetDrawsContent(true); | 35 texture_layer_impl->SetDrawsContent(true); |
33 texture_layer_impl->SetTextureMailbox( | 36 texture_layer_impl->SetTextureMailbox( |
34 texture_mailbox, | 37 texture_mailbox, |
35 SingleReleaseCallback::Create(base::Bind(&IgnoreCallback))); | 38 SingleReleaseCallbackImpl::Create(base::Bind(&IgnoreCallback))); |
36 | 39 |
37 impl.CalcDrawProps(viewport_size); | 40 impl.CalcDrawProps(viewport_size); |
38 | 41 |
39 { | 42 { |
40 SCOPED_TRACE("No occlusion"); | 43 SCOPED_TRACE("No occlusion"); |
41 gfx::Rect occluded; | 44 gfx::Rect occluded; |
42 impl.AppendQuadsWithOcclusion(texture_layer_impl, occluded); | 45 impl.AppendQuadsWithOcclusion(texture_layer_impl, occluded); |
43 | 46 |
44 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), | 47 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), |
45 gfx::Rect(layer_size)); | 48 gfx::Rect(layer_size)); |
(...skipping 21 matching lines...) Expand all Loading... |
67 occluded, | 70 occluded, |
68 &partially_occluded_count); | 71 &partially_occluded_count); |
69 // The layer outputs one quad, which is partially occluded. | 72 // The layer outputs one quad, which is partially occluded. |
70 EXPECT_EQ(1u, impl.quad_list().size()); | 73 EXPECT_EQ(1u, impl.quad_list().size()); |
71 EXPECT_EQ(1u, partially_occluded_count); | 74 EXPECT_EQ(1u, partially_occluded_count); |
72 } | 75 } |
73 } | 76 } |
74 | 77 |
75 } // namespace | 78 } // namespace |
76 } // namespace cc | 79 } // namespace cc |
OLD | NEW |