diff options
author | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-14 23:50:24 +0000 |
---|---|---|
committer | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-14 23:50:24 +0000 |
commit | a16cea9f88efd1b0fa43a8b331fa69e6c2b69864 (patch) | |
tree | 9242263c361166eb9fe80efce2c635f51ae0302b /chrome/common | |
parent | 715dfab49198de28a3c8577d63573a668b570f88 (diff) | |
download | chromium_src-a16cea9f88efd1b0fa43a8b331fa69e6c2b69864.zip chromium_src-a16cea9f88efd1b0fa43a8b331fa69e6c2b69864.tar.gz chromium_src-a16cea9f88efd1b0fa43a8b331fa69e6c2b69864.tar.bz2 |
Reverting 16124.
Review URL: http://codereview.chromium.org/115387
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16125 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/gtk_util.cc | 29 | ||||
-rw-r--r-- | chrome/common/gtk_util.h | 12 |
2 files changed, 5 insertions, 36 deletions
diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc index d246ccc..f0d5ea1 100644 --- a/chrome/common/gtk_util.cc +++ b/chrome/common/gtk_util.cc @@ -16,10 +16,6 @@ void RemoveWidget(GtkWidget* widget, gpointer container) { gtk_container_remove(GTK_CONTAINER(container), widget); } -void FreePixels(guchar* pixels, gpointer data) { - free(data); -} - } // namespace namespace event_utils { @@ -37,28 +33,7 @@ WindowOpenDisposition DispositionFromEventFlags(guint event_flags) { } // namespace event_utils -namespace gfx { - -GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap* bitmap) { - bitmap->lockPixels(); - int width = bitmap->width(); - int height = bitmap->height(); - int stride = bitmap->rowBytes(); - const guchar* orig_data = static_cast<guchar*>(bitmap->getPixels()); - guchar* data = base::BGRAToRGBA(orig_data, width, height, stride); - - // This pixbuf takes ownership of our malloc()ed data and will - // free it for us when it is destroyed. - GdkPixbuf* pixbuf = gdk_pixbuf_new_from_data( - data, - GDK_COLORSPACE_RGB, // The only colorspace gtk supports. - true, // There is an alpha channel. - 8, - width, height, stride, &FreePixels, data); - - bitmap->unlockPixels(); - return pixbuf; -} +namespace gtk_util { GtkWidget* CreateGtkBorderBin(GtkWidget* child, const GdkColor* color, int top, int bottom, int left, int right) { @@ -79,4 +54,4 @@ void RemoveAllChildren(GtkWidget* container) { gtk_container_foreach(GTK_CONTAINER(container), RemoveWidget, container); } -} // namespace gfx +} // namespace gtk_util diff --git a/chrome/common/gtk_util.h b/chrome/common/gtk_util.h index ff3dc5c..9a94182 100644 --- a/chrome/common/gtk_util.h +++ b/chrome/common/gtk_util.h @@ -9,9 +9,7 @@ #include "webkit/glue/window_open_disposition.h" -typedef struct _GdkPixbuf GdkPixbuf; typedef struct _GtkWidget GtkWidget; -class SkBitmap; namespace event_utils { @@ -22,13 +20,9 @@ WindowOpenDisposition DispositionFromEventFlags(guint state); } // namespace event_utils -namespace gfx { +namespace gtk_util { -// Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so -// it is an expensive operation. -GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap* bitmap); - -// Create a GtkBin with |child| as its child widget. This bin will paint a + // Create a GtkBin with |child| as its child widget. This bin will paint a // border of color |color| with the sizes specified in pixels. GtkWidget* CreateGtkBorderBin(GtkWidget* child, const GdkColor* color, int top, int bottom, int left, int right); @@ -36,6 +30,6 @@ GtkWidget* CreateGtkBorderBin(GtkWidget* child, const GdkColor* color, // Remove all children from this container. void RemoveAllChildren(GtkWidget* container); -} // namespace gfx +} // namespace gtk_util #endif // CHROME_COMMON_GTK_UTIL_H_ |