Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: cc/quads/draw_quad.h

Issue 1152473006: cc: Remove DrawQuad::IterateResoruces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mkwst review Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/quads/debug_border_draw_quad.cc ('k') | cc/quads/draw_quad.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base/resource_id.h" 10 #include "cc/base/resource_id.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 bool IsDebugQuad() const { return material == DEBUG_BORDER; } 89 bool IsDebugQuad() const { return material == DEBUG_BORDER; }
90 90
91 bool ShouldDrawWithBlending() const { 91 bool ShouldDrawWithBlending() const {
92 if (needs_blending || shared_quad_state->opacity < 1.0f) 92 if (needs_blending || shared_quad_state->opacity < 1.0f)
93 return true; 93 return true;
94 if (visible_rect.IsEmpty()) 94 if (visible_rect.IsEmpty())
95 return false; 95 return false;
96 return !opaque_rect.Contains(visible_rect); 96 return !opaque_rect.Contains(visible_rect);
97 } 97 }
98 98
99 typedef base::Callback<ResourceId(ResourceId)> ResourceIteratorCallback;
100 virtual void IterateResources(const ResourceIteratorCallback& callback) = 0;
101
102 // Is the left edge of this tile aligned with the originating layer's 99 // Is the left edge of this tile aligned with the originating layer's
103 // left edge? 100 // left edge?
104 bool IsLeftEdge() const { return !rect.x(); } 101 bool IsLeftEdge() const { return !rect.x(); }
105 102
106 // Is the top edge of this tile aligned with the originating layer's 103 // Is the top edge of this tile aligned with the originating layer's
107 // top edge? 104 // top edge?
108 bool IsTopEdge() const { return !rect.y(); } 105 bool IsTopEdge() const { return !rect.y(); }
109 106
110 // Is the right edge of this tile aligned with the originating layer's 107 // Is the right edge of this tile aligned with the originating layer's
111 // right edge? 108 // right edge?
112 bool IsRightEdge() const { 109 bool IsRightEdge() const {
113 return rect.right() == shared_quad_state->content_bounds.width(); 110 return rect.right() == shared_quad_state->content_bounds.width();
114 } 111 }
115 112
116 // Is the bottom edge of this tile aligned with the originating layer's 113 // Is the bottom edge of this tile aligned with the originating layer's
117 // bottom edge? 114 // bottom edge?
118 bool IsBottomEdge() const { 115 bool IsBottomEdge() const {
119 return rect.bottom() == shared_quad_state->content_bounds.height(); 116 return rect.bottom() == shared_quad_state->content_bounds.height();
120 } 117 }
121 118
122 // Is any edge of this tile aligned with the originating layer's 119 // Is any edge of this tile aligned with the originating layer's
123 // corresponding edge? 120 // corresponding edge?
124 bool IsEdge() const { 121 bool IsEdge() const {
125 return IsLeftEdge() || IsTopEdge() || IsRightEdge() || IsBottomEdge(); 122 return IsLeftEdge() || IsTopEdge() || IsRightEdge() || IsBottomEdge();
126 } 123 }
127 124
128 void AsValueInto(base::trace_event::TracedValue* value) const; 125 void AsValueInto(base::trace_event::TracedValue* value) const;
129 126
127 struct CC_EXPORT Resources {
128 enum : size_t { kMaxResourceIdCount = 4 };
Nico 2015/07/23 18:04:41 (drive-by since I just saw this: explicit types on
129 Resources();
130
131 ResourceId* begin() { return ids; }
132 ResourceId* end() {
133 DCHECK_LE(count, kMaxResourceIdCount);
134 return ids + count;
135 }
136
137 size_t count;
138 ResourceId ids[kMaxResourceIdCount];
139 };
140
141 Resources resources;
142
130 protected: 143 protected:
131 DrawQuad(); 144 DrawQuad();
132 145
133 void SetAll(const SharedQuadState* shared_quad_state, 146 void SetAll(const SharedQuadState* shared_quad_state,
134 Material material, 147 Material material,
135 const gfx::Rect& rect, 148 const gfx::Rect& rect,
136 const gfx::Rect& opaque_rect, 149 const gfx::Rect& opaque_rect,
137 const gfx::Rect& visible_rect, 150 const gfx::Rect& visible_rect,
138 bool needs_blending); 151 bool needs_blending);
139 virtual void ExtendValue(base::trace_event::TracedValue* value) const = 0; 152 virtual void ExtendValue(base::trace_event::TracedValue* value) const = 0;
140 }; 153 };
141 154
142 } // namespace cc 155 } // namespace cc
143 156
144 #endif // CC_QUADS_DRAW_QUAD_H_ 157 #endif // CC_QUADS_DRAW_QUAD_H_
OLDNEW
« no previous file with comments | « cc/quads/debug_border_draw_quad.cc ('k') | cc/quads/draw_quad.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698