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

Side by Side Diff: cc/trees/layer_sorter.cc

Issue 12965007: Fix cpplint errors in cc/(animation|input|layers|trees|test)/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_sorter.h ('k') | cc/trees/layer_tree_host.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/trees/layer_sorter.h" 5 #include "cc/trees/layer_sorter.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 #include <limits> 9 #include <limits>
10 #include <vector> 10 #include <vector>
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 float d = gfx::DotProduct(layer_normal, z_axis); 248 float d = gfx::DotProduct(layer_normal, z_axis);
249 float n = -gfx::DotProduct(layer_normal, w); 249 float n = -gfx::DotProduct(layer_normal, w);
250 250
251 // Check if layer is parallel to the z = 0 axis which will make it 251 // Check if layer is parallel to the z = 0 axis which will make it
252 // invisible and hence returning zero is fine. 252 // invisible and hence returning zero is fine.
253 if (!d) 253 if (!d)
254 return 0.f; 254 return 0.f;
255 255
256 // The intersection point would be given by: 256 // The intersection point would be given by:
257 // p + (n / d) * u but since we are only interested in the 257 // p + (n / d) * u but since we are only interested in the
258 // z coordinate and p's z coord is zero, all we need is the value of n/d. 258 // z coordinate and p's z coord is zero, all we need is the value of n/d.
259 return n / d; 259 return n / d;
260 } 260 }
261 261
262 void LayerSorter::CreateGraphNodes(LayerList::iterator first, 262 void LayerSorter::CreateGraphNodes(LayerList::iterator first,
263 LayerList::iterator last) { 263 LayerList::iterator last) {
264 DVLOG(2) << "Creating graph nodes:"; 264 DVLOG(2) << "Creating graph nodes:";
265 float min_z = FLT_MAX; 265 float min_z = FLT_MAX;
266 float max_z = -FLT_MAX; 266 float max_z = -FLT_MAX;
267 for (LayerList::const_iterator it = first; it < last; it++) { 267 for (LayerList::const_iterator it = first; it < last; it++) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 384
385 // Find all the nodes that don't have incoming edges. 385 // Find all the nodes that don't have incoming edges.
386 for (NodeList::iterator la = nodes_.begin(); la < nodes_.end(); la++) { 386 for (NodeList::iterator la = nodes_.begin(); la < nodes_.end(); la++) {
387 if (!la->incoming.size()) 387 if (!la->incoming.size())
388 no_incoming_edge_node_list.push_back(&(*la)); 388 no_incoming_edge_node_list.push_back(&(*la));
389 } 389 }
390 390
391 DVLOG(2) << "Sorted list: "; 391 DVLOG(2) << "Sorted list: ";
392 while (active_edges_.size() || no_incoming_edge_node_list.size()) { 392 while (active_edges_.size() || no_incoming_edge_node_list.size()) {
393 while (no_incoming_edge_node_list.size()) { 393 while (no_incoming_edge_node_list.size()) {
394
395 // It is necessary to preserve the existing ordering of layers, when there 394 // It is necessary to preserve the existing ordering of layers, when there
396 // are no explicit dependencies (because this existing ordering has 395 // are no explicit dependencies (because this existing ordering has
397 // correct z-index/layout ordering). To preserve this ordering, we process 396 // correct z-index/layout ordering). To preserve this ordering, we process
398 // Nodes in the same order that they were added to the list. 397 // Nodes in the same order that they were added to the list.
399 GraphNode* from_node = no_incoming_edge_node_list.front(); 398 GraphNode* from_node = no_incoming_edge_node_list.front();
400 no_incoming_edge_node_list.pop_front(); 399 no_incoming_edge_node_list.pop_front();
401 400
402 // Add it to the final list. 401 // Add it to the final list.
403 sorted_list.push_back(from_node); 402 sorted_list.push_back(from_node);
404 403
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 *it = sorted_list[count++]->layer; 458 *it = sorted_list[count++]->layer;
460 459
461 DVLOG(2) << "Sorting end ----"; 460 DVLOG(2) << "Sorting end ----";
462 461
463 nodes_.clear(); 462 nodes_.clear();
464 edges_.clear(); 463 edges_.clear();
465 active_edges_.clear(); 464 active_edges_.clear();
466 } 465 }
467 466
468 } // namespace cc 467 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_sorter.h ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698