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/render_surface_impl.h" | 5 #include "cc/layers/render_surface_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "cc/layers/append_quads_data.h" | 9 #include "cc/layers/append_quads_data.h" |
10 #include "cc/quads/render_pass_draw_quad.h" | 10 #include "cc/quads/render_pass_draw_quad.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 surface->test_properties()->mask_layer->SetDrawsContent(true); | 86 surface->test_properties()->mask_layer->SetDrawsContent(true); |
87 surface->test_properties()->mask_layer->SetBounds(layer_size); | 87 surface->test_properties()->mask_layer->SetBounds(layer_size); |
88 | 88 |
89 std::unique_ptr<LayerImpl> child = | 89 std::unique_ptr<LayerImpl> child = |
90 LayerImpl::Create(impl.host_impl()->active_tree(), 5); | 90 LayerImpl::Create(impl.host_impl()->active_tree(), 5); |
91 child->SetDrawsContent(true); | 91 child->SetDrawsContent(true); |
92 child->SetBounds(layer_size); | 92 child->SetBounds(layer_size); |
93 | 93 |
94 surface->test_properties()->AddChild(std::move(child)); | 94 surface->test_properties()->AddChild(std::move(child)); |
95 root->test_properties()->AddChild(std::move(surface)); | 95 root->test_properties()->AddChild(std::move(surface)); |
96 impl.host_impl()->active_tree()->SetRootLayer(std::move(root)); | 96 impl.host_impl()->active_tree()->SetRootLayerForTesting(std::move(root)); |
97 | 97 |
98 impl.host_impl()->SetViewportSize(viewport_size); | 98 impl.host_impl()->SetViewportSize(viewport_size); |
99 impl.host_impl()->active_tree()->BuildLayerListAndPropertyTreesForTesting(); | 99 impl.host_impl()->active_tree()->BuildLayerListAndPropertyTreesForTesting(); |
100 impl.host_impl()->active_tree()->UpdateDrawProperties(false); | 100 impl.host_impl()->active_tree()->UpdateDrawProperties(false); |
101 | 101 |
102 LayerImpl* surface_raw = impl.host_impl() | 102 LayerImpl* surface_raw = impl.host_impl() |
103 ->active_tree() | 103 ->active_tree() |
104 ->root_layer() | 104 ->root_layer_for_testing() |
105 ->test_properties() | 105 ->test_properties() |
106 ->children[0]; | 106 ->children[0]; |
107 RenderSurfaceImpl* render_surface_impl = surface_raw->render_surface(); | 107 RenderSurfaceImpl* render_surface_impl = surface_raw->render_surface(); |
108 std::unique_ptr<RenderPass> render_pass = RenderPass::Create(); | 108 std::unique_ptr<RenderPass> render_pass = RenderPass::Create(); |
109 AppendQuadsData append_quads_data; | 109 AppendQuadsData append_quads_data; |
110 render_surface_impl->AppendQuads( | 110 render_surface_impl->AppendQuads( |
111 render_pass.get(), render_surface_impl->draw_transform(), Occlusion(), | 111 render_pass.get(), render_surface_impl->draw_transform(), Occlusion(), |
112 SK_ColorBLACK, 1.f, render_surface_impl->MaskLayer(), &append_quads_data, | 112 SK_ColorBLACK, 1.f, render_surface_impl->MaskLayer(), &append_quads_data, |
113 RenderPassId(1, 1)); | 113 RenderPassId(1, 1)); |
114 | 114 |
115 const RenderPassDrawQuad* quad = | 115 const RenderPassDrawQuad* quad = |
116 RenderPassDrawQuad::MaterialCast(render_pass->quad_list.front()); | 116 RenderPassDrawQuad::MaterialCast(render_pass->quad_list.front()); |
117 EXPECT_EQ(gfx::Vector2dF(0.0005f, 0.0005f), quad->mask_uv_scale); | 117 EXPECT_EQ(gfx::Vector2dF(0.0005f, 0.0005f), quad->mask_uv_scale); |
118 EXPECT_EQ(gfx::Vector2dF(2.f, 2.f), quad->filters_scale); | 118 EXPECT_EQ(gfx::Vector2dF(2.f, 2.f), quad->filters_scale); |
119 } | 119 } |
120 | 120 |
121 } // namespace | 121 } // namespace |
122 } // namespace cc | 122 } // namespace cc |
OLD | NEW |