OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 int x1 = radius; | 392 int x1 = radius; |
393 int x2 = -radius; | 393 int x2 = -radius; |
394 int x; | 394 int x; |
395 if (mini_title_animation_->current_part_index() == 0) { | 395 if (mini_title_animation_->current_part_index() == 0) { |
396 x = mini_title_animation_->CurrentValueBetween(x0, x1); | 396 x = mini_title_animation_->CurrentValueBetween(x0, x1); |
397 } else if (mini_title_animation_->current_part_index() == 1) { | 397 } else if (mini_title_animation_->current_part_index() == 1) { |
398 x = x1; | 398 x = x1; |
399 } else { | 399 } else { |
400 x = mini_title_animation_->CurrentValueBetween(x1, x2); | 400 x = mini_title_animation_->CurrentValueBetween(x1, x2); |
401 } | 401 } |
| 402 SkPoint center_point; |
| 403 center_point.iset(x, 0); |
| 404 SkColor colors[2] = { kMiniTitleChangeGradientColor1, |
| 405 kMiniTitleChangeGradientColor2 }; |
| 406 SkShader* shader = SkGradientShader::CreateRadial(center_point, |
| 407 SkIntToScalar(radius), colors, NULL, 2, SkShader::kClamp_TileMode); |
402 SkPaint paint; | 408 SkPaint paint; |
403 SkPoint loc = { SkIntToScalar(x), SkIntToScalar(0) }; | |
404 SkColor colors[2]; | |
405 colors[0] = kMiniTitleChangeGradientColor1; | |
406 colors[1] = kMiniTitleChangeGradientColor2; | |
407 SkShader* shader = SkGradientShader::CreateRadial( | |
408 loc, | |
409 SkIntToScalar(radius), | |
410 colors, | |
411 NULL, | |
412 2, | |
413 SkShader::kClamp_TileMode); | |
414 paint.setShader(shader); | 409 paint.setShader(shader); |
415 shader->unref(); | 410 shader->unref(); |
416 hover_canvas.DrawRect(gfx::Rect(x - radius, -radius, radius * 2, radius * 2), | 411 hover_canvas.DrawRect(gfx::Rect(x - radius, -radius, radius * 2, radius * 2), |
417 paint); | 412 paint); |
418 | 413 |
419 // Draw the radial gradient clipped to the background into hover_image. | 414 // Draw the radial gradient clipped to the background into hover_image. |
420 SkBitmap hover_image = SkBitmapOperations::CreateMaskedBitmap( | 415 SkBitmap hover_image = SkBitmapOperations::CreateMaskedBitmap( |
421 hover_canvas.ExtractBitmap(), background_image); | 416 hover_canvas.ExtractBitmap(), background_image); |
422 | 417 |
423 // Draw the tab background to the canvas. | 418 // Draw the tab background to the canvas. |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 tab_active_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); | 619 tab_active_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); |
625 tab_active_.l_width = tab_active_.image_l->width(); | 620 tab_active_.l_width = tab_active_.image_l->width(); |
626 tab_active_.r_width = tab_active_.image_r->width(); | 621 tab_active_.r_width = tab_active_.image_r->width(); |
627 | 622 |
628 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); | 623 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); |
629 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); | 624 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); |
630 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); | 625 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); |
631 tab_inactive_.l_width = tab_inactive_.image_l->width(); | 626 tab_inactive_.l_width = tab_inactive_.image_l->width(); |
632 tab_inactive_.r_width = tab_inactive_.image_r->width(); | 627 tab_inactive_.r_width = tab_inactive_.image_r->width(); |
633 } | 628 } |
OLD | NEW |