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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 return storage_.get() == other.storage_.get(); | 249 return storage_.get() == other.storage_.get(); |
250 } | 250 } |
251 | 251 |
252 void ImageSkia::AddRepresentation(const ImageSkiaRep& image_rep) { | 252 void ImageSkia::AddRepresentation(const ImageSkiaRep& image_rep) { |
253 DCHECK(!image_rep.is_null()); | 253 DCHECK(!image_rep.is_null()); |
254 | 254 |
255 // TODO(oshima): This method should be called |SetRepresentation| | 255 // TODO(oshima): This method should be called |SetRepresentation| |
256 // and replace the existing rep if there is already one with the | 256 // and replace the existing rep if there is already one with the |
257 // same scale factor so that we can guarantee that a ImageSkia | 257 // same scale factor so that we can guarantee that a ImageSkia |
258 // instance contians only one image rep per scale factor. This is | 258 // instance contians only one image rep per scale factor. This is |
259 // not possible now as ImageLoadingTracker currently stores need | 259 // not possible now as ImageLoader currently stores need |
260 // this feature, but this needs to be fixed. | 260 // this feature, but this needs to be fixed. |
261 if (isNull()) { | 261 if (isNull()) { |
262 Init(image_rep); | 262 Init(image_rep); |
263 } else { | 263 } else { |
264 CHECK(CanModify()); | 264 CHECK(CanModify()); |
265 storage_->image_reps().push_back(image_rep); | 265 storage_->image_reps().push_back(image_rep); |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 void ImageSkia::RemoveRepresentation(ui::ScaleFactor scale_factor) { | 269 void ImageSkia::RemoveRepresentation(ui::ScaleFactor scale_factor) { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 bool ImageSkia::CanModify() const { | 404 bool ImageSkia::CanModify() const { |
405 return !storage_ || storage_->CanModify(); | 405 return !storage_ || storage_->CanModify(); |
406 } | 406 } |
407 | 407 |
408 void ImageSkia::DetachStorageFromThread() { | 408 void ImageSkia::DetachStorageFromThread() { |
409 if (storage_) | 409 if (storage_) |
410 storage_->DetachFromThread(); | 410 storage_->DetachFromThread(); |
411 } | 411 } |
412 | 412 |
413 } // namespace gfx | 413 } // namespace gfx |
OLD | NEW |