remove #error, because sdl.cpp isn't even included in the makefile for now
[enigma2.git] / lib / gdi / picload.cpp
index e3cdc035606e5aaa39405fa03ac2691ae3a906e6..e8a0e8c0bcd6f91ba860cf32cedfa2efdaf0cf7b 100644 (file)
@@ -1,9 +1,8 @@
+#include <png.h>       // must be included before Python.h because of setjmp
 #include <lib/gdi/picload.h>
 #include "picexif.h"
 #include <lib/python/python.h>
 
-#include <png.h>
-
 #include <fcntl.h>
 #include <unistd.h>
 #include <stdio.h>
@@ -14,7 +13,6 @@ extern "C" {
 #include <gif_lib.h>
 //#include "transupp.h"
 }
-#include <setjmp.h>
 
 unsigned char *pic_buffer=NULL;
 
@@ -393,7 +391,16 @@ static int png_load(const char *filename,  int *x, int *y)
                eDebug("[PNG] Error processing");
                return 0;
        }
-       
+
+       if (width * height > 1000000) // 1000x1000 or equiv.
+       {
+               eDebug("[png_load] image size is %d x %d, which is \"too large\".", width, height);
+               png_read_end(png_ptr, info_ptr);
+               png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
+               fclose(fh);
+               return 0;
+       }
+
        pic_buffer = new unsigned char[width * height * 3];
        *x=width;
        *y=height;
@@ -642,10 +649,10 @@ int loadPic(ePtr<gPixmap> &result, std::string filename, int w, int h, int aspec
                double aspect_ratio;
                switch(aspect)
                {
-                       case 1:         aspect_ratio = 1.777 / ((double)720/576); break; //16:9
-                       case 2:         aspect_ratio = 1.600 / ((double)720/576); break; //16:10
-                       //case 3:       aspect_ratio = 1.250 / ((double)720/576); break; //5:4
-                       default:        aspect_ratio = 1.333 / ((double)720/576); //4:3
+                       case 1:         aspect_ratio = 1.778 / ((double)702/576); break; //16:9
+                       case 2:         aspect_ratio = 1.600 / ((double)702/576); break; //16:10
+                       //case 3:       aspect_ratio = 1.250 / ((double)702/576); break; //5:4
+                       default:        aspect_ratio = 1.333 / ((double)702/576); //4:3
                }
 
                if((aspect_ratio * oy * w / ox) <= h)