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

Side by Side Diff: services/gfx/compositor/graph/node_def.cc

Issue 1778793002: Mozart: Make Snapshot immutable. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-2
Patch Set: Created 4 years, 9 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 | « services/gfx/compositor/compositor_engine.cc ('k') | services/gfx/compositor/graph/snapshot.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "services/gfx/compositor/graph/node_def.h" 5 #include "services/gfx/compositor/graph/node_def.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "mojo/services/gfx/composition/cpp/formatting.h" 10 #include "mojo/services/gfx/composition/cpp/formatting.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 const Func& func) const { 137 const Func& func) const {
138 DCHECK(content); 138 DCHECK(content);
139 DCHECK(snapshot); 139 DCHECK(snapshot);
140 140
141 switch (combinator_) { 141 switch (combinator_) {
142 // MERGE: All or nothing. 142 // MERGE: All or nothing.
143 case Combinator::MERGE: { 143 case Combinator::MERGE: {
144 for (uint32_t child_node_id : child_node_ids_) { 144 for (uint32_t child_node_id : child_node_ids_) {
145 const NodeDef* child_node = content->GetNode(child_node_id); 145 const NodeDef* child_node = content->GetNode(child_node_id);
146 DCHECK(child_node); 146 DCHECK(child_node);
147 DCHECK(!snapshot->IsBlocked(child_node)); 147 DCHECK(!snapshot->IsNodeBlocked(child_node));
148 if (!func(child_node)) 148 if (!func(child_node))
149 return; 149 return;
150 } 150 }
151 return; 151 return;
152 } 152 }
153 153
154 // PRUNE: Silently discard blocked children. 154 // PRUNE: Silently discard blocked children.
155 case Combinator::PRUNE: { 155 case Combinator::PRUNE: {
156 for (uint32_t child_node_id : child_node_ids_) { 156 for (uint32_t child_node_id : child_node_ids_) {
157 const NodeDef* child_node = content->GetNode(child_node_id); 157 const NodeDef* child_node = content->GetNode(child_node_id);
158 DCHECK(child_node); 158 DCHECK(child_node);
159 if (!snapshot->IsBlocked(child_node) && !func(child_node)) 159 if (!snapshot->IsNodeBlocked(child_node) && !func(child_node))
160 return; 160 return;
161 } 161 }
162 return; 162 return;
163 } 163 }
164 164
165 // FALLBACK: Keep only the first unblocked child. 165 // FALLBACK: Keep only the first unblocked child.
166 case Combinator::FALLBACK: { 166 case Combinator::FALLBACK: {
167 if (child_node_ids_.empty()) 167 if (child_node_ids_.empty())
168 return; 168 return;
169 for (uint32_t child_node_id : child_node_ids_) { 169 for (uint32_t child_node_id : child_node_ids_) {
170 const NodeDef* child_node = content->GetNode(child_node_id); 170 const NodeDef* child_node = content->GetNode(child_node_id);
171 DCHECK(child_node); 171 DCHECK(child_node);
172 if (!snapshot->IsBlocked(child_node)) { 172 if (!snapshot->IsNodeBlocked(child_node)) {
173 func(child_node); // don't care about the result because we 173 func(child_node); // don't care about the result because we
174 return; // always stop after the first one 174 return; // always stop after the first one
175 } 175 }
176 } 176 }
177 NOTREACHED(); 177 NOTREACHED();
178 return; 178 return;
179 } 179 }
180 180
181 default: { 181 default: {
182 NOTREACHED(); 182 NOTREACHED();
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 402
403 SkPaint paint; 403 SkPaint paint;
404 SetPaintForBlend(&paint, blend_.get()); 404 SetPaintForBlend(&paint, blend_.get());
405 405
406 canvas->saveLayer(SkRect::MakeWH(size_.width, size_.height), &paint); 406 canvas->saveLayer(SkRect::MakeWH(size_.width, size_.height), &paint);
407 NodeDef::RecordPictureInner(content, snapshot, canvas); 407 NodeDef::RecordPictureInner(content, snapshot, canvas);
408 canvas->restore(); 408 canvas->restore();
409 } 409 }
410 410
411 } // namespace compositor 411 } // namespace compositor
OLDNEW
« no previous file with comments | « services/gfx/compositor/compositor_engine.cc ('k') | services/gfx/compositor/graph/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698