| 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/views/tabs/tab.h" | 5 #include "chrome/browser/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" |
| 11 #include "app/slide_animation.h" | 11 #include "app/slide_animation.h" |
| 12 #include "app/throb_animation.h" | 12 #include "app/throb_animation.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/browser/browser_theme_provider.h" | 14 #include "chrome/browser/browser_theme_provider.h" |
| 15 #include "chrome/browser/defaults.h" | 15 #include "chrome/browser/defaults.h" |
| 16 #include "gfx/canvas.h" | 16 #include "gfx/canvas.h" |
| 17 #include "gfx/canvas_skia.h" |
| 17 #include "gfx/favicon_size.h" | 18 #include "gfx/favicon_size.h" |
| 18 #include "gfx/font.h" | 19 #include "gfx/font.h" |
| 19 #include "gfx/path.h" | 20 #include "gfx/path.h" |
| 20 #include "gfx/skbitmap_operations.h" | 21 #include "gfx/skbitmap_operations.h" |
| 21 #include "grit/app_resources.h" | 22 #include "grit/app_resources.h" |
| 22 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
| 23 #include "grit/theme_resources.h" | 24 #include "grit/theme_resources.h" |
| 24 #include "third_party/skia/include/effects/SkGradientShader.h" | 25 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 25 #include "views/controls/button/image_button.h" | 26 #include "views/controls/button/image_button.h" |
| 26 #include "views/widget/root_view.h" | 27 #include "views/widget/root_view.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 SkCanvas::kARGB_ClipLayer_SaveFlag); | 386 SkCanvas::kARGB_ClipLayer_SaveFlag); |
| 386 canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); | 387 canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode); |
| 387 PaintActiveTabBackground(canvas); | 388 PaintActiveTabBackground(canvas); |
| 388 canvas->restore(); | 389 canvas->restore(); |
| 389 } | 390 } |
| 390 } | 391 } |
| 391 } | 392 } |
| 392 | 393 |
| 393 void Tab::PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas) { | 394 void Tab::PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas) { |
| 394 // Render the inactive tab background. We'll use this for clipping. | 395 // Render the inactive tab background. We'll use this for clipping. |
| 395 gfx::Canvas background_canvas(width(), height(), false); | 396 gfx::CanvasSkia background_canvas(width(), height(), false); |
| 396 PaintInactiveTabBackground(&background_canvas); | 397 PaintInactiveTabBackground(background_canvas.AsCanvas()); |
| 397 | 398 |
| 398 SkBitmap background_image = background_canvas.ExtractBitmap(); | 399 SkBitmap background_image = background_canvas.ExtractBitmap(); |
| 399 | 400 |
| 400 // Draw a radial gradient to hover_canvas. | 401 // Draw a radial gradient to hover_canvas. |
| 401 gfx::Canvas hover_canvas(width(), height(), false); | 402 gfx::CanvasSkia hover_canvas(width(), height(), false); |
| 402 int radius = kMiniTitleChangeGradientRadius; | 403 int radius = kMiniTitleChangeGradientRadius; |
| 403 int x0 = width() + radius - kMiniTitleChangeInitialXOffset; | 404 int x0 = width() + radius - kMiniTitleChangeInitialXOffset; |
| 404 int x1 = radius; | 405 int x1 = radius; |
| 405 int x2 = -radius; | 406 int x2 = -radius; |
| 406 int x; | 407 int x; |
| 407 if (mini_title_animation_->current_part_index() == 0) { | 408 if (mini_title_animation_->current_part_index() == 0) { |
| 408 x = mini_title_animation_->CurrentValueBetween(x0, x1); | 409 x = mini_title_animation_->CurrentValueBetween(x0, x1); |
| 409 } else if (mini_title_animation_->current_part_index() == 1) { | 410 } else if (mini_title_animation_->current_part_index() == 1) { |
| 410 x = x1; | 411 x = x1; |
| 411 } else { | 412 } else { |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 tab_inactive.l_width = tab_inactive.image_l->width(); | 636 tab_inactive.l_width = tab_inactive.image_l->width(); |
| 636 tab_inactive.r_width = tab_inactive.image_r->width(); | 637 tab_inactive.r_width = tab_inactive.image_r->width(); |
| 637 | 638 |
| 638 tab_inactive_nano.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_NANO_LEFT); | 639 tab_inactive_nano.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_NANO_LEFT); |
| 639 tab_inactive_nano.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_NANO_CENTER); | 640 tab_inactive_nano.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_NANO_CENTER); |
| 640 tab_inactive_nano.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_NANO_RIGHT); | 641 tab_inactive_nano.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_NANO_RIGHT); |
| 641 tab_inactive_nano.l_width = tab_inactive_nano.image_l->width(); | 642 tab_inactive_nano.l_width = tab_inactive_nano.image_l->width(); |
| 642 tab_inactive_nano.r_width = tab_inactive_nano.image_r->width(); | 643 tab_inactive_nano.r_width = tab_inactive_nano.image_r->width(); |
| 643 tab_inactive_nano.y_offset = kNanoTabDiffHeight; | 644 tab_inactive_nano.y_offset = kNanoTabDiffHeight; |
| 644 } | 645 } |
| OLD | NEW |