| 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 "base/callback.h" |
| 9 #include "cc/cc_export.h" | 9 #include "cc/cc_export.h" |
| 10 #include "cc/resource_provider.h" | 10 #include "cc/resource_provider.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // With this setting, it is possible to force blending on regardless of the | 60 // With this setting, it is possible to force blending on regardless of the |
| 61 // opaque area. | 61 // opaque area. |
| 62 bool needs_blending; | 62 bool needs_blending; |
| 63 | 63 |
| 64 // Stores state common to a large bundle of quads; kept separate for memory | 64 // Stores state common to a large bundle of quads; kept separate for memory |
| 65 // efficiency. There is special treatment to reconstruct these pointers | 65 // efficiency. There is special treatment to reconstruct these pointers |
| 66 // during serialization. | 66 // during serialization. |
| 67 const SharedQuadState* shared_quad_state; | 67 const SharedQuadState* shared_quad_state; |
| 68 | 68 |
| 69 bool IsDebugQuad() const { return material == DEBUG_BORDER; } | 69 bool IsDebugQuad() const { return material == DEBUG_BORDER; } |
| 70 |
| 70 bool ShouldDrawWithBlending() const { | 71 bool ShouldDrawWithBlending() const { |
| 71 return needs_blending || shared_quad_state->opacity < 1.0f || | 72 return needs_blending || shared_quad_state->opacity < 1.0f || |
| 72 !opaque_rect.Contains(visible_rect); | 73 !opaque_rect.Contains(visible_rect); |
| 73 } | 74 } |
| 74 | 75 |
| 75 typedef base::Callback<ResourceProvider::ResourceId( | 76 typedef base::Callback<ResourceProvider::ResourceId( |
| 76 ResourceProvider::ResourceId)> ResourceIteratorCallback; | 77 ResourceProvider::ResourceId)> ResourceIteratorCallback; |
| 77 virtual void IterateResources(const ResourceIteratorCallback& callback) = 0; | 78 virtual void IterateResources(const ResourceIteratorCallback& callback) = 0; |
| 78 | 79 |
| 80 // Is the left edge of this tile aligned with the originating layer's |
| 81 // left edge? |
| 82 bool IsLeftEdge() const { return !rect.x(); } |
| 83 |
| 84 // Is the top edge of this tile aligned with the originating layer's |
| 85 // top edge? |
| 86 bool IsTopEdge() const { return !rect.y(); } |
| 87 |
| 88 // Is the right edge of this tile aligned with the originating layer's |
| 89 // right edge? |
| 90 bool IsRightEdge() const { |
| 91 return rect.right() == shared_quad_state->content_bounds.width(); |
| 92 } |
| 93 |
| 94 // Is the bottom edge of this tile aligned with the originating layer's |
| 95 // bottom edge? |
| 96 bool IsBottomEdge() const { |
| 97 return rect.bottom() == shared_quad_state->content_bounds.height(); |
| 98 } |
| 99 |
| 100 // Is any edge of this tile aligned with the originating layer's |
| 101 // corresponding edge? |
| 102 bool IsEdge() const { |
| 103 return IsLeftEdge() || IsTopEdge() || IsRightEdge() || IsBottomEdge(); |
| 104 } |
| 105 |
| 79 protected: | 106 protected: |
| 80 DrawQuad(); | 107 DrawQuad(); |
| 81 | 108 |
| 82 void SetAll(const SharedQuadState* shared_quad_state, | 109 void SetAll(const SharedQuadState* shared_quad_state, |
| 83 Material material, | 110 Material material, |
| 84 gfx::Rect rect, | 111 gfx::Rect rect, |
| 85 gfx::Rect opaque_rect, | 112 gfx::Rect opaque_rect, |
| 86 gfx::Rect visible_rect, | 113 gfx::Rect visible_rect, |
| 87 bool needs_blending); | 114 bool needs_blending); |
| 88 }; | 115 }; |
| 89 | 116 |
| 90 } | 117 } |
| 91 | 118 |
| 92 #endif // CC_DRAW_QUAD_H_ | 119 #endif // CC_DRAW_QUAD_H_ |
| OLD | NEW |