From 023446d6f94febce59f20be0816931448f0392c7 Mon Sep 17 00:00:00 2001 From: "saintlou@chromium.org" Date: Thu, 1 Mar 2012 01:52:50 +0000 Subject: 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 --- ash/desktop_background/desktop_background_view.cc | 43 +++-------------------- 1 file 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(width()) / - static_cast(wallpaper_.width()); - double vertical_ratio = static_cast(height()) / - static_cast(wallpaper_.height()); - - gfx::Size cropped_size; - if (vertical_ratio > horizontal_ratio) { - cropped_size = gfx::Size( - static_cast( - round(static_cast(width()) / vertical_ratio)), - wallpaper_.height()); - } else { - cropped_size = gfx::Size(wallpaper_.width(), - static_cast( - round(static_cast(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) { -- cgit v1.1