diff options
author | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-14 23:16:21 +0000 |
---|---|---|
committer | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-14 23:16:21 +0000 |
commit | e5a99ff3bd91f5493e7916b9dca6b29429ce0f43 (patch) | |
tree | cc12f65483a8c95dcea331605cc84af3a7c18da6 /chrome/common/gtk_util.cc | |
parent | 63e9985f427227c977c96d1105de6e251dfd7554 (diff) | |
download | chromium_src-e5a99ff3bd91f5493e7916b9dca6b29429ce0f43.zip chromium_src-e5a99ff3bd91f5493e7916b9dca6b29429ce0f43.tar.gz chromium_src-e5a99ff3bd91f5493e7916b9dca6b29429ce0f43.tar.bz2 |
Move bitmap conversion function from chrome/common/gtk_utils.h into app/gfx/gtk_utils.h
http://crbug.com/11387
Review URL: http://codereview.chromium.org/115382
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16122 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/gtk_util.cc')
-rw-r--r-- | chrome/common/gtk_util.cc | 29 |
1 files changed, 2 insertions, 27 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 |