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

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

Issue 8383028: ui/gfx: Convert Canvas::ClipRectInt() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/views/infobars/infobar_view.cc » ('j') | 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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/infobars/infobar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698