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/views/tabs/base_tab.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 | « chrome/browser/ui/views/infobars/infobar_view.cc ('k') | ui/gfx/canvas.h » ('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/views/tabs/base_tab.h" 5 #include "chrome/browser/ui/views/tabs/base_tab.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 int image_offset, 81 int image_offset,
82 int icon_width, 82 int icon_width,
83 int icon_height, 83 int icon_height,
84 const gfx::Rect& bounds, 84 const gfx::Rect& bounds,
85 bool filter) { 85 bool filter) {
86 // Center the image within bounds. 86 // Center the image within bounds.
87 int dst_x = bounds.x() - (icon_width - bounds.width()) / 2; 87 int dst_x = bounds.x() - (icon_width - bounds.width()) / 2;
88 int dst_y = bounds.y() - (icon_height - bounds.height()) / 2; 88 int dst_y = bounds.y() - (icon_height - bounds.height()) / 2;
89 // NOTE: the clipping is a work around for 69528, it shouldn't be necessary. 89 // NOTE: the clipping is a work around for 69528, it shouldn't be necessary.
90 canvas->Save(); 90 canvas->Save();
91 canvas->ClipRectInt(dst_x, dst_y, icon_width, icon_height); 91 canvas->ClipRectInt(gfx::Rect(dst_x, dst_y, icon_width, icon_height));
92 canvas->DrawBitmapInt(image, 92 canvas->DrawBitmapInt(image,
93 image_offset, 0, icon_width, icon_height, 93 image_offset, 0, icon_width, icon_height,
94 dst_x, dst_y, icon_width, icon_height, 94 dst_x, dst_y, icon_width, icon_height,
95 filter); 95 filter);
96 canvas->Restore(); 96 canvas->Restore();
97 } 97 }
98 98
99 } // namespace 99 } // namespace
100 100
101 // static 101 // static
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 SkBitmap frames(*tp->GetBitmapNamed( 437 SkBitmap frames(*tp->GetBitmapNamed(
438 (data().network_state == TabRendererData::NETWORK_STATE_WAITING) ? 438 (data().network_state == TabRendererData::NETWORK_STATE_WAITING) ?
439 IDR_THROBBER_WAITING : IDR_THROBBER)); 439 IDR_THROBBER_WAITING : IDR_THROBBER));
440 440
441 int icon_size = frames.height(); 441 int icon_size = frames.height();
442 int image_offset = loading_animation_frame_ * icon_size; 442 int image_offset = loading_animation_frame_ * icon_size;
443 DrawIconCenter(canvas, frames, image_offset, 443 DrawIconCenter(canvas, frames, image_offset,
444 icon_size, icon_size, bounds, false); 444 icon_size, icon_size, bounds, false);
445 } else { 445 } else {
446 canvas->Save(); 446 canvas->Save();
447 canvas->ClipRectInt(0, 0, width(), height()); 447 canvas->ClipRectInt(GetLocalBounds());
448 if (should_display_crashed_favicon_) { 448 if (should_display_crashed_favicon_) {
449 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 449 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
450 SkBitmap crashed_favicon(*rb.GetBitmapNamed(IDR_SAD_FAVICON)); 450 SkBitmap crashed_favicon(*rb.GetBitmapNamed(IDR_SAD_FAVICON));
451 bounds.set_y(bounds.y() + favicon_hiding_offset_); 451 bounds.set_y(bounds.y() + favicon_hiding_offset_);
452 DrawIconCenter(canvas, crashed_favicon, 0, 452 DrawIconCenter(canvas, crashed_favicon, 0,
453 crashed_favicon.width(), 453 crashed_favicon.width(),
454 crashed_favicon.height(), bounds, true); 454 crashed_favicon.height(), bounds, true);
455 } else { 455 } else {
456 if (!data().favicon.isNull()) { 456 if (!data().favicon.isNull()) {
457 // TODO(pkasting): Use code in tab_icon_view.cc:PaintIcon() (or switch 457 // TODO(pkasting): Use code in tab_icon_view.cc:PaintIcon() (or switch
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 // static 571 // static
572 void BaseTab::InitResources() { 572 void BaseTab::InitResources() {
573 static bool initialized = false; 573 static bool initialized = false;
574 if (!initialized) { 574 if (!initialized) {
575 initialized = true; 575 initialized = true;
576 font_ = new gfx::Font( 576 font_ = new gfx::Font(
577 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont)); 577 ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::BaseFont));
578 font_height_ = font_->GetHeight(); 578 font_height_ = font_->GetHeight();
579 } 579 }
580 } 580 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/infobar_view.cc ('k') | ui/gfx/canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698