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

Side by Side Diff: cc/base/spiral_iterator.cc

Issue 2503303002: ps test.
Patch Set: rebase Created 4 years, 1 month 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/base/spiral_iterator.h ('k') | cc/base/spiral_iterator_unittest.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/base/spiral_iterator.h" 5 #include "cc/base/spiral_iterator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 namespace cc { 9 namespace cc {
10 10
(...skipping 23 matching lines...) Expand all
34 current_step_ = horizontal_step_count_ - 1; 34 current_step_ = horizontal_step_count_ - 1;
35 35
36 index_x_ = around_index_rect_.right(); 36 index_x_ = around_index_rect_.right();
37 index_y_ = around_index_rect_.bottom(); 37 index_y_ = around_index_rect_.bottom();
38 38
39 // The current index is the bottom right of the around rect, which is also 39 // The current index is the bottom right of the around rect, which is also
40 // ignored. So we have to advance. 40 // ignored. So we have to advance.
41 ++(*this); 41 ++(*this);
42 } 42 }
43 43
44 SpiralIterator::SpiralIterator(const SpiralIterator::SpiralIterator& other) =
45 default;
46
47 SpiralIterator::SpiralIterator(SpiralIterator::SpiralIterator&& other) =
48 default;
49
50 SpiralIterator::~SpiralIterator() = default;
51
52 SpiralIterator& SpiralIterator::operator=(
53 const SpiralIterator::SpiralIterator& other) = default;
54
55 SpiralIterator& SpiralIterator::operator=(
56 SpiralIterator::SpiralIterator&& other) = default;
57
44 SpiralIterator::operator bool() const { 58 SpiralIterator::operator bool() const {
45 return index_x_ != -1 && index_y_ != -1; 59 return index_x_ != -1 && index_y_ != -1;
46 } 60 }
47 61
48 SpiralIterator& SpiralIterator::operator++() { 62 SpiralIterator& SpiralIterator::operator++() {
49 int cannot_hit_consider_count = 0; 63 int cannot_hit_consider_count = 0;
50 while (cannot_hit_consider_count < 4) { 64 while (cannot_hit_consider_count < 4) {
51 if (needs_direction_switch()) 65 if (needs_direction_switch())
52 switch_direction(); 66 switch_direction();
53 67
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 current_step_ = 0; 167 current_step_ = 0;
154 direction_ = static_cast<Direction>((direction_ + 1) % 4); 168 direction_ = static_cast<Direction>((direction_ + 1) % 4);
155 169
156 if (direction_ == RIGHT || direction_ == LEFT) { 170 if (direction_ == RIGHT || direction_ == LEFT) {
157 ++vertical_step_count_; 171 ++vertical_step_count_;
158 ++horizontal_step_count_; 172 ++horizontal_step_count_;
159 } 173 }
160 } 174 }
161 175
162 } // namespace cc 176 } // namespace cc
OLDNEW
« no previous file with comments | « cc/base/spiral_iterator.h ('k') | cc/base/spiral_iterator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698