| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 bool is_active, | 1336 bool is_active, |
| 1337 int fill_id, | 1337 int fill_id, |
| 1338 bool has_custom_image, | 1338 bool has_custom_image, |
| 1339 int y_offset) { | 1339 int y_offset) { |
| 1340 gfx::ImageSkia* fill_image = GetThemeProvider()->GetImageSkiaNamed(fill_id); | 1340 gfx::ImageSkia* fill_image = GetThemeProvider()->GetImageSkiaNamed(fill_id); |
| 1341 // The tab image needs to be lined up with the background image | 1341 // The tab image needs to be lined up with the background image |
| 1342 // so that it feels partially transparent. These offsets represent the tab | 1342 // so that it feels partially transparent. These offsets represent the tab |
| 1343 // position within the frame background image. | 1343 // position within the frame background image. |
| 1344 const int x_offset = GetMirroredX() + background_offset_.x(); | 1344 const int x_offset = GetMirroredX() + background_offset_.x(); |
| 1345 | 1345 |
| 1346 const SkScalar radius = SkFloatToScalar(width() / 3.f); | 1346 const SkScalar kMinHoverRadius = 16; |
| 1347 const bool draw_hover = | 1347 const SkScalar radius = |
| 1348 !is_active && hover_controller_.ShouldDraw() && radius > 0; | 1348 std::max(SkFloatToScalar(width() / 4.f), kMinHoverRadius); |
| 1349 const bool draw_hover = !is_active && hover_controller_.ShouldDraw(); |
| 1349 SkPoint hover_location(PointToSkPoint(hover_controller_.location())); | 1350 SkPoint hover_location(PointToSkPoint(hover_controller_.location())); |
| 1350 const SkAlpha hover_alpha = hover_controller_.GetAlpha(); | 1351 const SkAlpha hover_alpha = hover_controller_.GetAlpha(); |
| 1351 | 1352 |
| 1352 if (ui::MaterialDesignController::IsModeMaterial()) { | 1353 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 1353 gfx::ScopedCanvas scoped_canvas(canvas); | 1354 gfx::ScopedCanvas scoped_canvas(canvas); |
| 1354 const float scale = canvas->UndoDeviceScaleFactor(); | 1355 const float scale = canvas->UndoDeviceScaleFactor(); |
| 1355 | 1356 |
| 1356 // Draw the fill. | 1357 // Draw the fill. |
| 1357 SkPath fill; | 1358 SkPath fill; |
| 1358 GetFillPath(scale, &fill); | 1359 GetFillPath(scale, &fill); |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1765 const gfx::ImageSkia& image) { | 1766 const gfx::ImageSkia& image) { |
| 1766 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1767 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
| 1767 ImageCacheEntry entry; | 1768 ImageCacheEntry entry; |
| 1768 entry.resource_id = resource_id; | 1769 entry.resource_id = resource_id; |
| 1769 entry.scale_factor = scale_factor; | 1770 entry.scale_factor = scale_factor; |
| 1770 entry.image = image; | 1771 entry.image = image; |
| 1771 image_cache_->push_front(entry); | 1772 image_cache_->push_front(entry); |
| 1772 if (image_cache_->size() > kMaxImageCacheSize) | 1773 if (image_cache_->size() > kMaxImageCacheSize) |
| 1773 image_cache_->pop_back(); | 1774 image_cache_->pop_back(); |
| 1774 } | 1775 } |
| OLD | NEW |