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

Side by Side Diff: ui/gfx/image/image_skia.cc

Issue 2699983002: ImageSkia: don't force fallback to a supported scale when the image (Closed)
Patch Set: Created 3 years, 10 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/gfx/image/image_skia.h" 5 #include "ui/gfx/image/image_skia.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 smallest_diff = diff; 212 smallest_diff = diff;
213 } 213 }
214 } 214 }
215 215
216 if (fetch_new_image && source_.get()) { 216 if (fetch_new_image && source_.get()) {
217 DCHECK(CalledOnValidThread()) 217 DCHECK(CalledOnValidThread())
218 << "An ImageSkia with the source must be accessed by the same thread."; 218 << "An ImageSkia with the source must be accessed by the same thread.";
219 219
220 ImageSkiaRep image; 220 ImageSkiaRep image;
221 float resource_scale = scale; 221 float resource_scale = scale;
222 if (g_supported_scales) { 222 if (!HasRepresentationAtAllScales() && g_supported_scales) {
223 if (g_supported_scales->back() <= scale) { 223 if (g_supported_scales->back() <= scale) {
224 resource_scale = g_supported_scales->back(); 224 resource_scale = g_supported_scales->back();
225 } else { 225 } else {
226 for (size_t i = 0; i < g_supported_scales->size(); ++i) { 226 for (size_t i = 0; i < g_supported_scales->size(); ++i) {
227 if ((*g_supported_scales)[i] + kFallbackToSmallerScaleDiff >= scale) { 227 if ((*g_supported_scales)[i] + kFallbackToSmallerScaleDiff >= scale) {
228 resource_scale = (*g_supported_scales)[i]; 228 resource_scale = (*g_supported_scales)[i];
229 break; 229 break;
230 } 230 }
231 } 231 }
232 } 232 }
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 bool ImageSkia::CanModify() const { 518 bool ImageSkia::CanModify() const {
519 return !storage_.get() || storage_->CanModify(); 519 return !storage_.get() || storage_->CanModify();
520 } 520 }
521 521
522 void ImageSkia::DetachStorageFromThread() { 522 void ImageSkia::DetachStorageFromThread() {
523 if (storage_.get()) 523 if (storage_.get())
524 storage_->DetachFromThread(); 524 storage_->DetachFromThread();
525 } 525 }
526 526
527 } // namespace gfx 527 } // namespace gfx
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