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

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

Issue 11270042: Add non-member non-mutating methods for common gfx::Rect operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/partial_screenshot_view.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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 !ShouldAllowMouseWarp()) { 700 !ShouldAllowMouseWarp()) {
701 return; 701 return;
702 } 702 }
703 703
704 // It's available. Show a phantom window on the display if needed. 704 // It's available. Show a phantom window on the display if needed.
705 aura::RootWindow* another_root = 705 aura::RootWindow* another_root =
706 GetAnotherRootWindow(window()->GetRootWindow()); 706 GetAnotherRootWindow(window()->GetRootWindow());
707 const gfx::Rect root_bounds_in_screen(another_root->GetBoundsInScreen()); 707 const gfx::Rect root_bounds_in_screen(another_root->GetBoundsInScreen());
708 const gfx::Rect bounds_in_screen = 708 const gfx::Rect bounds_in_screen =
709 ScreenAsh::ConvertRectToScreen(window()->parent(), bounds); 709 ScreenAsh::ConvertRectToScreen(window()->parent(), bounds);
710 gfx::Rect bounds_in_another_root = root_bounds_in_screen; 710 gfx::Rect bounds_in_another_root =
711 bounds_in_another_root.Intersect(bounds_in_screen); 711 gfx::IntersectRects(root_bounds_in_screen, bounds_in_screen);
712 712
713 const float fraction_in_another_window = 713 const float fraction_in_another_window =
714 (bounds_in_another_root.width() * bounds_in_another_root.height()) / 714 (bounds_in_another_root.width() * bounds_in_another_root.height()) /
715 static_cast<float>(bounds.width() * bounds.height()); 715 static_cast<float>(bounds.width() * bounds.height());
716 const float phantom_opacity = 716 const float phantom_opacity =
717 !in_original_root ? 1 : (kMaxOpacity * fraction_in_another_window); 717 !in_original_root ? 1 : (kMaxOpacity * fraction_in_another_window);
718 const float window_opacity = 718 const float window_opacity =
719 in_original_root ? 1 : (kMaxOpacity * (1 - fraction_in_another_window)); 719 in_original_root ? 1 : (kMaxOpacity * (1 - fraction_in_another_window));
720 720
721 if (fraction_in_another_window > 0) { 721 if (fraction_in_another_window > 0) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 gfx::Rect layer_bounds = layer_->bounds(); 828 gfx::Rect layer_bounds = layer_->bounds();
829 layer_bounds.set_origin(gfx::Point(0, 0)); 829 layer_bounds.set_origin(gfx::Point(0, 0));
830 layer_->SetBounds(layer_bounds); 830 layer_->SetBounds(layer_bounds);
831 layer_->SetVisible(false); 831 layer_->SetVisible(false);
832 // Detach it from the current container. 832 // Detach it from the current container.
833 layer_->parent()->Remove(layer_); 833 layer_->parent()->Remove(layer_);
834 } 834 }
835 835
836 } // namespace internal 836 } // namespace internal
837 } // namespace ash 837 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/partial_screenshot_view.cc ('k') | cc/delegated_renderer_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698