diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 00:46:21 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 00:46:21 +0000 |
commit | e321a3c8eef6418c248743fdb68aa8bbba02e98f (patch) | |
tree | 7a7d10306739b3abe433b2d5b63fc46fbefc2935 /gfx | |
parent | 1517425f81d0f49afcf4cc49f62ee2aa1995a4ca (diff) | |
download | chromium_src-e321a3c8eef6418c248743fdb68aa8bbba02e98f.zip chromium_src-e321a3c8eef6418c248743fdb68aa8bbba02e98f.tar.gz chromium_src-e321a3c8eef6418c248743fdb68aa8bbba02e98f.tar.bz2 |
gfx: Get rid of deprecated version of CreateIconFileFromSkBitmap.
BUG=23581
TEST=trybots
Review URL: http://codereview.chromium.org/3745003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62488 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/icon_util.cc | 12 | ||||
-rw-r--r-- | gfx/icon_util.h | 3 | ||||
-rw-r--r-- | gfx/icon_util_unittest.cc | 2 |
3 files changed, 5 insertions, 12 deletions
diff --git a/gfx/icon_util.cc b/gfx/icon_util.cc index 35aa230..6a4e51c 100644 --- a/gfx/icon_util.cc +++ b/gfx/icon_util.cc @@ -187,7 +187,7 @@ SkBitmap* IconUtil::CreateSkBitmapFromHICON(HICON icon, const gfx::Size& s) { } bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap, - const std::wstring& icon_file_name) { + const FilePath& icon_path) { // Only 32 bit ARGB bitmaps are supported. We also make sure the bitmap has // been properly initialized. SkAutoLockPixels bitmap_lock(bitmap); @@ -197,8 +197,8 @@ bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap, return false; // We start by creating the file. - ScopedHandle icon_file(::CreateFile(icon_file_name.c_str(), GENERIC_WRITE, 0, - NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)); + ScopedHandle icon_file(::CreateFile(icon_path.value().c_str(), + GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)); if (icon_file.Get() == INVALID_HANDLE_VALUE) return false; @@ -248,17 +248,13 @@ bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap, ::CloseHandle(icon_file.Take()); delete [] buffer; if (delete_file) { - bool success = file_util::Delete(icon_file_name, false); + bool success = file_util::Delete(icon_path, false); DCHECK(success); } return !delete_file; } -bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap, - const FilePath& icon_path) { - return CreateIconFileFromSkBitmap(bitmap, icon_path.ToWStringHack()); -} bool IconUtil::PixelsHaveAlpha(const uint32* pixels, size_t num_pixels) { for (const uint32* end = pixels + num_pixels; pixels != end; ++pixels) { if ((*pixels & 0xff000000) != 0) diff --git a/gfx/icon_util.h b/gfx/icon_util.h index 80c81f6..19d0a5f 100644 --- a/gfx/icon_util.h +++ b/gfx/icon_util.h @@ -78,9 +78,6 @@ class IconUtil { // the desired .ico file. // // The function returns true on success and false otherwise. - // TODO(tfarina): Deprecated version of the FilePath version below. - static bool CreateIconFileFromSkBitmap(const SkBitmap& bitmap, - const std::wstring& icon_file_name); static bool CreateIconFileFromSkBitmap(const SkBitmap& bitmap, const FilePath& icon_path); diff --git a/gfx/icon_util_unittest.cc b/gfx/icon_util_unittest.cc index 996dac4..43eca49 100644 --- a/gfx/icon_util_unittest.cc +++ b/gfx/icon_util_unittest.cc @@ -113,7 +113,7 @@ TEST_F(IconUtilTest, TestCreateIconFileInvalidParameters) { scoped_ptr<SkBitmap> bitmap; FilePath valid_icon_filename = test_data_directory_.AppendASCII( kSmallIconName); - std::wstring invalid_icon_filename(L"C:\\<>?.ico"); + FilePath invalid_icon_filename(FILE_PATH_LITERAL("C:\\<>?.ico")); // Wrong bitmap format. bitmap.reset(new SkBitmap); |