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 <vector> | 9 #include <vector> |
9 | 10 |
10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
11 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
12 #include "cc/base/hash_pair.h" | 13 #include "cc/base/hash_pair.h" |
13 #include "cc/base/scoped_ptr_hash_map.h" | 14 #include "cc/base/scoped_ptr_hash_map.h" |
14 #include "cc/base/scoped_ptr_vector.h" | 15 #include "cc/base/scoped_ptr_vector.h" |
15 #include "skia/ext/refptr.h" | 16 #include "skia/ext/refptr.h" |
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" | 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations
.h" |
17 #include "third_party/skia/include/core/SkColor.h" | 18 #include "third_party/skia/include/core/SkColor.h" |
(...skipping 20 matching lines...) Expand all Loading... |
38 }; | 39 }; |
39 | 40 |
40 typedef ScopedPtrVector<SharedQuadState> SharedQuadStateList; | 41 typedef ScopedPtrVector<SharedQuadState> SharedQuadStateList; |
41 | 42 |
42 class CC_EXPORT RenderPass { | 43 class CC_EXPORT RenderPass { |
43 public: | 44 public: |
44 struct Id { | 45 struct Id { |
45 int layer_id; | 46 int layer_id; |
46 int index; | 47 int index; |
47 | 48 |
48 Id(int layer_id, int index) : layer_id(layer_id), index(index) {} | 49 Id(int layer_id, int index) : layer_id(layer_id), index(index) {} |
49 | 50 |
50 bool operator==(const Id& other) const { | 51 bool operator==(const Id& other) const { |
51 return layer_id == other.layer_id && index == other.index; | 52 return layer_id == other.layer_id && index == other.index; |
52 } | 53 } |
53 bool operator!=(const Id& other) const { | 54 bool operator!=(const Id& other) const { |
54 return !(*this == other); | 55 return !(*this == other); |
55 } | 56 } |
56 bool operator<(const Id& other) const { | 57 bool operator<(const Id& other) const { |
57 return layer_id < other.layer_id || | 58 return layer_id < other.layer_id || |
58 (layer_id == other.layer_id && index < other.index); | 59 (layer_id == other.layer_id && index < other.index); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 99 |
99 QuadList quad_list; | 100 QuadList quad_list; |
100 SharedQuadStateList shared_quad_state_list; | 101 SharedQuadStateList shared_quad_state_list; |
101 | 102 |
102 protected: | 103 protected: |
103 RenderPass(); | 104 RenderPass(); |
104 | 105 |
105 DISALLOW_COPY_AND_ASSIGN(RenderPass); | 106 DISALLOW_COPY_AND_ASSIGN(RenderPass); |
106 }; | 107 }; |
107 | 108 |
108 } // namespace cc | 109 } // namespace cc |
109 | 110 |
110 namespace BASE_HASH_NAMESPACE { | 111 namespace BASE_HASH_NAMESPACE { |
111 #if defined(COMPILER_MSVC) | 112 #if defined(COMPILER_MSVC) |
112 template<> | 113 template<> |
113 inline size_t hash_value<cc::RenderPass::Id>(const cc::RenderPass::Id& key) { | 114 inline size_t hash_value<cc::RenderPass::Id>(const cc::RenderPass::Id& key) { |
114 return hash_value<std::pair<int, int> >( | 115 return hash_value<std::pair<int, int> >( |
115 std::pair<int, int>(key.layer_id, key.index)); | 116 std::pair<int, int>(key.layer_id, key.index)); |
116 } | 117 } |
117 #elif defined(COMPILER_GCC) | 118 #elif defined(COMPILER_GCC) |
118 template<> | 119 template<> |
119 struct hash<cc::RenderPass::Id> { | 120 struct hash<cc::RenderPass::Id> { |
120 size_t operator()(cc::RenderPass::Id key) const { | 121 size_t operator()(cc::RenderPass::Id key) const { |
121 return hash<std::pair<int, int> >()( | 122 return hash<std::pair<int, int> >()( |
122 std::pair<int, int>(key.layer_id, key.index)); | 123 std::pair<int, int>(key.layer_id, key.index)); |
123 } | 124 } |
124 }; | 125 }; |
125 #else | 126 #else |
126 #error define a hash function for your compiler | 127 #error define a hash function for your compiler |
127 #endif // COMPILER | 128 #endif // COMPILER |
128 } | 129 } |
129 | 130 |
130 namespace cc { | 131 namespace cc { |
131 typedef ScopedPtrVector<RenderPass> RenderPassList; | 132 typedef ScopedPtrVector<RenderPass> RenderPassList; |
132 typedef base::hash_map<RenderPass::Id, RenderPass*> RenderPassIdHashMap; | 133 typedef base::hash_map<RenderPass::Id, RenderPass*> RenderPassIdHashMap; |
133 } // namespace cc | 134 } // namespace cc |
134 | 135 |
135 #endif // CC_QUADS_RENDER_PASS_H_ | 136 #endif // CC_QUADS_RENDER_PASS_H_ |
OLD | NEW |