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

Unified Diff: chrome/browser/chromeos/login/user_controller.cc

Issue 2136018: Fix for flickering of images on login screen.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/login/user_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/user_controller.cc
===================================================================
--- chrome/browser/chromeos/login/user_controller.cc (revision 47639)
+++ chrome/browser/chromeos/login/user_controller.cc (working copy)
@@ -151,8 +151,7 @@
return;
user_.set_image(user->image());
- SetImage(user_.image(), user_.image().width(), user_.image().height());
- image_view_->SchedulePaint();
+ SetImage(user_.image());
}
void UserController::Login() {
@@ -204,15 +203,13 @@
image_view_ = new views::ImageView();
image_view_->set_background(
views::Background::CreateSolidBackground(kBackgroundColor));
- if (!is_guest_) {
- SetImage(user_.image(), user_.image().width(), user_.image().height());
- } else {
+ if (!is_guest_)
+ SetImage(user_.image());
+ else
SetImage(*ResourceBundle::GetSharedInstance().GetBitmapNamed(
- IDR_LOGIN_OTHER_USER),
- kSize, kSize);
- }
+ IDR_LOGIN_OTHER_USER));
WidgetGtk* window = new WidgetGtk(WidgetGtk::TYPE_WINDOW);
- window->Init(NULL, gfx::Rect());
+ window->Init(NULL, gfx::Rect(0, 0, kSize, kSize));
window->SetContentsView(image_view_);
std::vector<int> params;
params.push_back(index);
@@ -220,7 +217,6 @@
window->GetNativeView(),
WM_IPC_WINDOW_LOGIN_IMAGE,
&params);
- window->SetBounds(gfx::Rect(0, 0, kSize, kSize));
window->Show();
return window;
}
@@ -275,13 +271,13 @@
return window;
}
-void UserController::SetImage(const SkBitmap& image,
- int desired_width,
- int desired_height) {
+void UserController::SetImage(const SkBitmap& image) {
+ int desired_size = std::min(image.width(), image.height());
+ // Desired size is not preserved if it's greater than 75% of kSize.
+ if (desired_size * 4 > 3 * kSize)
+ desired_size = kSize;
+ image_view_->SetImageSize(gfx::Size(desired_size, desired_size));
image_view_->SetImage(image);
- image_view_->SetImageSize(
- gfx::Size(std::min(desired_width, kSize),
- std::min(desired_height, kSize)));
}
gfx::Rect UserController::GetScreenBounds() const {
« no previous file with comments | « chrome/browser/chromeos/login/user_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698