| OLD | NEW |
| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 colors[1] = kMiniTitleChangeGradientColor2; | 390 colors[1] = kMiniTitleChangeGradientColor2; |
| 391 SkShader* shader = SkGradientShader::CreateRadial( | 391 SkShader* shader = SkGradientShader::CreateRadial( |
| 392 loc, | 392 loc, |
| 393 SkIntToScalar(radius), | 393 SkIntToScalar(radius), |
| 394 colors, | 394 colors, |
| 395 NULL, | 395 NULL, |
| 396 2, | 396 2, |
| 397 SkShader::kClamp_TileMode); | 397 SkShader::kClamp_TileMode); |
| 398 paint.setShader(shader); | 398 paint.setShader(shader); |
| 399 shader->unref(); | 399 shader->unref(); |
| 400 hover_canvas.DrawRect(gfx::Rect(x - radius, -radius, radius * 2, radius * 2), | 400 hover_canvas.DrawRectInt(x - radius, -radius, radius * 2, radius * 2, paint); |
| 401 paint); | |
| 402 | 401 |
| 403 // Draw the radial gradient clipped to the background into hover_image. | 402 // Draw the radial gradient clipped to the background into hover_image. |
| 404 SkBitmap hover_image = SkBitmapOperations::CreateMaskedBitmap( | 403 SkBitmap hover_image = SkBitmapOperations::CreateMaskedBitmap( |
| 405 hover_canvas.ExtractBitmap(), background_image); | 404 hover_canvas.ExtractBitmap(), background_image); |
| 406 | 405 |
| 407 // Draw the tab background to the canvas. | 406 // Draw the tab background to the canvas. |
| 408 canvas->DrawBitmapInt(background_image, 0, 0); | 407 canvas->DrawBitmapInt(background_image, 0, 0); |
| 409 | 408 |
| 410 // And then the gradient on top of that. | 409 // And then the gradient on top of that. |
| 411 if (mini_title_animation_->current_part_index() == 2) { | 410 if (mini_title_animation_->current_part_index() == 2) { |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 SkIntToScalar(radius), | 570 SkIntToScalar(radius), |
| 572 colors, | 571 colors, |
| 573 NULL, | 572 NULL, |
| 574 2, | 573 2, |
| 575 SkShader::kClamp_TileMode); | 574 SkShader::kClamp_TileMode); |
| 576 // Shader can end up null when radius = 0. | 575 // Shader can end up null when radius = 0. |
| 577 // If so, this results in default full tab glow behavior. | 576 // If so, this results in default full tab glow behavior. |
| 578 if (shader) { | 577 if (shader) { |
| 579 paint.setShader(shader); | 578 paint.setShader(shader); |
| 580 shader->unref(); | 579 shader->unref(); |
| 581 gfx::Rect paint_rect(hover_point_, gfx::Size()); | 580 hover_canvas.DrawRectInt(hover_point_.x() - radius, |
| 582 paint_rect.Inset(-radius, -radius); | 581 hover_point_.y() - radius, |
| 583 hover_canvas.DrawRect(paint_rect, paint); | 582 radius * 2, radius * 2, paint); |
| 584 } | 583 } |
| 585 return hover_canvas.ExtractBitmap(); | 584 return hover_canvas.ExtractBitmap(); |
| 586 } | 585 } |
| 587 | 586 |
| 588 int Tab::IconCapacity() const { | 587 int Tab::IconCapacity() const { |
| 589 if (height() < GetMinimumUnselectedSize().height()) | 588 if (height() < GetMinimumUnselectedSize().height()) |
| 590 return 0; | 589 return 0; |
| 591 return (width() - kLeftPadding - kRightPadding) / kTabIconSize; | 590 return (width() - kLeftPadding - kRightPadding) / kTabIconSize; |
| 592 } | 591 } |
| 593 | 592 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 tab_active_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); | 650 tab_active_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); |
| 652 tab_active_.l_width = tab_active_.image_l->width(); | 651 tab_active_.l_width = tab_active_.image_l->width(); |
| 653 tab_active_.r_width = tab_active_.image_r->width(); | 652 tab_active_.r_width = tab_active_.image_r->width(); |
| 654 | 653 |
| 655 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); | 654 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); |
| 656 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); | 655 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); |
| 657 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); | 656 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); |
| 658 tab_inactive_.l_width = tab_inactive_.image_l->width(); | 657 tab_inactive_.l_width = tab_inactive_.image_l->width(); |
| 659 tab_inactive_.r_width = tab_inactive_.image_r->width(); | 658 tab_inactive_.r_width = tab_inactive_.image_r->width(); |
| 660 } | 659 } |
| OLD | NEW |