| 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/base/scoped_ptr_vector.h" | 5 #include "cc/base/scoped_ptr_vector.h" |
| 6 #include "cc/layers/append_quads_data.h" | 6 #include "cc/layers/append_quads_data.h" |
| 7 #include "cc/layers/layer_impl.h" | 7 #include "cc/layers/layer_impl.h" |
| 8 #include "cc/layers/render_pass_sink.h" | 8 #include "cc/layers/render_pass_sink.h" |
| 9 #include "cc/layers/render_surface_impl.h" | 9 #include "cc/layers/render_surface_impl.h" |
| 10 #include "cc/quads/shared_quad_state.h" | 10 #include "cc/quads/shared_quad_state.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 code_to_test; \ | 31 code_to_test; \ |
| 32 EXPECT_FALSE(render_surface->SurfacePropertyChanged()) | 32 EXPECT_FALSE(render_surface->SurfacePropertyChanged()) |
| 33 | 33 |
| 34 TEST(RenderSurfaceTest, VerifySurfaceChangesAreTrackedProperly) { | 34 TEST(RenderSurfaceTest, VerifySurfaceChangesAreTrackedProperly) { |
| 35 // | 35 // |
| 36 // This test checks that SurfacePropertyChanged() has the correct behavior. | 36 // This test checks that SurfacePropertyChanged() has the correct behavior. |
| 37 // | 37 // |
| 38 | 38 |
| 39 FakeImplProxy proxy; | 39 FakeImplProxy proxy; |
| 40 TestSharedBitmapManager shared_bitmap_manager; | 40 TestSharedBitmapManager shared_bitmap_manager; |
| 41 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 41 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 42 scoped_ptr<LayerImpl> owning_layer = | 42 scoped_ptr<LayerImpl> owning_layer = |
| 43 LayerImpl::Create(host_impl.active_tree(), 1); | 43 LayerImpl::Create(host_impl.active_tree(), 1); |
| 44 owning_layer->SetHasRenderSurface(true); | 44 owning_layer->SetHasRenderSurface(true); |
| 45 ASSERT_TRUE(owning_layer->render_surface()); | 45 ASSERT_TRUE(owning_layer->render_surface()); |
| 46 RenderSurfaceImpl* render_surface = owning_layer->render_surface(); | 46 RenderSurfaceImpl* render_surface = owning_layer->render_surface(); |
| 47 gfx::Rect test_rect(3, 4, 5, 6); | 47 gfx::Rect test_rect(3, 4, 5, 6); |
| 48 owning_layer->ResetAllChangeTrackingForSubtree(); | 48 owning_layer->ResetAllChangeTrackingForSubtree(); |
| 49 | 49 |
| 50 // Currently, the content_rect, clip_rect, and | 50 // Currently, the content_rect, clip_rect, and |
| 51 // owning_layer->layerPropertyChanged() are the only sources of change. | 51 // owning_layer->layerPropertyChanged() are the only sources of change. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 76 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE( | 76 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE( |
| 77 render_surface->SetDrawTransform(dummy_matrix)); | 77 render_surface->SetDrawTransform(dummy_matrix)); |
| 78 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE( | 78 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE( |
| 79 render_surface->SetReplicaDrawTransform(dummy_matrix)); | 79 render_surface->SetReplicaDrawTransform(dummy_matrix)); |
| 80 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(render_surface->ClearLayerLists()); | 80 EXECUTE_AND_VERIFY_SURFACE_DID_NOT_CHANGE(render_surface->ClearLayerLists()); |
| 81 } | 81 } |
| 82 | 82 |
| 83 TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectSharedQuadState) { | 83 TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectSharedQuadState) { |
| 84 FakeImplProxy proxy; | 84 FakeImplProxy proxy; |
| 85 TestSharedBitmapManager shared_bitmap_manager; | 85 TestSharedBitmapManager shared_bitmap_manager; |
| 86 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 86 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 87 scoped_ptr<LayerImpl> root_layer = | 87 scoped_ptr<LayerImpl> root_layer = |
| 88 LayerImpl::Create(host_impl.active_tree(), 1); | 88 LayerImpl::Create(host_impl.active_tree(), 1); |
| 89 | 89 |
| 90 scoped_ptr<LayerImpl> owning_layer = | 90 scoped_ptr<LayerImpl> owning_layer = |
| 91 LayerImpl::Create(host_impl.active_tree(), 2); | 91 LayerImpl::Create(host_impl.active_tree(), 2); |
| 92 owning_layer->SetHasRenderSurface(true); | 92 owning_layer->SetHasRenderSurface(true); |
| 93 ASSERT_TRUE(owning_layer->render_surface()); | 93 ASSERT_TRUE(owning_layer->render_surface()); |
| 94 owning_layer->draw_properties().render_target = owning_layer.get(); | 94 owning_layer->draw_properties().render_target = owning_layer.get(); |
| 95 | 95 |
| 96 SkXfermode::Mode blend_mode = SkXfermode::kSoftLight_Mode; | 96 SkXfermode::Mode blend_mode = SkXfermode::kSoftLight_Mode; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 return render_passes_; | 140 return render_passes_; |
| 141 } | 141 } |
| 142 | 142 |
| 143 private: | 143 private: |
| 144 RenderPassList render_passes_; | 144 RenderPassList render_passes_; |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectRenderPass) { | 147 TEST(RenderSurfaceTest, SanityCheckSurfaceCreatesCorrectRenderPass) { |
| 148 FakeImplProxy proxy; | 148 FakeImplProxy proxy; |
| 149 TestSharedBitmapManager shared_bitmap_manager; | 149 TestSharedBitmapManager shared_bitmap_manager; |
| 150 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); | 150 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, nullptr); |
| 151 scoped_ptr<LayerImpl> root_layer = | 151 scoped_ptr<LayerImpl> root_layer = |
| 152 LayerImpl::Create(host_impl.active_tree(), 1); | 152 LayerImpl::Create(host_impl.active_tree(), 1); |
| 153 | 153 |
| 154 scoped_ptr<LayerImpl> owning_layer = | 154 scoped_ptr<LayerImpl> owning_layer = |
| 155 LayerImpl::Create(host_impl.active_tree(), 2); | 155 LayerImpl::Create(host_impl.active_tree(), 2); |
| 156 owning_layer->SetHasRenderSurface(true); | 156 owning_layer->SetHasRenderSurface(true); |
| 157 ASSERT_TRUE(owning_layer->render_surface()); | 157 ASSERT_TRUE(owning_layer->render_surface()); |
| 158 owning_layer->draw_properties().render_target = owning_layer.get(); | 158 owning_layer->draw_properties().render_target = owning_layer.get(); |
| 159 RenderSurfaceImpl* render_surface = owning_layer->render_surface(); | 159 RenderSurfaceImpl* render_surface = owning_layer->render_surface(); |
| 160 | 160 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 174 ASSERT_EQ(1u, pass_sink.RenderPasses().size()); | 174 ASSERT_EQ(1u, pass_sink.RenderPasses().size()); |
| 175 RenderPass* pass = pass_sink.RenderPasses()[0]; | 175 RenderPass* pass = pass_sink.RenderPasses()[0]; |
| 176 | 176 |
| 177 EXPECT_EQ(RenderPassId(2, 0), pass->id); | 177 EXPECT_EQ(RenderPassId(2, 0), pass->id); |
| 178 EXPECT_EQ(content_rect, pass->output_rect); | 178 EXPECT_EQ(content_rect, pass->output_rect); |
| 179 EXPECT_EQ(origin, pass->transform_to_root_target); | 179 EXPECT_EQ(origin, pass->transform_to_root_target); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace | 182 } // namespace |
| 183 } // namespace cc | 183 } // namespace cc |
| OLD | NEW |