X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fgfximage.c;h=661f9cd9db2a7981b63f3638f36b3079a00d6813;hp=3e6cfde069cd2ef648d10fe9bc4c4fa934ad2b22;hb=c63b2bf21dc1df9a736f0b4c08f6cba828cdab92;hpb=8deae5c09c8cda6f48fb9b0113487567582e6376 diff --git a/lib/gfximage.c b/lib/gfximage.c index 3e6cfde..661f9cd 100644 --- a/lib/gfximage.c +++ b/lib/gfximage.c @@ -7,6 +7,15 @@ #include "gfximage.h" #include "types.h" +gfximage_t*gfximage_new(int width, int height) +{ + gfximage_t*i = rfx_calloc(sizeof(gfximage_t)); + i->data = rfx_calloc(width*height*4); + i->width = width; + i->height = height; + return i; +} + void gfximage_save_jpeg(gfximage_t*img, const char*filename, int quality) { int x,y; @@ -254,9 +263,11 @@ gfximage_t* gfximage_rescale(gfximage_t*image, int newwidth, int newheight) rgba_int_t*tmpline; int monochrome = 0; gfxcolor_t monochrome_colors[2]; - - if(newwidth<1 || newheight<1) - return 0; + + if(newwidth<1) + newwidth=1; + if(newheight<1) + newheight=1; int width = image->width; int height = image->height;