Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: cc/trees/layer_tree_host_unittest_damage.cc

Issue 2716733007: cc: Rename LayerImpl::render_surface to GetRenderSurface (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_occlusion.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 break; 48 break;
49 } 49 }
50 } 50 }
51 51
52 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* impl, 52 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* impl,
53 LayerTreeHostImpl::FrameData* frame_data, 53 LayerTreeHostImpl::FrameData* frame_data,
54 DrawResult draw_result) override { 54 DrawResult draw_result) override {
55 EXPECT_EQ(DRAW_SUCCESS, draw_result); 55 EXPECT_EQ(DRAW_SUCCESS, draw_result);
56 56
57 RenderSurfaceImpl* root_surface = 57 RenderSurfaceImpl* root_surface =
58 impl->active_tree()->root_layer_for_testing()->render_surface(); 58 impl->active_tree()->root_layer_for_testing()->GetRenderSurface();
59 gfx::Rect root_damage; 59 gfx::Rect root_damage;
60 EXPECT_TRUE( 60 EXPECT_TRUE(
61 root_surface->damage_tracker()->GetDamageRectIfValid(&root_damage)); 61 root_surface->damage_tracker()->GetDamageRectIfValid(&root_damage));
62 62
63 switch (draw_count_) { 63 switch (draw_count_) {
64 case 0: 64 case 0:
65 // The first frame has full damage. 65 // The first frame has full damage.
66 EXPECT_EQ(gfx::Rect(10, 10), root_damage); 66 EXPECT_EQ(gfx::Rect(10, 10), root_damage);
67 break; 67 break;
68 case 1: 68 case 1:
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 break; 111 break;
112 } 112 }
113 } 113 }
114 114
115 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* impl, 115 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* impl,
116 LayerTreeHostImpl::FrameData* frame_data, 116 LayerTreeHostImpl::FrameData* frame_data,
117 DrawResult draw_result) override { 117 DrawResult draw_result) override {
118 EXPECT_EQ(DRAW_SUCCESS, draw_result); 118 EXPECT_EQ(DRAW_SUCCESS, draw_result);
119 119
120 RenderSurfaceImpl* root_surface = 120 RenderSurfaceImpl* root_surface =
121 impl->active_tree()->root_layer_for_testing()->render_surface(); 121 impl->active_tree()->root_layer_for_testing()->GetRenderSurface();
122 gfx::Rect root_damage; 122 gfx::Rect root_damage;
123 EXPECT_TRUE( 123 EXPECT_TRUE(
124 root_surface->damage_tracker()->GetDamageRectIfValid(&root_damage)); 124 root_surface->damage_tracker()->GetDamageRectIfValid(&root_damage));
125 125
126 switch (draw_count_) { 126 switch (draw_count_) {
127 case 0: 127 case 0:
128 // The first frame has full damage. 128 // The first frame has full damage.
129 EXPECT_EQ(gfx::Rect(10, 10), root_damage); 129 EXPECT_EQ(gfx::Rect(10, 10), root_damage);
130 break; 130 break;
131 case 1: 131 case 1:
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 LayerTreeHostDamageTest::SetupTree(); 253 LayerTreeHostDamageTest::SetupTree();
254 client_.set_bounds(root_->bounds()); 254 client_.set_bounds(root_->bounds());
255 } 255 }
256 256
257 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 257 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
258 LayerTreeHostImpl::FrameData* frame_data, 258 LayerTreeHostImpl::FrameData* frame_data,
259 DrawResult draw_result) override { 259 DrawResult draw_result) override {
260 EXPECT_EQ(DRAW_SUCCESS, draw_result); 260 EXPECT_EQ(DRAW_SUCCESS, draw_result);
261 261
262 RenderSurfaceImpl* root_surface = 262 RenderSurfaceImpl* root_surface =
263 host_impl->active_tree()->root_layer_for_testing()->render_surface(); 263 host_impl->active_tree()->root_layer_for_testing()->GetRenderSurface();
264 gfx::Rect root_damage; 264 gfx::Rect root_damage;
265 EXPECT_TRUE( 265 EXPECT_TRUE(
266 root_surface->damage_tracker()->GetDamageRectIfValid(&root_damage)); 266 root_surface->damage_tracker()->GetDamageRectIfValid(&root_damage));
267 root_damage.Intersect(root_surface->content_rect()); 267 root_damage.Intersect(root_surface->content_rect());
268 268
269 int source_frame = host_impl->active_tree()->source_frame_number(); 269 int source_frame = host_impl->active_tree()->source_frame_number();
270 switch (source_frame) { 270 switch (source_frame) {
271 case 0: 271 case 0:
272 // The first frame draws and clears any damage. 272 // The first frame draws and clears any damage.
273 EXPECT_EQ(root_surface->content_rect(), root_damage); 273 EXPECT_EQ(root_surface->content_rect(), root_damage);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 void BeginTest() override { 379 void BeginTest() override {
380 num_draws_ = 0; 380 num_draws_ = 0;
381 PostSetNeedsCommitToMainThread(); 381 PostSetNeedsCommitToMainThread();
382 } 382 }
383 383
384 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 384 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
385 LayerTreeHostImpl::FrameData* frame_data, 385 LayerTreeHostImpl::FrameData* frame_data,
386 DrawResult draw_result) override { 386 DrawResult draw_result) override {
387 EXPECT_EQ(DRAW_SUCCESS, draw_result); 387 EXPECT_EQ(DRAW_SUCCESS, draw_result);
388 RenderSurfaceImpl* root_surface = 388 RenderSurfaceImpl* root_surface =
389 host_impl->active_tree()->root_layer_for_testing()->render_surface(); 389 host_impl->active_tree()->root_layer_for_testing()->GetRenderSurface();
390 gfx::Rect root_damage; 390 gfx::Rect root_damage;
391 EXPECT_TRUE( 391 EXPECT_TRUE(
392 root_surface->damage_tracker()->GetDamageRectIfValid(&root_damage)); 392 root_surface->damage_tracker()->GetDamageRectIfValid(&root_damage));
393 root_damage.Intersect(root_surface->content_rect()); 393 root_damage.Intersect(root_surface->content_rect());
394 switch (num_draws_) { 394 switch (num_draws_) {
395 case 0: 395 case 0:
396 // The first frame has damage, so we should draw and swap. 396 // The first frame has damage, so we should draw and swap.
397 break; 397 break;
398 case 1: 398 case 1:
399 // The second frame should not damage the scrollbars. 399 // The second frame should not damage the scrollbars.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 void BeginTest() override { 464 void BeginTest() override {
465 num_draws_ = 0; 465 num_draws_ = 0;
466 PostSetNeedsCommitToMainThread(); 466 PostSetNeedsCommitToMainThread();
467 } 467 }
468 468
469 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 469 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
470 LayerTreeHostImpl::FrameData* frame_data, 470 LayerTreeHostImpl::FrameData* frame_data,
471 DrawResult draw_result) override { 471 DrawResult draw_result) override {
472 EXPECT_EQ(DRAW_SUCCESS, draw_result); 472 EXPECT_EQ(DRAW_SUCCESS, draw_result);
473 RenderSurfaceImpl* root_surface = 473 RenderSurfaceImpl* root_surface =
474 host_impl->active_tree()->root_layer_for_testing()->render_surface(); 474 host_impl->active_tree()->root_layer_for_testing()->GetRenderSurface();
475 gfx::Rect root_damage; 475 gfx::Rect root_damage;
476 EXPECT_TRUE( 476 EXPECT_TRUE(
477 root_surface->damage_tracker()->GetDamageRectIfValid(&root_damage)); 477 root_surface->damage_tracker()->GetDamageRectIfValid(&root_damage));
478 root_damage.Intersect(root_surface->content_rect()); 478 root_damage.Intersect(root_surface->content_rect());
479 int frame = host_impl->active_tree()->source_frame_number(); 479 int frame = host_impl->active_tree()->source_frame_number();
480 switch (num_draws_) { 480 switch (num_draws_) {
481 case 0: 481 case 0:
482 // The first frame has damage, so we should draw and swap. 482 // The first frame has damage, so we should draw and swap.
483 EXPECT_EQ(0, frame); 483 EXPECT_EQ(0, frame);
484 break; 484 break;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 526
527 void AfterTest() override { EXPECT_EQ(3, num_draws_); } 527 void AfterTest() override { EXPECT_EQ(3, num_draws_); }
528 528
529 int num_draws_; 529 int num_draws_;
530 }; 530 };
531 531
532 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestScrollbarCommitDoesNoDamage); 532 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestScrollbarCommitDoesNoDamage);
533 533
534 } // namespace 534 } // namespace
535 } // namespace cc 535 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_occlusion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698