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_H_ | 5 #ifndef CC_QUADS_RENDER_PASS_H_ |
6 #define CC_QUADS_RENDER_PASS_H_ | 6 #define CC_QUADS_RENDER_PASS_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
14 #include "cc/base/scoped_ptr_hash_map.h" | 14 #include "cc/base/scoped_ptr_hash_map.h" |
15 #include "cc/base/scoped_ptr_vector.h" | 15 #include "cc/base/scoped_ptr_vector.h" |
16 #include "skia/ext/refptr.h" | 16 #include "skia/ext/refptr.h" |
17 #include "third_party/skia/include/core/SkColor.h" | 17 #include "third_party/skia/include/core/SkColor.h" |
18 #include "third_party/skia/include/core/SkImageFilter.h" | 18 #include "third_party/skia/include/core/SkImageFilter.h" |
19 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
20 #include "ui/gfx/rect_f.h" | 20 #include "ui/gfx/rect_f.h" |
21 #include "ui/gfx/transform.h" | 21 #include "ui/gfx/transform.h" |
22 | 22 |
| 23 namespace base { |
| 24 class Value; |
| 25 }; |
| 26 |
23 namespace cc { | 27 namespace cc { |
24 | 28 |
25 class DrawQuad; | 29 class DrawQuad; |
26 class CopyOutputRequest; | 30 class CopyOutputRequest; |
27 class SharedQuadState; | 31 class SharedQuadState; |
28 | 32 |
29 // A list of DrawQuad objects, sorted internally in front-to-back order. | 33 // A list of DrawQuad objects, sorted internally in front-to-back order. |
30 class QuadList : public ScopedPtrVector<DrawQuad> { | 34 class QuadList : public ScopedPtrVector<DrawQuad> { |
31 public: | 35 public: |
32 typedef reverse_iterator BackToFrontIterator; | 36 typedef reverse_iterator BackToFrontIterator; |
33 typedef const_reverse_iterator ConstBackToFrontIterator; | 37 typedef const_reverse_iterator ConstBackToFrontIterator; |
34 | 38 |
35 inline BackToFrontIterator BackToFrontBegin() { return rbegin(); } | 39 inline BackToFrontIterator BackToFrontBegin() { return rbegin(); } |
36 inline BackToFrontIterator BackToFrontEnd() { return rend(); } | 40 inline BackToFrontIterator BackToFrontEnd() { return rend(); } |
37 inline ConstBackToFrontIterator BackToFrontBegin() const { return rbegin(); } | 41 inline ConstBackToFrontIterator BackToFrontBegin() const { return rbegin(); } |
38 inline ConstBackToFrontIterator BackToFrontEnd() const { return rend(); } | 42 inline ConstBackToFrontIterator BackToFrontEnd() const { return rend(); } |
39 }; | 43 }; |
40 | 44 |
41 typedef ScopedPtrVector<SharedQuadState> SharedQuadStateList; | 45 typedef ScopedPtrVector<SharedQuadState> SharedQuadStateList; |
42 | 46 |
43 class CC_EXPORT RenderPass { | 47 class CC_EXPORT RenderPass { |
44 public: | 48 public: |
45 struct Id { | 49 struct Id { |
46 int layer_id; | 50 int layer_id; |
47 int index; | 51 int index; |
48 | 52 |
49 Id(int layer_id, int index) : layer_id(layer_id), index(index) {} | 53 Id(int layer_id, int index) : layer_id(layer_id), index(index) {} |
| 54 void* AsTracingId() const; |
50 | 55 |
51 bool operator==(const Id& other) const { | 56 bool operator==(const Id& other) const { |
52 return layer_id == other.layer_id && index == other.index; | 57 return layer_id == other.layer_id && index == other.index; |
53 } | 58 } |
54 bool operator!=(const Id& other) const { | 59 bool operator!=(const Id& other) const { |
55 return !(*this == other); | 60 return !(*this == other); |
56 } | 61 } |
57 bool operator<(const Id& other) const { | 62 bool operator<(const Id& other) const { |
58 return layer_id < other.layer_id || | 63 return layer_id < other.layer_id || |
59 (layer_id == other.layer_id && index < other.index); | 64 (layer_id == other.layer_id && index < other.index); |
(...skipping 12 matching lines...) Expand all Loading... |
72 gfx::RectF damage_rect, | 77 gfx::RectF damage_rect, |
73 const gfx::Transform& transform_to_root_target); | 78 const gfx::Transform& transform_to_root_target); |
74 | 79 |
75 void SetAll(Id id, | 80 void SetAll(Id id, |
76 gfx::Rect output_rect, | 81 gfx::Rect output_rect, |
77 gfx::RectF damage_rect, | 82 gfx::RectF damage_rect, |
78 const gfx::Transform& transform_to_root_target, | 83 const gfx::Transform& transform_to_root_target, |
79 bool has_transparent_background, | 84 bool has_transparent_background, |
80 bool has_occlusion_from_outside_target_surface); | 85 bool has_occlusion_from_outside_target_surface); |
81 | 86 |
| 87 scoped_ptr<base::Value> AsValue() const; |
| 88 |
82 // Uniquely identifies the render pass in the compositor's current frame. | 89 // Uniquely identifies the render pass in the compositor's current frame. |
83 Id id; | 90 Id id; |
84 | 91 |
85 // These are in the space of the render pass' physical pixels. | 92 // These are in the space of the render pass' physical pixels. |
86 gfx::Rect output_rect; | 93 gfx::Rect output_rect; |
87 gfx::RectF damage_rect; | 94 gfx::RectF damage_rect; |
88 | 95 |
89 // Transforms from the origin of the |output_rect| to the origin of the root | 96 // Transforms from the origin of the |output_rect| to the origin of the root |
90 // render pass' |output_rect|. | 97 // render pass' |output_rect|. |
91 gfx::Transform transform_to_root_target; | 98 gfx::Transform transform_to_root_target; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 #error define a hash function for your compiler | 138 #error define a hash function for your compiler |
132 #endif // COMPILER | 139 #endif // COMPILER |
133 } // namespace BASE_HASH_NAMESPACE | 140 } // namespace BASE_HASH_NAMESPACE |
134 | 141 |
135 namespace cc { | 142 namespace cc { |
136 typedef ScopedPtrVector<RenderPass> RenderPassList; | 143 typedef ScopedPtrVector<RenderPass> RenderPassList; |
137 typedef base::hash_map<RenderPass::Id, RenderPass*> RenderPassIdHashMap; | 144 typedef base::hash_map<RenderPass::Id, RenderPass*> RenderPassIdHashMap; |
138 } // namespace cc | 145 } // namespace cc |
139 | 146 |
140 #endif // CC_QUADS_RENDER_PASS_H_ | 147 #endif // CC_QUADS_RENDER_PASS_H_ |
OLD | NEW |