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

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

Issue 173630: Paint the hover animation state when painting just the favicon. (Closed)
Patch Set: 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 | « 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/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 849ca4a6828d9f8bad62047a4d2d8e5795e51671..042ff68e287c95c384dd47140314842fc12afa42 100644
--- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
@@ -371,6 +371,26 @@ void TabRendererGtk::PaintFavIconArea(GdkEventExpose* event) {
favicon_bounds_.x(), favicon_bounds_.y(),
favicon_bounds_.width(), favicon_bounds_.height());
+ // Draw our hover state.
+ if (!IsSelected()) {
+ Animation* animation = hover_animation_.get();
+ if (animation->GetCurrentValue() > 0) {
+ SkRect bounds;
+ bounds.set(favicon_bounds_.x(), favicon_bounds_.y(),
+ favicon_bounds_.right(), favicon_bounds_.bottom());
+ canvas.saveLayerAlpha(&bounds,
+ static_cast<int>(animation->GetCurrentValue() * kHoverOpacity * 0xff),
+ SkCanvas::kARGB_ClipLayer_SaveFlag);
+ canvas.drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
+ SkBitmap* active_bg = theme_provider_->GetBitmapNamed(IDR_THEME_TOOLBAR);
+ canvas.TileImageInt(*active_bg,
+ x() + favicon_bounds_.x(), favicon_bounds_.y(),
+ favicon_bounds_.x(), favicon_bounds_.y(),
+ favicon_bounds_.width(), favicon_bounds_.height());
+ canvas.restore();
+ }
+ }
+
// Now paint the icon.
PaintIcon(&canvas);
}
« 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