Commit 3d9c8b00 authored by pkotwicz@chromium.org's avatar pkotwicz@chromium.org

Unmirrors new tab button theme background in Rtl mode.

When running Chrome in RTL mode, the new tab button is mirrored, but the theme background shouldn't be.

Bug=None
Test=Manual

Review URL: https://chromiumcodereview.appspot.com/10808051

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150363 0039d316-1c4b-4281-b951-d872f2087c98
parent 7be809df
...@@ -420,8 +420,19 @@ gfx::ImageSkia NewTabButton::GetBackgroundImage( ...@@ -420,8 +420,19 @@ gfx::ImageSkia NewTabButton::GetBackgroundImage(
GetThemeProvider()->GetImageSkiaNamed(background_id); GetThemeProvider()->GetImageSkiaNamed(background_id);
int offset_y = GetThemeProvider()->HasCustomImage(background_id) ? int offset_y = GetThemeProvider()->HasCustomImage(background_id) ?
0 : background_offset_.y(); 0 : background_offset_.y();
canvas.TileImageInt(*background, GetMirroredX() + background_offset_.x(),
newtab_button_v_offset() + offset_y, 0, 0, width, height); // The new tab background is mirrored in RTL mode, but the theme background
// should never be mirrored. Mirror it here to compensate.
float x_scale = 1.0f;
int x = GetMirroredX() + background_offset_.x();
if (base::i18n::IsRTL()) {
x_scale = -1.0f;
// Offset by |width| such that the same region is painted as if there was no
// flip.
x += width;
}
canvas.TileImageInt(*background, x, newtab_button_v_offset() + offset_y,
x_scale, 1.0f, 0, 0, width, height);
if (alpha != 255) { if (alpha != 255) {
SkPaint paint; SkPaint paint;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment