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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 8305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8316 child->SetPosition(gfx::PointF(9.f, 9.f)); | 8316 child->SetPosition(gfx::PointF(9.f, 9.f)); |
8317 child->SetBounds(gfx::Size(1, 1)); | 8317 child->SetBounds(gfx::Size(1, 1)); |
8318 child->SetDrawsContent(true); | 8318 child->SetDrawsContent(true); |
8319 child->SetBackgroundColor(SK_ColorRED); | 8319 child->SetBackgroundColor(SK_ColorRED); |
8320 root->test_properties()->AddChild(std::move(child)); | 8320 root->test_properties()->AddChild(std::move(child)); |
8321 | 8321 |
8322 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root)); | 8322 host_impl_->active_tree()->SetRootLayerForTesting(std::move(root)); |
8323 host_impl_->active_tree()->BuildPropertyTreesForTesting(); | 8323 host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
8324 | 8324 |
8325 // Draw a frame. In the first frame, the entire viewport should be damaged. | 8325 // Draw a frame. In the first frame, the entire viewport should be damaged. |
8326 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); | 8326 gfx::Rect full_frame_damage(host_impl_->DeviceViewport().size()); |
8327 DrawFrameAndTestDamage(full_frame_damage); | 8327 DrawFrameAndTestDamage(full_frame_damage); |
8328 | 8328 |
8329 // The second frame has damage that doesn't touch the child layer. Its quads | 8329 // The second frame has damage that doesn't touch the child layer. Its quads |
8330 // should still be generated. | 8330 // should still be generated. |
8331 gfx::Rect small_damage = gfx::Rect(0, 0, 1, 1); | 8331 gfx::Rect small_damage = gfx::Rect(0, 0, 1, 1); |
8332 host_impl_->active_tree()->root_layer_for_testing()->SetUpdateRect( | 8332 host_impl_->active_tree()->root_layer_for_testing()->SetUpdateRect( |
8333 small_damage); | 8333 small_damage); |
8334 DrawFrameAndTestDamage(small_damage); | 8334 DrawFrameAndTestDamage(small_damage); |
8335 | 8335 |
8336 // The third frame should have no damage, so no quads should be generated. | 8336 // The third frame should have no damage, so no quads should be generated. |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9116 static_cast<FakeCompositorFrameSink*>( | 9116 static_cast<FakeCompositorFrameSink*>( |
9117 host_impl_->compositor_frame_sink()); | 9117 host_impl_->compositor_frame_sink()); |
9118 | 9118 |
9119 ui::LatencyInfo latency_info; | 9119 ui::LatencyInfo latency_info; |
9120 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, | 9120 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, |
9121 0); | 9121 0); |
9122 std::unique_ptr<SwapPromise> swap_promise( | 9122 std::unique_ptr<SwapPromise> swap_promise( |
9123 new LatencyInfoSwapPromise(latency_info)); | 9123 new LatencyInfoSwapPromise(latency_info)); |
9124 host_impl_->active_tree()->QueuePinnedSwapPromise(std::move(swap_promise)); | 9124 host_impl_->active_tree()->QueuePinnedSwapPromise(std::move(swap_promise)); |
9125 | 9125 |
9126 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); | 9126 gfx::Rect full_frame_damage(host_impl_->DeviceViewport().size()); |
9127 TestFrameData frame; | 9127 TestFrameData frame; |
9128 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 9128 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
9129 EXPECT_TRUE(host_impl_->DrawLayers(&frame)); | 9129 EXPECT_TRUE(host_impl_->DrawLayers(&frame)); |
9130 host_impl_->DidDrawAllLayers(frame); | 9130 host_impl_->DidDrawAllLayers(frame); |
9131 | 9131 |
9132 const std::vector<ui::LatencyInfo>& metadata_latency_after = | 9132 const std::vector<ui::LatencyInfo>& metadata_latency_after = |
9133 fake_compositor_frame_sink->last_sent_frame()->metadata.latency_info; | 9133 fake_compositor_frame_sink->last_sent_frame()->metadata.latency_info; |
9134 EXPECT_EQ(1u, metadata_latency_after.size()); | 9134 EXPECT_EQ(1u, metadata_latency_after.size()); |
9135 EXPECT_TRUE(metadata_latency_after[0].FindLatency( | 9135 EXPECT_TRUE(metadata_latency_after[0].FindLatency( |
9136 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL)); | 9136 ui::INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT, 0, NULL)); |
(...skipping 23 matching lines...) Expand all Loading... |
9160 selection.start.type = gfx::SelectionBound::CENTER; | 9160 selection.start.type = gfx::SelectionBound::CENTER; |
9161 selection.start.layer_id = root_layer_id; | 9161 selection.start.layer_id = root_layer_id; |
9162 selection.start.edge_bottom = selection_bottom; | 9162 selection.start.edge_bottom = selection_bottom; |
9163 selection.start.edge_top = selection_top; | 9163 selection.start.edge_top = selection_top; |
9164 selection.end = selection.start; | 9164 selection.end = selection.start; |
9165 host_impl_->active_tree()->RegisterSelection(selection); | 9165 host_impl_->active_tree()->RegisterSelection(selection); |
9166 | 9166 |
9167 // Trigger a draw-swap sequence. | 9167 // Trigger a draw-swap sequence. |
9168 host_impl_->SetNeedsRedraw(); | 9168 host_impl_->SetNeedsRedraw(); |
9169 | 9169 |
9170 gfx::Rect full_frame_damage(host_impl_->DrawViewportSize()); | 9170 gfx::Rect full_frame_damage(host_impl_->DeviceViewport().size()); |
9171 TestFrameData frame; | 9171 TestFrameData frame; |
9172 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); | 9172 EXPECT_EQ(DRAW_SUCCESS, host_impl_->PrepareToDraw(&frame)); |
9173 EXPECT_TRUE(host_impl_->DrawLayers(&frame)); | 9173 EXPECT_TRUE(host_impl_->DrawLayers(&frame)); |
9174 host_impl_->DidDrawAllLayers(frame); | 9174 host_impl_->DidDrawAllLayers(frame); |
9175 | 9175 |
9176 // Ensure the selection bounds have propagated to the frame metadata. | 9176 // Ensure the selection bounds have propagated to the frame metadata. |
9177 const Selection<gfx::SelectionBound>& selection_after = | 9177 const Selection<gfx::SelectionBound>& selection_after = |
9178 fake_compositor_frame_sink->last_sent_frame()->metadata.selection; | 9178 fake_compositor_frame_sink->last_sent_frame()->metadata.selection; |
9179 EXPECT_EQ(selection.start.type, selection_after.start.type()); | 9179 EXPECT_EQ(selection.start.type, selection_after.start.type()); |
9180 EXPECT_EQ(selection.end.type, selection_after.end.type()); | 9180 EXPECT_EQ(selection.end.type, selection_after.end.type()); |
(...skipping 3184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12365 else | 12365 else |
12366 EXPECT_FALSE(tile->HasRasterTask()); | 12366 EXPECT_FALSE(tile->HasRasterTask()); |
12367 } | 12367 } |
12368 Region expected_invalidation( | 12368 Region expected_invalidation( |
12369 raster_source->GetRectForImage(checkerable_image->uniqueID())); | 12369 raster_source->GetRectForImage(checkerable_image->uniqueID())); |
12370 EXPECT_EQ(expected_invalidation, *(root->GetPendingInvalidation())); | 12370 EXPECT_EQ(expected_invalidation, *(root->GetPendingInvalidation())); |
12371 } | 12371 } |
12372 | 12372 |
12373 } // namespace | 12373 } // namespace |
12374 } // namespace cc | 12374 } // namespace cc |
OLD | NEW |