| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/gtk/tabs/tab_renderer_gtk.h" | 5 #include "chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 canvas->DrawStringInt(title, *title_font_, title_color, | 827 canvas->DrawStringInt(title, *title_font_, title_color, |
| 828 title_bounds_.x(), title_bounds_.y(), | 828 title_bounds_.x(), title_bounds_.y(), |
| 829 title_bounds_.width(), title_bounds_.height()); | 829 title_bounds_.width(), title_bounds_.height()); |
| 830 } | 830 } |
| 831 | 831 |
| 832 void TabRendererGtk::PaintIcon(gfx::Canvas* canvas) { | 832 void TabRendererGtk::PaintIcon(gfx::Canvas* canvas) { |
| 833 if (loading_animation_.animation_state() != ANIMATION_NONE) { | 833 if (loading_animation_.animation_state() != ANIMATION_NONE) { |
| 834 PaintLoadingAnimation(canvas); | 834 PaintLoadingAnimation(canvas); |
| 835 } else { | 835 } else { |
| 836 canvas->Save(); | 836 canvas->Save(); |
| 837 canvas->ClipRectInt(0, 0, width(), height() - kFaviconTitleSpacing); | 837 canvas->ClipRectInt( |
| 838 gfx::Rect(0, 0, width(), height() - kFaviconTitleSpacing)); |
| 838 if (should_display_crashed_favicon_) { | 839 if (should_display_crashed_favicon_) { |
| 839 canvas->DrawBitmapInt(*crashed_favicon, 0, 0, | 840 canvas->DrawBitmapInt(*crashed_favicon, 0, 0, |
| 840 crashed_favicon->width(), | 841 crashed_favicon->width(), |
| 841 crashed_favicon->height(), | 842 crashed_favicon->height(), |
| 842 favicon_bounds_.x(), | 843 favicon_bounds_.x(), |
| 843 favicon_bounds_.y() + favicon_hiding_offset_, | 844 favicon_bounds_.y() + favicon_hiding_offset_, |
| 844 gfx::kFaviconSize, gfx::kFaviconSize, | 845 gfx::kFaviconSize, gfx::kFaviconSize, |
| 845 true); | 846 true); |
| 846 } else { | 847 } else { |
| 847 if (!data_.favicon.isNull()) { | 848 if (!data_.favicon.isNull()) { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 (loading_animation_.animation_state() == ANIMATION_WAITING) ? | 972 (loading_animation_.animation_state() == ANIMATION_WAITING) ? |
| 972 loading_animation_.waiting_animation_frames() : | 973 loading_animation_.waiting_animation_frames() : |
| 973 loading_animation_.loading_animation_frames(); | 974 loading_animation_.loading_animation_frames(); |
| 974 const int image_size = frames->height(); | 975 const int image_size = frames->height(); |
| 975 const int image_offset = loading_animation_.animation_frame() * image_size; | 976 const int image_offset = loading_animation_.animation_frame() * image_size; |
| 976 DCHECK(image_size == favicon_bounds_.height()); | 977 DCHECK(image_size == favicon_bounds_.height()); |
| 977 DCHECK(image_size == favicon_bounds_.width()); | 978 DCHECK(image_size == favicon_bounds_.width()); |
| 978 | 979 |
| 979 // NOTE: the clipping is a work around for 69528, it shouldn't be necessary. | 980 // NOTE: the clipping is a work around for 69528, it shouldn't be necessary. |
| 980 canvas->Save(); | 981 canvas->Save(); |
| 981 canvas->ClipRectInt( | 982 canvas->ClipRectInt(gfx::Rect(favicon_bounds_.x(), favicon_bounds_.y(), |
| 982 favicon_bounds_.x(), favicon_bounds_.y(), image_size, image_size); | 983 image_size, image_size)); |
| 983 canvas->DrawBitmapInt(*frames, image_offset, 0, image_size, image_size, | 984 canvas->DrawBitmapInt(*frames, image_offset, 0, image_size, image_size, |
| 984 favicon_bounds_.x(), favicon_bounds_.y(), image_size, image_size, | 985 favicon_bounds_.x(), favicon_bounds_.y(), image_size, image_size, |
| 985 false); | 986 false); |
| 986 canvas->Restore(); | 987 canvas->Restore(); |
| 987 } | 988 } |
| 988 | 989 |
| 989 int TabRendererGtk::IconCapacity() const { | 990 int TabRendererGtk::IconCapacity() const { |
| 990 if (height() < GetMinimumUnselectedSize().height()) | 991 if (height() < GetMinimumUnselectedSize().height()) |
| 991 return 0; | 992 return 0; |
| 992 return (width() - kLeftPadding - kRightPadding) / gfx::kFaviconSize; | 993 return (width() - kLeftPadding - kRightPadding) / gfx::kFaviconSize; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 | 1091 |
| 1091 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 1092 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 1092 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); | 1093 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); |
| 1093 title_font_ = new gfx::Font(base_font.GetFontName(), kFontPixelSize); | 1094 title_font_ = new gfx::Font(base_font.GetFontName(), kFontPixelSize); |
| 1094 title_font_height_ = title_font_->GetHeight(); | 1095 title_font_height_ = title_font_->GetHeight(); |
| 1095 | 1096 |
| 1096 crashed_favicon = rb.GetBitmapNamed(IDR_SAD_FAVICON); | 1097 crashed_favicon = rb.GetBitmapNamed(IDR_SAD_FAVICON); |
| 1097 | 1098 |
| 1098 initialized_ = true; | 1099 initialized_ = true; |
| 1099 } | 1100 } |
| OLD | NEW |