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

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

Issue 563713003: Avoid DCHECK on 3x scaled screens. (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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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