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

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

Issue 2189583004: [not for review - epic CL] Adding Elastic+Momentum+Layered scrolling to views::ScrollView Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 2 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 | « cc/trees/tree_synchronizer_unittest.cc ('k') | ui/compositor/BUILD.gn » ('j') | 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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 bool* fell_back_to_1x) const { 823 bool* fell_back_to_1x) const {
824 DCHECK(fell_back_to_1x); 824 DCHECK(fell_back_to_1x);
825 ResourceHandle* data_handle_100_percent = nullptr; 825 ResourceHandle* data_handle_100_percent = nullptr;
826 for (size_t i = 0; i < data_packs_.size(); ++i) { 826 for (size_t i = 0; i < data_packs_.size(); ++i) {
827 if (data_packs_[i]->GetScaleFactor() == ui::SCALE_FACTOR_NONE && 827 if (data_packs_[i]->GetScaleFactor() == ui::SCALE_FACTOR_NONE &&
828 LoadBitmap(*data_packs_[i], resource_id, bitmap, fell_back_to_1x)) { 828 LoadBitmap(*data_packs_[i], resource_id, bitmap, fell_back_to_1x)) {
829 DCHECK(!*fell_back_to_1x); 829 DCHECK(!*fell_back_to_1x);
830 *scale_factor = ui::SCALE_FACTOR_NONE; 830 *scale_factor = ui::SCALE_FACTOR_NONE;
831 return true; 831 return true;
832 } 832 }
833 if (data_packs_[i]->GetScaleFactor() == ui::SCALE_FACTOR_100P) 833
834 // There may be multiple SCALE_FACTOR_100P providers, assume only the first
835 // may provide test fallbacks.
836 if (!data_handle_100_percent &&
837 data_packs_[i]->GetScaleFactor() == ui::SCALE_FACTOR_100P)
834 data_handle_100_percent = data_packs_[i]; 838 data_handle_100_percent = data_packs_[i];
835 839
836 if (data_packs_[i]->GetScaleFactor() == *scale_factor && 840 if (data_packs_[i]->GetScaleFactor() == *scale_factor &&
837 LoadBitmap(*data_packs_[i], resource_id, bitmap, fell_back_to_1x)) { 841 LoadBitmap(*data_packs_[i], resource_id, bitmap, fell_back_to_1x)) {
838 return true; 842 return true;
839 } 843 }
840 } 844 }
841 845
842 // Unit tests may only have 1x data pack. Allow them to fallback to 1x 846 // Unit tests may only have 1x data pack. Allow them to fallback to 1x
843 // resources. 847 // resources.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 // static 905 // static
902 bool ResourceBundle::DecodePNG(const unsigned char* buf, 906 bool ResourceBundle::DecodePNG(const unsigned char* buf,
903 size_t size, 907 size_t size,
904 SkBitmap* bitmap, 908 SkBitmap* bitmap,
905 bool* fell_back_to_1x) { 909 bool* fell_back_to_1x) {
906 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); 910 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size);
907 return gfx::PNGCodec::Decode(buf, size, bitmap); 911 return gfx::PNGCodec::Decode(buf, size, bitmap);
908 } 912 }
909 913
910 } // namespace ui 914 } // namespace ui
OLDNEW
« no previous file with comments | « cc/trees/tree_synchronizer_unittest.cc ('k') | ui/compositor/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698