| 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 #include "chrome/browser/themes/browser_theme_pack.h" | 5 #include "chrome/browser/themes/browser_theme_pack.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 if (memory.get()) { | 538 if (memory.get()) { |
| 539 // Decode the PNG. | 539 // Decode the PNG. |
| 540 SkBitmap bitmap; | 540 SkBitmap bitmap; |
| 541 if (!gfx::PNGCodec::Decode(memory->front(), memory->size(), | 541 if (!gfx::PNGCodec::Decode(memory->front(), memory->size(), |
| 542 &bitmap)) { | 542 &bitmap)) { |
| 543 NOTREACHED() << "Unable to decode theme image resource " << idr_id | 543 NOTREACHED() << "Unable to decode theme image resource " << idr_id |
| 544 << " from saved DataPack."; | 544 << " from saved DataPack."; |
| 545 return NULL; | 545 return NULL; |
| 546 } | 546 } |
| 547 | 547 |
| 548 gfx::Image* ret = new gfx::Image(new SkBitmap(bitmap)); | 548 gfx::Image* ret = new gfx::Image(bitmap); |
| 549 loaded_images_[prs_id] = ret; | 549 loaded_images_[prs_id] = ret; |
| 550 | 550 |
| 551 return ret; | 551 return ret; |
| 552 } | 552 } |
| 553 | 553 |
| 554 return NULL; | 554 return NULL; |
| 555 } | 555 } |
| 556 | 556 |
| 557 RefCountedMemory* BrowserThemePack::GetRawData(int idr_id) const { | 557 RefCountedMemory* BrowserThemePack::GetRawData(int idr_id) const { |
| 558 RefCountedMemory* memory = NULL; | 558 RefCountedMemory* memory = NULL; |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 } | 885 } |
| 886 } | 886 } |
| 887 | 887 |
| 888 if (is_copyable) { | 888 if (is_copyable) { |
| 889 image_memory_[id] = raw_data; | 889 image_memory_[id] = raw_data; |
| 890 } else if (raw_data.get() && raw_data->size()) { | 890 } else if (raw_data.get() && raw_data->size()) { |
| 891 // Decode the PNG. | 891 // Decode the PNG. |
| 892 SkBitmap bitmap; | 892 SkBitmap bitmap; |
| 893 if (gfx::PNGCodec::Decode(raw_data->front(), raw_data->size(), | 893 if (gfx::PNGCodec::Decode(raw_data->front(), raw_data->size(), |
| 894 &bitmap)) { | 894 &bitmap)) { |
| 895 (*raw_bitmaps)[it->first] = new gfx::Image(new SkBitmap(bitmap)); | 895 (*raw_bitmaps)[it->first] = new gfx::Image(bitmap); |
| 896 } else { | 896 } else { |
| 897 NOTREACHED() << "Unable to decode theme image resource " << it->first; | 897 NOTREACHED() << "Unable to decode theme image resource " << it->first; |
| 898 } | 898 } |
| 899 } | 899 } |
| 900 } | 900 } |
| 901 | 901 |
| 902 return true; | 902 return true; |
| 903 } | 903 } |
| 904 | 904 |
| 905 void BrowserThemePack::GenerateFrameImages(ImageCache* bitmaps) const { | 905 void BrowserThemePack::GenerateFrameImages(ImageCache* bitmaps) const { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 hsl.h = tints_[i].h; | 1063 hsl.h = tints_[i].h; |
| 1064 hsl.s = tints_[i].s; | 1064 hsl.s = tints_[i].s; |
| 1065 hsl.l = tints_[i].l; | 1065 hsl.l = tints_[i].l; |
| 1066 return hsl; | 1066 return hsl; |
| 1067 } | 1067 } |
| 1068 } | 1068 } |
| 1069 } | 1069 } |
| 1070 | 1070 |
| 1071 return ThemeService::GetDefaultTint(id); | 1071 return ThemeService::GetDefaultTint(id); |
| 1072 } | 1072 } |
| OLD | NEW |