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

Side by Side Diff: ash/desktop_background/desktop_background_view.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, 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 | « no previous file | ash/display/multi_display_manager.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/desktop_background/desktop_background_view.h" 5 #include "ash/desktop_background/desktop_background_view.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "ash/ash_export.h" 9 #include "ash/ash_export.h"
10 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 gfx::Size cropped_size; 120 gfx::Size cropped_size;
121 if (vertical_ratio > horizontal_ratio) { 121 if (vertical_ratio > horizontal_ratio) {
122 cropped_size = gfx::Size( 122 cropped_size = gfx::Size(
123 RoundPositive(static_cast<double>(width()) / vertical_ratio), 123 RoundPositive(static_cast<double>(width()) / vertical_ratio),
124 wallpaper.height()); 124 wallpaper.height());
125 } else { 125 } else {
126 cropped_size = gfx::Size(wallpaper.width(), 126 cropped_size = gfx::Size(wallpaper.width(),
127 RoundPositive(static_cast<double>(height()) / horizontal_ratio)); 127 RoundPositive(static_cast<double>(height()) / horizontal_ratio));
128 } 128 }
129 129
130 gfx::Rect wallpaper_cropped_rect = wallpaper_rect.Center(cropped_size); 130 gfx::Rect wallpaper_cropped_rect = wallpaper_rect;
131 wallpaper_cropped_rect.ClampToCenteredSize(cropped_size);
131 canvas->DrawImageInt(wallpaper, 132 canvas->DrawImageInt(wallpaper,
132 wallpaper_cropped_rect.x(), wallpaper_cropped_rect.y(), 133 wallpaper_cropped_rect.x(), wallpaper_cropped_rect.y(),
133 wallpaper_cropped_rect.width(), wallpaper_cropped_rect.height(), 134 wallpaper_cropped_rect.width(), wallpaper_cropped_rect.height(),
134 0, 0, width(), height(), 135 0, 0, width(), height(),
135 true); 136 true);
136 } else if (wallpaper_layout == ash::TILE) { 137 } else if (wallpaper_layout == ash::TILE) {
137 canvas->TileImageInt(wallpaper, 0, 0, width(), height()); 138 canvas->TileImageInt(wallpaper, 0, 0, width(), height());
138 } else if (wallpaper_layout == ash::STRETCH) { 139 } else if (wallpaper_layout == ash::STRETCH) {
139 // This is generally not recommended as it may show artifacts. 140 // This is generally not recommended as it may show artifacts.
140 canvas->DrawImageInt(wallpaper, 0, 0, wallpaper.width(), 141 canvas->DrawImageInt(wallpaper, 0, 0, wallpaper.width(),
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION); 189 settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION);
189 settings.AddObserver(new ShowWallpaperAnimationObserver(root_window, 190 settings.AddObserver(new ShowWallpaperAnimationObserver(root_window,
190 desktop_widget)); 191 desktop_widget));
191 desktop_widget->Show(); 192 desktop_widget->Show();
192 desktop_widget->GetNativeView()->SetName("DesktopBackgroundView"); 193 desktop_widget->GetNativeView()->SetName("DesktopBackgroundView");
193 return desktop_widget; 194 return desktop_widget;
194 } 195 }
195 196
196 } // namespace internal 197 } // namespace internal
197 } // namespace ash 198 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/display/multi_display_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698