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_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windowsx.h> | 8 #include <windowsx.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 break; | 419 break; |
420 default: | 420 default: |
421 NOTREACHED(); | 421 NOTREACHED(); |
422 break; | 422 break; |
423 } | 423 } |
424 | 424 |
425 gfx::ImageSkia* mask = | 425 gfx::ImageSkia* mask = |
426 GetThemeProvider()->GetImageSkiaNamed(IDR_NEWTAB_BUTTON_MASK); | 426 GetThemeProvider()->GetImageSkiaNamed(IDR_NEWTAB_BUTTON_MASK); |
427 int height = mask->height(); | 427 int height = mask->height(); |
428 int width = mask->width(); | 428 int width = mask->width(); |
| 429 |
| 430 // The canvas and mask has to use the same scale factor. |
| 431 if (!mask->HasRepresentation(scale_factor)) |
| 432 scale_factor = ui::SCALE_FACTOR_100P; |
| 433 |
429 gfx::Canvas canvas(gfx::Size(width, height), scale_factor, false); | 434 gfx::Canvas canvas(gfx::Size(width, height), scale_factor, false); |
430 | 435 |
431 // For custom images the background starts at the top of the tab strip. | 436 // For custom images the background starts at the top of the tab strip. |
432 // Otherwise the background starts at the top of the frame. | 437 // Otherwise the background starts at the top of the frame. |
433 gfx::ImageSkia* background = | 438 gfx::ImageSkia* background = |
434 GetThemeProvider()->GetImageSkiaNamed(background_id); | 439 GetThemeProvider()->GetImageSkiaNamed(background_id); |
435 int offset_y = GetThemeProvider()->HasCustomImage(background_id) ? | 440 int offset_y = GetThemeProvider()->HasCustomImage(background_id) ? |
436 0 : background_offset_.y(); | 441 0 : background_offset_.y(); |
437 | 442 |
438 // The new tab background is mirrored in RTL mode, but the theme background | 443 // The new tab background is mirrored in RTL mode, but the theme background |
(...skipping 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2570 if (!adjust_layout_) | 2575 if (!adjust_layout_) |
2571 return false; | 2576 return false; |
2572 | 2577 |
2573 #if !defined(OS_CHROMEOS) | 2578 #if !defined(OS_CHROMEOS) |
2574 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) | 2579 if (ui::GetDisplayLayout() != ui::LAYOUT_TOUCH) |
2575 return false; | 2580 return false; |
2576 #endif | 2581 #endif |
2577 | 2582 |
2578 return true; | 2583 return true; |
2579 } | 2584 } |
OLD | NEW |