diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2013-12-15 02:22:26 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2013-12-15 02:22:26 +0000 |
commit | 0142e0de15158c6f0d73fc7a022da938ae724be4 (patch) | |
tree | a8424fcdb5c88dc946e0ffd7bde3062ca06f6f75 /generator | |
parent | 7903da13d060ae1237340ace03ce6761bd8ab1f8 (diff) | |
download | netpbm-mirror-0142e0de15158c6f0d73fc7a022da938ae724be4.tar.gz netpbm-mirror-0142e0de15158c6f0d73fc7a022da938ae724be4.tar.xz netpbm-mirror-0142e0de15158c6f0d73fc7a022da938ae724be4.zip |
Release 10.64.05
git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@2060 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'generator')
-rw-r--r-- | generator/ppmpat.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/generator/ppmpat.c b/generator/ppmpat.c index 2e8092b3..fe1a1d27 100644 --- a/generator/ppmpat.c +++ b/generator/ppmpat.c @@ -877,6 +877,19 @@ static ppmd_point sq_offs[SQ_MAXCIRCLE_POINTS]; +static void +validateSquigAspect(unsigned int const cols, + unsigned int const rows) { + + if (cols / rows >= 25 || rows / cols >= 25) + pm_error("Image too narrow. Aspect ratio: %u/%u=%f " + "is outside accepted range: 0.04 - 25.0", + cols, rows, (float)cols/rows ); + +} + + + static ppmd_point vectorSum(ppmd_point const a, ppmd_point const b) { @@ -1081,6 +1094,8 @@ squig(pixel ** const pixels, pixval const maxval) { int i; + + validateSquigAspect(cols, rows); clearImageToBlack(pixels, cols, rows, maxval); @@ -1106,6 +1121,9 @@ squig(pixel ** const pixels, unsigned int j; for (j = 1; j < SQ_POINTS - 1; ++j) { + /* validateSquigAspect() assures that + cols - 2 * radius, rows -2 * radius are positive + */ c[j].x = (rand() % (cols - 2 * radius)) + radius; c[j].y = (rand() % (rows - 2 * radius)) + radius; } |