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

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

Issue 10837090: Change return type of FaviconTabHelper::GetFavicon() to gfx::Image. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 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') | no next file » | 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 NSImage* image = NSImageFromImageSkia(*skia_rep->image()); 330 NSImage* image = NSImageFromImageSkia(*skia_rep->image());
331 base::mac::NSObjectRetain(image); 331 base::mac::NSObjectRetain(image);
332 rep = new internal::ImageRepCocoa(image); 332 rep = new internal::ImageRepCocoa(image);
333 CHECK(rep); 333 CHECK(rep);
334 AddRepresentation(rep); 334 AddRepresentation(rep);
335 } 335 }
336 return rep->AsImageRepCocoa()->image(); 336 return rep->AsImageRepCocoa()->image();
337 } 337 }
338 #endif 338 #endif
339 339
340 SkBitmap Image::AsBitmap() const {
341 return IsEmpty() ? SkBitmap() : *ToSkBitmap();
342 }
343
344 ImageSkia Image::AsImageSkia() const {
345 return IsEmpty() ? ImageSkia(SkBitmap()) : *ToImageSkia();
346 }
347
340 ImageSkia* Image::CopyImageSkia() const { 348 ImageSkia* Image::CopyImageSkia() const {
341 return new ImageSkia(*ToImageSkia()); 349 return new ImageSkia(*ToImageSkia());
342 } 350 }
343 351
344 SkBitmap* Image::CopySkBitmap() const { 352 SkBitmap* Image::CopySkBitmap() const {
345 return new SkBitmap(*ToSkBitmap()); 353 return new SkBitmap(*ToSkBitmap());
346 } 354 }
347 355
348 #if defined(TOOLKIT_GTK) 356 #if defined(TOOLKIT_GTK)
349 GdkPixbuf* Image::CopyGdkPixbuf() const { 357 GdkPixbuf* Image::CopyGdkPixbuf() const {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 } 413 }
406 return it->second; 414 return it->second;
407 } 415 }
408 416
409 void Image::AddRepresentation(internal::ImageRep* rep) const { 417 void Image::AddRepresentation(internal::ImageRep* rep) const {
410 CHECK(storage_.get()); 418 CHECK(storage_.get());
411 storage_->representations().insert(std::make_pair(rep->type(), rep)); 419 storage_->representations().insert(std::make_pair(rep->type(), rep));
412 } 420 }
413 421
414 } // namespace gfx 422 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/image/image.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698