| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/gtk/tabs/tab_renderer_gtk.h" | 5 #include "chrome/browser/gtk/tabs/tab_renderer_gtk.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "app/gfx/canvas_paint.h" | 10 #include "app/gfx/canvas_paint.h" |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 } | 364 } |
| 365 if (!theme_provider_->HasCustomImage(theme_id)) | 365 if (!theme_provider_->HasCustomImage(theme_id)) |
| 366 offset_y = kInactiveTabBackgroundOffsetY; | 366 offset_y = kInactiveTabBackgroundOffsetY; |
| 367 } | 367 } |
| 368 SkBitmap* tab_bg = theme_provider_->GetBitmapNamed(theme_id); | 368 SkBitmap* tab_bg = theme_provider_->GetBitmapNamed(theme_id); |
| 369 canvas.TileImageInt(*tab_bg, | 369 canvas.TileImageInt(*tab_bg, |
| 370 x() + favicon_bounds_.x(), offset_y + favicon_bounds_.y(), | 370 x() + favicon_bounds_.x(), offset_y + favicon_bounds_.y(), |
| 371 favicon_bounds_.x(), favicon_bounds_.y(), | 371 favicon_bounds_.x(), favicon_bounds_.y(), |
| 372 favicon_bounds_.width(), favicon_bounds_.height()); | 372 favicon_bounds_.width(), favicon_bounds_.height()); |
| 373 | 373 |
| 374 // Draw our hover state. |
| 375 if (!IsSelected()) { |
| 376 Animation* animation = hover_animation_.get(); |
| 377 if (animation->GetCurrentValue() > 0) { |
| 378 SkRect bounds; |
| 379 bounds.set(favicon_bounds_.x(), favicon_bounds_.y(), |
| 380 favicon_bounds_.right(), favicon_bounds_.bottom()); |
| 381 canvas.saveLayerAlpha(&bounds, |
| 382 static_cast<int>(animation->GetCurrentValue() * kHoverOpacity * 0xff), |
| 383 SkCanvas::kARGB_ClipLayer_SaveFlag); |
| 384 canvas.drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); |
| 385 SkBitmap* active_bg = theme_provider_->GetBitmapNamed(IDR_THEME_TOOLBAR); |
| 386 canvas.TileImageInt(*active_bg, |
| 387 x() + favicon_bounds_.x(), favicon_bounds_.y(), |
| 388 favicon_bounds_.x(), favicon_bounds_.y(), |
| 389 favicon_bounds_.width(), favicon_bounds_.height()); |
| 390 canvas.restore(); |
| 391 } |
| 392 } |
| 393 |
| 374 // Now paint the icon. | 394 // Now paint the icon. |
| 375 PaintIcon(&canvas); | 395 PaintIcon(&canvas); |
| 376 } | 396 } |
| 377 | 397 |
| 378 // static | 398 // static |
| 379 gfx::Size TabRendererGtk::GetMinimumUnselectedSize() { | 399 gfx::Size TabRendererGtk::GetMinimumUnselectedSize() { |
| 380 InitResources(); | 400 InitResources(); |
| 381 | 401 |
| 382 gfx::Size minimum_size; | 402 gfx::Size minimum_size; |
| 383 minimum_size.set_width(kLeftPadding + kRightPadding); | 403 minimum_size.set_width(kLeftPadding + kRightPadding); |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 // Force the font size to 9pt, which matches Windows' default font size | 1001 // Force the font size to 9pt, which matches Windows' default font size |
| 982 // (taken from the system). | 1002 // (taken from the system). |
| 983 gfx::Font base_font = rb.GetFont(ResourceBundle::BaseFont); | 1003 gfx::Font base_font = rb.GetFont(ResourceBundle::BaseFont); |
| 984 title_font_ = new gfx::Font(gfx::Font::CreateFont(base_font.FontName(), 9)); | 1004 title_font_ = new gfx::Font(gfx::Font::CreateFont(base_font.FontName(), 9)); |
| 985 title_font_height_ = title_font_->height(); | 1005 title_font_height_ = title_font_->height(); |
| 986 | 1006 |
| 987 crashed_fav_icon = rb.GetBitmapNamed(IDR_SAD_FAVICON); | 1007 crashed_fav_icon = rb.GetBitmapNamed(IDR_SAD_FAVICON); |
| 988 | 1008 |
| 989 initialized_ = true; | 1009 initialized_ = true; |
| 990 } | 1010 } |
| OLD | NEW |