Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: ui/base/resource/resource_bundle.cc

Issue 564473002: Makes loading test resources load the first supported scale factor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698