| 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 "ui/base/resource/resource_bundle.h" | 5 #include "ui/base/resource/resource_bundle.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 int resource_id, | 398 int resource_id, |
| 399 ScaleFactor scale_factor) const { | 399 ScaleFactor scale_factor) const { |
| 400 base::RefCountedStaticMemory* bytes = NULL; | 400 base::RefCountedStaticMemory* bytes = NULL; |
| 401 if (delegate_) | 401 if (delegate_) |
| 402 bytes = delegate_->LoadDataResourceBytes(resource_id, scale_factor); | 402 bytes = delegate_->LoadDataResourceBytes(resource_id, scale_factor); |
| 403 | 403 |
| 404 if (!bytes) { | 404 if (!bytes) { |
| 405 base::StringPiece data = | 405 base::StringPiece data = |
| 406 GetRawDataResourceForScale(resource_id, scale_factor); | 406 GetRawDataResourceForScale(resource_id, scale_factor); |
| 407 if (!data.empty()) { | 407 if (!data.empty()) { |
| 408 bytes = new base::RefCountedStaticMemory( | 408 bytes = new base::RefCountedStaticMemory(data.data(), data.length()); |
| 409 reinterpret_cast<const unsigned char*>(data.data()), data.length()); | |
| 410 } | 409 } |
| 411 } | 410 } |
| 412 | 411 |
| 413 return bytes; | 412 return bytes; |
| 414 } | 413 } |
| 415 | 414 |
| 416 base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) const { | 415 base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) const { |
| 417 return GetRawDataResourceForScale(resource_id, ui::SCALE_FACTOR_NONE); | 416 return GetRawDataResourceForScale(resource_id, ui::SCALE_FACTOR_NONE); |
| 418 } | 417 } |
| 419 | 418 |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 // static | 795 // static |
| 797 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 796 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
| 798 size_t size, | 797 size_t size, |
| 799 SkBitmap* bitmap, | 798 SkBitmap* bitmap, |
| 800 bool* fell_back_to_1x) { | 799 bool* fell_back_to_1x) { |
| 801 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 800 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
| 802 return gfx::PNGCodec::Decode(buf, size, bitmap); | 801 return gfx::PNGCodec::Decode(buf, size, bitmap); |
| 803 } | 802 } |
| 804 | 803 |
| 805 } // namespace ui | 804 } // namespace ui |
| OLD | NEW |