| Index: chrome/browser/ntp_background_util.cc
|
| diff --git a/chrome/browser/ntp_background_util.cc b/chrome/browser/ntp_background_util.cc
|
| index c6682d0d7fda06b3d175046b71b5ef89d80bda00..297a0f084bab3634f36f684e78baed27e11571d3 100644
|
| --- a/chrome/browser/ntp_background_util.cc
|
| +++ b/chrome/browser/ntp_background_util.cc
|
| @@ -4,6 +4,8 @@
|
|
|
| #include "chrome/browser/ntp_background_util.h"
|
|
|
| +#include <cmath>
|
| +
|
| #include "base/logging.h"
|
| #include "chrome/browser/themes/theme_service.h"
|
| #include "grit/theme_resources.h"
|
| @@ -22,15 +24,22 @@ void PaintThemeBackground(
|
| int width = area.width() + ntp_background->width();
|
| int height = area.height() + ntp_background->height();
|
|
|
| - if (alignment & ThemeService::ALIGN_BOTTOM)
|
| + if (alignment & ThemeService::ALIGN_BOTTOM) {
|
| y_pos += area.height() + tab_contents_height - ntp_background->height();
|
| + } else if (alignment & ThemeService::ALIGN_TOP) {
|
| + // no op
|
| + } else { // ALIGN_CENTER
|
| + y_pos += std::floor(area.height() + tab_contents_height / 2.0 -
|
| + ntp_background->height() / 2.0 + 0.5);
|
| + }
|
|
|
| if (alignment & ThemeService::ALIGN_RIGHT) {
|
| x_pos += area.width() - ntp_background->width();
|
| } else if (alignment & ThemeService::ALIGN_LEFT) {
|
| // no op
|
| } else { // ALIGN_CENTER
|
| - x_pos += area.width() / 2 - ntp_background->width() / 2;
|
| + x_pos +=
|
| + std::floor(area.width() / 2.0 - ntp_background->width() / 2.0 + 0.5);
|
| }
|
|
|
| if (tiling != ThemeService::REPEAT &&
|
| @@ -68,7 +77,7 @@ void NtpBackgroundUtil::PaintBackgroundDetachedMode(ui::ThemeProvider* tp,
|
| tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_TILING, &tiling);
|
| int alignment;
|
| if (tp->GetDisplayProperty(ThemeService::NTP_BACKGROUND_ALIGNMENT,
|
| - &alignment)) {
|
| + &alignment)) {
|
| SkBitmap* ntp_background = tp->GetBitmapNamed(IDR_THEME_NTP_BACKGROUND);
|
|
|
| PaintThemeBackground(
|
|
|