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