| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 ImageSkia::operator SkBitmap&() const { | 168 ImageSkia::operator SkBitmap&() const { |
| 169 if (isNull()) | 169 if (isNull()) |
| 170 return const_cast<SkBitmap&>(NullImageRep().sk_bitmap()); | 170 return const_cast<SkBitmap&>(NullImageRep().sk_bitmap()); |
| 171 | 171 |
| 172 return const_cast<SkBitmap&>(storage_->image_reps()[0].sk_bitmap()); | 172 return const_cast<SkBitmap&>(storage_->image_reps()[0].sk_bitmap()); |
| 173 } | 173 } |
| 174 | 174 |
| 175 ImageSkia::~ImageSkia() { | 175 ImageSkia::~ImageSkia() { |
| 176 } | 176 } |
| 177 | 177 |
| 178 bool ImageSkia::Equals(const gfx::ImageSkia& other) const { |
| 179 return storage_.get() == other.storage_.get(); |
| 180 } |
| 181 |
| 178 void ImageSkia::AddRepresentation(const ImageSkiaRep& image_rep) { | 182 void ImageSkia::AddRepresentation(const ImageSkiaRep& image_rep) { |
| 179 DCHECK(!image_rep.is_null()); | 183 DCHECK(!image_rep.is_null()); |
| 180 | 184 |
| 181 if (isNull()) | 185 if (isNull()) |
| 182 Init(image_rep); | 186 Init(image_rep); |
| 183 else | 187 else |
| 184 storage_->image_reps().push_back(image_rep); | 188 storage_->image_reps().push_back(image_rep); |
| 185 } | 189 } |
| 186 | 190 |
| 187 void ImageSkia::RemoveRepresentation(ui::ScaleFactor scale_factor) { | 191 void ImageSkia::RemoveRepresentation(ui::ScaleFactor scale_factor) { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 if (image_rep.sk_bitmap().empty()) { | 300 if (image_rep.sk_bitmap().empty()) { |
| 297 storage_ = NULL; | 301 storage_ = NULL; |
| 298 return; | 302 return; |
| 299 } | 303 } |
| 300 storage_ = new internal::ImageSkiaStorage( | 304 storage_ = new internal::ImageSkiaStorage( |
| 301 NULL, gfx::Size(image_rep.GetWidth(), image_rep.GetHeight())); | 305 NULL, gfx::Size(image_rep.GetWidth(), image_rep.GetHeight())); |
| 302 storage_->image_reps().push_back(image_rep); | 306 storage_->image_reps().push_back(image_rep); |
| 303 } | 307 } |
| 304 | 308 |
| 305 } // namespace gfx | 309 } // namespace gfx |
| OLD | NEW |