| 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 <limits> | 7 #include <limits> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/big_endian.h" | 10 #include "base/big_endian.h" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 NOTREACHED(); | 314 NOTREACHED(); |
| 315 return std::string(); | 315 return std::string(); |
| 316 } | 316 } |
| 317 | 317 |
| 318 locale_resources_data_.reset(data_pack.release()); | 318 locale_resources_data_.reset(data_pack.release()); |
| 319 return app_locale; | 319 return app_locale; |
| 320 } | 320 } |
| 321 | 321 |
| 322 void ResourceBundle::LoadTestResources(const base::FilePath& path, | 322 void ResourceBundle::LoadTestResources(const base::FilePath& path, |
| 323 const base::FilePath& locale_path) { | 323 const base::FilePath& locale_path) { |
| 324 DCHECK(!ui::GetSupportedScaleFactors().empty()); |
| 325 const ScaleFactor scale_factor(ui::GetSupportedScaleFactors()[0]); |
| 324 // Use the given resource pak for both common and localized resources. | 326 // Use the given resource pak for both common and localized resources. |
| 325 scoped_ptr<DataPack> data_pack(new DataPack(SCALE_FACTOR_100P)); | 327 scoped_ptr<DataPack> data_pack(new DataPack(scale_factor)); |
| 326 if (!path.empty() && data_pack->LoadFromPath(path)) | 328 if (!path.empty() && data_pack->LoadFromPath(path)) |
| 327 AddDataPack(data_pack.release()); | 329 AddDataPack(data_pack.release()); |
| 328 | 330 |
| 329 data_pack.reset(new DataPack(ui::SCALE_FACTOR_NONE)); | 331 data_pack.reset(new DataPack(ui::SCALE_FACTOR_NONE)); |
| 330 if (!locale_path.empty() && data_pack->LoadFromPath(locale_path)) { | 332 if (!locale_path.empty() && data_pack->LoadFromPath(locale_path)) { |
| 331 locale_resources_data_.reset(data_pack.release()); | 333 locale_resources_data_.reset(data_pack.release()); |
| 332 } else { | 334 } else { |
| 333 locale_resources_data_.reset(new DataPack(ui::SCALE_FACTOR_NONE)); | 335 locale_resources_data_.reset(new DataPack(ui::SCALE_FACTOR_NONE)); |
| 334 } | 336 } |
| 335 } | 337 } |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 851 // static | 853 // static |
| 852 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 854 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
| 853 size_t size, | 855 size_t size, |
| 854 SkBitmap* bitmap, | 856 SkBitmap* bitmap, |
| 855 bool* fell_back_to_1x) { | 857 bool* fell_back_to_1x) { |
| 856 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 858 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
| 857 return gfx::PNGCodec::Decode(buf, size, bitmap); | 859 return gfx::PNGCodec::Decode(buf, size, bitmap); |
| 858 } | 860 } |
| 859 | 861 |
| 860 } // namespace ui | 862 } // namespace ui |
| OLD | NEW |