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

Unified Diff: chrome/browser/views/tabs/tab_renderer.cc

Issue 149727: Align custom background tab images correctly.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/tabs/tab_renderer.cc
===================================================================
--- chrome/browser/views/tabs/tab_renderer.cc (revision 20799)
+++ chrome/browser/views/tabs/tab_renderer.cc (working copy)
@@ -598,10 +598,16 @@
SkBitmap* tab_bg = GetThemeProvider()->GetBitmapNamed(tab_id);
+ // If the theme is providing a custom background image, then its top edge
+ // should be at the top of the tab. Otherwise, we assume that the background
+ // image is a composited foreground + frame image.
+ int bg_offset_y = GetThemeProvider()->HasCustomImage(tab_id) ?
+ 0 : background_offset_.y();
+
// Draw left edge. Don't draw over the toolbar, as we're not the foreground
// tab.
SkBitmap tab_l = skia::ImageOperations::CreateTiledBitmap(
- *tab_bg, offset, background_offset_.y(),
+ *tab_bg, offset, bg_offset_y,
tab_active.l_width, height());
SkBitmap theme_l = skia::ImageOperations::CreateMaskedBitmap(
tab_l, *tab_alpha.image_l);
@@ -613,7 +619,7 @@
// Draw right edge. Again, don't draw over the toolbar.
SkBitmap tab_r = skia::ImageOperations::CreateTiledBitmap(
*tab_bg,
- offset + width() - tab_active.r_width, background_offset_.y(),
+ offset + width() - tab_active.r_width, bg_offset_y,
tab_active.r_width, height());
SkBitmap theme_r = skia::ImageOperations::CreateMaskedBitmap(
tab_r, *tab_alpha.image_r);
@@ -626,7 +632,7 @@
// by incrementing by kDropShadowHeight, since it's a simple rectangle. And
// again, don't draw over the toolbar.
canvas->TileImageInt(*tab_bg,
- offset + tab_active.l_width, background_offset_.y() + kDropShadowHeight,
+ offset + tab_active.l_width, bg_offset_y + kDropShadowHeight,
tab_active.l_width, kDropShadowHeight,
width() - tab_active.l_width - tab_active.r_width,
height() - kDropShadowHeight - kToolbarOverlap);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698