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

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

Issue 9455062: Add gfx::Image::Image(const SkBitmap&) constructor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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_unittest.cc » ('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/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 Image::Image() { 236 Image::Image() {
237 // |storage_| is NULL for empty Images. 237 // |storage_| is NULL for empty Images.
238 } 238 }
239 239
240 Image::Image(const SkBitmap* bitmap) 240 Image::Image(const SkBitmap* bitmap)
241 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { 241 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) {
242 internal::ImageRepSkia* rep = new internal::ImageRepSkia(bitmap); 242 internal::ImageRepSkia* rep = new internal::ImageRepSkia(bitmap);
243 AddRepresentation(rep); 243 AddRepresentation(rep);
244 } 244 }
245 245
246 Image::Image(const SkBitmap& bitmap)
247 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) {
248 internal::ImageRepSkia* rep =
249 new internal::ImageRepSkia(new SkBitmap(bitmap));
250 AddRepresentation(rep);
251 }
252
246 Image::Image(const std::vector<const SkBitmap*>& bitmaps) 253 Image::Image(const std::vector<const SkBitmap*>& bitmaps)
247 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { 254 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) {
248 internal::ImageRepSkia* rep = new internal::ImageRepSkia(bitmaps); 255 internal::ImageRepSkia* rep = new internal::ImageRepSkia(bitmaps);
249 AddRepresentation(rep); 256 AddRepresentation(rep);
250 } 257 }
251 258
252 #if defined(TOOLKIT_USES_GTK) 259 #if defined(TOOLKIT_USES_GTK)
253 Image::Image(GdkPixbuf* pixbuf) 260 Image::Image(GdkPixbuf* pixbuf)
254 : storage_(new internal::ImageStorage(Image::kImageRepGdk)) { 261 : storage_(new internal::ImageStorage(Image::kImageRepGdk)) {
255 internal::ImageRepGdk* rep = new internal::ImageRepGdk(pixbuf); 262 internal::ImageRepGdk* rep = new internal::ImageRepGdk(pixbuf);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 return GetRepresentation(Image::kImageRepSkia)->AsImageRepSkia()-> 466 return GetRepresentation(Image::kImageRepSkia)->AsImageRepSkia()->
460 bitmaps().size(); 467 bitmaps().size();
461 } 468 }
462 469
463 const SkBitmap* Image::GetSkBitmapAtIndex(size_t index) const { 470 const SkBitmap* Image::GetSkBitmapAtIndex(size_t index) const {
464 return GetRepresentation(Image::kImageRepSkia)->AsImageRepSkia()-> 471 return GetRepresentation(Image::kImageRepSkia)->AsImageRepSkia()->
465 bitmaps()[index]; 472 bitmaps()[index];
466 } 473 }
467 474
468 } // namespace gfx 475 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/image/image.h ('k') | ui/gfx/image/image_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698