$OpenBSD: patch-ui_gfx_image_cc,v 1.1 2011/04/29 13:18:02 robert Exp $ --- ui/gfx/image.cc.orig Fri Apr 29 10:48:33 2011 +++ ui/gfx/image.cc Fri Apr 29 10:48:56 2011 @@ -9,7 +9,7 @@ #include "base/logging.h" #include "third_party/skia/include/core/SkBitmap.h" -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_OPENBSD) #include #include #include "ui/gfx/canvas_skia.h" @@ -29,7 +29,7 @@ namespace internal { const SkBitmap* NSImageToSkBitmap(NSImage* image); #endif -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_OPENBSD) const SkBitmap* GdkPixbufToSkBitmap(GdkPixbuf* pixbuf) { gfx::CanvasSkia canvas(gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf), @@ -61,7 +61,7 @@ class ImageRep { return reinterpret_cast(this); } -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_OPENBSD) GdkPixbufRep* AsGdkPixbufRep() { CHECK_EQ(type_, Image::kGdkPixbufRep); return reinterpret_cast(this); @@ -102,7 +102,7 @@ class SkBitmapRep : public ImageRep { DISALLOW_COPY_AND_ASSIGN(SkBitmapRep); }; -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_OPENBSD) class GdkPixbufRep : public ImageRep { public: explicit GdkPixbufRep(GdkPixbuf* pixbuf) @@ -158,7 +158,7 @@ Image::Image(const SkBitmap* bitmap) AddRepresentation(rep); } -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_OPENBSD) Image::Image(GdkPixbuf* pixbuf) : default_representation_(Image::kGdkPixbufRep) { internal::GdkPixbufRep* rep = new internal::GdkPixbufRep(pixbuf); @@ -190,7 +190,7 @@ Image::operator const SkBitmap&() { return *(this->operator const SkBitmap*()); } -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_OPENBSD) Image::operator GdkPixbuf*() { internal::ImageRep* rep = GetRepresentation(Image::kGdkPixbufRep); return rep->AsGdkPixbufRep()->pixbuf(); @@ -237,7 +237,7 @@ internal::ImageRep* Image::GetRepresentation(Represent // Handle native-to-Skia conversion. if (rep_type == Image::kSkBitmapRep) { internal::SkBitmapRep* rep = NULL; -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_OPENBSD) if (default_representation_ == Image::kGdkPixbufRep) { internal::GdkPixbufRep* pixbuf_rep = default_rep->AsGdkPixbufRep(); rep = new internal::SkBitmapRep( @@ -261,7 +261,7 @@ internal::ImageRep* Image::GetRepresentation(Represent if (default_rep->type() == Image::kSkBitmapRep) { internal::SkBitmapRep* skia_rep = default_rep->AsSkBitmapRep(); internal::ImageRep* native_rep = NULL; -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_OPENBSD) if (rep_type == Image::kGdkPixbufRep) { GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(skia_rep->bitmap()); native_rep = new internal::GdkPixbufRep(pixbuf);