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 #ifndef CC_TEST_MOCK_QUAD_CULLER_H_ | 5 #ifndef CC_TEST_MOCK_QUAD_CULLER_H_ |
6 #define CC_TEST_MOCK_QUAD_CULLER_H_ | 6 #define CC_TEST_MOCK_QUAD_CULLER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "cc/layers/quad_sink.h" | 9 #include "cc/layers/quad_sink.h" |
10 #include "cc/quads/draw_quad.h" | 10 #include "cc/quads/draw_quad.h" |
11 #include "cc/quads/render_pass.h" | 11 #include "cc/quads/render_pass.h" |
12 #include "cc/test/mock_occlusion_tracker.h" | 12 #include "cc/test/mock_occlusion_tracker.h" |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 class LayerImpl; | 15 class LayerImpl; |
16 | 16 |
17 class MockQuadCuller : public QuadSink { | 17 class MockQuadCuller : public QuadSink { |
18 public: | 18 public: |
19 virtual ~MockQuadCuller(); | 19 virtual ~MockQuadCuller(); |
20 | 20 |
21 MockQuadCuller(RenderPass* external_render_pass, | 21 MockQuadCuller(RenderPass* render_pass, |
22 MockOcclusionTracker<LayerImpl>* occlusion_tracker); | 22 MockOcclusionTracker<LayerImpl>* occlusion_tracker); |
23 // QuadSink interface. | 23 |
24 virtual SharedQuadState* CreateSharedQuadState() OVERRIDE; | 24 virtual gfx::Rect UnoccludedContentRect( |
25 virtual gfx::Rect UnoccludedContentRect(const gfx::Rect& content_rect, | 25 const gfx::Rect& content_rect, |
26 const gfx::Transform& draw_transform) | 26 const gfx::Transform& draw_transform) OVERRIDE; |
27 OVERRIDE; | 27 |
28 virtual gfx::Rect UnoccludedContributingSurfaceContentRect( | 28 virtual gfx::Rect UnoccludedContributingSurfaceContentRect( |
29 const gfx::Rect& content_rect, | 29 const gfx::Rect& content_rect, |
30 const gfx::Transform& draw_transform) OVERRIDE; | 30 const gfx::Transform& draw_transform) OVERRIDE; |
31 virtual void Append(scoped_ptr<DrawQuad> draw_quad) OVERRIDE; | |
32 | 31 |
33 const QuadList& quad_list() const { return active_render_pass_->quad_list; } | 32 const QuadList& quad_list() const { return render_pass_->quad_list; } |
34 const SharedQuadStateList& shared_quad_state_list() const { | 33 const SharedQuadStateList& shared_quad_state_list() const { |
35 return active_render_pass_->shared_quad_state_list; | 34 return render_pass_->shared_quad_state_list; |
36 } | 35 } |
37 | 36 |
38 void set_occluded_target_rect(const gfx::Rect& occluded) { | 37 void set_occluded_target_rect(const gfx::Rect& occluded) { |
39 occlusion_tracker_->set_occluded_target_rect(occluded); | 38 occlusion_tracker_->set_occluded_target_rect(occluded); |
40 } | 39 } |
41 | 40 |
42 void set_occluded_target_rect_for_contributing_surface( | 41 void set_occluded_target_rect_for_contributing_surface( |
43 const gfx::Rect& occluded) { | 42 const gfx::Rect& occluded) { |
44 occlusion_tracker_->set_occluded_target_rect_for_contributing_surface( | 43 occlusion_tracker_->set_occluded_target_rect_for_contributing_surface( |
45 occluded); | 44 occluded); |
46 } | 45 } |
47 | 46 |
48 void clear_lists() { | 47 void clear_lists() { |
49 active_render_pass_->quad_list.clear(); | 48 render_pass_->quad_list.clear(); |
50 active_render_pass_->shared_quad_state_list.clear(); | 49 render_pass_->shared_quad_state_list.clear(); |
51 } | 50 } |
52 | 51 |
53 private: | 52 private: |
54 scoped_ptr<RenderPass> render_pass_storage_; | |
55 RenderPass* active_render_pass_; | |
56 scoped_ptr<MockOcclusionTracker<LayerImpl> > occlusion_tracker_storage_; | |
57 MockOcclusionTracker<LayerImpl>* occlusion_tracker_; | 53 MockOcclusionTracker<LayerImpl>* occlusion_tracker_; |
58 | |
59 gfx::Rect occluded_target_rect_; | |
60 gfx::Rect occluded_target_rect_for_contributing_surface_; | |
61 }; | 54 }; |
62 | 55 |
63 } // namespace cc | 56 } // namespace cc |
64 | 57 |
65 #endif // CC_TEST_MOCK_QUAD_CULLER_H_ | 58 #endif // CC_TEST_MOCK_QUAD_CULLER_H_ |
OLD | NEW |