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

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: fix build 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
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/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/base/resource/resource_data_dll_win.h" 10 #include "ui/base/resource/resource_data_dll_win.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // than 1.5. Otherwise use the 1x resource. 42 // than 1.5. Otherwise use the 1x resource.
43 use_hidpi_pak = ui::GetDPIScale() > 1.5; 43 use_hidpi_pak = ui::GetDPIScale() > 1.5;
44 #endif 44 #endif
45 45
46 bool use_metro_pak = false; 46 bool use_metro_pak = false;
47 #if defined(ENABLE_METRO) 47 #if defined(ENABLE_METRO)
48 use_metro_pak = ui::IsInMetroMode(); 48 use_metro_pak = ui::IsInMetroMode();
49 #endif 49 #endif
50 50
51 if (use_metro_pak) { 51 if (use_metro_pak) {
52 AddDataPack(GetResourcesPakFilePath("theme_resources_metro_1x.pak")); 52 AddDataPack(GetResourcesPakFilePath("theme_resources_metro_1x.pak"), 1.0);
53 } else if (use_hidpi_pak) { 53 } else if (use_hidpi_pak) {
54 AddDataPack(GetResourcesPakFilePath("theme_resources_2x.pak")); 54 AddDataPack(GetResourcesPakFilePath("theme_resources_2x.pak"), 2.0);
55 } else { 55 } else {
56 AddDataPack(GetResourcesPakFilePath("theme_resources_standard.pak")); 56 AddDataPack(GetResourcesPakFilePath("theme_resources_standard.pak"), 1.0);
57 } 57 }
58 58
59 if (use_hidpi_pak) { 59 if (use_hidpi_pak) {
60 AddDataPack(GetResourcesPakFilePath("ui_resources_2x.pak")); 60 AddDataPack(GetResourcesPakFilePath("ui_resources_2x.pak"), 2.0);
61 } else { 61 } else {
62 AddDataPack(GetResourcesPakFilePath("ui_resources_standard.pak")); 62 AddDataPack(GetResourcesPakFilePath("ui_resources_standard.pak"), 1.0);
63 } 63 }
64 } 64 }
65 65
66 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { 66 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) {
67 // Flipped image is not used on Windows. 67 // Flipped image is not used on Windows.
68 DCHECK_EQ(rtl, RTL_DISABLED); 68 DCHECK_EQ(rtl, RTL_DISABLED);
69 69
70 // Windows only uses SkBitmap for gfx::Image, so this is the same as 70 // Windows only uses SkBitmap for gfx::Image, so this is the same as
71 // GetImageNamed. 71 // GetImageNamed.
72 return GetImageNamed(resource_id); 72 return GetImageNamed(resource_id);
73 } 73 }
74 74
75 void SetResourcesDataDLL(HINSTANCE handle) { 75 void SetResourcesDataDLL(HINSTANCE handle) {
76 resources_data_dll = handle; 76 resources_data_dll = handle;
77 } 77 }
78 78
79 HICON LoadThemeIconFromResourcesDataDLL(int icon_id) { 79 HICON LoadThemeIconFromResourcesDataDLL(int icon_id) {
80 return ::LoadIcon(GetCurrentResourceDLL(), MAKEINTRESOURCE(icon_id)); 80 return ::LoadIcon(GetCurrentResourceDLL(), MAKEINTRESOURCE(icon_id));
81 } 81 }
82 82
83 } // namespace ui; 83 } // namespace ui;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698