| 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 #ifndef UI_GFX_ICON_UTIL_H_ | 5 #ifndef UI_GFX_ICON_UTIL_H_ |
| 6 #define UI_GFX_ICON_UTIL_H_ | 6 #define UI_GFX_ICON_UTIL_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // the return value is NULL. | 96 // the return value is NULL. |
| 97 // | 97 // |
| 98 // The client owns the returned bitmap object and is responsible for deleting | 98 // The client owns the returned bitmap object and is responsible for deleting |
| 99 // it when it is no longer needed. | 99 // it when it is no longer needed. |
| 100 static SkBitmap* CreateSkBitmapFromHICON(HICON icon, const gfx::Size& s); | 100 static SkBitmap* CreateSkBitmapFromHICON(HICON icon, const gfx::Size& s); |
| 101 | 101 |
| 102 // Loads an icon resource as a SkBitmap for the specified |size| from a | 102 // Loads an icon resource as a SkBitmap for the specified |size| from a |
| 103 // loaded .dll or .exe |module|. Supports loading smaller icon sizes as well | 103 // loaded .dll or .exe |module|. Supports loading smaller icon sizes as well |
| 104 // as the Vista+ 256x256 PNG icon size. If the icon could not be loaded or | 104 // as the Vista+ 256x256 PNG icon size. If the icon could not be loaded or |
| 105 // found, returns a NULL scoped_ptr. | 105 // found, returns a NULL scoped_ptr. |
| 106 static scoped_ptr<SkBitmap> CreateSkBitmapFromIconResource(HMODULE module, | 106 static scoped_ptr<gfx::ImageFamily> CreateImageFamilyFromIconResource( |
| 107 int resource_id, | 107 HMODULE module, |
| 108 int size); | 108 int resource_id); |
| 109 | 109 |
| 110 // Given a valid HICON handle representing an icon, this function converts | 110 // Given a valid HICON handle representing an icon, this function converts |
| 111 // the icon into an SkBitmap object containing an ARGB bitmap using the | 111 // the icon into an SkBitmap object containing an ARGB bitmap using the |
| 112 // dimensions of HICON. If the function cannot convert the icon to a bitmap | 112 // dimensions of HICON. If the function cannot convert the icon to a bitmap |
| 113 // (most probably due to an invalid parameter), the return value is NULL. | 113 // (most probably due to an invalid parameter), the return value is NULL. |
| 114 // | 114 // |
| 115 // The client owns the returned bitmap object and is responsible for deleting | 115 // The client owns the returned bitmap object and is responsible for deleting |
| 116 // it when it is no longer needed. | 116 // it when it is no longer needed. |
| 117 static SkBitmap* CreateSkBitmapFromHICON(HICON icon); | 117 static SkBitmap* CreateSkBitmapFromHICON(HICON icon); |
| 118 | 118 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 // A helper function of CreateSkBitmapFromHICON. | 269 // A helper function of CreateSkBitmapFromHICON. |
| 270 static SkBitmap CreateSkBitmapFromHICONHelper(HICON icon, | 270 static SkBitmap CreateSkBitmapFromHICONHelper(HICON icon, |
| 271 const gfx::Size& s); | 271 const gfx::Size& s); |
| 272 | 272 |
| 273 // Prevent clients from instantiating objects of that class by declaring the | 273 // Prevent clients from instantiating objects of that class by declaring the |
| 274 // ctor/dtor as private. | 274 // ctor/dtor as private. |
| 275 DISALLOW_IMPLICIT_CONSTRUCTORS(IconUtil); | 275 DISALLOW_IMPLICIT_CONSTRUCTORS(IconUtil); |
| 276 }; | 276 }; |
| 277 | 277 |
| 278 #endif // UI_GFX_ICON_UTIL_H_ | 278 #endif // UI_GFX_ICON_UTIL_H_ |
| OLD | NEW |