OLD | NEW |
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/occlusion_tracker.h" | 5 #include "cc/trees/occlusion_tracker.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "cc/animation/animation_host.h" | 9 #include "cc/animation/animation_host.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 this->identity_matrix, gfx::PointF(), gfx::Size(100, 100)); | 1765 this->identity_matrix, gfx::PointF(), gfx::Size(100, 100)); |
1766 LayerImpl* blend_mode_layer = this->CreateDrawingLayer( | 1766 LayerImpl* blend_mode_layer = this->CreateDrawingLayer( |
1767 parent, this->identity_matrix, gfx::PointF(0.f, 0.f), | 1767 parent, this->identity_matrix, gfx::PointF(0.f, 0.f), |
1768 gfx::Size(100, 100), true); | 1768 gfx::Size(100, 100), true); |
1769 LayerImpl* top_layer = this->CreateDrawingLayer( | 1769 LayerImpl* top_layer = this->CreateDrawingLayer( |
1770 parent, this->identity_matrix, gfx::PointF(10.f, 12.f), | 1770 parent, this->identity_matrix, gfx::PointF(10.f, 12.f), |
1771 gfx::Size(20, 22), true); | 1771 gfx::Size(20, 22), true); |
1772 | 1772 |
1773 // Blend mode makes the layer own a surface. | 1773 // Blend mode makes the layer own a surface. |
1774 blend_mode_layer->test_properties()->force_render_surface = true; | 1774 blend_mode_layer->test_properties()->force_render_surface = true; |
1775 blend_mode_layer->test_properties()->blend_mode = | 1775 blend_mode_layer->test_properties()->blend_mode = SkBlendMode::kMultiply; |
1776 SkXfermode::kMultiply_Mode; | |
1777 | 1776 |
1778 this->CalcDrawEtc(parent); | 1777 this->CalcDrawEtc(parent); |
1779 | 1778 |
1780 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1779 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1781 | 1780 |
1782 this->VisitLayer(top_layer, &occlusion); | 1781 this->VisitLayer(top_layer, &occlusion); |
1783 // |top_layer| occludes. | 1782 // |top_layer| occludes. |
1784 EXPECT_EQ(gfx::Rect(10, 12, 20, 22).ToString(), | 1783 EXPECT_EQ(gfx::Rect(10, 12, 20, 22).ToString(), |
1785 occlusion.occlusion_from_inside_target().ToString()); | 1784 occlusion.occlusion_from_inside_target().ToString()); |
1786 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); | 1785 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2426 EXPECT_EQ(gfx::Rect(), | 2425 EXPECT_EQ(gfx::Rect(), |
2427 occlusion.UnoccludedSurfaceContentRect( | 2426 occlusion.UnoccludedSurfaceContentRect( |
2428 surface, gfx::Rect(80, 70, 50, 50))); | 2427 surface, gfx::Rect(80, 70, 50, 50))); |
2429 } | 2428 } |
2430 }; | 2429 }; |
2431 | 2430 |
2432 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 2431 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
2433 | 2432 |
2434 } // namespace | 2433 } // namespace |
2435 } // namespace cc | 2434 } // namespace cc |
OLD | NEW |