diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-22 17:36:17 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-22 17:36:17 +0000 |
commit | 52d70a7c296f2eeef7343ed94375a7abad4a65dc (patch) | |
tree | 83f282358ee747ae897c440d781ade9d6a0730bc /app/resource_bundle.cc | |
parent | 52bf465e9d660330d267d5b29c36fe3e9ce1d905 (diff) | |
download | chromium_src-52d70a7c296f2eeef7343ed94375a7abad4a65dc.zip chromium_src-52d70a7c296f2eeef7343ed94375a7abad4a65dc.tar.gz chromium_src-52d70a7c296f2eeef7343ed94375a7abad4a65dc.tar.bz2 |
Make PNGCodec::Decode(...) not make an intermediary copy of the decoded data;
instead have it write directly to the returned SkBitmap.
BUG=http://crbug.com/24493
TEST=Perf should get better. On the perf trybot, tab_complex_theme_cold got an average of ~40ms better.
Review URL: http://codereview.chromium.org/305001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29780 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/resource_bundle.cc')
-rw-r--r-- | app/resource_bundle.cc | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/app/resource_bundle.cc b/app/resource_bundle.cc index 7261dfd..28674a8 100644 --- a/app/resource_bundle.cc +++ b/app/resource_bundle.cc @@ -69,27 +69,18 @@ void ResourceBundle::FreeImages() { /* static */ SkBitmap* ResourceBundle::LoadBitmap(DataHandle data_handle, int resource_id) { - std::vector<unsigned char> png_data; - scoped_refptr<RefCountedMemory> memory( LoadResourceBytes(data_handle, resource_id)); if (!memory) return NULL; - // Decode the PNG. - int image_width; - int image_height; - if (!gfx::PNGCodec::Decode( - memory->front(), memory->size(), - gfx::PNGCodec::FORMAT_BGRA, - &png_data, &image_width, &image_height)) { - NOTREACHED() << "Unable to decode image resource " << resource_id; + SkBitmap bitmap; + if (!gfx::PNGCodec::Decode(memory->front(), memory->size(), &bitmap)) { + NOTREACHED() << "Unable to decode theme image resource " << resource_id; return NULL; } - return gfx::PNGCodec::CreateSkBitmapFromBGRAFormat(png_data, - image_width, - image_height); + return new SkBitmap(bitmap); } std::string ResourceBundle::GetDataResource(int resource_id) { |