OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_DRAW_QUAD_H_ | 5 #ifndef CC_QUADS_DRAW_QUAD_H_ |
6 #define CC_QUADS_DRAW_QUAD_H_ | 6 #define CC_QUADS_DRAW_QUAD_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
10 #include "cc/quads/shared_quad_state.h" | 10 #include "cc/quads/shared_quad_state.h" |
11 #include "cc/resources/resource_provider.h" | 11 #include "cc/resources/resource_provider.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 namespace debug { | |
15 class TracedValue; | |
16 } | |
17 class Value; | 14 class Value; |
18 class DictionaryValue; | 15 class DictionaryValue; |
19 } | 16 } |
20 | 17 |
21 namespace cc { | 18 namespace cc { |
22 | 19 |
23 // DrawQuad is a bag of data used for drawing a quad. Because different | 20 // DrawQuad is a bag of data used for drawing a quad. Because different |
24 // materials need different bits of per-quad data to render, classes that derive | 21 // materials need different bits of per-quad data to render, classes that derive |
25 // from DrawQuad store additional data in their derived instance. The Material | 22 // from DrawQuad store additional data in their derived instance. The Material |
26 // enum is used to "safely" downcast to the derived class. | 23 // enum is used to "safely" downcast to the derived class. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 bool IsBottomEdge() const { | 116 bool IsBottomEdge() const { |
120 return rect.bottom() == shared_quad_state->content_bounds.height(); | 117 return rect.bottom() == shared_quad_state->content_bounds.height(); |
121 } | 118 } |
122 | 119 |
123 // Is any edge of this tile aligned with the originating layer's | 120 // Is any edge of this tile aligned with the originating layer's |
124 // corresponding edge? | 121 // corresponding edge? |
125 bool IsEdge() const { | 122 bool IsEdge() const { |
126 return IsLeftEdge() || IsTopEdge() || IsRightEdge() || IsBottomEdge(); | 123 return IsLeftEdge() || IsTopEdge() || IsRightEdge() || IsBottomEdge(); |
127 } | 124 } |
128 | 125 |
129 void AsValueInto(base::debug::TracedValue* value) const; | 126 scoped_ptr<base::Value> AsValue() const; |
130 | 127 |
131 protected: | 128 protected: |
132 DrawQuad(); | 129 DrawQuad(); |
133 | 130 |
134 void SetAll(const SharedQuadState* shared_quad_state, | 131 void SetAll(const SharedQuadState* shared_quad_state, |
135 Material material, | 132 Material material, |
136 const gfx::Rect& rect, | 133 const gfx::Rect& rect, |
137 const gfx::Rect& opaque_rect, | 134 const gfx::Rect& opaque_rect, |
138 const gfx::Rect& visible_rect, | 135 const gfx::Rect& visible_rect, |
139 bool needs_blending); | 136 bool needs_blending); |
140 virtual void ExtendValue(base::debug::TracedValue* value) const = 0; | 137 virtual void ExtendValue(base::DictionaryValue* value) const = 0; |
141 }; | 138 }; |
142 | 139 |
143 } // namespace cc | 140 } // namespace cc |
144 | 141 |
145 #endif // CC_QUADS_DRAW_QUAD_H_ | 142 #endif // CC_QUADS_DRAW_QUAD_H_ |
OLD | NEW |