| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 base::AutoLock lock_scope(*images_and_fonts_lock_); | 421 base::AutoLock lock_scope(*images_and_fonts_lock_); |
| 422 | 422 |
| 423 // Another thread raced the load and has already cached the image. | 423 // Another thread raced the load and has already cached the image. |
| 424 if (images_.count(resource_id)) | 424 if (images_.count(resource_id)) |
| 425 return images_[resource_id]; | 425 return images_[resource_id]; |
| 426 | 426 |
| 427 images_[resource_id] = image; | 427 images_[resource_id] = image; |
| 428 return images_[resource_id]; | 428 return images_[resource_id]; |
| 429 } | 429 } |
| 430 | 430 |
| 431 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) { | |
| 432 return GetNativeImageNamed(resource_id, RTL_DISABLED); | |
| 433 } | |
| 434 | |
| 435 base::RefCountedStaticMemory* ResourceBundle::LoadDataResourceBytes( | 431 base::RefCountedStaticMemory* ResourceBundle::LoadDataResourceBytes( |
| 436 int resource_id) const { | 432 int resource_id) const { |
| 437 return LoadDataResourceBytesForScale(resource_id, ui::SCALE_FACTOR_NONE); | 433 return LoadDataResourceBytesForScale(resource_id, ui::SCALE_FACTOR_NONE); |
| 438 } | 434 } |
| 439 | 435 |
| 440 base::RefCountedStaticMemory* ResourceBundle::LoadDataResourceBytesForScale( | 436 base::RefCountedStaticMemory* ResourceBundle::LoadDataResourceBytesForScale( |
| 441 int resource_id, | 437 int resource_id, |
| 442 ScaleFactor scale_factor) const { | 438 ScaleFactor scale_factor) const { |
| 443 base::RefCountedStaticMemory* bytes = NULL; | 439 base::RefCountedStaticMemory* bytes = NULL; |
| 444 if (delegate_) | 440 if (delegate_) |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 // static | 915 // static |
| 920 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 916 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
| 921 size_t size, | 917 size_t size, |
| 922 SkBitmap* bitmap, | 918 SkBitmap* bitmap, |
| 923 bool* fell_back_to_1x) { | 919 bool* fell_back_to_1x) { |
| 924 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 920 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
| 925 return gfx::PNGCodec::Decode(buf, size, bitmap); | 921 return gfx::PNGCodec::Decode(buf, size, bitmap); |
| 926 } | 922 } |
| 927 | 923 |
| 928 } // namespace ui | 924 } // namespace ui |
| OLD | NEW |