| 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 | 325 |
| 326 if (image.IsEmpty()) { | 326 if (image.IsEmpty()) { |
| 327 DCHECK(!delegate_ && !data_packs_.empty()) << | 327 DCHECK(!delegate_ && !data_packs_.empty()) << |
| 328 "Missing call to SetResourcesDataDLL?"; | 328 "Missing call to SetResourcesDataDLL?"; |
| 329 | 329 |
| 330 // TODO(oshima): Consider reading the image size from png IHDR chunk and | 330 // TODO(oshima): Consider reading the image size from png IHDR chunk and |
| 331 // skip decoding here and remove #ifdef below. | 331 // skip decoding here and remove #ifdef below. |
| 332 // ResourceBundle::GetSharedInstance() is destroyed after the | 332 // ResourceBundle::GetSharedInstance() is destroyed after the |
| 333 // BrowserMainLoop has finished running. |image_skia| is guaranteed to be | 333 // BrowserMainLoop has finished running. |image_skia| is guaranteed to be |
| 334 // destroyed before the resource bundle is destroyed. | 334 // destroyed before the resource bundle is destroyed. |
| 335 #if defined(OS_CHROMEOS) | 335 #if defined(OS_CHROMEOS) || defined(ENABLE_HIDPI) |
| 336 ui::ScaleFactor scale_factor_to_load = ui::GetMaxScaleFactor(); | 336 ui::ScaleFactor scale_factor_to_load = ui::GetMaxScaleFactor(); |
| 337 #else | 337 #else |
| 338 ui::ScaleFactor scale_factor_to_load = ui::SCALE_FACTOR_100P; | 338 ui::ScaleFactor scale_factor_to_load = ui::SCALE_FACTOR_100P; |
| 339 #endif | 339 #endif |
| 340 gfx::ImageSkia image_skia(new ResourceBundleImageSource(this, resource_id), | 340 gfx::ImageSkia image_skia(new ResourceBundleImageSource(this, resource_id), |
| 341 scale_factor_to_load); | 341 scale_factor_to_load); |
| 342 if (image_skia.isNull()) { | 342 if (image_skia.isNull()) { |
| 343 LOG(WARNING) << "Unable to load image with id " << resource_id; | 343 LOG(WARNING) << "Unable to load image with id " << resource_id; |
| 344 NOTREACHED(); // Want to assert in debug mode. | 344 NOTREACHED(); // Want to assert in debug mode. |
| 345 // The load failed to retrieve the image; show a debugging red square. | 345 // The load failed to retrieve the image; show a debugging red square. |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 // static | 710 // static |
| 711 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 711 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
| 712 size_t size, | 712 size_t size, |
| 713 SkBitmap* bitmap, | 713 SkBitmap* bitmap, |
| 714 bool* fell_back_to_1x) { | 714 bool* fell_back_to_1x) { |
| 715 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 715 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
| 716 return gfx::PNGCodec::Decode(buf, size, bitmap); | 716 return gfx::PNGCodec::Decode(buf, size, bitmap); |
| 717 } | 717 } |
| 718 | 718 |
| 719 } // namespace ui | 719 } // namespace ui |
| OLD | NEW |