| 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 "cc/output/bsp_tree.h" | 5 #include "cc/output/bsp_tree.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "cc/base/container_util.h" | 10 #include "cc/base/container_util.h" |
| 11 #include "cc/output/bsp_compare_result.h" | 11 #include "cc/output/bsp_compare_result.h" |
| 12 #include "cc/quads/draw_polygon.h" | 12 #include "cc/quads/draw_polygon.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 BspNode::BspNode(scoped_ptr<DrawPolygon> data) : node_data(data.Pass()) { | 16 BspNode::BspNode(scoped_ptr<DrawPolygon> data) : node_data(std::move(data)) {} |
| 17 } | |
| 18 | 17 |
| 19 BspNode::~BspNode() { | 18 BspNode::~BspNode() { |
| 20 } | 19 } |
| 21 | 20 |
| 22 BspTree::BspTree(std::deque<scoped_ptr<DrawPolygon>>* list) { | 21 BspTree::BspTree(std::deque<scoped_ptr<DrawPolygon>>* list) { |
| 23 if (list->size() == 0) | 22 if (list->size() == 0) |
| 24 return; | 23 return; |
| 25 | 24 |
| 26 root_ = make_scoped_ptr(new BspNode(PopFront(list))); | 25 root_ = make_scoped_ptr(new BspNode(PopFront(list))); |
| 27 BuildTree(root_.get(), list); | 26 BuildTree(root_.get(), list); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 scoped_ptr<DrawPolygon> new_front; | 61 scoped_ptr<DrawPolygon> new_front; |
| 63 scoped_ptr<DrawPolygon> new_back; | 62 scoped_ptr<DrawPolygon> new_back; |
| 64 // Time to split this geometry, *it needs to be split by node_data. | 63 // Time to split this geometry, *it needs to be split by node_data. |
| 65 polygon = PopFront(polygon_list); | 64 polygon = PopFront(polygon_list); |
| 66 bool split_result = | 65 bool split_result = |
| 67 polygon->Split(*(node->node_data), &new_front, &new_back); | 66 polygon->Split(*(node->node_data), &new_front, &new_back); |
| 68 DCHECK(split_result); | 67 DCHECK(split_result); |
| 69 if (!split_result) { | 68 if (!split_result) { |
| 70 break; | 69 break; |
| 71 } | 70 } |
| 72 front_list.push_back(new_front.Pass()); | 71 front_list.push_back(std::move(new_front)); |
| 73 back_list.push_back(new_back.Pass()); | 72 back_list.push_back(std::move(new_back)); |
| 74 break; | 73 break; |
| 75 } | 74 } |
| 76 case BSP_COPLANAR_FRONT: | 75 case BSP_COPLANAR_FRONT: |
| 77 node->coplanars_front.push_back(PopFront(polygon_list)); | 76 node->coplanars_front.push_back(PopFront(polygon_list)); |
| 78 break; | 77 break; |
| 79 case BSP_COPLANAR_BACK: | 78 case BSP_COPLANAR_BACK: |
| 80 node->coplanars_back.push_back(PopFront(polygon_list)); | 79 node->coplanars_back.push_back(PopFront(polygon_list)); |
| 81 break; | 80 break; |
| 82 default: | 81 default: |
| 83 NOTREACHED(); | 82 NOTREACHED(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 108 if (node.normal().z() > 0.0f) { | 107 if (node.normal().z() > 0.0f) { |
| 109 return BSP_FRONT; | 108 return BSP_FRONT; |
| 110 } | 109 } |
| 111 return BSP_BACK; | 110 return BSP_BACK; |
| 112 } | 111 } |
| 113 | 112 |
| 114 BspTree::~BspTree() { | 113 BspTree::~BspTree() { |
| 115 } | 114 } |
| 116 | 115 |
| 117 } // namespace cc | 116 } // namespace cc |
| OLD | NEW |