| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/multi_animation.h" | 9 #include "app/multi_animation.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 } | 596 } |
| 597 colors[0] = SkColorSetARGB(hover_alpha, 255, 255, 255); | 597 colors[0] = SkColorSetARGB(hover_alpha, 255, 255, 255); |
| 598 colors[1] = SkColorSetARGB(0, 255, 255, 255); | 598 colors[1] = SkColorSetARGB(0, 255, 255, 255); |
| 599 SkShader* shader = SkGradientShader::CreateRadial( | 599 SkShader* shader = SkGradientShader::CreateRadial( |
| 600 loc, | 600 loc, |
| 601 SkIntToScalar(radius), | 601 SkIntToScalar(radius), |
| 602 colors, | 602 colors, |
| 603 NULL, | 603 NULL, |
| 604 2, | 604 2, |
| 605 SkShader::kClamp_TileMode); | 605 SkShader::kClamp_TileMode); |
| 606 paint.setShader(shader); | 606 // Shader can end up null when radius = 0. |
| 607 shader->unref(); | 607 // If so, this results in default full tab glow behavior. |
| 608 hover_canvas.DrawRectInt(hover_point_.x() - radius, | 608 if (shader) { |
| 609 hover_point_.y() - radius, | 609 paint.setShader(shader); |
| 610 radius * 2, radius * 2, paint); | 610 shader->unref(); |
| 611 | 611 hover_canvas.DrawRectInt(hover_point_.x() - radius, |
| 612 hover_point_.y() - radius, |
| 613 radius * 2, radius * 2, paint); |
| 614 } |
| 612 return hover_canvas.ExtractBitmap(); | 615 return hover_canvas.ExtractBitmap(); |
| 613 } | 616 } |
| 614 | 617 |
| 615 int Tab::IconCapacity() const { | 618 int Tab::IconCapacity() const { |
| 616 if (height() < GetMinimumUnselectedSize().height()) | 619 if (height() < GetMinimumUnselectedSize().height()) |
| 617 return 0; | 620 return 0; |
| 618 return (width() - kLeftPadding - kRightPadding) / kFavIconSize; | 621 return (width() - kLeftPadding - kRightPadding) / kFavIconSize; |
| 619 } | 622 } |
| 620 | 623 |
| 621 bool Tab::ShouldShowIcon() const { | 624 bool Tab::ShouldShowIcon() const { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 tab_active.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); | 664 tab_active.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); |
| 662 tab_active.l_width = tab_active.image_l->width(); | 665 tab_active.l_width = tab_active.image_l->width(); |
| 663 tab_active.r_width = tab_active.image_r->width(); | 666 tab_active.r_width = tab_active.image_r->width(); |
| 664 | 667 |
| 665 tab_inactive.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); | 668 tab_inactive.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); |
| 666 tab_inactive.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); | 669 tab_inactive.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); |
| 667 tab_inactive.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); | 670 tab_inactive.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); |
| 668 tab_inactive.l_width = tab_inactive.image_l->width(); | 671 tab_inactive.l_width = tab_inactive.image_l->width(); |
| 669 tab_inactive.r_width = tab_inactive.image_r->width(); | 672 tab_inactive.r_width = tab_inactive.image_r->width(); |
| 670 } | 673 } |
| OLD | NEW |