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

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

Issue 130443005: [#5] Pass gfx structs by const ref (gfx::Vector2dF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated the review comments Created 6 years, 11 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/test/animation_test_common.cc ('k') | cc/trees/layer_tree_host_common.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 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>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "cc/base/math_util.h" 13 #include "cc/base/math_util.h"
14 #include "cc/layers/render_surface_impl.h" 14 #include "cc/layers/render_surface_impl.h"
15 #include "ui/gfx/transform.h" 15 #include "ui/gfx/transform.h"
16 16
17 namespace cc { 17 namespace cc {
18 18
19 // This epsilon is used to determine if two layers are too close to each other 19 // This epsilon is used to determine if two layers are too close to each other
20 // to be able to tell which is in front of the other. It's a relative epsilon 20 // to be able to tell which is in front of the other. It's a relative epsilon
21 // so it is robust to changes in scene scale. This value was chosen by picking 21 // so it is robust to changes in scene scale. This value was chosen by picking
22 // a value near machine epsilon and then increasing it until the flickering on 22 // a value near machine epsilon and then increasing it until the flickering on
23 // the test scene went away. 23 // the test scene went away.
24 const float k_layer_epsilon = 1e-4f; 24 const float k_layer_epsilon = 1e-4f;
25 25
26 inline static float PerpProduct(gfx::Vector2dF u, gfx::Vector2dF v) { 26 inline static float PerpProduct(const gfx::Vector2dF& u,
27 const gfx::Vector2dF& v) {
27 return u.x() * v.y() - u.y() * v.x(); 28 return u.x() * v.y() - u.y() * v.x();
28 } 29 }
29 30
30 // Tests if two edges defined by their endpoints (a,b) and (c,d) intersect. 31 // Tests if two edges defined by their endpoints (a,b) and (c,d) intersect.
31 // Returns true and the point of intersection if they do and false otherwise. 32 // Returns true and the point of intersection if they do and false otherwise.
32 static bool EdgeEdgeTest(const gfx::PointF& a, 33 static bool EdgeEdgeTest(const gfx::PointF& a,
33 const gfx::PointF& b, 34 const gfx::PointF& b,
34 const gfx::PointF& c, 35 const gfx::PointF& c,
35 const gfx::PointF& d, 36 const gfx::PointF& d,
36 gfx::PointF* r) { 37 gfx::PointF* r) {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 *it = sorted_list[count++]->layer; 461 *it = sorted_list[count++]->layer;
461 462
462 DVLOG(2) << "Sorting end ----"; 463 DVLOG(2) << "Sorting end ----";
463 464
464 nodes_.clear(); 465 nodes_.clear();
465 edges_.clear(); 466 edges_.clear();
466 active_edges_.clear(); 467 active_edges_.clear();
467 } 468 }
468 469
469 } // namespace cc 470 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/animation_test_common.cc ('k') | cc/trees/layer_tree_host_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698