| 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 26 matching lines...) Expand all Loading... |
| 37 #include "ui/gfx/codec/jpeg_codec.h" | 37 #include "ui/gfx/codec/jpeg_codec.h" |
| 38 #include "ui/gfx/codec/png_codec.h" | 38 #include "ui/gfx/codec/png_codec.h" |
| 39 #include "ui/gfx/geometry/safe_integer_conversions.h" | 39 #include "ui/gfx/geometry/safe_integer_conversions.h" |
| 40 #include "ui/gfx/geometry/size_conversions.h" | 40 #include "ui/gfx/geometry/size_conversions.h" |
| 41 #include "ui/gfx/image/image_skia.h" | 41 #include "ui/gfx/image/image_skia.h" |
| 42 #include "ui/gfx/image/image_skia_source.h" | 42 #include "ui/gfx/image/image_skia_source.h" |
| 43 #include "ui/strings/grit/app_locale_settings.h" | 43 #include "ui/strings/grit/app_locale_settings.h" |
| 44 | 44 |
| 45 #if defined(OS_ANDROID) | 45 #if defined(OS_ANDROID) |
| 46 #include "ui/base/resource/resource_bundle_android.h" | 46 #include "ui/base/resource/resource_bundle_android.h" |
| 47 #include "ui/gfx/android/device_display_info.h" | |
| 48 #endif | 47 #endif |
| 49 | 48 |
| 50 #if defined(OS_CHROMEOS) | 49 #if defined(OS_CHROMEOS) |
| 51 #include "ui/gfx/platform_font_linux.h" | 50 #include "ui/gfx/platform_font_linux.h" |
| 52 #endif | 51 #endif |
| 53 | 52 |
| 54 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
| 55 #include "ui/display/win/dpi.h" | 54 #include "ui/display/win/dpi.h" |
| 56 #endif | 55 #endif |
| 57 | 56 |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 #if !defined(OS_IOS) | 685 #if !defined(OS_IOS) |
| 687 // On platforms other than iOS, 100P is always a supported scale factor. | 686 // On platforms other than iOS, 100P is always a supported scale factor. |
| 688 // For Windows we have a separate case in this function. | 687 // For Windows we have a separate case in this function. |
| 689 supported_scale_factors.push_back(SCALE_FACTOR_100P); | 688 supported_scale_factors.push_back(SCALE_FACTOR_100P); |
| 690 #endif | 689 #endif |
| 691 #if defined(OS_ANDROID) | 690 #if defined(OS_ANDROID) |
| 692 float display_density; | 691 float display_density; |
| 693 if (display::Display::HasForceDeviceScaleFactor()) { | 692 if (display::Display::HasForceDeviceScaleFactor()) { |
| 694 display_density = display::Display::GetForcedDeviceScaleFactor(); | 693 display_density = display::Display::GetForcedDeviceScaleFactor(); |
| 695 } else { | 694 } else { |
| 696 gfx::DeviceDisplayInfo device_info; | 695 display_density = GetPrimaryDisplayScale(); |
| 697 display_density = device_info.GetDIPScale(); | |
| 698 } | 696 } |
| 699 const ScaleFactor closest = FindClosestScaleFactorUnsafe(display_density); | 697 const ScaleFactor closest = FindClosestScaleFactorUnsafe(display_density); |
| 700 if (closest != SCALE_FACTOR_100P) | 698 if (closest != SCALE_FACTOR_100P) |
| 701 supported_scale_factors.push_back(closest); | 699 supported_scale_factors.push_back(closest); |
| 702 #elif defined(OS_IOS) | 700 #elif defined(OS_IOS) |
| 703 display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay(); | 701 display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay(); |
| 704 if (display.device_scale_factor() > 2.0) { | 702 if (display.device_scale_factor() > 2.0) { |
| 705 DCHECK_EQ(3.0, display.device_scale_factor()); | 703 DCHECK_EQ(3.0, display.device_scale_factor()); |
| 706 supported_scale_factors.push_back(SCALE_FACTOR_300P); | 704 supported_scale_factors.push_back(SCALE_FACTOR_300P); |
| 707 } else if (display.device_scale_factor() > 1.0) { | 705 } else if (display.device_scale_factor() > 1.0) { |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 // static | 898 // static |
| 901 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 899 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
| 902 size_t size, | 900 size_t size, |
| 903 SkBitmap* bitmap, | 901 SkBitmap* bitmap, |
| 904 bool* fell_back_to_1x) { | 902 bool* fell_back_to_1x) { |
| 905 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 903 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
| 906 return gfx::PNGCodec::Decode(buf, size, bitmap); | 904 return gfx::PNGCodec::Decode(buf, size, bitmap); |
| 907 } | 905 } |
| 908 | 906 |
| 909 } // namespace ui | 907 } // namespace ui |
| OLD | NEW |