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

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

Issue 1479883002: cc: Fix draw transform computation for non-drawn layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove LayerImpl::draw_transform() Created 5 years 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layer_iterator.h" 5 #include "cc/layers/layer_iterator.h"
6 #include "cc/output/copy_output_request.h" 6 #include "cc/output/copy_output_request.h"
7 #include "cc/output/copy_output_result.h" 7 #include "cc/output/copy_output_result.h"
8 #include "cc/test/fake_content_layer_client.h" 8 #include "cc/test/fake_content_layer_client.h"
9 #include "cc/test/fake_output_surface.h" 9 #include "cc/test/fake_output_surface.h"
10 #include "cc/test/fake_picture_layer.h" 10 #include "cc/test/fake_picture_layer.h"
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 489
490 FakeContentLayerClient client_; 490 FakeContentLayerClient client_;
491 scoped_refptr<FakePictureLayer> root_; 491 scoped_refptr<FakePictureLayer> root_;
492 scoped_refptr<FakePictureLayer> parent_layer_; 492 scoped_refptr<FakePictureLayer> parent_layer_;
493 scoped_refptr<FakePictureLayer> copy_layer_; 493 scoped_refptr<FakePictureLayer> copy_layer_;
494 }; 494 };
495 495
496 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 496 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
497 LayerTreeHostCopyRequestTestClippedOut); 497 LayerTreeHostCopyRequestTestClippedOut);
498 498
499 class LayerTreeHostCopyRequestTestScaledLayer
500 : public LayerTreeHostCopyRequestTest {
501 protected:
502 void SetupTree() override {
503 root_ = Layer::Create(layer_settings());
504 root_->SetBounds(gfx::Size(20, 20));
505
506 gfx::Transform scale;
507 scale.Scale(2, 2);
508
509 copy_layer_ = Layer::Create(layer_settings());
510 copy_layer_->SetBounds(gfx::Size(10, 10));
511 copy_layer_->SetTransform(scale);
512 root_->AddChild(copy_layer_);
513
514 child_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
515 child_layer_->SetBounds(gfx::Size(10, 10));
516 copy_layer_->AddChild(child_layer_);
517
518 layer_tree_host()->SetRootLayer(root_);
519 LayerTreeHostCopyRequestTest::SetupTree();
520 client_.set_bounds(root_->bounds());
521 }
522
523 void BeginTest() override {
524 PostSetNeedsCommitToMainThread();
525
526 scoped_ptr<CopyOutputRequest> request =
527 CopyOutputRequest::CreateBitmapRequest(base::Bind(
528 &LayerTreeHostCopyRequestTestScaledLayer::CopyOutputCallback,
529 base::Unretained(this)));
530 request->set_area(gfx::Rect(5, 5));
531 copy_layer_->RequestCopyOfOutput(std::move(request));
532 }
533
534 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {
535 // The request area is expressed in layer space, but the result's size takes
536 // into account the transform from layer space to surface space.
537 EXPECT_EQ(gfx::Size(10, 10), result->size());
538 EndTest();
539 }
540
541 void AfterTest() override {}
542
543 FakeContentLayerClient client_;
544 scoped_refptr<Layer> root_;
545 scoped_refptr<Layer> copy_layer_;
546 scoped_refptr<FakePictureLayer> child_layer_;
547 };
548
549 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
550 LayerTreeHostCopyRequestTestScaledLayer);
551
499 class LayerTreeHostTestAsyncTwoReadbacksWithoutDraw 552 class LayerTreeHostTestAsyncTwoReadbacksWithoutDraw
500 : public LayerTreeHostCopyRequestTest { 553 : public LayerTreeHostCopyRequestTest {
501 protected: 554 protected:
502 void SetupTree() override { 555 void SetupTree() override {
503 root_ = FakePictureLayer::Create(layer_settings(), &client_); 556 root_ = FakePictureLayer::Create(layer_settings(), &client_);
504 root_->SetBounds(gfx::Size(20, 20)); 557 root_->SetBounds(gfx::Size(20, 20));
505 558
506 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_); 559 copy_layer_ = FakePictureLayer::Create(layer_settings(), &client_);
507 copy_layer_->SetBounds(gfx::Size(10, 10)); 560 copy_layer_->SetBounds(gfx::Size(10, 10));
508 root_->AddChild(copy_layer_); 561 root_->AddChild(copy_layer_);
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 int num_draws_; 1187 int num_draws_;
1135 bool copy_happened_; 1188 bool copy_happened_;
1136 bool draw_happened_; 1189 bool draw_happened_;
1137 }; 1190 };
1138 1191
1139 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( 1192 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(
1140 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest); 1193 LayerTreeHostCopyRequestTestMultipleDrawsHiddenCopyRequest);
1141 1194
1142 } // namespace 1195 } // namespace
1143 } // namespace cc 1196 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698