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 "cc/animation/layer_animation_controller.h" | 7 #include "cc/animation/layer_animation_controller.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 namespace cc { | 27 namespace cc { |
28 namespace { | 28 namespace { |
29 | 29 |
30 class TestContentLayer : public Layer { | 30 class TestContentLayer : public Layer { |
31 public: | 31 public: |
32 TestContentLayer() : Layer(), override_opaque_contents_rect_(false) { | 32 TestContentLayer() : Layer(), override_opaque_contents_rect_(false) { |
33 SetIsDrawable(true); | 33 SetIsDrawable(true); |
34 } | 34 } |
35 | 35 |
36 virtual SimpleEnclosedRegion VisibleContentOpaqueRegion() const OVERRIDE { | 36 virtual SimpleEnclosedRegion VisibleContentOpaqueRegion() const override { |
37 if (override_opaque_contents_rect_) { | 37 if (override_opaque_contents_rect_) { |
38 return SimpleEnclosedRegion( | 38 return SimpleEnclosedRegion( |
39 gfx::IntersectRects(opaque_contents_rect_, visible_content_rect())); | 39 gfx::IntersectRects(opaque_contents_rect_, visible_content_rect())); |
40 } | 40 } |
41 return Layer::VisibleContentOpaqueRegion(); | 41 return Layer::VisibleContentOpaqueRegion(); |
42 } | 42 } |
43 void SetOpaqueContentsRect(const gfx::Rect& opaque_contents_rect) { | 43 void SetOpaqueContentsRect(const gfx::Rect& opaque_contents_rect) { |
44 override_opaque_contents_rect_ = true; | 44 override_opaque_contents_rect_ = true; |
45 opaque_contents_rect_ = opaque_contents_rect; | 45 opaque_contents_rect_ = opaque_contents_rect; |
46 } | 46 } |
47 | 47 |
48 private: | 48 private: |
49 virtual ~TestContentLayer() {} | 49 virtual ~TestContentLayer() {} |
50 | 50 |
51 bool override_opaque_contents_rect_; | 51 bool override_opaque_contents_rect_; |
52 gfx::Rect opaque_contents_rect_; | 52 gfx::Rect opaque_contents_rect_; |
53 }; | 53 }; |
54 | 54 |
55 class TestContentLayerImpl : public LayerImpl { | 55 class TestContentLayerImpl : public LayerImpl { |
56 public: | 56 public: |
57 TestContentLayerImpl(LayerTreeImpl* tree_impl, int id) | 57 TestContentLayerImpl(LayerTreeImpl* tree_impl, int id) |
58 : LayerImpl(tree_impl, id), override_opaque_contents_rect_(false) { | 58 : LayerImpl(tree_impl, id), override_opaque_contents_rect_(false) { |
59 SetDrawsContent(true); | 59 SetDrawsContent(true); |
60 } | 60 } |
61 | 61 |
62 virtual SimpleEnclosedRegion VisibleContentOpaqueRegion() const OVERRIDE { | 62 virtual SimpleEnclosedRegion VisibleContentOpaqueRegion() const override { |
63 if (override_opaque_contents_rect_) { | 63 if (override_opaque_contents_rect_) { |
64 return SimpleEnclosedRegion( | 64 return SimpleEnclosedRegion( |
65 gfx::IntersectRects(opaque_contents_rect_, visible_content_rect())); | 65 gfx::IntersectRects(opaque_contents_rect_, visible_content_rect())); |
66 } | 66 } |
67 return LayerImpl::VisibleContentOpaqueRegion(); | 67 return LayerImpl::VisibleContentOpaqueRegion(); |
68 } | 68 } |
69 void SetOpaqueContentsRect(const gfx::Rect& opaque_contents_rect) { | 69 void SetOpaqueContentsRect(const gfx::Rect& opaque_contents_rect) { |
70 override_opaque_contents_rect_ = true; | 70 override_opaque_contents_rect_ = true; |
71 opaque_contents_rect_ = opaque_contents_rect; | 71 opaque_contents_rect_ = opaque_contents_rect; |
72 } | 72 } |
(...skipping 3228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3301 EXPECT_EQ(gfx::Rect(), | 3301 EXPECT_EQ(gfx::Rect(), |
3302 occlusion.UnoccludedSurfaceContentRect( | 3302 occlusion.UnoccludedSurfaceContentRect( |
3303 surface, gfx::Rect(80, 70, 50, 50))); | 3303 surface, gfx::Rect(80, 70, 50, 50))); |
3304 } | 3304 } |
3305 }; | 3305 }; |
3306 | 3306 |
3307 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 3307 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
3308 | 3308 |
3309 } // namespace | 3309 } // namespace |
3310 } // namespace cc | 3310 } // namespace cc |
OLD | NEW |