From 5ce1d403f629ae64a786de28480d170b25ec31ea Mon Sep 17 00:00:00 2001 From: sam Date: Mon, 25 Aug 2008 19:13:46 +0000 Subject: [PATCH] * Allow bayer:256 constructs, which do the same as bayer:256x256. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2766 92316355-f0b4-4df1-b90c-862c8a59935f --- pipi/stock.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/pipi/stock.c b/pipi/stock.c index 923aea6..7aaf40a 100644 --- a/pipi/stock.c +++ b/pipi/stock.c @@ -30,18 +30,18 @@ pipi_image_t *pipi_load_stock(char const *name) { pipi_image_t *ret; pipi_pixels_t *pix; - float *data; /* Generate a Bayer dithering pattern. */ if(!strncmp(name, "bayer:", 6)) { - int w, h; + int w, h = 0; w = atoi(name + 6); name = strchr(name + 6, 'x'); - if(!name) - return NULL; - h = atoi(name + 1); + if(name) + h = atoi(name + 1); + if(!h) + h = w; return pipi_render_bayer(w, h); } @@ -168,13 +168,14 @@ pipi_image_t *pipi_load_stock(char const *name) /* Generate a completely random image. */ if(!strncmp(name, "random:", 7)) { - int w, h; + int w, h = 0; w = atoi(name + 7); name = strchr(name + 7, 'x'); - if(!name) - return NULL; - h = atoi(name + 1); + if(name) + h = atoi(name + 1); + if(!h) + h = w; if(w <= 0 || h <= 0) return NULL;