OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 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 | 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_QUADS_RENDER_PASS_DRAW_QUAD_H_ | 5 #ifndef CC_QUADS_RENDER_PASS_DRAW_QUAD_H_ |
6 #define CC_QUADS_RENDER_PASS_DRAW_QUAD_H_ | 6 #define CC_QUADS_RENDER_PASS_DRAW_QUAD_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
13 #include "cc/output/filter_operations.h" | 13 #include "cc/output/filter_operations.h" |
14 #include "cc/quads/draw_quad.h" | 14 #include "cc/quads/draw_quad.h" |
15 #include "cc/quads/render_pass_id.h" | 15 #include "cc/quads/render_pass_id.h" |
16 | 16 |
| 17 #include "ui/gfx/geometry/point_f.h" |
| 18 |
17 namespace cc { | 19 namespace cc { |
18 | 20 |
19 class CC_EXPORT RenderPassDrawQuad : public DrawQuad { | 21 class CC_EXPORT RenderPassDrawQuad : public DrawQuad { |
20 public: | 22 public: |
21 static const size_t kMaskResourceIdIndex = 0; | 23 static const size_t kMaskResourceIdIndex = 0; |
22 | 24 |
23 RenderPassDrawQuad(); | 25 RenderPassDrawQuad(); |
24 RenderPassDrawQuad(const RenderPassDrawQuad& other); | 26 RenderPassDrawQuad(const RenderPassDrawQuad& other); |
25 ~RenderPassDrawQuad() override; | 27 ~RenderPassDrawQuad() override; |
26 | 28 |
27 void SetNew(const SharedQuadState* shared_quad_state, | 29 void SetNew(const SharedQuadState* shared_quad_state, |
28 const gfx::Rect& rect, | 30 const gfx::Rect& rect, |
29 const gfx::Rect& visible_rect, | 31 const gfx::Rect& visible_rect, |
30 RenderPassId render_pass_id, | 32 RenderPassId render_pass_id, |
31 ResourceId mask_resource_id, | 33 ResourceId mask_resource_id, |
32 const gfx::Vector2dF& mask_uv_scale, | 34 const gfx::Vector2dF& mask_uv_scale, |
33 const gfx::Size& mask_texture_size, | 35 const gfx::Size& mask_texture_size, |
34 const FilterOperations& filters, | 36 const FilterOperations& filters, |
35 const gfx::Vector2dF& filters_scale, | 37 const gfx::Vector2dF& filters_scale, |
| 38 const gfx::PointF& filters_origin, |
36 const FilterOperations& background_filters); | 39 const FilterOperations& background_filters); |
37 | 40 |
38 void SetAll(const SharedQuadState* shared_quad_state, | 41 void SetAll(const SharedQuadState* shared_quad_state, |
39 const gfx::Rect& rect, | 42 const gfx::Rect& rect, |
40 const gfx::Rect& opaque_rect, | 43 const gfx::Rect& opaque_rect, |
41 const gfx::Rect& visible_rect, | 44 const gfx::Rect& visible_rect, |
42 bool needs_blending, | 45 bool needs_blending, |
43 RenderPassId render_pass_id, | 46 RenderPassId render_pass_id, |
44 ResourceId mask_resource_id, | 47 ResourceId mask_resource_id, |
45 const gfx::Vector2dF& mask_uv_scale, | 48 const gfx::Vector2dF& mask_uv_scale, |
46 const gfx::Size& mask_texture_size, | 49 const gfx::Size& mask_texture_size, |
47 const FilterOperations& filters, | 50 const FilterOperations& filters, |
48 const gfx::Vector2dF& filters_scale, | 51 const gfx::Vector2dF& filters_scale, |
| 52 const gfx::PointF& filters_origin, |
49 const FilterOperations& background_filters); | 53 const FilterOperations& background_filters); |
50 | 54 |
51 RenderPassId render_pass_id; | 55 RenderPassId render_pass_id; |
52 gfx::Vector2dF mask_uv_scale; | 56 gfx::Vector2dF mask_uv_scale; |
53 gfx::Size mask_texture_size; | 57 gfx::Size mask_texture_size; |
54 | 58 |
55 // Post-processing filters, applied to the pixels in the render pass' texture. | 59 // Post-processing filters, applied to the pixels in the render pass' texture. |
56 FilterOperations filters; | 60 FilterOperations filters; |
57 | 61 |
58 // The scale from layer space of the root layer of the render pass to | 62 // The scale from layer space of the root layer of the render pass to |
59 // the render pass physical pixels. This scale is applied to the filter | 63 // the render pass physical pixels. This scale is applied to the filter |
60 // parameters for pixel-moving filters. This scale should include | 64 // parameters for pixel-moving filters. This scale should include |
61 // content-to-target-space scale, and device pixel ratio. | 65 // content-to-target-space scale, and device pixel ratio. |
62 gfx::Vector2dF filters_scale; | 66 gfx::Vector2dF filters_scale; |
63 | 67 |
| 68 // The origin for post-processing filters which will be used to offset |
| 69 // crop rects, lights, etc. |
| 70 gfx::PointF filters_origin; |
| 71 |
64 // Post-processing filters, applied to the pixels showing through the | 72 // Post-processing filters, applied to the pixels showing through the |
65 // background of the render pass, from behind it. | 73 // background of the render pass, from behind it. |
66 FilterOperations background_filters; | 74 FilterOperations background_filters; |
67 | 75 |
68 // Helper function to generate the normalized uv rect. | 76 // Helper function to generate the normalized uv rect. |
69 gfx::RectF MaskUVRect() const; | 77 gfx::RectF MaskUVRect() const; |
70 | 78 |
71 ResourceId mask_resource_id() const { | 79 ResourceId mask_resource_id() const { |
72 return resources.ids[kMaskResourceIdIndex]; | 80 return resources.ids[kMaskResourceIdIndex]; |
73 } | 81 } |
74 | 82 |
75 static const RenderPassDrawQuad* MaterialCast(const DrawQuad*); | 83 static const RenderPassDrawQuad* MaterialCast(const DrawQuad*); |
76 | 84 |
77 private: | 85 private: |
78 void ExtendValue(base::trace_event::TracedValue* value) const override; | 86 void ExtendValue(base::trace_event::TracedValue* value) const override; |
79 }; | 87 }; |
80 | 88 |
81 } // namespace cc | 89 } // namespace cc |
82 | 90 |
83 #endif // CC_QUADS_RENDER_PASS_DRAW_QUAD_H_ | 91 #endif // CC_QUADS_RENDER_PASS_DRAW_QUAD_H_ |
OLD | NEW |