1 /* 2 * This library is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU Lesser General Public 4 * License as published by the Free Software Foundation; either 5 * version 2 of the License, or (at your option) any later version. 6 * 7 * This library is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 * Lesser General Public License for more details. 11 * 12 * You should have received a copy of the GNU Lesser General Public 13 * License along with this library; if not, write to the Free Software 14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 */ 16 17 #include "config.h" 18 #include "DragImage.h" 19 20 #include "CachedImage.h" 21 #include "Image.h" 22 23 #include <gtk/gtk.h> 24 25 namespace WebCore { 26 27 IntSize dragImageSize(DragImageRef image) 28 { 29 if (image) 30 return IntSize(gdk_pixbuf_get_width(image), gdk_pixbuf_get_height(image)); 31 32 return IntSize(0, 0); 33 } 34 35 void deleteDragImage(DragImageRef image) 36 { 37 if (image) 38 g_object_unref(image); 39 } 40 41 DragImageRef scaleDragImage(DragImageRef image, FloatSize scale) 42 { 43 if (image) { 44 IntSize imageSize = dragImageSize(image); 45 GdkPixbuf* scaledImage = gdk_pixbuf_scale_simple(image, 46 imageSize.width() * scale.width(), 47 imageSize.height() * scale.height(), 48 GDK_INTERP_BILINEAR); 49 deleteDragImage(image); 50 return scaledImage; 51 } 52 53 return 0; 54 } 55 56 DragImageRef dissolveDragImageToFraction(DragImageRef image, float) 57 { 58 return image; 59 } 60 61 DragImageRef createDragImageFromImage(Image* image) 62 { 63 return image->getGdkPixbuf(); 64 } 65 66 DragImageRef createDragImageIconForCachedImage(CachedImage*) 67 { 68 return 0; 69 } 70 71 } 72