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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
(...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 x = mini_title_animation_->CurrentValueBetween(x0, x1); | 1093 x = mini_title_animation_->CurrentValueBetween(x0, x1); |
1094 } else if (mini_title_animation_->current_part_index() == 1) { | 1094 } else if (mini_title_animation_->current_part_index() == 1) { |
1095 x = x1; | 1095 x = x1; |
1096 } else { | 1096 } else { |
1097 x = mini_title_animation_->CurrentValueBetween(x1, x2); | 1097 x = mini_title_animation_->CurrentValueBetween(x1, x2); |
1098 } | 1098 } |
1099 SkPoint center_point; | 1099 SkPoint center_point; |
1100 center_point.iset(x, 0); | 1100 center_point.iset(x, 0); |
1101 SkColor colors[2] = { kMiniTitleChangeGradientColor1, | 1101 SkColor colors[2] = { kMiniTitleChangeGradientColor1, |
1102 kMiniTitleChangeGradientColor2 }; | 1102 kMiniTitleChangeGradientColor2 }; |
1103 SkShader* shader = SkGradientShader::CreateRadial(center_point, | 1103 skia::RefPtr<SkShader> shader = SkGradientShader::CreateRadial(center_point, |
1104 SkIntToScalar(radius), colors, NULL, 2, SkShader::kClamp_TileMode); | 1104 SkIntToScalar(radius), colors, NULL, 2, SkShader::kClamp_TileMode); |
1105 SkPaint paint; | 1105 SkPaint paint; |
1106 paint.setShader(shader); | 1106 paint.setShader(shader.get()); |
1107 shader->unref(); | |
1108 hover_canvas.DrawRect(gfx::Rect(x - radius, -radius, radius * 2, radius * 2), | 1107 hover_canvas.DrawRect(gfx::Rect(x - radius, -radius, radius * 2, radius * 2), |
1109 paint); | 1108 paint); |
1110 | 1109 |
1111 // Draw the radial gradient clipped to the background into hover_image. | 1110 // Draw the radial gradient clipped to the background into hover_image. |
1112 gfx::ImageSkia hover_image = gfx::ImageSkiaOperations::CreateMaskedImage( | 1111 gfx::ImageSkia hover_image = gfx::ImageSkiaOperations::CreateMaskedImage( |
1113 gfx::ImageSkia(hover_canvas.ExtractImageRep()), background_image); | 1112 gfx::ImageSkia(hover_canvas.ExtractImageRep()), background_image); |
1114 | 1113 |
1115 // Draw the tab background to the canvas. | 1114 // Draw the tab background to the canvas. |
1116 canvas->DrawImageInt(background_image, 0, 0); | 1115 canvas->DrawImageInt(background_image, 0, 0); |
1117 | 1116 |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 const gfx::ImageSkia& image) { | 1564 const gfx::ImageSkia& image) { |
1566 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1565 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
1567 ImageCacheEntry entry; | 1566 ImageCacheEntry entry; |
1568 entry.resource_id = resource_id; | 1567 entry.resource_id = resource_id; |
1569 entry.scale_factor = scale_factor; | 1568 entry.scale_factor = scale_factor; |
1570 entry.image = image; | 1569 entry.image = image; |
1571 image_cache_->push_front(entry); | 1570 image_cache_->push_front(entry); |
1572 if (image_cache_->size() > kMaxImageCacheSize) | 1571 if (image_cache_->size() > kMaxImageCacheSize) |
1573 image_cache_->pop_back(); | 1572 image_cache_->pop_back(); |
1574 } | 1573 } |
OLD | NEW |