Fix:graphics/opengl:Added support for image scaling
authortegzed <tegzed@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 21 Mar 2011 17:40:31 +0000 (17:40 +0000)
committertegzed <tegzed@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 21 Mar 2011 17:40:31 +0000 (17:40 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@4380 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/graphics/opengl/graphics_opengl.c

index 230713a..87bf0d4 100644 (file)
@@ -358,6 +358,15 @@ image_new (struct graphics_priv *gr, struct graphics_image_methods *meth,
   width = FreeImage_GetWidth (image);
   height = FreeImage_GetHeight (image);
 
+  if(*w!=width || *h!=height) {
+    FIBITMAP *image2;
+    image2 = FreeImage_Rescale(image, *w, *h, NULL);
+    FreeImage_Unload(image);
+    image = image2;
+    width = *w;
+    height = *h;
+  }
+
   data = (unsigned char *) malloc (width * height * 4);
 
   RGBQUAD *palette = NULL;