summaryrefslogtreecommitdiffstats
path: root/ash/desktop_background
diff options
context:
space:
mode:
authorsaintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-01 01:52:50 +0000
committersaintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-01 01:52:50 +0000
commit023446d6f94febce59f20be0816931448f0392c7 (patch)
tree0fa02d930101eeed3911fe95e2bc70bf6e6794b6 /ash/desktop_background
parentd83bf8bcb31336fe556bee17223014baaaaf5c42 (diff)
downloadchromium_src-023446d6f94febce59f20be0816931448f0392c7.zip
chromium_src-023446d6f94febce59f20be0816931448f0392c7.tar.gz
chromium_src-023446d6f94febce59f20be0816931448f0392c7.tar.bz2
Revert "Change Aura desktop background behavior."
This reverts commit 7fdf4eb7cd05b725d246ef8be99eb43784ed5ad3. R=saintlou@chromium.org BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/9549024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124326 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/desktop_background')
-rw-r--r--ash/desktop_background/desktop_background_view.cc43
1 files changed, 4 insertions, 39 deletions
diff --git a/ash/desktop_background/desktop_background_view.cc b/ash/desktop_background/desktop_background_view.cc
index 0e7132a..44526cb 100644
--- a/ash/desktop_background/desktop_background_view.cc
+++ b/ash/desktop_background/desktop_background_view.cc
@@ -34,45 +34,10 @@ DesktopBackgroundView::~DesktopBackgroundView() {
// DesktopBackgroundView, views::View overrides:
void DesktopBackgroundView::OnPaint(gfx::Canvas* canvas) {
- // Scale the image while maintaining the aspect ratio, cropping as
- // necessary to fill the background. Ideally the image should be larger
- // than the largest display supported, if not we will center it rather than
- // streching to avoid upsampling artifacts (Note that we could tile too, but
- // decided not to do this at the moment).
- gfx::Rect wallpaper_rect(0, 0, wallpaper_.width(), wallpaper_.height());
- if (wallpaper_.width() > width() && wallpaper_.height() > height()) {
- // The dimension with the smallest ratio must be cropped, the other one
- // is preserved. Both are set in gfx::Size cropped_size.
- double horizontal_ratio = static_cast<double>(width()) /
- static_cast<double>(wallpaper_.width());
- double vertical_ratio = static_cast<double>(height()) /
- static_cast<double>(wallpaper_.height());
-
- gfx::Size cropped_size;
- if (vertical_ratio > horizontal_ratio) {
- cropped_size = gfx::Size(
- static_cast<int>(
- round(static_cast<double>(width()) / vertical_ratio)),
- wallpaper_.height());
- } else {
- cropped_size = gfx::Size(wallpaper_.width(),
- static_cast<int>(
- round(static_cast<double>(height()) / horizontal_ratio)));
- }
-
- gfx::Rect wallpaper_cropped_rect = wallpaper_rect.Center(cropped_size);
- canvas->DrawBitmapInt(wallpaper_,
- wallpaper_cropped_rect.x(), wallpaper_cropped_rect.y(),
- wallpaper_cropped_rect.width(), wallpaper_cropped_rect.height(),
- 0, 0, width(), height(),
- true);
- }
- else {
- // Center the wallpaper in the destination rectangle (Skia will crop
- // as needed).
- canvas->DrawBitmapInt(wallpaper_, (width() - wallpaper_.width()) / 2,
- (height() - wallpaper_.height()) / 2);
- }
+ canvas->DrawBitmapInt(wallpaper_,
+ 0, 0, wallpaper_.width(), wallpaper_.height(),
+ 0, 0, width(), height(),
+ true);
}
bool DesktopBackgroundView::OnMousePressed(const views::MouseEvent& event) {