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.
5 #ifndef CC_QUADS_RENDER_PASS_DRAW_QUAD_H_
6 #define CC_QUADS_RENDER_PASS_DRAW_QUAD_H_
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_id.h"
14 #include "cc/resources/resource_provider.h"
18 class CC_EXPORT RenderPassDrawQuad
: public DrawQuad
{
21 ~RenderPassDrawQuad() override
;
23 void SetNew(const SharedQuadState
* shared_quad_state
,
24 const gfx::Rect
& rect
,
25 const gfx::Rect
& visible_rect
,
26 RenderPassId render_pass_id
,
27 ResourceId mask_resource_id
,
28 const gfx::Vector2dF
& mask_uv_scale
,
29 const gfx::Size
& mask_texture_size
,
30 const FilterOperations
& filters
,
31 const gfx::Vector2dF
& filters_scale
,
32 const FilterOperations
& background_filters
);
34 void SetAll(const SharedQuadState
* shared_quad_state
,
35 const gfx::Rect
& rect
,
36 const gfx::Rect
& opaque_rect
,
37 const gfx::Rect
& visible_rect
,
39 RenderPassId render_pass_id
,
40 ResourceId mask_resource_id
,
41 const gfx::Vector2dF
& mask_uv_scale
,
42 const gfx::Size
& mask_texture_size
,
43 const FilterOperations
& filters
,
44 const gfx::Vector2dF
& filters_scale
,
45 const FilterOperations
& background_filters
);
47 RenderPassId render_pass_id
;
48 gfx::Vector2dF mask_uv_scale
;
49 gfx::Size mask_texture_size
;
51 // Post-processing filters, applied to the pixels in the render pass' texture.
52 FilterOperations filters
;
54 // The scale from layer space of the root layer of the render pass to
55 // the render pass physical pixels. This scale is applied to the filter
56 // parameters for pixel-moving filters. This scale should include
57 // content-to-target-space scale, and device pixel ratio.
58 gfx::Vector2dF filters_scale
;
60 // Post-processing filters, applied to the pixels showing through the
61 // background of the render pass, from behind it.
62 FilterOperations background_filters
;
64 // Helper function to generate the normalized uv rect.
65 gfx::RectF
MaskUVRect() const;
67 ResourceId
mask_resource_id() const {
68 return resources
.ids
[kMaskResourceIdIndex
];
71 static const RenderPassDrawQuad
* MaterialCast(const DrawQuad
*);
74 static const size_t kMaskResourceIdIndex
= 0;
76 void ExtendValue(base::trace_event::TracedValue
* value
) const override
;
81 #endif // CC_QUADS_RENDER_PASS_DRAW_QUAD_H_