| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "base/synchronization/lock.h" | 25 #include "base/synchronization/lock.h" |
| 26 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 27 #include "skia/ext/image_operations.h" | 27 #include "skia/ext/image_operations.h" |
| 28 #include "third_party/skia/include/core/SkBitmap.h" | 28 #include "third_party/skia/include/core/SkBitmap.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/base/layout.h" | 30 #include "ui/base/layout.h" |
| 31 #include "ui/base/material_design/material_design_controller.h" | 31 #include "ui/base/material_design/material_design_controller.h" |
| 32 #include "ui/base/resource/data_pack.h" | 32 #include "ui/base/resource/data_pack.h" |
| 33 #include "ui/base/ui_base_paths.h" | 33 #include "ui/base/ui_base_paths.h" |
| 34 #include "ui/base/ui_base_switches.h" | 34 #include "ui/base/ui_base_switches.h" |
| 35 #include "ui/base/ui_features.h" |
| 35 #include "ui/gfx/codec/jpeg_codec.h" | 36 #include "ui/gfx/codec/jpeg_codec.h" |
| 36 #include "ui/gfx/codec/png_codec.h" | 37 #include "ui/gfx/codec/png_codec.h" |
| 37 #include "ui/gfx/geometry/safe_integer_conversions.h" | 38 #include "ui/gfx/geometry/safe_integer_conversions.h" |
| 38 #include "ui/gfx/geometry/size_conversions.h" | 39 #include "ui/gfx/geometry/size_conversions.h" |
| 39 #include "ui/gfx/image/image_skia.h" | 40 #include "ui/gfx/image/image_skia.h" |
| 40 #include "ui/gfx/image/image_skia_source.h" | 41 #include "ui/gfx/image/image_skia_source.h" |
| 41 #include "ui/gfx/screen.h" | 42 #include "ui/gfx/screen.h" |
| 42 #include "ui/strings/grit/app_locale_settings.h" | 43 #include "ui/strings/grit/app_locale_settings.h" |
| 43 | 44 |
| 44 #if defined(OS_ANDROID) | 45 #if defined(OS_ANDROID) |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 supported_scale_factors.push_back(SCALE_FACTOR_200P); | 631 supported_scale_factors.push_back(SCALE_FACTOR_200P); |
| 631 } else { | 632 } else { |
| 632 supported_scale_factors.push_back(SCALE_FACTOR_100P); | 633 supported_scale_factors.push_back(SCALE_FACTOR_100P); |
| 633 } | 634 } |
| 634 #elif defined(OS_MACOSX) | 635 #elif defined(OS_MACOSX) |
| 635 if (base::mac::IsOSLionOrLater()) | 636 if (base::mac::IsOSLionOrLater()) |
| 636 supported_scale_factors.push_back(SCALE_FACTOR_200P); | 637 supported_scale_factors.push_back(SCALE_FACTOR_200P); |
| 637 #elif defined(OS_CHROMEOS) | 638 #elif defined(OS_CHROMEOS) |
| 638 // TODO(oshima): Include 200P only if the device support 200P | 639 // TODO(oshima): Include 200P only if the device support 200P |
| 639 supported_scale_factors.push_back(SCALE_FACTOR_200P); | 640 supported_scale_factors.push_back(SCALE_FACTOR_200P); |
| 640 #elif defined(OS_LINUX) && defined(ENABLE_HIDPI) | 641 #elif defined(OS_LINUX) && BUILDFLAG(ENABLE_HIDPI) |
| 641 supported_scale_factors.push_back(SCALE_FACTOR_200P); | 642 supported_scale_factors.push_back(SCALE_FACTOR_200P); |
| 642 #elif defined(OS_WIN) | 643 #elif defined(OS_WIN) |
| 643 bool default_to_100P = true; | 644 bool default_to_100P = true; |
| 644 // On Windows if the dpi scale is greater than 1.25 on high dpi machines | 645 // On Windows if the dpi scale is greater than 1.25 on high dpi machines |
| 645 // downscaling from 200 percent looks better than scaling up from 100 | 646 // downscaling from 200 percent looks better than scaling up from 100 |
| 646 // percent. | 647 // percent. |
| 647 if (gfx::GetDPIScale() > 1.25) { | 648 if (gfx::GetDPIScale() > 1.25) { |
| 648 supported_scale_factors.push_back(SCALE_FACTOR_200P); | 649 supported_scale_factors.push_back(SCALE_FACTOR_200P); |
| 649 default_to_100P = false; | 650 default_to_100P = false; |
| 650 } | 651 } |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 // static | 874 // static |
| 874 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 875 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
| 875 size_t size, | 876 size_t size, |
| 876 SkBitmap* bitmap, | 877 SkBitmap* bitmap, |
| 877 bool* fell_back_to_1x) { | 878 bool* fell_back_to_1x) { |
| 878 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 879 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
| 879 return gfx::PNGCodec::Decode(buf, size, bitmap); | 880 return gfx::PNGCodec::Decode(buf, size, bitmap); |
| 880 } | 881 } |
| 881 | 882 |
| 882 } // namespace ui | 883 } // namespace ui |
| OLD | NEW |