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

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

Issue 10245003: Makes ImageSkia more like SkBitmap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nicer diff 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
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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 Image::Image(const SkBitmap* bitmap) 227 Image::Image(const SkBitmap* bitmap)
228 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { 228 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) {
229 internal::ImageRepSkia* rep = new internal::ImageRepSkia( 229 internal::ImageRepSkia* rep = new internal::ImageRepSkia(
230 new ImageSkia(bitmap)); 230 new ImageSkia(bitmap));
231 AddRepresentation(rep); 231 AddRepresentation(rep);
232 } 232 }
233 233
234 Image::Image(const SkBitmap& bitmap) 234 Image::Image(const SkBitmap& bitmap)
235 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { 235 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) {
236 internal::ImageRepSkia* rep = 236 internal::ImageRepSkia* rep =
237 new internal::ImageRepSkia(new ImageSkia(new SkBitmap(bitmap))); 237 new internal::ImageRepSkia(new ImageSkia(bitmap));
238 AddRepresentation(rep); 238 AddRepresentation(rep);
239 } 239 }
240 240
241 Image::Image(const std::vector<const SkBitmap*>& bitmaps) 241 Image::Image(const std::vector<const SkBitmap*>& bitmaps)
242 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { 242 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) {
243 internal::ImageRepSkia* rep = new internal::ImageRepSkia( 243 internal::ImageRepSkia* rep = new internal::ImageRepSkia(
244 new ImageSkia(bitmaps)); 244 new ImageSkia(bitmaps));
245 AddRepresentation(rep); 245 AddRepresentation(rep);
246 } 246 }
247 247
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 // Something went seriously wrong... 436 // Something went seriously wrong...
437 return NULL; 437 return NULL;
438 } 438 }
439 439
440 void Image::AddRepresentation(internal::ImageRep* rep) const { 440 void Image::AddRepresentation(internal::ImageRep* rep) const {
441 CHECK(storage_.get()); 441 CHECK(storage_.get());
442 storage_->representations().insert(std::make_pair(rep->type(), rep)); 442 storage_->representations().insert(std::make_pair(rep->type(), rep));
443 } 443 }
444 444
445 } // namespace gfx 445 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/canvas.cc ('k') | ui/gfx/image/image_skia.h » ('j') | ui/gfx/image/image_skia.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698