| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |