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

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

Issue 8476019: ui/gfx: Convert Canvas::DrawRectInt() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 colors[1] = kMiniTitleChangeGradientColor2; 395 colors[1] = kMiniTitleChangeGradientColor2;
396 SkShader* shader = SkGradientShader::CreateRadial( 396 SkShader* shader = SkGradientShader::CreateRadial(
397 loc, 397 loc,
398 SkIntToScalar(radius), 398 SkIntToScalar(radius),
399 colors, 399 colors,
400 NULL, 400 NULL,
401 2, 401 2,
402 SkShader::kClamp_TileMode); 402 SkShader::kClamp_TileMode);
403 paint.setShader(shader); 403 paint.setShader(shader);
404 shader->unref(); 404 shader->unref();
405 hover_canvas.DrawRectInt(x - radius, -radius, radius * 2, radius * 2, paint); 405 hover_canvas.DrawRect(gfx::Rect(x - radius, -radius, radius * 2, radius * 2),
406 paint);
406 407
407 // Draw the radial gradient clipped to the background into hover_image. 408 // Draw the radial gradient clipped to the background into hover_image.
408 SkBitmap hover_image = SkBitmapOperations::CreateMaskedBitmap( 409 SkBitmap hover_image = SkBitmapOperations::CreateMaskedBitmap(
409 hover_canvas.ExtractBitmap(), background_image); 410 hover_canvas.ExtractBitmap(), background_image);
410 411
411 // Draw the tab background to the canvas. 412 // Draw the tab background to the canvas.
412 canvas->DrawBitmapInt(background_image, 0, 0); 413 canvas->DrawBitmapInt(background_image, 0, 0);
413 414
414 // And then the gradient on top of that. 415 // And then the gradient on top of that.
415 if (mini_title_animation_->current_part_index() == 2) { 416 if (mini_title_animation_->current_part_index() == 2) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 SkIntToScalar(radius), 576 SkIntToScalar(radius),
576 colors, 577 colors,
577 NULL, 578 NULL,
578 2, 579 2,
579 SkShader::kClamp_TileMode); 580 SkShader::kClamp_TileMode);
580 // Shader can end up null when radius = 0. 581 // Shader can end up null when radius = 0.
581 // If so, this results in default full tab glow behavior. 582 // If so, this results in default full tab glow behavior.
582 if (shader) { 583 if (shader) {
583 paint.setShader(shader); 584 paint.setShader(shader);
584 shader->unref(); 585 shader->unref();
585 hover_canvas.DrawRectInt(hover_point_.x() - radius, 586 hover_canvas.DrawRect(gfx::Rect(hover_point_.x() - radius,
Peter Kasting 2011/11/05 01:10:10 Nit: Seems cleaner: gfx::Rect paint_rect(hove
tfarina 2011/11/05 02:23:24 Done.
586 hover_point_.y() - radius, 587 hover_point_.y() - radius,
587 radius * 2, radius * 2, paint); 588 radius * 2, radius * 2), paint);
588 } 589 }
589 return hover_canvas.ExtractBitmap(); 590 return hover_canvas.ExtractBitmap();
590 } 591 }
591 592
592 int Tab::IconCapacity() const { 593 int Tab::IconCapacity() const {
593 if (height() < GetMinimumUnselectedSize().height()) 594 if (height() < GetMinimumUnselectedSize().height())
594 return 0; 595 return 0;
595 return (width() - kLeftPadding - kRightPadding) / kTabIconSize; 596 return (width() - kLeftPadding - kRightPadding) / kTabIconSize;
596 } 597 }
597 598
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 tab_active_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); 656 tab_active_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT);
656 tab_active_.l_width = tab_active_.image_l->width(); 657 tab_active_.l_width = tab_active_.image_l->width();
657 tab_active_.r_width = tab_active_.image_r->width(); 658 tab_active_.r_width = tab_active_.image_r->width();
658 659
659 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); 660 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT);
660 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); 661 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER);
661 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); 662 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT);
662 tab_inactive_.l_width = tab_inactive_.image_l->width(); 663 tab_inactive_.l_width = tab_inactive_.image_l->width();
663 tab_inactive_.r_width = tab_inactive_.image_r->width(); 664 tab_inactive_.r_width = tab_inactive_.image_r->width();
664 } 665 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698