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