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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 } | 153 } |
154 | 154 |
155 ImageSkia::ImageSkia(const ImageSkia& other) : storage_(other.storage_) { | 155 ImageSkia::ImageSkia(const ImageSkia& other) : storage_(other.storage_) { |
156 } | 156 } |
157 | 157 |
158 ImageSkia& ImageSkia::operator=(const ImageSkia& other) { | 158 ImageSkia& ImageSkia::operator=(const ImageSkia& other) { |
159 storage_ = other.storage_; | 159 storage_ = other.storage_; |
160 return *this; | 160 return *this; |
161 } | 161 } |
162 | 162 |
163 ImageSkia& ImageSkia::operator=(const SkBitmap& other) { | |
164 Init(ImageSkiaRep(other, ui::SCALE_FACTOR_100P)); | |
165 return *this; | |
166 } | |
167 | |
168 ImageSkia::~ImageSkia() { | 163 ImageSkia::~ImageSkia() { |
169 } | 164 } |
170 | 165 |
171 bool ImageSkia::BackedBySameObjectAs(const gfx::ImageSkia& other) const { | 166 bool ImageSkia::BackedBySameObjectAs(const gfx::ImageSkia& other) const { |
172 return storage_.get() == other.storage_.get(); | 167 return storage_.get() == other.storage_.get(); |
173 } | 168 } |
174 | 169 |
175 void ImageSkia::AddRepresentation(const ImageSkiaRep& image_rep) { | 170 void ImageSkia::AddRepresentation(const ImageSkiaRep& image_rep) { |
176 DCHECK(!image_rep.is_null()); | 171 DCHECK(!image_rep.is_null()); |
177 | 172 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 } | 280 } |
286 | 281 |
287 ImageSkiaReps::iterator it = | 282 ImageSkiaReps::iterator it = |
288 storage_->FindRepresentation(ui::SCALE_FACTOR_100P, true); | 283 storage_->FindRepresentation(ui::SCALE_FACTOR_100P, true); |
289 if (it != storage_->image_reps().end()) | 284 if (it != storage_->image_reps().end()) |
290 return it->mutable_sk_bitmap(); | 285 return it->mutable_sk_bitmap(); |
291 return NullImageRep().mutable_sk_bitmap(); | 286 return NullImageRep().mutable_sk_bitmap(); |
292 } | 287 } |
293 | 288 |
294 } // namespace gfx | 289 } // namespace gfx |
OLD | NEW |