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