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

Side by Side Diff: chrome/browser/ui/views/tabs/tab.cc

Issue 9332006: ui/gfx: Make the first version of Canvas::TileImageInt take a gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: put back the Peter's nits Created 8 years, 10 months 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/tab.h" 5 #include "chrome/browser/ui/views/tabs/tab.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/defaults.h" 10 #include "chrome/browser/defaults.h"
11 #include "chrome/browser/themes/theme_service.h" 11 #include "chrome/browser/themes/theme_service.h"
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 479
480 canvas->DrawBitmapInt(background_canvas.ExtractBitmap(), 0, 0); 480 canvas->DrawBitmapInt(background_canvas.ExtractBitmap(), 0, 0);
481 481
482 if (!GetThemeProvider()->HasCustomImage(tab_id) && 482 if (!GetThemeProvider()->HasCustomImage(tab_id) &&
483 hover_controller().ShouldDraw()) { 483 hover_controller().ShouldDraw()) {
484 hover_controller().Draw(canvas, background_canvas.ExtractBitmap()); 484 hover_controller().Draw(canvas, background_canvas.ExtractBitmap());
485 } 485 }
486 486
487 // Now draw the highlights/shadows around the tab edge. 487 // Now draw the highlights/shadows around the tab edge.
488 canvas->DrawBitmapInt(*tab_inactive_image->image_l, 0, 0); 488 canvas->DrawBitmapInt(*tab_inactive_image->image_l, 0, 0);
489 canvas->TileImageInt(*tab_inactive_image->image_c, 489 gfx::Rect tile_rect(GetLocalBounds());
490 tab_inactive_image->l_width, 0, 490 tile_rect.Inset(tab_inactive_image->l_width, 0,
491 width() - tab_inactive_image->l_width - 491 tab_inactive_image->r_width, 0);
492 tab_inactive_image->r_width, 492 canvas->TileImage(*tab_inactive_image->image_c, tile_rect);
493 height()); 493 canvas->DrawBitmapInt(*tab_inactive_image->image_r, tile_rect.right(), 0);
494 canvas->DrawBitmapInt(*tab_inactive_image->image_r,
495 width() - tab_inactive_image->r_width, 0);
496 } 494 }
497 495
498 void Tab::PaintActiveTabBackground(gfx::Canvas* canvas) { 496 void Tab::PaintActiveTabBackground(gfx::Canvas* canvas) {
499 int offset = GetMirroredX() + background_offset_.x(); 497 int offset = GetMirroredX() + background_offset_.x();
500 ui::ThemeProvider* tp = GetThemeProvider(); 498 ui::ThemeProvider* tp = GetThemeProvider();
501 DCHECK(tp) << "Unable to get theme provider"; 499 DCHECK(tp) << "Unable to get theme provider";
502 500
503 SkBitmap* tab_bg = GetThemeProvider()->GetBitmapNamed(IDR_THEME_TOOLBAR); 501 SkBitmap* tab_bg = GetThemeProvider()->GetBitmapNamed(IDR_THEME_TOOLBAR);
504 502
505 TabImage* tab_image = &tab_active_; 503 TabImage* tab_image = &tab_active_;
(...skipping 18 matching lines...) Expand all
524 canvas->TileImageInt(*tab_bg, 522 canvas->TileImageInt(*tab_bg,
525 offset + tab_image->l_width, 523 offset + tab_image->l_width,
526 kDropShadowHeight + tab_image->y_offset, 524 kDropShadowHeight + tab_image->y_offset,
527 tab_image->l_width, 525 tab_image->l_width,
528 kDropShadowHeight + tab_image->y_offset, 526 kDropShadowHeight + tab_image->y_offset,
529 width() - tab_image->l_width - tab_image->r_width, 527 width() - tab_image->l_width - tab_image->r_width,
530 height() - kDropShadowHeight - tab_image->y_offset); 528 height() - kDropShadowHeight - tab_image->y_offset);
531 529
532 // Now draw the highlights/shadows around the tab edge. 530 // Now draw the highlights/shadows around the tab edge.
533 canvas->DrawBitmapInt(*tab_image->image_l, 0, 0); 531 canvas->DrawBitmapInt(*tab_image->image_l, 0, 0);
534 canvas->TileImageInt(*tab_image->image_c, tab_image->l_width, 0, 532 canvas->TileImage(*tab_image->image_c, gfx::Rect(tab_image->l_width, 0,
535 width() - tab_image->l_width - tab_image->r_width, height()); 533 width() - tab_image->l_width - tab_image->r_width, height()));
536 canvas->DrawBitmapInt(*tab_image->image_r, width() - tab_image->r_width, 0); 534 canvas->DrawBitmapInt(*tab_image->image_r, width() - tab_image->r_width, 0);
537 } 535 }
538 536
539 int Tab::IconCapacity() const { 537 int Tab::IconCapacity() const {
540 if (height() < GetMinimumUnselectedSize().height()) 538 if (height() < GetMinimumUnselectedSize().height())
541 return 0; 539 return 0;
542 return (width() - kLeftPadding - kRightPadding) / kTabIconSize; 540 return (width() - kLeftPadding - kRightPadding) / kTabIconSize;
543 } 541 }
544 542
545 bool Tab::ShouldShowIcon() const { 543 bool Tab::ShouldShowIcon() const {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 tab_active_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); 602 tab_active_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT);
605 tab_active_.l_width = tab_active_.image_l->width(); 603 tab_active_.l_width = tab_active_.image_l->width();
606 tab_active_.r_width = tab_active_.image_r->width(); 604 tab_active_.r_width = tab_active_.image_r->width();
607 605
608 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); 606 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT);
609 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); 607 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER);
610 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); 608 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT);
611 tab_inactive_.l_width = tab_inactive_.image_l->width(); 609 tab_inactive_.l_width = tab_inactive_.image_l->width();
612 tab_inactive_.r_width = tab_inactive_.image_r->width(); 610 tab_inactive_.r_width = tab_inactive_.image_r->width();
613 } 611 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/opaque_browser_frame_view.cc ('k') | chrome/common/extensions/extension_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698