summaryrefslogtreecommitdiffstats
path: root/ui/gfx
diff options
context:
space:
mode:
authorasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-31 05:27:37 +0000
committerasvitkine@chromium.org <asvitkine@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-31 05:27:37 +0000
commit05af9e8c72d448d5286c6c1aad4b01fae03037b7 (patch)
tree4466e94fb210afb7c258aecef91d68fe526fc7ef /ui/gfx
parentb31b7ea92d9c1e4dfc57c7218d1b01b454d8ca10 (diff)
downloadchromium_src-05af9e8c72d448d5286c6c1aad4b01fae03037b7.zip
chromium_src-05af9e8c72d448d5286c6c1aad4b01fae03037b7.tar.gz
chromium_src-05af9e8c72d448d5286c6c1aad4b01fae03037b7.tar.bz2
Support large icons for Windows desktop profile shortcuts.
Also, fixes a problem in the existing code where the badged avatar on the icon was slightly stretched compared to the original image (as shown in the tab strip). BUG=167277 TEST=See bug. Review URL: https://chromiumcodereview.appspot.com/12090073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179804 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx')
-rw-r--r--ui/gfx/icon_util.cc8
-rw-r--r--ui/gfx/icon_util.h3
2 files changed, 7 insertions, 4 deletions
diff --git a/ui/gfx/icon_util.cc b/ui/gfx/icon_util.cc
index 7bce98e..d071a2f 100644
--- a/ui/gfx/icon_util.cc
+++ b/ui/gfx/icon_util.cc
@@ -138,10 +138,10 @@ SkBitmap* IconUtil::CreateSkBitmapFromHICON(HICON icon, const gfx::Size& s) {
scoped_ptr<SkBitmap> IconUtil::CreateSkBitmapFromIconResource(HMODULE module,
int resource_id,
int size) {
- DCHECK_LE(size, 256);
+ DCHECK_LE(size, kLargeIconSize);
// For everything except the Vista+ 256x256 icons, use |LoadImage()|.
- if (size != 256) {
+ if (size != kLargeIconSize) {
HICON icon_handle =
static_cast<HICON>(LoadImage(module, MAKEINTRESOURCE(resource_id),
IMAGE_ICON, size, size,
@@ -357,8 +357,8 @@ bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap,
// If |large_bitmap| was specified, validate its dimension and convert to PNG.
scoped_refptr<base::RefCountedMemory> png_bytes;
if (!large_bitmap.empty()) {
- CHECK_EQ(256, large_bitmap.width());
- CHECK_EQ(256, large_bitmap.height());
+ CHECK_EQ(kLargeIconSize, large_bitmap.width());
+ CHECK_EQ(kLargeIconSize, large_bitmap.height());
png_bytes = gfx::Image::CreateFrom1xBitmap(large_bitmap).As1xPNGBytes();
}
diff --git a/ui/gfx/icon_util.h b/ui/gfx/icon_util.h
index dfeea4c..4aa2676 100644
--- a/ui/gfx/icon_util.h
+++ b/ui/gfx/icon_util.h
@@ -55,6 +55,9 @@ class SkBitmap;
///////////////////////////////////////////////////////////////////////////////
class UI_EXPORT IconUtil {
public:
+ // The size of the large icon entries in .ico files on Windows Vista+.
+ static const int kLargeIconSize = 256;
+
// Given an SkBitmap object, the function converts the bitmap to a Windows
// icon and returns the corresponding HICON handle. If the function cannot
// convert the bitmap, NULL is returned.