| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 // static | 26 // static |
| 27 gfx::ImageSkiaRep& NullImageRep() { | 27 gfx::ImageSkiaRep& NullImageRep() { |
| 28 CR_DEFINE_STATIC_LOCAL(ImageSkiaRep, null_image_rep, ()); | 28 CR_DEFINE_STATIC_LOCAL(ImageSkiaRep, null_image_rep, ()); |
| 29 return null_image_rep; | 29 return null_image_rep; |
| 30 } | 30 } |
| 31 | 31 |
| 32 std::vector<float>* g_supported_scales = NULL; | 32 std::vector<float>* g_supported_scales = NULL; |
| 33 | 33 |
| 34 // The difference to fall back to the smaller scale factor rather than the | 34 // The difference to fall back to the smaller scale factor rather than the |
| 35 // larger one. For example, assume 1.25 is requested but only 1.0 and 2.0 are | 35 // larger one. For example, assume 1.20 is requested but only 1.0 and 2.0 are |
| 36 // supported. In that case, not fall back to 2.0 but 1.0, and then expand | 36 // supported. In that case, not fall back to 2.0 but 1.0, and then expand |
| 37 // the image to 1.25. | 37 // the image to 1.25. |
| 38 const float kFallbackToSmallerScaleDiff = 0.25f; | 38 const float kFallbackToSmallerScaleDiff = 0.20f; |
| 39 | 39 |
| 40 } // namespace | 40 } // namespace |
| 41 | 41 |
| 42 namespace internal { | 42 namespace internal { |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 class Matcher { | 45 class Matcher { |
| 46 public: | 46 public: |
| 47 explicit Matcher(float scale) : scale_(scale) { | 47 explicit Matcher(float scale) : scale_(scale) { |
| 48 } | 48 } |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 bool ImageSkia::CanModify() const { | 498 bool ImageSkia::CanModify() const { |
| 499 return !storage_.get() || storage_->CanModify(); | 499 return !storage_.get() || storage_->CanModify(); |
| 500 } | 500 } |
| 501 | 501 |
| 502 void ImageSkia::DetachStorageFromThread() { | 502 void ImageSkia::DetachStorageFromThread() { |
| 503 if (storage_.get()) | 503 if (storage_.get()) |
| 504 storage_->DetachFromThread(); | 504 storage_->DetachFromThread(); |
| 505 } | 505 } |
| 506 | 506 |
| 507 } // namespace gfx | 507 } // namespace gfx |
| OLD | NEW |