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 11 matching lines...) Expand all Loading... |
22 #include "cc/trees/single_thread_proxy.h" | 22 #include "cc/trees/single_thread_proxy.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 #include "ui/gfx/transform.h" | 25 #include "ui/gfx/transform.h" |
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 explicit TestContentLayer(const LayerSettings& settings) |
| 33 : Layer(settings), override_opaque_contents_rect_(false) { |
33 SetIsDrawable(true); | 34 SetIsDrawable(true); |
34 } | 35 } |
35 | 36 |
36 SimpleEnclosedRegion VisibleContentOpaqueRegion() const override { | 37 SimpleEnclosedRegion VisibleContentOpaqueRegion() const override { |
37 if (override_opaque_contents_rect_) { | 38 if (override_opaque_contents_rect_) { |
38 return SimpleEnclosedRegion( | 39 return SimpleEnclosedRegion( |
39 gfx::IntersectRects(opaque_contents_rect_, visible_content_rect())); | 40 gfx::IntersectRects(opaque_contents_rect_, visible_content_rect())); |
40 } | 41 } |
41 return Layer::VisibleContentOpaqueRegion(); | 42 return Layer::VisibleContentOpaqueRegion(); |
42 } | 43 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 struct OcclusionTrackerTestMainThreadTypes { | 111 struct OcclusionTrackerTestMainThreadTypes { |
111 typedef Layer LayerType; | 112 typedef Layer LayerType; |
112 typedef FakeLayerTreeHost HostType; | 113 typedef FakeLayerTreeHost HostType; |
113 typedef RenderSurface RenderSurfaceType; | 114 typedef RenderSurface RenderSurfaceType; |
114 typedef TestContentLayer ContentLayerType; | 115 typedef TestContentLayer ContentLayerType; |
115 typedef scoped_refptr<Layer> LayerPtrType; | 116 typedef scoped_refptr<Layer> LayerPtrType; |
116 typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; | 117 typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; |
117 typedef LayerIterator<Layer> TestLayerIterator; | 118 typedef LayerIterator<Layer> TestLayerIterator; |
118 typedef OcclusionTracker<Layer> OcclusionTrackerType; | 119 typedef OcclusionTracker<Layer> OcclusionTrackerType; |
119 | 120 |
120 static LayerPtrType CreateLayer(HostType* host) { return Layer::Create(); } | 121 static LayerPtrType CreateLayer(HostType* host) { |
| 122 return Layer::Create(LayerSettings()); |
| 123 } |
121 static ContentLayerPtrType CreateContentLayer(HostType* host) { | 124 static ContentLayerPtrType CreateContentLayer(HostType* host) { |
122 return make_scoped_refptr(new ContentLayerType()); | 125 return make_scoped_refptr(new ContentLayerType(LayerSettings())); |
123 } | 126 } |
124 | 127 |
125 template <typename T> | 128 template <typename T> |
126 static LayerPtrType PassLayerPtr(T* layer) { | 129 static LayerPtrType PassLayerPtr(T* layer) { |
127 LayerPtrType ref(*layer); | 130 LayerPtrType ref(*layer); |
128 *layer = NULL; | 131 *layer = NULL; |
129 return ref; | 132 return ref; |
130 } | 133 } |
131 static void SetForceRenderSurface(LayerType* layer, bool force) { | 134 static void SetForceRenderSurface(LayerType* layer, bool force) { |
132 layer->SetForceRenderSurface(force); | 135 layer->SetForceRenderSurface(force); |
(...skipping 3190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3323 EXPECT_EQ(gfx::Rect(), | 3326 EXPECT_EQ(gfx::Rect(), |
3324 occlusion.UnoccludedSurfaceContentRect( | 3327 occlusion.UnoccludedSurfaceContentRect( |
3325 surface, gfx::Rect(80, 70, 50, 50))); | 3328 surface, gfx::Rect(80, 70, 50, 50))); |
3326 } | 3329 } |
3327 }; | 3330 }; |
3328 | 3331 |
3329 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 3332 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
3330 | 3333 |
3331 } // namespace | 3334 } // namespace |
3332 } // namespace cc | 3335 } // namespace cc |
OLD | NEW |