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

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

Issue 10151025: Add scale factor tag to data packs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/resource/resource_bundle_unittest.cc ('k') | ui/base/resource/resource_data_dll_win.h » ('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_win.h" 5 #include "ui/base/resource/resource_bundle_win.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "ui/base/layout.h" 9 #include "ui/base/layout.h"
10 #include "ui/base/resource/resource_bundle.h" 10 #include "ui/base/resource/resource_bundle.h"
(...skipping 27 matching lines...) Expand all
38 38
39 bool use_hidpi = false; 39 bool use_hidpi = false;
40 #if defined(ENABLE_HIDPI) 40 #if defined(ENABLE_HIDPI)
41 // If we're running in HiDPI mode at a scale larger than 150%, we switch 41 // If we're running in HiDPI mode at a scale larger than 150%, we switch
42 // to 2x resources for desktop layouts. 42 // to 2x resources for desktop layouts.
43 use_hidpi = ui::GetDPIScale() > 1.5; 43 use_hidpi = ui::GetDPIScale() > 1.5;
44 #endif 44 #endif
45 45
46 switch (ui::GetDisplayLayout()) { 46 switch (ui::GetDisplayLayout()) {
47 case ui::LAYOUT_TOUCH: 47 case ui::LAYOUT_TOUCH:
48 AddDataPack(GetResourcesPakFilePath("theme_resources_metro_1x.pak")); 48 AddDataPack(GetResourcesPakFilePath("theme_resources_metro_1x.pak"),
49 AddDataPack(GetResourcesPakFilePath("ui_resources_standard.pak")); 49 ResourceHandle::kScaleFactor100x);
50 AddDataPack(GetResourcesPakFilePath("ui_resources_standard.pak"),
51 ResourceHandle::kScaleFactor100x);
50 break; 52 break;
51 default: 53 default:
52 if (use_hidpi) { 54 if (use_hidpi) {
53 AddDataPack(GetResourcesPakFilePath("theme_resources_2x.pak")); 55 AddDataPack(GetResourcesPakFilePath("theme_resources_2x.pak"),
54 AddDataPack(GetResourcesPakFilePath("ui_resources_2x.pak")); 56 ResourceHandle::kScaleFactor200x);
57 AddDataPack(GetResourcesPakFilePath("ui_resources_2x.pak"),
58 ResourceHandle::kScaleFactor200x);
55 } else { 59 } else {
56 AddDataPack(GetResourcesPakFilePath("theme_resources_standard.pak")); 60 AddDataPack(GetResourcesPakFilePath("theme_resources_standard.pak"),
57 AddDataPack(GetResourcesPakFilePath("ui_resources_standard.pak")); 61 ResourceHandle::kScaleFactor100x);
62 AddDataPack(GetResourcesPakFilePath("ui_resources_standard.pak"),
63 ResourceHandle::kScaleFactor100x);
58 } 64 }
59 break; 65 break;
60 } 66 }
61 } 67 }
62 68
63 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { 69 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) {
64 // Flipped image is not used on Windows. 70 // Flipped image is not used on Windows.
65 DCHECK_EQ(rtl, RTL_DISABLED); 71 DCHECK_EQ(rtl, RTL_DISABLED);
66 72
67 // Windows only uses SkBitmap for gfx::Image, so this is the same as 73 // Windows only uses SkBitmap for gfx::Image, so this is the same as
68 // GetImageNamed. 74 // GetImageNamed.
69 return GetImageNamed(resource_id); 75 return GetImageNamed(resource_id);
70 } 76 }
71 77
72 void SetResourcesDataDLL(HINSTANCE handle) { 78 void SetResourcesDataDLL(HINSTANCE handle) {
73 resources_data_dll = handle; 79 resources_data_dll = handle;
74 } 80 }
75 81
76 HICON LoadThemeIconFromResourcesDataDLL(int icon_id) { 82 HICON LoadThemeIconFromResourcesDataDLL(int icon_id) {
77 return ::LoadIcon(GetCurrentResourceDLL(), MAKEINTRESOURCE(icon_id)); 83 return ::LoadIcon(GetCurrentResourceDLL(), MAKEINTRESOURCE(icon_id));
78 } 84 }
79 85
80 } // namespace ui; 86 } // namespace ui;
OLDNEW
« no previous file with comments | « ui/base/resource/resource_bundle_unittest.cc ('k') | ui/base/resource/resource_data_dll_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698