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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <utility> | 10 #include <utility> |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 #if defined(OS_CHROMEOS) || defined(OS_WIN) || defined(OS_LINUX) | 679 #if defined(OS_CHROMEOS) || defined(OS_WIN) || defined(OS_LINUX) |
680 return max_scale_factor_; | 680 return max_scale_factor_; |
681 #else | 681 #else |
682 return GetSupportedScaleFactors().back(); | 682 return GetSupportedScaleFactors().back(); |
683 #endif | 683 #endif |
684 } | 684 } |
685 | 685 |
686 bool ResourceBundle::IsScaleFactorSupported(ScaleFactor scale_factor) { | 686 bool ResourceBundle::IsScaleFactorSupported(ScaleFactor scale_factor) { |
687 const std::vector<ScaleFactor>& supported_scale_factors = | 687 const std::vector<ScaleFactor>& supported_scale_factors = |
688 ui::GetSupportedScaleFactors(); | 688 ui::GetSupportedScaleFactors(); |
689 return std::find(supported_scale_factors.begin(), | 689 return base::ContainsValue(supported_scale_factors, scale_factor); |
690 supported_scale_factors.end(), | |
691 scale_factor) != supported_scale_factors.end(); | |
692 } | 690 } |
693 | 691 |
694 ResourceBundle::ResourceBundle(Delegate* delegate) | 692 ResourceBundle::ResourceBundle(Delegate* delegate) |
695 : delegate_(delegate), | 693 : delegate_(delegate), |
696 locale_resources_data_lock_(new base::Lock), | 694 locale_resources_data_lock_(new base::Lock), |
697 max_scale_factor_(SCALE_FACTOR_100P) { | 695 max_scale_factor_(SCALE_FACTOR_100P) { |
698 } | 696 } |
699 | 697 |
700 ResourceBundle::~ResourceBundle() { | 698 ResourceBundle::~ResourceBundle() { |
701 FreeImages(); | 699 FreeImages(); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 // static | 922 // static |
925 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 923 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
926 size_t size, | 924 size_t size, |
927 SkBitmap* bitmap, | 925 SkBitmap* bitmap, |
928 bool* fell_back_to_1x) { | 926 bool* fell_back_to_1x) { |
929 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 927 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
930 return gfx::PNGCodec::Decode(buf, size, bitmap); | 928 return gfx::PNGCodec::Decode(buf, size, bitmap); |
931 } | 929 } |
932 | 930 |
933 } // namespace ui | 931 } // namespace ui |
OLD | NEW |