Home | History | Annotate | Download | only in layers
      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_LAYERS_QUAD_SINK_H_
      6 #define CC_LAYERS_QUAD_SINK_H_
      7 
      8 #include "base/memory/scoped_ptr.h"
      9 #include "cc/base/cc_export.h"
     10 
     11 namespace gfx {
     12 class Rect;
     13 class Transform;
     14 }
     15 
     16 namespace cc {
     17 
     18 class DrawQuad;
     19 class LayerImpl;
     20 class RenderPass;
     21 class RenderSurfaceImpl;
     22 class SharedQuadState;
     23 template <typename LayerType>
     24 class OcclusionTracker;
     25 
     26 class CC_EXPORT QuadSink {
     27  public:
     28   QuadSink(RenderPass* render_pass,
     29            const OcclusionTracker<LayerImpl>* occlusion_tracker);
     30   ~QuadSink() {}
     31 
     32   // Call this to add a SharedQuadState before appending quads that refer to it.
     33   // Returns a pointer to the given SharedQuadState, that can be set on the
     34   // quads to append.
     35   virtual SharedQuadState* CreateSharedQuadState();
     36 
     37   virtual gfx::Rect UnoccludedContentRect(const gfx::Rect& content_rect,
     38                                           const gfx::Transform& draw_transform);
     39 
     40   virtual gfx::Rect UnoccludedContributingSurfaceContentRect(
     41       const gfx::Rect& content_rect,
     42       const gfx::Transform& draw_transform);
     43 
     44   virtual void Append(scoped_ptr<DrawQuad> draw_quad);
     45 
     46   const RenderPass* render_pass() const { return render_pass_; }
     47 
     48  protected:
     49   RenderPass* render_pass_;
     50 
     51   SharedQuadState* current_shared_quad_state_;
     52 
     53  private:
     54   const OcclusionTracker<LayerImpl>* occlusion_tracker_;
     55 
     56   DISALLOW_COPY_AND_ASSIGN(QuadSink);
     57 };
     58 
     59 }  // namespace cc
     60 
     61 #endif  // CC_LAYERS_QUAD_SINK_H_
     62