| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 // thread so that other thread can use this. | 351 // thread so that other thread can use this. |
| 352 if (!copy->isNull()) | 352 if (!copy->isNull()) |
| 353 copy->storage_->DetachFromThread(); | 353 copy->storage_->DetachFromThread(); |
| 354 return base::WrapUnique(copy); | 354 return base::WrapUnique(copy); |
| 355 } | 355 } |
| 356 | 356 |
| 357 bool ImageSkia::BackedBySameObjectAs(const gfx::ImageSkia& other) const { | 357 bool ImageSkia::BackedBySameObjectAs(const gfx::ImageSkia& other) const { |
| 358 return storage_.get() == other.storage_.get(); | 358 return storage_.get() == other.storage_.get(); |
| 359 } | 359 } |
| 360 | 360 |
| 361 bool ImageSkia::Equals(const gfx::ImageSkia& other) const { |
| 362 return BackedBySameObjectAs(other); |
| 363 } |
| 364 |
| 361 void ImageSkia::AddRepresentation(const ImageSkiaRep& image_rep) { | 365 void ImageSkia::AddRepresentation(const ImageSkiaRep& image_rep) { |
| 362 DCHECK(!image_rep.is_null()); | 366 DCHECK(!image_rep.is_null()); |
| 363 | 367 |
| 364 // TODO(oshima): This method should be called |SetRepresentation| | 368 // TODO(oshima): This method should be called |SetRepresentation| |
| 365 // and replace the existing rep if there is already one with the | 369 // and replace the existing rep if there is already one with the |
| 366 // same scale so that we can guarantee that a ImageSkia instance contains only | 370 // same scale so that we can guarantee that a ImageSkia instance contains only |
| 367 // one image rep per scale. This is not possible now as ImageLoader currently | 371 // one image rep per scale. This is not possible now as ImageLoader currently |
| 368 // stores need this feature, but this needs to be fixed. | 372 // stores need this feature, but this needs to be fixed. |
| 369 if (isNull()) { | 373 if (isNull()) { |
| 370 Init(image_rep); | 374 Init(image_rep); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 bool ImageSkia::CanModify() const { | 522 bool ImageSkia::CanModify() const { |
| 519 return !storage_.get() || storage_->CanModify(); | 523 return !storage_.get() || storage_->CanModify(); |
| 520 } | 524 } |
| 521 | 525 |
| 522 void ImageSkia::DetachStorageFromThread() { | 526 void ImageSkia::DetachStorageFromThread() { |
| 523 if (storage_.get()) | 527 if (storage_.get()) |
| 524 storage_->DetachFromThread(); | 528 storage_->DetachFromThread(); |
| 525 } | 529 } |
| 526 | 530 |
| 527 } // namespace gfx | 531 } // namespace gfx |
| OLD | NEW |