Chromium Code Reviews| 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 "base/callback.h" | |
| 8 #include "cc/cc_export.h" | 9 #include "cc/cc_export.h" |
| 9 #include "cc/resource_provider.h" | 10 #include "cc/resource_provider.h" |
| 10 #include "cc/shared_quad_state.h" | 11 #include "cc/shared_quad_state.h" |
| 11 | 12 |
| 12 namespace cc { | 13 namespace cc { |
| 13 | 14 |
| 14 // DrawQuad is a bag of data used for drawing a quad. Because different | 15 // DrawQuad is a bag of data used for drawing a quad. Because different |
| 15 // materials need different bits of per-quad data to render, classes that derive | 16 // materials need different bits of per-quad data to render, classes that derive |
| 16 // from DrawQuad store additional data in their derived instance. The Material | 17 // from DrawQuad store additional data in their derived instance. The Material |
| 17 // enum is used to "safely" downcast to the derived class. | 18 // enum is used to "safely" downcast to the derived class. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 |
| 74 virtual void AppendResources(ResourceProvider::ResourceIdArray* resources); | 75 virtual void AppendResources(ResourceProvider::ResourceIdArray* resources); |
| 75 | 76 |
| 77 typedef base::Callback<ResourceProvider::ResourceId( | |
| 78 ResourceProvider::ResourceId)> ResourceRemapCallback; | |
| 79 virtual void RemapResources(const ResourceRemapCallback& remap_callback); | |
|
piman
2013/02/27 23:09:39
Awesome, I was thinking of something similar.
Poss
danakj
2013/02/28 02:51:05
Oh.. that is a cool idea.
| |
| 80 | |
| 76 protected: | 81 protected: |
| 77 DrawQuad(); | 82 DrawQuad(); |
| 78 | 83 |
| 79 void SetAll(const SharedQuadState* shared_quad_state, | 84 void SetAll(const SharedQuadState* shared_quad_state, |
| 80 Material material, | 85 Material material, |
| 81 gfx::Rect rect, | 86 gfx::Rect rect, |
| 82 gfx::Rect opaque_rect, | 87 gfx::Rect opaque_rect, |
| 83 gfx::Rect visible_rect, | 88 gfx::Rect visible_rect, |
| 84 bool needs_blending); | 89 bool needs_blending); |
| 85 }; | 90 }; |
| 86 | 91 |
| 87 } | 92 } |
| 88 | 93 |
| 89 #endif // CC_DRAW_QUAD_H_ | 94 #endif // CC_DRAW_QUAD_H_ |
| OLD | NEW |