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

Side by Side Diff: chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc

Issue 8341089: GTK: More profiling of the rendering path. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Some of estade's nits Created 9 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/gtk/gtk_theme_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 title_bounds_, 839 title_bounds_,
840 title_bounds_, 840 title_bounds_,
841 title_color, 841 title_color,
842 base::i18n::IsRTL() ? gfx::Canvas::TEXT_ALIGN_RIGHT : 842 base::i18n::IsRTL() ? gfx::Canvas::TEXT_ALIGN_RIGHT :
843 gfx::Canvas::TEXT_ALIGN_LEFT); 843 gfx::Canvas::TEXT_ALIGN_LEFT);
844 } 844 }
845 845
846 void TabRendererGtk::PaintIcon(GtkWidget* widget, cairo_t* cr) { 846 void TabRendererGtk::PaintIcon(GtkWidget* widget, cairo_t* cr) {
847 if (loading_animation_.animation_state() != ANIMATION_NONE) { 847 if (loading_animation_.animation_state() != ANIMATION_NONE) {
848 PaintLoadingAnimation(widget, cr); 848 PaintLoadingAnimation(widget, cr);
849 } else { 849 return;
850 if (should_display_crashed_favicon_) { 850 }
851 theme_service_->GetSurfaceNamed(IDR_SAD_FAVICON, widget)->SetSource(
852 cr, favicon_bounds_.x(),
853 favicon_bounds_.y() + favicon_hiding_offset_);
854 cairo_paint(cr);
855 } else {
856 if (!data_.favicon.isNull()) {
857 if (data_.is_default_favicon && theme_service_->UsingNativeTheme()) {
858 GdkPixbuf* favicon = GtkThemeService::GetDefaultFavicon(true);
859 851
860 // TODO(erg): Get GtkThemeService to hand us a 852 CairoCachedSurface* to_display = NULL;
861 // CairoCachedSurface. Then we can simplify all of this. 853 if (should_display_crashed_favicon_) {
862 gdk_cairo_set_source_pixbuf( 854 to_display = theme_service_->GetSurfaceNamed(IDR_SAD_FAVICON, widget);
863 cr, favicon, favicon_bounds_.x(), 855 } else if (!data_.favicon.isNull()) {
864 favicon_bounds_.y() + favicon_hiding_offset_); 856 if (data_.is_default_favicon && theme_service_->UsingNativeTheme()) {
865 cairo_paint(cr); 857 to_display = theme_service_->GetCairoIcon(
866 } else if (data_.cairo_favicon.valid()) { 858 GtkThemeService::NATIVE_FAVICON, widget);
867 // TODO(erg): We should research whether we still need to draw app 859 } else if (data_.cairo_favicon.valid()) {
868 // icons larger. We don't appear to be getting larger icons. 860 to_display = &data_.cairo_favicon;
869 data_.cairo_favicon.SetSource(
870 cr,
871 favicon_bounds_.x(),
872 favicon_bounds_.y() + favicon_hiding_offset_);
873 cairo_paint(cr);
874 }
875 }
876 } 861 }
877 } 862 }
863
864 if (to_display) {
865 to_display->SetSource(cr,
866 favicon_bounds_.x(),
867 favicon_bounds_.y() + favicon_hiding_offset_);
868 cairo_paint(cr);
869 }
878 } 870 }
879 871
880 void TabRendererGtk::PaintTabBackground(GtkWidget* widget, cairo_t* cr) { 872 void TabRendererGtk::PaintTabBackground(GtkWidget* widget, cairo_t* cr) {
881 if (IsActive()) { 873 if (IsActive()) {
882 PaintActiveTabBackground(widget, cr); 874 PaintActiveTabBackground(widget, cr);
883 } else { 875 } else {
884 PaintInactiveTabBackground(widget, cr); 876 PaintInactiveTabBackground(widget, cr);
885 877
886 double throb_value = GetThrobValue(); 878 double throb_value = GetThrobValue();
887 if (throb_value > 0) { 879 if (throb_value > 0) {
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 1102
1111 close_button_width_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->width(); 1103 close_button_width_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->width();
1112 close_button_height_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->height(); 1104 close_button_height_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->height();
1113 1105
1114 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); 1106 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont);
1115 title_font_ = new gfx::Font(base_font.GetFontName(), kFontPixelSize); 1107 title_font_ = new gfx::Font(base_font.GetFontName(), kFontPixelSize);
1116 title_font_height_ = title_font_->GetHeight(); 1108 title_font_height_ = title_font_->GetHeight();
1117 1109
1118 initialized_ = true; 1110 initialized_ = true;
1119 } 1111 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/gtk_theme_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698