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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 373 |
374 if (image.IsEmpty()) { | 374 if (image.IsEmpty()) { |
375 DCHECK(!delegate_ && !data_packs_.empty()) << | 375 DCHECK(!delegate_ && !data_packs_.empty()) << |
376 "Missing call to SetResourcesDataDLL?"; | 376 "Missing call to SetResourcesDataDLL?"; |
377 | 377 |
378 // TODO(oshima): Consider reading the image size from png IHDR chunk and | 378 // TODO(oshima): Consider reading the image size from png IHDR chunk and |
379 // skip decoding here and remove #ifdef below. | 379 // skip decoding here and remove #ifdef below. |
380 // ResourceBundle::GetSharedInstance() is destroyed after the | 380 // ResourceBundle::GetSharedInstance() is destroyed after the |
381 // BrowserMainLoop has finished running. |image_skia| is guaranteed to be | 381 // BrowserMainLoop has finished running. |image_skia| is guaranteed to be |
382 // destroyed before the resource bundle is destroyed. | 382 // destroyed before the resource bundle is destroyed. |
383 #if defined(OS_CHROMEOS) | 383 #if defined(OS_CHROMEOS) || defined(ENABLE_HIDPI) |
384 ui::ScaleFactor scale_factor_to_load = ui::GetMaxScaleFactor(); | 384 ui::ScaleFactor scale_factor_to_load = ui::GetMaxScaleFactor(); |
385 #else | 385 #else |
386 ui::ScaleFactor scale_factor_to_load = ui::SCALE_FACTOR_100P; | 386 ui::ScaleFactor scale_factor_to_load = ui::SCALE_FACTOR_100P; |
387 #endif | 387 #endif |
388 gfx::ImageSkia image_skia(new ResourceBundleImageSource(this, resource_id), | 388 gfx::ImageSkia image_skia(new ResourceBundleImageSource(this, resource_id), |
389 scale_factor_to_load); | 389 scale_factor_to_load); |
390 if (image_skia.isNull()) { | 390 if (image_skia.isNull()) { |
391 LOG(WARNING) << "Unable to load image with id " << resource_id; | 391 LOG(WARNING) << "Unable to load image with id " << resource_id; |
392 NOTREACHED(); // Want to assert in debug mode. | 392 NOTREACHED(); // Want to assert in debug mode. |
393 // The load failed to retrieve the image; show a debugging red square. | 393 // The load failed to retrieve the image; show a debugging red square. |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 SkBitmap bitmap; | 709 SkBitmap bitmap; |
710 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 32, 32); | 710 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 32, 32); |
711 bitmap.allocPixels(); | 711 bitmap.allocPixels(); |
712 bitmap.eraseARGB(255, 255, 0, 0); | 712 bitmap.eraseARGB(255, 255, 0, 0); |
713 empty_image_ = gfx::Image(bitmap); | 713 empty_image_ = gfx::Image(bitmap); |
714 } | 714 } |
715 return empty_image_; | 715 return empty_image_; |
716 } | 716 } |
717 | 717 |
718 } // namespace ui | 718 } // namespace ui |
OLD | NEW |