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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 base::AutoLock lock_scope(*images_and_fonts_lock_); | 314 base::AutoLock lock_scope(*images_and_fonts_lock_); |
315 if (images_.count(resource_id)) | 315 if (images_.count(resource_id)) |
316 return images_[resource_id]; | 316 return images_[resource_id]; |
317 } | 317 } |
318 | 318 |
319 gfx::Image image; | 319 gfx::Image image; |
320 if (delegate_) | 320 if (delegate_) |
321 image = delegate_->GetImageNamed(resource_id); | 321 image = delegate_->GetImageNamed(resource_id); |
322 | 322 |
323 if (image.IsEmpty()) { | 323 if (image.IsEmpty()) { |
324 DCHECK(!delegate_ && !data_packs_.empty()) << | 324 DCHECK(!data_packs_.empty()) << |
325 "Missing call to SetResourcesDataDLL?"; | 325 "Missing call to SetResourcesDataDLL?"; |
326 | 326 |
327 // TODO(oshima): Consider reading the image size from png IHDR chunk and | 327 // TODO(oshima): Consider reading the image size from png IHDR chunk and |
328 // skip decoding here and remove #ifdef below. | 328 // skip decoding here and remove #ifdef below. |
329 // ResourceBundle::GetSharedInstance() is destroyed after the | 329 // ResourceBundle::GetSharedInstance() is destroyed after the |
330 // BrowserMainLoop has finished running. |image_skia| is guaranteed to be | 330 // BrowserMainLoop has finished running. |image_skia| is guaranteed to be |
331 // destroyed before the resource bundle is destroyed. | 331 // destroyed before the resource bundle is destroyed. |
332 #if defined(OS_CHROMEOS) | 332 #if defined(OS_CHROMEOS) |
333 ui::ScaleFactor scale_factor_to_load = ui::GetMaxScaleFactor(); | 333 ui::ScaleFactor scale_factor_to_load = ui::GetMaxScaleFactor(); |
334 #else | 334 #else |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 // static | 727 // static |
728 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 728 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
729 size_t size, | 729 size_t size, |
730 SkBitmap* bitmap, | 730 SkBitmap* bitmap, |
731 bool* fell_back_to_1x) { | 731 bool* fell_back_to_1x) { |
732 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 732 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
733 return gfx::PNGCodec::Decode(buf, size, bitmap); | 733 return gfx::PNGCodec::Decode(buf, size, bitmap); |
734 } | 734 } |
735 | 735 |
736 } // namespace ui | 736 } // namespace ui |
OLD | NEW |