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