| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 161 } |
| 162 | 162 |
| 163 ImageSkia& ImageSkia::operator=(const SkBitmap& other) { | 163 ImageSkia& ImageSkia::operator=(const SkBitmap& other) { |
| 164 Init(ImageSkiaRep(other, ui::SCALE_FACTOR_100P)); | 164 Init(ImageSkiaRep(other, ui::SCALE_FACTOR_100P)); |
| 165 return *this; | 165 return *this; |
| 166 } | 166 } |
| 167 | 167 |
| 168 ImageSkia::~ImageSkia() { | 168 ImageSkia::~ImageSkia() { |
| 169 } | 169 } |
| 170 | 170 |
| 171 bool ImageSkia::BackedBySameObjectAs(const gfx::ImageSkia& other) const { |
| 172 return storage_.get() == other.storage_.get(); |
| 173 } |
| 174 |
| 171 void ImageSkia::AddRepresentation(const ImageSkiaRep& image_rep) { | 175 void ImageSkia::AddRepresentation(const ImageSkiaRep& image_rep) { |
| 172 DCHECK(!image_rep.is_null()); | 176 DCHECK(!image_rep.is_null()); |
| 173 | 177 |
| 174 if (isNull()) | 178 if (isNull()) |
| 175 Init(image_rep); | 179 Init(image_rep); |
| 176 else | 180 else |
| 177 storage_->image_reps().push_back(image_rep); | 181 storage_->image_reps().push_back(image_rep); |
| 178 } | 182 } |
| 179 | 183 |
| 180 void ImageSkia::RemoveRepresentation(ui::ScaleFactor scale_factor) { | 184 void ImageSkia::RemoveRepresentation(ui::ScaleFactor scale_factor) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 if (image_rep.sk_bitmap().empty()) { | 295 if (image_rep.sk_bitmap().empty()) { |
| 292 storage_ = NULL; | 296 storage_ = NULL; |
| 293 return; | 297 return; |
| 294 } | 298 } |
| 295 storage_ = new internal::ImageSkiaStorage( | 299 storage_ = new internal::ImageSkiaStorage( |
| 296 NULL, gfx::Size(image_rep.GetWidth(), image_rep.GetHeight())); | 300 NULL, gfx::Size(image_rep.GetWidth(), image_rep.GetHeight())); |
| 297 storage_->image_reps().push_back(image_rep); | 301 storage_->image_reps().push_back(image_rep); |
| 298 } | 302 } |
| 299 | 303 |
| 300 } // namespace gfx | 304 } // namespace gfx |
| OLD | NEW |