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

Side by Side Diff: ash/wm/overview/window_grid.cc

Issue 1540753002: Switch to standard integer types in ash/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: arraysize Created 5 years 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 | « ash/wm/overview/window_grid.h ('k') | ash/wm/overview/window_selector.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 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 "ash/wm/overview/window_grid.h" 5 #include "ash/wm/overview/window_grid.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 int num_columns = std::min(static_cast<int>(items->size()), 178 int num_columns = std::min(static_cast<int>(items->size()),
179 bounding_rect.width() / item_size.width()); 179 bounding_rect.width() / item_size.width());
180 for (size_t i = 0; i < items->size(); ++i) { 180 for (size_t i = 0; i < items->size(); ++i) {
181 int column = i % num_columns; 181 int column = i % num_columns;
182 int row = i / num_columns; 182 int row = i / num_columns;
183 gfx::Point overview_item_center( 183 gfx::Point overview_item_center(
184 bounding_rect.x() + column * item_size.width() + item_size.width() / 2, 184 bounding_rect.x() + column * item_size.width() + item_size.width() / 2,
185 bounding_rect.y() + row * item_size.height() + item_size.height() / 2); 185 bounding_rect.y() + row * item_size.height() + item_size.height() / 2);
186 // Find the nearest window for this position. 186 // Find the nearest window for this position.
187 size_t swap_index = i; 187 size_t swap_index = i;
188 int64 shortest_distance = std::numeric_limits<int64>::max(); 188 int64_t shortest_distance = std::numeric_limits<int64_t>::max();
189 for (size_t j = i; j < items->size(); ++j) { 189 for (size_t j = i; j < items->size(); ++j) {
190 aura::Window* window = (*items)[j]; 190 aura::Window* window = (*items)[j];
191 int64 distance = (ScreenUtil::ConvertRectToScreen( 191 int64_t distance =
192 window, window->GetTargetBounds()).CenterPoint() - 192 (ScreenUtil::ConvertRectToScreen(window, window->GetTargetBounds())
193 overview_item_center).LengthSquared(); 193 .CenterPoint() -
194 overview_item_center)
195 .LengthSquared();
194 // We compare raw pointers to create a stable ordering given two windows 196 // We compare raw pointers to create a stable ordering given two windows
195 // with the same center point. 197 // with the same center point.
196 if (distance < shortest_distance || 198 if (distance < shortest_distance ||
197 (distance == shortest_distance && window < (*items)[swap_index])) { 199 (distance == shortest_distance && window < (*items)[swap_index])) {
198 shortest_distance = distance; 200 shortest_distance = distance;
199 swap_index = j; 201 swap_index = j;
200 } 202 }
201 } 203 }
202 if (swap_index > i) 204 if (swap_index > i)
203 std::swap((*items)[i], (*items)[swap_index]); 205 std::swap((*items)[i], (*items)[swap_index]);
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 507 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
506 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); 508 selection_widget_->SetBounds(SelectedWindow()->target_bounds());
507 selection_widget_->SetOpacity(255); 509 selection_widget_->SetOpacity(255);
508 return; 510 return;
509 } 511 }
510 selection_widget_->SetBounds(SelectedWindow()->target_bounds()); 512 selection_widget_->SetBounds(SelectedWindow()->target_bounds());
511 selection_widget_->SetOpacity(255); 513 selection_widget_->SetOpacity(255);
512 } 514 }
513 515
514 } // namespace ash 516 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/overview/window_grid.h ('k') | ash/wm/overview/window_selector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698