| 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 <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 const base::FilePath& icon_path, | 134 const base::FilePath& icon_path, |
| 135 WriteType write_type = ATOMIC_WRITE); | 135 WriteType write_type = ATOMIC_WRITE); |
| 136 | 136 |
| 137 // Creates a cursor of the specified size from the DIB passed in. | 137 // Creates a cursor of the specified size from the DIB passed in. |
| 138 // Returns the cursor on success or NULL on failure. | 138 // Returns the cursor on success or NULL on failure. |
| 139 static base::win::ScopedHICON CreateCursorFromDIB(const gfx::Size& icon_size, | 139 static base::win::ScopedHICON CreateCursorFromDIB(const gfx::Size& icon_size, |
| 140 const gfx::Point& hotspot, | 140 const gfx::Point& hotspot, |
| 141 const void* dib_bits, | 141 const void* dib_bits, |
| 142 size_t dib_size); | 142 size_t dib_size); |
| 143 | 143 |
| 144 // Given a valid HICON handle representing an icon, this function retrieves |
| 145 // the hot spot of the icon. |
| 146 static gfx::Point GetHotSpotFromHICON(HICON icon); |
| 147 |
| 144 private: | 148 private: |
| 145 // The icon format is published in the MSDN but there is no definition of | 149 // The icon format is published in the MSDN but there is no definition of |
| 146 // the icon file structures in any of the Windows header files so we need to | 150 // the icon file structures in any of the Windows header files so we need to |
| 147 // define these structure within the class. We must make sure we use 2 byte | 151 // define these structure within the class. We must make sure we use 2 byte |
| 148 // packing so that the structures are laid out properly within the file. | 152 // packing so that the structures are laid out properly within the file. |
| 149 // See: http://msdn.microsoft.com/en-us/library/ms997538.aspx | 153 // See: http://msdn.microsoft.com/en-us/library/ms997538.aspx |
| 150 #pragma pack(push) | 154 #pragma pack(push) |
| 151 #pragma pack(2) | 155 #pragma pack(2) |
| 152 | 156 |
| 153 // ICONDIRENTRY contains meta data for an individual icon image within a | 157 // ICONDIRENTRY contains meta data for an individual icon image within a |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // A helper function of CreateSkBitmapFromHICON. | 269 // A helper function of CreateSkBitmapFromHICON. |
| 266 static SkBitmap CreateSkBitmapFromHICONHelper(HICON icon, | 270 static SkBitmap CreateSkBitmapFromHICONHelper(HICON icon, |
| 267 const gfx::Size& s); | 271 const gfx::Size& s); |
| 268 | 272 |
| 269 // Prevent clients from instantiating objects of that class by declaring the | 273 // Prevent clients from instantiating objects of that class by declaring the |
| 270 // ctor/dtor as private. | 274 // ctor/dtor as private. |
| 271 DISALLOW_IMPLICIT_CONSTRUCTORS(IconUtil); | 275 DISALLOW_IMPLICIT_CONSTRUCTORS(IconUtil); |
| 272 }; | 276 }; |
| 273 | 277 |
| 274 #endif // UI_GFX_ICON_UTIL_H_ | 278 #endif // UI_GFX_ICON_UTIL_H_ |
| OLD | NEW |