| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/gfx/geometry/r_tree_base.h" | 5 #include "ui/gfx/geometry/r_tree_base.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 children_.insert(children_.end(), | 456 children_.insert(children_.end(), |
| 457 sorted_children.begin(), | 457 sorted_children.begin(), |
| 458 sorted_children.begin() + split_index); | 458 sorted_children.begin() + split_index); |
| 459 sibling->children_.insert(sibling->children_.end(), | 459 sibling->children_.insert(sibling->children_.end(), |
| 460 sorted_children.begin() + split_index, | 460 sorted_children.begin() + split_index, |
| 461 sorted_children.end()); | 461 sorted_children.end()); |
| 462 | 462 |
| 463 for (size_t i = 0; i < sibling->children_.size(); ++i) | 463 for (size_t i = 0; i < sibling->children_.size(); ++i) |
| 464 sibling->children_[i]->set_parent(sibling.get()); | 464 sibling->children_[i]->set_parent(sibling.get()); |
| 465 | 465 |
| 466 return sibling.PassAs<NodeBase>(); | 466 return sibling.Pass(); |
| 467 } | 467 } |
| 468 | 468 |
| 469 RTreeBase::Node* RTreeBase::Node::LeastOverlapIncrease( | 469 RTreeBase::Node* RTreeBase::Node::LeastOverlapIncrease( |
| 470 const Rect& node_rect, | 470 const Rect& node_rect, |
| 471 const Rects& expanded_rects) { | 471 const Rects& expanded_rects) { |
| 472 NodeBase* best_node = children_.front(); | 472 NodeBase* best_node = children_.front(); |
| 473 int least_overlap_increase = | 473 int least_overlap_increase = |
| 474 OverlapIncreaseToAdd(node_rect, children_[0], expanded_rects[0]); | 474 OverlapIncreaseToAdd(node_rect, children_[0], expanded_rects[0]); |
| 475 for (size_t i = 1; i < children_.size(); ++i) { | 475 for (size_t i = 1; i < children_.size(); ++i) { |
| 476 int overlap_increase = | 476 int overlap_increase = |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 root_.reset( | 649 root_.reset( |
| 650 static_cast<Node*>(root_->RemoveAndReturnLastChild().release())); | 650 static_cast<Node*>(root_->RemoveAndReturnLastChild().release())); |
| 651 } | 651 } |
| 652 } | 652 } |
| 653 | 653 |
| 654 void RTreeBase::ResetRoot() { | 654 void RTreeBase::ResetRoot() { |
| 655 root_.reset(new Node()); | 655 root_.reset(new Node()); |
| 656 } | 656 } |
| 657 | 657 |
| 658 } // namespace gfx | 658 } // namespace gfx |
| OLD | NEW |