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

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: reland 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) 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/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"
(...skipping 468 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 canvas->TileImage(*tab_inactive_image->image_c,
490 tab_inactive_image->l_width, 0, 490 gfx::Rect(tab_inactive_image->l_width, 0,
491 width() - tab_inactive_image->l_width - 491 width() - tab_inactive_image->l_width -
492 tab_inactive_image->r_width, 492 tab_inactive_image->r_width,
493 height()); 493 height()));
494 canvas->DrawBitmapInt(*tab_inactive_image->image_r, 494 canvas->DrawBitmapInt(*tab_inactive_image->image_r,
495 width() - tab_inactive_image->r_width, 0); 495 width() - tab_inactive_image->r_width, 0);
496 } 496 }
497 497
498 void Tab::PaintActiveTabBackground(gfx::Canvas* canvas) { 498 void Tab::PaintActiveTabBackground(gfx::Canvas* canvas) {
499 int offset = GetMirroredX() + background_offset_.x(); 499 int offset = GetMirroredX() + background_offset_.x();
500 ui::ThemeProvider* tp = GetThemeProvider(); 500 ui::ThemeProvider* tp = GetThemeProvider();
501 DCHECK(tp) << "Unable to get theme provider"; 501 DCHECK(tp) << "Unable to get theme provider";
502 502
503 SkBitmap* tab_bg = GetThemeProvider()->GetBitmapNamed(IDR_THEME_TOOLBAR); 503 SkBitmap* tab_bg = GetThemeProvider()->GetBitmapNamed(IDR_THEME_TOOLBAR);
(...skipping 20 matching lines...) Expand all
524 canvas->TileImageInt(*tab_bg, 524 canvas->TileImageInt(*tab_bg,
525 offset + tab_image->l_width, 525 offset + tab_image->l_width,
526 kDropShadowHeight + tab_image->y_offset, 526 kDropShadowHeight + tab_image->y_offset,
527 tab_image->l_width, 527 tab_image->l_width,
528 kDropShadowHeight + tab_image->y_offset, 528 kDropShadowHeight + tab_image->y_offset,
529 width() - tab_image->l_width - tab_image->r_width, 529 width() - tab_image->l_width - tab_image->r_width,
530 height() - kDropShadowHeight - tab_image->y_offset); 530 height() - kDropShadowHeight - tab_image->y_offset);
531 531
532 // Now draw the highlights/shadows around the tab edge. 532 // Now draw the highlights/shadows around the tab edge.
533 canvas->DrawBitmapInt(*tab_image->image_l, 0, 0); 533 canvas->DrawBitmapInt(*tab_image->image_l, 0, 0);
534 canvas->TileImageInt(*tab_image->image_c, tab_image->l_width, 0, 534 canvas->TileImage(*tab_image->image_c, gfx::Rect(tab_image->l_width, 0,
535 width() - tab_image->l_width - tab_image->r_width, height()); 535 width() - tab_image->l_width - tab_image->r_width, height()));
536 canvas->DrawBitmapInt(*tab_image->image_r, width() - tab_image->r_width, 0); 536 canvas->DrawBitmapInt(*tab_image->image_r, width() - tab_image->r_width, 0);
537 } 537 }
538 538
539 int Tab::IconCapacity() const { 539 int Tab::IconCapacity() const {
540 if (height() < GetMinimumUnselectedSize().height()) 540 if (height() < GetMinimumUnselectedSize().height())
541 return 0; 541 return 0;
542 return (width() - kLeftPadding - kRightPadding) / kTabIconSize; 542 return (width() - kLeftPadding - kRightPadding) / kTabIconSize;
543 } 543 }
544 544
545 bool Tab::ShouldShowIcon() const { 545 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); 604 tab_active_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT);
605 tab_active_.l_width = tab_active_.image_l->width(); 605 tab_active_.l_width = tab_active_.image_l->width();
606 tab_active_.r_width = tab_active_.image_r->width(); 606 tab_active_.r_width = tab_active_.image_r->width();
607 607
608 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); 608 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT);
609 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); 609 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER);
610 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); 610 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT);
611 tab_inactive_.l_width = tab_inactive_.image_l->width(); 611 tab_inactive_.l_width = tab_inactive_.image_l->width();
612 tab_inactive_.r_width = tab_inactive_.image_r->width(); 612 tab_inactive_.r_width = tab_inactive_.image_r->width();
613 } 613 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698