OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <limits> | 5 #include <limits> |
6 | 6 |
7 #include "chrome/browser/views/tabs/tab_renderer.h" | 7 #include "chrome/browser/views/tabs/tab_renderer.h" |
8 | 8 |
9 #include "base/gfx/image_operations.h" | |
10 #include "chrome/app/theme/theme_resources.h" | 9 #include "chrome/app/theme/theme_resources.h" |
11 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
12 #include "chrome/browser/tabs/tab_strip_model.h" | 11 #include "chrome/browser/tabs/tab_strip_model.h" |
13 #include "chrome/browser/tab_contents.h" | 12 #include "chrome/browser/tab_contents.h" |
14 #include "chrome/common/gfx/chrome_canvas.h" | 13 #include "chrome/common/gfx/chrome_canvas.h" |
15 #include "chrome/common/gfx/chrome_font.h" | 14 #include "chrome/common/gfx/chrome_font.h" |
16 #include "chrome/common/l10n_util.h" | 15 #include "chrome/common/l10n_util.h" |
17 #include "chrome/common/resource_bundle.h" | 16 #include "chrome/common/resource_bundle.h" |
18 #include "chrome/common/win_util.h" | 17 #include "chrome/common/win_util.h" |
19 #include "generated_resources.h" | 18 #include "generated_resources.h" |
| 19 #include "skia/ext/image_operations.h" |
20 | 20 |
21 static const int kLeftPadding = 16; | 21 static const int kLeftPadding = 16; |
22 static const int kTopPadding = 6; | 22 static const int kTopPadding = 6; |
23 static const int kRightPadding = 15; | 23 static const int kRightPadding = 15; |
24 static const int kBottomPadding = 5; | 24 static const int kBottomPadding = 5; |
25 static const int kFavIconTitleSpacing = 4; | 25 static const int kFavIconTitleSpacing = 4; |
26 static const int kTitleCloseButtonSpacing = 5; | 26 static const int kTitleCloseButtonSpacing = 5; |
27 static const int kStandardTitleWidth = 175; | 27 static const int kStandardTitleWidth = 175; |
28 static const int kCloseButtonVertFuzz = 0; | 28 static const int kCloseButtonVertFuzz = 0; |
29 static const int kCloseButtonHorzFuzz = 5; | 29 static const int kCloseButtonHorzFuzz = 5; |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 void TabRenderer::PaintActiveTabBackground(ChromeCanvas* canvas) { | 579 void TabRenderer::PaintActiveTabBackground(ChromeCanvas* canvas) { |
580 canvas->DrawBitmapInt(*tab_active_l, 0, 0); | 580 canvas->DrawBitmapInt(*tab_active_l, 0, 0); |
581 canvas->TileImageInt(*tab_active_c, tab_active_l_width, 0, | 581 canvas->TileImageInt(*tab_active_c, tab_active_l_width, 0, |
582 width() - tab_active_l_width - tab_active_r_width, height()); | 582 width() - tab_active_l_width - tab_active_r_width, height()); |
583 canvas->DrawBitmapInt(*tab_active_r, width() - tab_active_r_width, 0); | 583 canvas->DrawBitmapInt(*tab_active_r, width() - tab_active_r_width, 0); |
584 } | 584 } |
585 | 585 |
586 void TabRenderer::PaintHoverTabBackground(ChromeCanvas* canvas, | 586 void TabRenderer::PaintHoverTabBackground(ChromeCanvas* canvas, |
587 double opacity) { | 587 double opacity) { |
588 bool is_otr = data_.off_the_record; | 588 bool is_otr = data_.off_the_record; |
589 SkBitmap left = gfx::ImageOperations::CreateBlendedBitmap( | 589 SkBitmap left = skia::ImageOperations::CreateBlendedBitmap( |
590 (is_otr ? *tab_inactive_otr_l : *tab_inactive_l), | 590 (is_otr ? *tab_inactive_otr_l : *tab_inactive_l), |
591 *tab_hover_l, opacity); | 591 *tab_hover_l, opacity); |
592 SkBitmap center = gfx::ImageOperations::CreateBlendedBitmap( | 592 SkBitmap center = skia::ImageOperations::CreateBlendedBitmap( |
593 (is_otr ? *tab_inactive_otr_c : *tab_inactive_c), | 593 (is_otr ? *tab_inactive_otr_c : *tab_inactive_c), |
594 *tab_hover_c, opacity); | 594 *tab_hover_c, opacity); |
595 SkBitmap right = gfx::ImageOperations::CreateBlendedBitmap( | 595 SkBitmap right = skia::ImageOperations::CreateBlendedBitmap( |
596 (is_otr ? *tab_inactive_otr_r : *tab_inactive_r), | 596 (is_otr ? *tab_inactive_otr_r : *tab_inactive_r), |
597 *tab_hover_r, opacity); | 597 *tab_hover_r, opacity); |
598 | 598 |
599 canvas->DrawBitmapInt(left, 0, 0); | 599 canvas->DrawBitmapInt(left, 0, 0); |
600 canvas->TileImageInt(center, tab_active_l_width, 0, | 600 canvas->TileImageInt(center, tab_active_l_width, 0, |
601 width() - tab_active_l_width - tab_active_r_width, height()); | 601 width() - tab_active_l_width - tab_active_r_width, height()); |
602 canvas->DrawBitmapInt(right, width() - tab_active_r_width, 0); | 602 canvas->DrawBitmapInt(right, width() - tab_active_r_width, 0); |
603 } | 603 } |
604 | 604 |
605 void TabRenderer::PaintLoadingAnimation(ChromeCanvas* canvas) { | 605 void TabRenderer::PaintLoadingAnimation(ChromeCanvas* canvas) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 } | 671 } |
672 | 672 |
673 void TabRenderer::DisplayCrashedFavIcon() { | 673 void TabRenderer::DisplayCrashedFavIcon() { |
674 should_display_crashed_favicon_ = true; | 674 should_display_crashed_favicon_ = true; |
675 } | 675 } |
676 | 676 |
677 void TabRenderer::ResetCrashedFavIcon() { | 677 void TabRenderer::ResetCrashedFavIcon() { |
678 should_display_crashed_favicon_ = false; | 678 should_display_crashed_favicon_ = false; |
679 } | 679 } |
680 | 680 |
OLD | NEW |