X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fdevices%2Frescale.c;h=350dfd2b849bf498ba87eb070ba9d790df954bd8;hb=7fb4a4ac393f19a0b8a8998a2f1deac88c97eda0;hp=b8530b9319b01891bca9a25e2e790c1d1e93ce1a;hpb=63b58b0a4d9cb491218bd737cd1bfb54c43f1b37;p=swftools.git diff --git a/lib/devices/rescale.c b/lib/devices/rescale.c index b8530b9..350dfd2 100644 --- a/lib/devices/rescale.c +++ b/lib/devices/rescale.c @@ -54,7 +54,7 @@ static void dbg(char*format, ...) int l; va_list arglist; va_start(arglist, format); - vsprintf(buf, format, arglist); + vsnprintf(buf, sizeof(buf)-1, format, arglist); va_end(arglist); l = strlen(buf); while(l && buf[l-1]=='\n') { @@ -121,6 +121,12 @@ int rescale_setparameter(gfxdevice_t*dev, const char*key, const char*value) if(!strcmp(key, "keepratio")) { i->keepratio = atoi(value); return 1; + } else if(!strcmp(key, "centerx")) { + i->centerx = atoi(value); + return 1; + } else if(!strcmp(key, "centery")) { + i->centery = atoi(value); + return 1; } else { if(i->out) { return i->out->setparameter(i->out,key,value); @@ -325,3 +331,10 @@ void gfxdevice_rescale_setdevice(gfxdevice_t*dev, gfxdevice_t*out) } i->out = out; } + +gfxdevice_t* gfxdevice_rescale_new(gfxdevice_t*out, int width, int height, double scale) +{ + gfxdevice_t* d = (gfxdevice_t*)malloc(sizeof(gfxdevice_t)); + gfxdevice_rescale_init(d, out, width, height, scale); + return d; +}