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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 const gfx::Display display = | 603 const gfx::Display display = |
604 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | 604 gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
605 const float display_density = display.device_scale_factor(); | 605 const float display_density = display.device_scale_factor(); |
606 const ScaleFactor closest = FindClosestScaleFactorUnsafe(display_density); | 606 const ScaleFactor closest = FindClosestScaleFactorUnsafe(display_density); |
607 if (closest != SCALE_FACTOR_100P) | 607 if (closest != SCALE_FACTOR_100P) |
608 supported_scale_factors.push_back(closest); | 608 supported_scale_factors.push_back(closest); |
609 #elif defined(OS_IOS) | 609 #elif defined(OS_IOS) |
610 gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | 610 gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
611 if (display.device_scale_factor() > 2.0) { | 611 if (display.device_scale_factor() > 2.0) { |
612 DCHECK_EQ(3.0, display.device_scale_factor()); | 612 DCHECK_EQ(3.0, display.device_scale_factor()); |
613 // TODO(lliabraa): Add 3x images instead of using 2x on 3x screens. | 613 supported_scale_factors.push_back(SCALE_FACTOR_300P); |
614 // crbug.com/413300 | |
615 supported_scale_factors.push_back(SCALE_FACTOR_200P); | |
616 } else if (display.device_scale_factor() > 1.0) { | 614 } else if (display.device_scale_factor() > 1.0) { |
617 DCHECK_EQ(2.0, display.device_scale_factor()); | 615 DCHECK_EQ(2.0, display.device_scale_factor()); |
618 supported_scale_factors.push_back(SCALE_FACTOR_200P); | 616 supported_scale_factors.push_back(SCALE_FACTOR_200P); |
619 } else { | 617 } else { |
620 supported_scale_factors.push_back(SCALE_FACTOR_100P); | 618 supported_scale_factors.push_back(SCALE_FACTOR_100P); |
621 } | 619 } |
622 #elif defined(OS_MACOSX) | 620 #elif defined(OS_MACOSX) |
623 if (base::mac::IsOSLionOrLater()) | 621 if (base::mac::IsOSLionOrLater()) |
624 supported_scale_factors.push_back(SCALE_FACTOR_200P); | 622 supported_scale_factors.push_back(SCALE_FACTOR_200P); |
625 #elif defined(OS_CHROMEOS) | 623 #elif defined(OS_CHROMEOS) |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 // static | 856 // static |
859 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 857 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
860 size_t size, | 858 size_t size, |
861 SkBitmap* bitmap, | 859 SkBitmap* bitmap, |
862 bool* fell_back_to_1x) { | 860 bool* fell_back_to_1x) { |
863 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 861 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
864 return gfx::PNGCodec::Decode(buf, size, bitmap); | 862 return gfx::PNGCodec::Decode(buf, size, bitmap); |
865 } | 863 } |
866 | 864 |
867 } // namespace ui | 865 } // namespace ui |
OLD | NEW |