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

Side by Side Diff: ash/wm/partial_screenshot_view.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/system/drive/tray_drive.cc ('k') | ash/wm/workspace/workspace_window_resizer.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/partial_screenshot_view.h" 5 #include "ash/wm/partial_screenshot_view.h"
6 6
7 #include "ash/screenshot_delegate.h" 7 #include "ash/screenshot_delegate.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/wm/overlay_event_filter.h" 10 #include "ash/wm/overlay_event_filter.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 115
116 void PartialScreenshotView::OnMouseReleased(const ui::MouseEvent& event) { 116 void PartialScreenshotView::OnMouseReleased(const ui::MouseEvent& event) {
117 Cancel(); 117 Cancel();
118 if (!is_dragging_) 118 if (!is_dragging_)
119 return; 119 return;
120 120
121 is_dragging_ = false; 121 is_dragging_ = false;
122 if (screenshot_delegate_) { 122 if (screenshot_delegate_) {
123 aura::RootWindow *root_window = Shell::GetPrimaryRootWindow(); 123 aura::RootWindow *root_window = Shell::GetPrimaryRootWindow();
124 gfx::Rect root_window_screenshot_rect = root_window->bounds();
125 root_window_screenshot_rect.Intersect(GetScreenshotRect());
126 screenshot_delegate_->HandleTakePartialScreenshot( 124 screenshot_delegate_->HandleTakePartialScreenshot(
127 root_window, root_window_screenshot_rect); 125 root_window,
126 gfx::IntersectRects(root_window->bounds(), GetScreenshotRect()));
128 } 127 }
129 } 128 }
130 129
131 gfx::Rect PartialScreenshotView::GetScreenshotRect() const { 130 gfx::Rect PartialScreenshotView::GetScreenshotRect() const {
132 int left = std::min(start_position_.x(), current_position_.x()); 131 int left = std::min(start_position_.x(), current_position_.x());
133 int top = std::min(start_position_.y(), current_position_.y()); 132 int top = std::min(start_position_.y(), current_position_.y());
134 int width = ::abs(start_position_.x() - current_position_.x()); 133 int width = ::abs(start_position_.x() - current_position_.x());
135 int height = ::abs(start_position_.y() - current_position_.y()); 134 int height = ::abs(start_position_.y() - current_position_.y());
136 return gfx::Rect(left, top, width, height); 135 return gfx::Rect(left, top, width, height);
137 } 136 }
138 137
139 } // namespace ash 138 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/drive/tray_drive.cc ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698