Changeset 42780 in webkit
- Timestamp:
- Apr 23, 2009 8:39:29 AM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r42778 r42780 1 2009-04-23 Zan Dobersek <zandobersek@gmail.com> 2 3 Reviewed by Gustavo Noronha. 4 5 https://bugs.webkit.org/show_bug.cgi?id=15654 6 GdkPixbuf support for ImageCairo 7 8 Add support for converting a Cairo surface to a GdkPixbuf. 9 10 * platform/graphics/BitmapImage.h: 11 * platform/graphics/Image.h: 12 (WebCore::Image::getGdkPixbuf): 13 * platform/graphics/gtk/ImageGtk.cpp: 14 (WebCore::BitmapImage::getGdkPixbuf): 15 1 16 2009-04-23 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> 2 17 -
trunk/WebCore/platform/graphics/BitmapImage.h
r41358 r42780 141 141 #endif 142 142 143 #if PLATFORM(GTK) 144 virtual GdkPixbuf* getGdkPixbuf(); 145 #endif 146 143 147 virtual NativeImagePtr nativeImageForCurrentFrame() { return frameAtIndex(currentFrame()); } 144 148 -
trunk/WebCore/platform/graphics/Image.h
r41996 r42780 60 60 #if PLATFORM(QT) 61 61 #include <QPixmap> 62 #endif 63 64 #if PLATFORM(GTK) 65 typedef struct _GdkPixbuf GdkPixbuf; 62 66 #endif 63 67 … … 143 147 #endif 144 148 149 #if PLATFORM(GTK) 150 virtual GdkPixbuf* getGdkPixbuf() { return 0; } 151 #endif 152 145 153 protected: 146 154 Image(ImageObserver* = 0); -
trunk/WebCore/platform/graphics/gtk/ImageGtk.cpp
r35731 r42780 28 28 #include "BitmapImage.h" 29 29 30 #include <cairo.h> 31 #include <gtk/gtk.h> 32 30 33 // This function loads resources from WebKit 31 34 Vector<char> loadResourceIntoArray(const char*); … … 50 53 } 51 54 55 GdkPixbuf* BitmapImage::getGdkPixbuf() 56 { 57 int width = cairo_image_surface_get_width(frameAtIndex(currentFrame())); 58 int height = cairo_image_surface_get_height(frameAtIndex(currentFrame())); 59 60 GdkPixmap* pixmap = gdk_pixmap_new(0, width, height, 32); 61 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(pixmap)); 62 cairo_set_source_surface(cr, frameAtIndex(currentFrame()), 0, 0); 63 cairo_paint(cr); 64 cairo_destroy(cr); 65 66 GdkPixbuf* pixbuf = gdk_pixbuf_get_from_drawable(0, GDK_DRAWABLE(pixmap), 0, 0, 0, 0, 0, width, height); 67 g_object_unref(pixmap); 68 69 return pixbuf; 52 70 } 71 72 }
Note: See TracChangeset
for help on using the changeset viewer.