Chromium Code Reviews| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 // static | 310 // static |
| 311 float ImageSkia::GetMaxSupportedScale() { | 311 float ImageSkia::GetMaxSupportedScale() { |
| 312 return g_supported_scales->back(); | 312 return g_supported_scales->back(); |
| 313 } | 313 } |
| 314 | 314 |
| 315 // static | 315 // static |
| 316 ImageSkia ImageSkia::CreateFrom1xBitmap(const SkBitmap& bitmap) { | 316 ImageSkia ImageSkia::CreateFrom1xBitmap(const SkBitmap& bitmap) { |
| 317 return ImageSkia(ImageSkiaRep(bitmap, 0.0f)); | 317 return ImageSkia(ImageSkiaRep(bitmap, 0.0f)); |
| 318 } | 318 } |
| 319 | 319 |
| 320 // static | |
| 321 bool ImageSkia::IsSupportedScale(float scale) { | |
|
oshima
2015/03/24 21:57:01
can you move this to ui/base/layout.h ?
ananta
2015/03/24 23:11:56
Done.
| |
| 322 const std::vector<float>& supported_scales = GetSupportedScales(); | |
| 323 return std::find(supported_scales.begin(), supported_scales.end(), scale) | |
| 324 != supported_scales.end(); | |
| 325 } | |
| 326 | |
| 320 scoped_ptr<ImageSkia> ImageSkia::DeepCopy() const { | 327 scoped_ptr<ImageSkia> ImageSkia::DeepCopy() const { |
| 321 ImageSkia* copy = new ImageSkia; | 328 ImageSkia* copy = new ImageSkia; |
| 322 if (isNull()) | 329 if (isNull()) |
| 323 return make_scoped_ptr(copy); | 330 return make_scoped_ptr(copy); |
| 324 | 331 |
| 325 CHECK(CanRead()); | 332 CHECK(CanRead()); |
| 326 | 333 |
| 327 std::vector<gfx::ImageSkiaRep>& reps = storage_->image_reps(); | 334 std::vector<gfx::ImageSkiaRep>& reps = storage_->image_reps(); |
| 328 for (std::vector<gfx::ImageSkiaRep>::iterator iter = reps.begin(); | 335 for (std::vector<gfx::ImageSkiaRep>::iterator iter = reps.begin(); |
| 329 iter != reps.end(); ++iter) { | 336 iter != reps.end(); ++iter) { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 492 bool ImageSkia::CanModify() const { | 499 bool ImageSkia::CanModify() const { |
| 493 return !storage_.get() || storage_->CanModify(); | 500 return !storage_.get() || storage_->CanModify(); |
| 494 } | 501 } |
| 495 | 502 |
| 496 void ImageSkia::DetachStorageFromThread() { | 503 void ImageSkia::DetachStorageFromThread() { |
| 497 if (storage_.get()) | 504 if (storage_.get()) |
| 498 storage_->DetachFromThread(); | 505 storage_->DetachFromThread(); |
| 499 } | 506 } |
| 500 | 507 |
| 501 } // namespace gfx | 508 } // namespace gfx |
| OLD | NEW |