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.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 | 567 |
568 gfx::RectF root_damage_rect; | 568 gfx::RectF root_damage_rect; |
569 if (!frame_data->render_passes.empty()) | 569 if (!frame_data->render_passes.empty()) |
570 root_damage_rect = frame_data->render_passes.back()->damage_rect; | 570 root_damage_rect = frame_data->render_passes.back()->damage_rect; |
571 | 571 |
572 // The first time, the whole view needs be drawn. | 572 // The first time, the whole view needs be drawn. |
573 // Afterwards, just the opacity of surface_layer1 is changed a few times, | 573 // Afterwards, just the opacity of surface_layer1 is changed a few times, |
574 // and each damage should be the bounding box of it and its child. If this | 574 // and each damage should be the bounding box of it and its child. If this |
575 // was working improperly, the damage might not include its childs bounding | 575 // was working improperly, the damage might not include its childs bounding |
576 // box. | 576 // box. |
577 // TODO(enne): This compositor thread function is asking for the | 577 switch (host_impl->active_tree()->source_frame_number()) { |
578 // frame number from the layer tree host on the main thread. :( | 578 case 0: |
579 switch (layer_tree_host()->source_frame_number()) { | |
580 case 1: | |
581 EXPECT_RECT_EQ(gfx::Rect(root_layer_->bounds()), root_damage_rect); | 579 EXPECT_RECT_EQ(gfx::Rect(root_layer_->bounds()), root_damage_rect); |
582 break; | 580 break; |
| 581 case 1: |
583 case 2: | 582 case 2: |
584 case 3: | 583 case 3: |
585 case 4: | |
586 EXPECT_RECT_EQ(gfx::Rect(child_layer_->bounds()), root_damage_rect); | 584 EXPECT_RECT_EQ(gfx::Rect(child_layer_->bounds()), root_damage_rect); |
587 break; | 585 break; |
588 default: | 586 default: |
589 NOTREACHED(); | 587 NOTREACHED(); |
590 } | 588 } |
591 | 589 |
592 return draw_result; | 590 return draw_result; |
593 } | 591 } |
594 | 592 |
595 virtual void DidCommitAndDrawFrame() OVERRIDE { | 593 virtual void DidCommitAndDrawFrame() OVERRIDE { |
(...skipping 20 matching lines...) Expand all Loading... |
616 | 614 |
617 virtual void AfterTest() OVERRIDE {} | 615 virtual void AfterTest() OVERRIDE {} |
618 | 616 |
619 private: | 617 private: |
620 FakeContentLayerClient client_; | 618 FakeContentLayerClient client_; |
621 scoped_refptr<ContentLayer> root_layer_; | 619 scoped_refptr<ContentLayer> root_layer_; |
622 scoped_refptr<FakeContentLayer> parent_layer_; | 620 scoped_refptr<FakeContentLayer> parent_layer_; |
623 scoped_refptr<FakeContentLayer> child_layer_; | 621 scoped_refptr<FakeContentLayer> child_layer_; |
624 }; | 622 }; |
625 | 623 |
626 // TODO(enne): http://crbug.com/380895 | 624 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUndrawnLayersDamageLater); |
627 // SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUndrawnLayersDamageLater); | |
628 | 625 |
629 // Tests that if a layer is not drawn because of some reason in the parent, | 626 // Tests that if a layer is not drawn because of some reason in the parent, |
630 // causing its content bounds to not be computed, then when it is later drawn, | 627 // causing its content bounds to not be computed, then when it is later drawn, |
631 // its content bounds get pushed. | 628 // its content bounds get pushed. |
632 class LayerTreeHostTestUndrawnLayersPushContentBoundsLater | 629 class LayerTreeHostTestUndrawnLayersPushContentBoundsLater |
633 : public LayerTreeHostTest { | 630 : public LayerTreeHostTest { |
634 public: | 631 public: |
635 LayerTreeHostTestUndrawnLayersPushContentBoundsLater() | 632 LayerTreeHostTestUndrawnLayersPushContentBoundsLater() |
636 : root_layer_(Layer::Create()) {} | 633 : root_layer_(Layer::Create()) {} |
637 | 634 |
(...skipping 4256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4894 const gfx::Size bounds_; | 4891 const gfx::Size bounds_; |
4895 FakeContentLayerClient client_; | 4892 FakeContentLayerClient client_; |
4896 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; | 4893 scoped_refptr<ContentLayerWithUpdateTracking> content_layer_; |
4897 scoped_refptr<FakePictureLayer> picture_layer_; | 4894 scoped_refptr<FakePictureLayer> picture_layer_; |
4898 Layer* child_layer_; | 4895 Layer* child_layer_; |
4899 }; | 4896 }; |
4900 | 4897 |
4901 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); | 4898 MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousPainting); |
4902 | 4899 |
4903 } // namespace cc | 4900 } // namespace cc |
OLD | NEW |