Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: ui/base/resource/resource_bundle.cc

Issue 1917083002: Move gfx::Display/Screen to display::Display/Screen in ui/base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/layout.cc ('k') | ui/base/resource/resource_bundle_auralinux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15 matching lines...) Expand all
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/base/ui_features.h"
36 #include "ui/display/display.h"
37 #include "ui/display/screen.h"
36 #include "ui/gfx/codec/jpeg_codec.h" 38 #include "ui/gfx/codec/jpeg_codec.h"
37 #include "ui/gfx/codec/png_codec.h" 39 #include "ui/gfx/codec/png_codec.h"
38 #include "ui/gfx/geometry/safe_integer_conversions.h" 40 #include "ui/gfx/geometry/safe_integer_conversions.h"
39 #include "ui/gfx/geometry/size_conversions.h" 41 #include "ui/gfx/geometry/size_conversions.h"
40 #include "ui/gfx/image/image_skia.h" 42 #include "ui/gfx/image/image_skia.h"
41 #include "ui/gfx/image/image_skia_source.h" 43 #include "ui/gfx/image/image_skia_source.h"
42 #include "ui/gfx/screen.h"
43 #include "ui/strings/grit/app_locale_settings.h" 44 #include "ui/strings/grit/app_locale_settings.h"
44 45
45 #if defined(OS_ANDROID) 46 #if defined(OS_ANDROID)
46 #include "ui/base/resource/resource_bundle_android.h" 47 #include "ui/base/resource/resource_bundle_android.h"
47 #include "ui/gfx/android/device_display_info.h" 48 #include "ui/gfx/android/device_display_info.h"
48 #endif 49 #endif
49 50
50 #if defined(OS_CHROMEOS) 51 #if defined(OS_CHROMEOS)
51 #include "ui/gfx/platform_font_linux.h" 52 #include "ui/gfx/platform_font_linux.h"
52 #endif 53 #endif
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 DCHECK(g_shared_instance_ == NULL) << "ResourceBundle initialized twice"; 641 DCHECK(g_shared_instance_ == NULL) << "ResourceBundle initialized twice";
641 g_shared_instance_ = new ResourceBundle(delegate); 642 g_shared_instance_ = new ResourceBundle(delegate);
642 static std::vector<ScaleFactor> supported_scale_factors; 643 static std::vector<ScaleFactor> supported_scale_factors;
643 #if !defined(OS_IOS) 644 #if !defined(OS_IOS)
644 // On platforms other than iOS, 100P is always a supported scale factor. 645 // On platforms other than iOS, 100P is always a supported scale factor.
645 // For Windows we have a separate case in this function. 646 // For Windows we have a separate case in this function.
646 supported_scale_factors.push_back(SCALE_FACTOR_100P); 647 supported_scale_factors.push_back(SCALE_FACTOR_100P);
647 #endif 648 #endif
648 #if defined(OS_ANDROID) 649 #if defined(OS_ANDROID)
649 float display_density; 650 float display_density;
650 if (gfx::Display::HasForceDeviceScaleFactor()) { 651 if (display::Display::HasForceDeviceScaleFactor()) {
651 display_density = gfx::Display::GetForcedDeviceScaleFactor(); 652 display_density = display::Display::GetForcedDeviceScaleFactor();
652 } else { 653 } else {
653 gfx::DeviceDisplayInfo device_info; 654 gfx::DeviceDisplayInfo device_info;
654 display_density = device_info.GetDIPScale(); 655 display_density = device_info.GetDIPScale();
655 } 656 }
656 const ScaleFactor closest = FindClosestScaleFactorUnsafe(display_density); 657 const ScaleFactor closest = FindClosestScaleFactorUnsafe(display_density);
657 if (closest != SCALE_FACTOR_100P) 658 if (closest != SCALE_FACTOR_100P)
658 supported_scale_factors.push_back(closest); 659 supported_scale_factors.push_back(closest);
659 #elif defined(OS_IOS) 660 #elif defined(OS_IOS)
660 gfx::Display display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); 661 display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
661 if (display.device_scale_factor() > 2.0) { 662 if (display.device_scale_factor() > 2.0) {
662 DCHECK_EQ(3.0, display.device_scale_factor()); 663 DCHECK_EQ(3.0, display.device_scale_factor());
663 supported_scale_factors.push_back(SCALE_FACTOR_300P); 664 supported_scale_factors.push_back(SCALE_FACTOR_300P);
664 } else if (display.device_scale_factor() > 1.0) { 665 } else if (display.device_scale_factor() > 1.0) {
665 DCHECK_EQ(2.0, display.device_scale_factor()); 666 DCHECK_EQ(2.0, display.device_scale_factor());
666 supported_scale_factors.push_back(SCALE_FACTOR_200P); 667 supported_scale_factors.push_back(SCALE_FACTOR_200P);
667 } else { 668 } else {
668 supported_scale_factors.push_back(SCALE_FACTOR_100P); 669 supported_scale_factors.push_back(SCALE_FACTOR_100P);
669 } 670 }
670 #elif defined(OS_MACOSX) || defined(OS_CHROMEOS) || defined(OS_LINUX) || \ 671 #elif defined(OS_MACOSX) || defined(OS_CHROMEOS) || defined(OS_LINUX) || \
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 // static 866 // static
866 bool ResourceBundle::DecodePNG(const unsigned char* buf, 867 bool ResourceBundle::DecodePNG(const unsigned char* buf,
867 size_t size, 868 size_t size,
868 SkBitmap* bitmap, 869 SkBitmap* bitmap,
869 bool* fell_back_to_1x) { 870 bool* fell_back_to_1x) {
870 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); 871 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size);
871 return gfx::PNGCodec::Decode(buf, size, bitmap); 872 return gfx::PNGCodec::Decode(buf, size, bitmap);
872 } 873 }
873 874
874 } // namespace ui 875 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/layout.cc ('k') | ui/base/resource/resource_bundle_auralinux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698