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_DRAW_QUAD_H_ | 5 #ifndef CC_DRAW_QUAD_H_ |
6 #define CC_DRAW_QUAD_H_ | 6 #define CC_DRAW_QUAD_H_ |
7 | 7 |
8 #include "cc/cc_export.h" | 8 #include "cc/cc_export.h" |
| 9 #include "cc/resource_provider.h" |
9 #include "cc/shared_quad_state.h" | 10 #include "cc/shared_quad_state.h" |
10 | 11 |
11 namespace cc { | 12 namespace cc { |
12 | 13 |
13 // DrawQuad is a bag of data used for drawing a quad. Because different | 14 // DrawQuad is a bag of data used for drawing a quad. Because different |
14 // materials need different bits of per-quad data to render, classes that derive | 15 // materials need different bits of per-quad data to render, classes that derive |
15 // from DrawQuad store additional data in their derived instance. The Material | 16 // from DrawQuad store additional data in their derived instance. The Material |
16 // enum is used to "safely" downcast to the derived class. | 17 // enum is used to "safely" downcast to the derived class. |
17 class CC_EXPORT DrawQuad { | 18 class CC_EXPORT DrawQuad { |
18 public: | 19 public: |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // efficiency. There is special treatment to reconstruct these pointers | 65 // efficiency. There is special treatment to reconstruct these pointers |
65 // during serialization. | 66 // during serialization. |
66 const SharedQuadState* shared_quad_state; | 67 const SharedQuadState* shared_quad_state; |
67 | 68 |
68 bool IsDebugQuad() const { return material == DEBUG_BORDER; } | 69 bool IsDebugQuad() const { return material == DEBUG_BORDER; } |
69 bool ShouldDrawWithBlending() const { | 70 bool ShouldDrawWithBlending() const { |
70 return needs_blending || shared_quad_state->opacity < 1.0f || | 71 return needs_blending || shared_quad_state->opacity < 1.0f || |
71 !opaque_rect.Contains(visible_rect); | 72 !opaque_rect.Contains(visible_rect); |
72 } | 73 } |
73 | 74 |
| 75 virtual void AppendResources(ResourceProvider::ResourceIdArray* resources); |
| 76 |
74 protected: | 77 protected: |
75 DrawQuad(); | 78 DrawQuad(); |
76 | 79 |
77 void SetAll(const SharedQuadState* shared_quad_state, | 80 void SetAll(const SharedQuadState* shared_quad_state, |
78 Material material, | 81 Material material, |
79 gfx::Rect rect, | 82 gfx::Rect rect, |
80 gfx::Rect opaque_rect, | 83 gfx::Rect opaque_rect, |
81 gfx::Rect visible_rect, | 84 gfx::Rect visible_rect, |
82 bool needs_blending); | 85 bool needs_blending); |
83 }; | 86 }; |
84 | 87 |
85 } | 88 } |
86 | 89 |
87 #endif // CC_DRAW_QUAD_H_ | 90 #endif // CC_DRAW_QUAD_H_ |
OLD | NEW |