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

Side by Side Diff: ash/wm/workspace/workspace_window_resizer.cc

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: cc/ fixes Created 8 years, 2 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 | « ash/wm/workspace/workspace_layout_manager2.cc ('k') | cc/delegated_renderer_layer_impl.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/workspace/workspace_window_resizer.h" 5 #include "ash/wm/workspace/workspace_window_resizer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 !ShouldAllowMouseWarp()) { 664 !ShouldAllowMouseWarp()) {
665 return; 665 return;
666 } 666 }
667 667
668 // It's available. Show a phantom window on the display if needed. 668 // It's available. Show a phantom window on the display if needed.
669 aura::RootWindow* another_root = 669 aura::RootWindow* another_root =
670 GetAnotherRootWindow(window()->GetRootWindow()); 670 GetAnotherRootWindow(window()->GetRootWindow());
671 const gfx::Rect root_bounds_in_screen(another_root->GetBoundsInScreen()); 671 const gfx::Rect root_bounds_in_screen(another_root->GetBoundsInScreen());
672 const gfx::Rect bounds_in_screen = 672 const gfx::Rect bounds_in_screen =
673 ScreenAsh::ConvertRectToScreen(window()->parent(), bounds); 673 ScreenAsh::ConvertRectToScreen(window()->parent(), bounds);
674 const gfx::Rect bounds_in_another_root = 674 gfx::Rect bounds_in_another_root = root_bounds_in_screen;
675 root_bounds_in_screen.Intersect(bounds_in_screen); 675 bounds_in_another_root.Intersect(bounds_in_screen);
676 676
677 const float fraction_in_another_window = 677 const float fraction_in_another_window =
678 (bounds_in_another_root.width() * bounds_in_another_root.height()) / 678 (bounds_in_another_root.width() * bounds_in_another_root.height()) /
679 static_cast<float>(bounds.width() * bounds.height()); 679 static_cast<float>(bounds.width() * bounds.height());
680 const float phantom_opacity = 680 const float phantom_opacity =
681 !in_original_root ? 1 : (kMaxOpacity * fraction_in_another_window); 681 !in_original_root ? 1 : (kMaxOpacity * fraction_in_another_window);
682 const float window_opacity = 682 const float window_opacity =
683 in_original_root ? 1 : (kMaxOpacity * (1 - fraction_in_another_window)); 683 in_original_root ? 1 : (kMaxOpacity * (1 - fraction_in_another_window));
684 684
685 if (fraction_in_another_window > 0) { 685 if (fraction_in_another_window > 0) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 gfx::Rect layer_bounds = layer_->bounds(); 792 gfx::Rect layer_bounds = layer_->bounds();
793 layer_bounds.set_origin(gfx::Point(0, 0)); 793 layer_bounds.set_origin(gfx::Point(0, 0));
794 layer_->SetBounds(layer_bounds); 794 layer_->SetBounds(layer_bounds);
795 layer_->SetVisible(false); 795 layer_->SetVisible(false);
796 // Detach it from the current container. 796 // Detach it from the current container.
797 layer_->parent()->Remove(layer_); 797 layer_->parent()->Remove(layer_);
798 } 798 }
799 799
800 } // namespace internal 800 } // namespace internal
801 } // namespace ash 801 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager2.cc ('k') | cc/delegated_renderer_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698