Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: ui/gfx/image/image.cc

Issue 10378009: Get rid of Image::Image(SkBitmap*) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: k Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/image/image.h ('k') | ui/gfx/image/image_mac_unittest.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.h" 5 #include "ui/gfx/image/image.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 friend class base::RefCounted<ImageStorage>; 218 friend class base::RefCounted<ImageStorage>;
219 }; 219 };
220 220
221 } // namespace internal 221 } // namespace internal
222 222
223 Image::Image() { 223 Image::Image() {
224 // |storage_| is NULL for empty Images. 224 // |storage_| is NULL for empty Images.
225 } 225 }
226 226
227 Image::Image(const SkBitmap* bitmap)
228 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) {
229 internal::ImageRepSkia* rep = new internal::ImageRepSkia(
230 new ImageSkia(bitmap));
231 AddRepresentation(rep);
232 }
233
234 Image::Image(const SkBitmap& bitmap) 227 Image::Image(const SkBitmap& bitmap)
235 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { 228 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) {
236 internal::ImageRepSkia* rep = 229 internal::ImageRepSkia* rep =
237 new internal::ImageRepSkia(new ImageSkia(new SkBitmap(bitmap))); 230 new internal::ImageRepSkia(new ImageSkia(new SkBitmap(bitmap)));
238 AddRepresentation(rep); 231 AddRepresentation(rep);
239 } 232 }
240 233
241 Image::Image(const std::vector<const SkBitmap*>& bitmaps) 234 Image::Image(const std::vector<const SkBitmap*>& bitmaps)
242 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { 235 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) {
243 internal::ImageRepSkia* rep = new internal::ImageRepSkia( 236 internal::ImageRepSkia* rep = new internal::ImageRepSkia(
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 // Something went seriously wrong... 429 // Something went seriously wrong...
437 return NULL; 430 return NULL;
438 } 431 }
439 432
440 void Image::AddRepresentation(internal::ImageRep* rep) const { 433 void Image::AddRepresentation(internal::ImageRep* rep) const {
441 CHECK(storage_.get()); 434 CHECK(storage_.get());
442 storage_->representations().insert(std::make_pair(rep->type(), rep)); 435 storage_->representations().insert(std::make_pair(rep->type(), rep));
443 } 436 }
444 437
445 } // namespace gfx 438 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/image/image.h ('k') | ui/gfx/image/image_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698