1// Copyright 2011 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_QUADS_RENDER_PASS_DRAW_QUAD_H_
6#define CC_QUADS_RENDER_PASS_DRAW_QUAD_H_
7
8#include "base/basictypes.h"
9#include "base/memory/scoped_ptr.h"
10#include "cc/base/cc_export.h"
11#include "cc/output/filter_operations.h"
12#include "cc/quads/draw_quad.h"
13#include "cc/quads/render_pass.h"
14#include "cc/resources/resource_provider.h"
15
16namespace cc {
17
18class CC_EXPORT RenderPassDrawQuad : public DrawQuad {
19 public:
20  static scoped_ptr<RenderPassDrawQuad> Create();
21  virtual ~RenderPassDrawQuad();
22
23  void SetNew(const SharedQuadState* shared_quad_state,
24              gfx::Rect rect,
25              RenderPass::Id render_pass_id,
26              bool is_replica,
27              ResourceProvider::ResourceId mask_resource_id,
28              gfx::Rect contents_changed_since_last_frame,
29              gfx::RectF mask_uv_rect,
30              const FilterOperations& filters,
31              const FilterOperations& background_filters);
32
33  void SetAll(const SharedQuadState* shared_quad_state,
34              gfx::Rect rect,
35              gfx::Rect opaque_rect,
36              gfx::Rect visible_rect,
37              bool needs_blending,
38              RenderPass::Id render_pass_id,
39              bool is_replica,
40              ResourceProvider::ResourceId mask_resource_id,
41              gfx::Rect contents_changed_since_last_frame,
42              gfx::RectF mask_uv_rect,
43              const FilterOperations& filters,
44              const FilterOperations& background_filters);
45
46  scoped_ptr<RenderPassDrawQuad> Copy(
47      const SharedQuadState* copied_shared_quad_state,
48      RenderPass::Id copied_render_pass_id) const;
49
50  RenderPass::Id render_pass_id;
51  bool is_replica;
52  ResourceProvider::ResourceId mask_resource_id;
53  gfx::Rect contents_changed_since_last_frame;
54  gfx::RectF mask_uv_rect;
55
56  // Post-processing filters, applied to the pixels in the render pass' texture.
57  FilterOperations filters;
58
59  // Post-processing filters, applied to the pixels showing through the
60  // background of the render pass, from behind it.
61  FilterOperations background_filters;
62
63  virtual void IterateResources(const ResourceIteratorCallback& callback)
64      OVERRIDE;
65
66  static const RenderPassDrawQuad* MaterialCast(const DrawQuad*);
67
68 private:
69  RenderPassDrawQuad();
70  virtual void ExtendValue(base::DictionaryValue* value) const OVERRIDE;
71};
72
73}  // namespace cc
74
75#endif  // CC_QUADS_RENDER_PASS_DRAW_QUAD_H_
76