| Index: ui/base/resource/resource_bundle.cc
|
| diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc
|
| index 899a8a45cb95aaf05737504cde5e9780fdf25afd..54489c1c33fd922e0eef1999e57024528940ca91 100644
|
| --- a/ui/base/resource/resource_bundle.cc
|
| +++ b/ui/base/resource/resource_bundle.cc
|
| @@ -822,31 +822,30 @@ bool ResourceBundle::LoadBitmap(int resource_id,
|
| SkBitmap* bitmap,
|
| bool* fell_back_to_1x) const {
|
| DCHECK(fell_back_to_1x);
|
| - ResourceHandle* data_handle_100_percent = nullptr;
|
| - for (size_t i = 0; i < data_packs_.size(); ++i) {
|
| - if (data_packs_[i]->GetScaleFactor() == ui::SCALE_FACTOR_NONE &&
|
| - LoadBitmap(*data_packs_[i], resource_id, bitmap, fell_back_to_1x)) {
|
| + for (const auto& pack : data_packs_) {
|
| + if (pack->GetScaleFactor() == ui::SCALE_FACTOR_NONE &&
|
| + LoadBitmap(*pack, resource_id, bitmap, fell_back_to_1x)) {
|
| DCHECK(!*fell_back_to_1x);
|
| *scale_factor = ui::SCALE_FACTOR_NONE;
|
| return true;
|
| }
|
| - if (data_packs_[i]->GetScaleFactor() == ui::SCALE_FACTOR_100P)
|
| - data_handle_100_percent = data_packs_[i];
|
|
|
| - if (data_packs_[i]->GetScaleFactor() == *scale_factor &&
|
| - LoadBitmap(*data_packs_[i], resource_id, bitmap, fell_back_to_1x)) {
|
| + if (pack->GetScaleFactor() == *scale_factor &&
|
| + LoadBitmap(*pack, resource_id, bitmap, fell_back_to_1x)) {
|
| return true;
|
| }
|
| }
|
|
|
| // Unit tests may only have 1x data pack. Allow them to fallback to 1x
|
| // resources.
|
| - if (*scale_factor != ui::SCALE_FACTOR_100P && is_test_resources_ &&
|
| - data_handle_100_percent &&
|
| - LoadBitmap(*data_handle_100_percent, resource_id, bitmap,
|
| - fell_back_to_1x)) {
|
| - *fell_back_to_1x = true;
|
| - return true;
|
| + if (is_test_resources_ && *scale_factor != ui::SCALE_FACTOR_100P) {
|
| + for (const auto& pack : data_packs_) {
|
| + if (pack->GetScaleFactor() == ui::SCALE_FACTOR_100P &&
|
| + LoadBitmap(*pack, resource_id, bitmap, fell_back_to_1x)) {
|
| + *fell_back_to_1x = true;
|
| + return true;
|
| + }
|
| + }
|
| }
|
|
|
| return false;
|
|
|