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

Unified Diff: chrome/browser/gtk/tabs/tab_renderer_gtk.cc

Issue 179003: Add a fast path for tab strip expose. (Closed)
Patch Set: comment Created 11 years, 4 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/gtk/tabs/tab_renderer_gtk.h ('k') | chrome/browser/gtk/tabs/tab_strip_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/tabs/tab_renderer_gtk.cc
diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
index 3034738fc7fc9bdf0a7718927426988e4656a342..f90974d3c142d2e42321412bfb7437a3a22f1b06 100644
--- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
@@ -35,6 +35,7 @@ const int kFavIconTitleSpacing = 4;
const int kTitleCloseButtonSpacing = 5;
const int kStandardTitleWidth = 175;
const int kDropShadowOffset = 2;
+const int kInactiveTabBackgroundOffsetY = 20;
// Preferred width of pinned tabs.
const int kPinnedTabWidth = 56;
// When a non-pinned tab is pinned the width of the tab animates. If the width
@@ -333,6 +334,46 @@ bool TabRendererGtk::ValidateLoadingAnimation(AnimationState animation_state) {
return loading_animation_.ValidateLoadingAnimation(animation_state);
}
+void TabRendererGtk::PaintFavIconArea(GdkEventExpose* event) {
+ DCHECK(ShouldShowIcon());
+
+ // The paint area is the favicon bounds, but we're painting into the gdk
+ // window belonging to the tabstrip. So the coordinates are relative to the
+ // top left of the tab strip.
+ event->area.x = x() + favicon_bounds_.x();
+ event->area.y = y() + favicon_bounds_.y();
+ event->area.width = favicon_bounds_.width();
+ event->area.height = favicon_bounds_.height();
+ gfx::CanvasPaint canvas(event, false);
+
+ // The actual paint methods expect 0, 0 to be the tab top left (see
+ // PaintTab).
+ canvas.TranslateInt(x(), y());
+
+ // Paint the background behind the favicon.
+ int theme_id;
+ int offset_y = 0;
+ if (IsSelected()) {
+ theme_id = IDR_THEME_TOOLBAR;
+ } else {
+ if (!data_.off_the_record) {
+ theme_id = IDR_THEME_TAB_BACKGROUND;
+ } else {
+ theme_id = IDR_THEME_TAB_BACKGROUND_INCOGNITO;
+ }
+ if (!theme_provider_->HasCustomImage(theme_id))
+ offset_y = kInactiveTabBackgroundOffsetY;
+ }
+ SkBitmap* tab_bg = theme_provider_->GetBitmapNamed(theme_id);
+ canvas.TileImageInt(*tab_bg,
+ x() + favicon_bounds_.x(), offset_y + favicon_bounds_.y(),
+ favicon_bounds_.x(), favicon_bounds_.y(),
+ favicon_bounds_.width(), favicon_bounds_.height());
+
+ // Now paint the icon.
+ PaintIcon(&canvas);
+}
+
// static
gfx::Size TabRendererGtk::GetMinimumUnselectedSize() {
InitResources();
@@ -752,7 +793,8 @@ void TabRendererGtk::PaintInactiveTabBackground(gfx::Canvas* canvas) {
// 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 offset_y = theme_provider_->HasCustomImage(tab_id) ? 0 : 20;
+ int offset_y = theme_provider_->HasCustomImage(tab_id) ?
+ 0 : kInactiveTabBackgroundOffsetY;
// Draw left edge.
SkBitmap* theme_l = GetMaskedBitmap(tab_alpha_.image_l, tab_bg, offset_x,
« no previous file with comments | « chrome/browser/gtk/tabs/tab_renderer_gtk.h ('k') | chrome/browser/gtk/tabs/tab_strip_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698