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

Unified Diff: ui/gfx/image/image.cc

Issue 10377122: Convert GdkPixbufFromSkBitmap and GdkPixbufToSkBitmap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/gtk_util.cc ('k') | ui/gfx/image/image_unittest_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image.cc
diff --git a/ui/gfx/image/image.cc b/ui/gfx/image/image.cc
index 70324b182033cdbb6f6a735c238f4616bc6cccd0..0ef9298404c2e63fa65cec549a2fc438c1ac10da 100644
--- a/ui/gfx/image/image.cc
+++ b/ui/gfx/image/image.cc
@@ -36,7 +36,7 @@ NSImage* ImageSkiaToNSImage(const ImageSkia* image);
#endif
#if defined(TOOLKIT_GTK)
-const SkBitmap* GdkPixbufToSkBitmap(GdkPixbuf* pixbuf) {
+const ImageSkia GdkPixbufToImageSkia(GdkPixbuf* pixbuf) {
CHECK(pixbuf);
gfx::Canvas canvas(gfx::Size(gdk_pixbuf_get_width(pixbuf),
gdk_pixbuf_get_height(pixbuf)), false);
@@ -44,7 +44,7 @@ const SkBitmap* GdkPixbufToSkBitmap(GdkPixbuf* pixbuf) {
cairo_t* cr = scoped_platform_paint.GetPlatformSurface();
gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0);
cairo_paint(cr);
- return new SkBitmap(canvas.ExtractBitmap());
+ return ImageSkia(SkBitmap(canvas.ExtractBitmap()));
}
#endif
@@ -384,7 +384,7 @@ internal::ImageRep* Image::GetRepresentation(
if (storage_->default_representation_type() == Image::kImageRepGdk) {
internal::ImageRepGdk* pixbuf_rep = default_rep->AsImageRepGdk();
rep = new internal::ImageRepSkia(new ImageSkia(
- internal::GdkPixbufToSkBitmap(pixbuf_rep->pixbuf())));
+ internal::GdkPixbufToImageSkia(pixbuf_rep->pixbuf())));
}
// We don't do conversions from CairoCachedSurfaces to Skia because the
// data lives on the display server and we'll always have a GdkPixbuf if we
@@ -422,7 +422,7 @@ internal::ImageRep* Image::GetRepresentation(
#elif defined(TOOLKIT_GTK)
if (rep_type == Image::kImageRepGdk) {
GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(
- default_rep->AsImageRepSkia()->image()->bitmap());
+ *default_rep->AsImageRepSkia()->image()->bitmap());
native_rep = new internal::ImageRepGdk(pixbuf);
}
#elif defined(OS_MACOSX)
« no previous file with comments | « ui/gfx/gtk_util.cc ('k') | ui/gfx/image/image_unittest_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698