| 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 "ui/base/resource/resource_bundle.h" | 5 #include "ui/base/resource/resource_bundle.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/big_endian.h" | 10 #include "base/big_endian.h" |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 #elif defined(OS_MACOSX) | 622 #elif defined(OS_MACOSX) |
| 623 if (base::mac::IsOSLionOrLater()) | 623 if (base::mac::IsOSLionOrLater()) |
| 624 supported_scale_factors.push_back(SCALE_FACTOR_200P); | 624 supported_scale_factors.push_back(SCALE_FACTOR_200P); |
| 625 #elif defined(OS_CHROMEOS) | 625 #elif defined(OS_CHROMEOS) |
| 626 // TODO(oshima): Include 200P only if the device support 200P | 626 // TODO(oshima): Include 200P only if the device support 200P |
| 627 supported_scale_factors.push_back(SCALE_FACTOR_200P); | 627 supported_scale_factors.push_back(SCALE_FACTOR_200P); |
| 628 #elif defined(OS_LINUX) && defined(ENABLE_HIDPI) | 628 #elif defined(OS_LINUX) && defined(ENABLE_HIDPI) |
| 629 supported_scale_factors.push_back(SCALE_FACTOR_200P); | 629 supported_scale_factors.push_back(SCALE_FACTOR_200P); |
| 630 #elif defined(OS_WIN) | 630 #elif defined(OS_WIN) |
| 631 bool default_to_100P = true; | 631 bool default_to_100P = true; |
| 632 if (gfx::IsHighDPIEnabled()) { | 632 // On Windows if the dpi scale is greater than 1.25 on high dpi machines |
| 633 // On Windows if the dpi scale is greater than 1.25 on high dpi machines | 633 // downscaling from 200 percent looks better than scaling up from 100 |
| 634 // downscaling from 200 percent looks better than scaling up from 100 | 634 // percent. |
| 635 // percent. | 635 if (gfx::GetDPIScale() > 1.25) { |
| 636 if (gfx::GetDPIScale() > 1.25) { | 636 supported_scale_factors.push_back(SCALE_FACTOR_200P); |
| 637 supported_scale_factors.push_back(SCALE_FACTOR_200P); | 637 default_to_100P = false; |
| 638 default_to_100P = false; | |
| 639 } | |
| 640 } | 638 } |
| 641 if (default_to_100P) | 639 if (default_to_100P) |
| 642 supported_scale_factors.push_back(SCALE_FACTOR_100P); | 640 supported_scale_factors.push_back(SCALE_FACTOR_100P); |
| 643 #endif | 641 #endif |
| 644 ui::SetSupportedScaleFactors(supported_scale_factors); | 642 ui::SetSupportedScaleFactors(supported_scale_factors); |
| 645 #if defined(OS_WIN) | 643 #if defined(OS_WIN) |
| 646 // Must be called _after_ supported scale factors are set since it | 644 // Must be called _after_ supported scale factors are set since it |
| 647 // uses them. | 645 // uses them. |
| 648 gfx::InitDeviceScaleFactor(gfx::GetDPIScale()); | 646 gfx::InitDeviceScaleFactor(gfx::GetDPIScale()); |
| 649 #endif | 647 #endif |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 // static | 853 // static |
| 856 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 854 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
| 857 size_t size, | 855 size_t size, |
| 858 SkBitmap* bitmap, | 856 SkBitmap* bitmap, |
| 859 bool* fell_back_to_1x) { | 857 bool* fell_back_to_1x) { |
| 860 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 858 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
| 861 return gfx::PNGCodec::Decode(buf, size, bitmap); | 859 return gfx::PNGCodec::Decode(buf, size, bitmap); |
| 862 } | 860 } |
| 863 | 861 |
| 864 } // namespace ui | 862 } // namespace ui |
| OLD | NEW |