diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2021-03-27 18:51:04 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2021-03-27 18:51:04 +0000 |
commit | e722d4426fa43a12dcba8369808b28af4e38b526 (patch) | |
tree | 258b7d8c8bdc28a3805348893179f3a9bece0e06 /editor | |
parent | 70281e0860cc4ef71cd1f4c25a45f45bf2cbdb6d (diff) | |
download | netpbm-mirror-e722d4426fa43a12dcba8369808b28af4e38b526.tar.gz netpbm-mirror-e722d4426fa43a12dcba8369808b28af4e38b526.tar.xz netpbm-mirror-e722d4426fa43a12dcba8369808b28af4e38b526.zip |
Release 10.73.35
git-svn-id: http://svn.code.sf.net/p/netpbm/code/super_stable@4072 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'editor')
-rw-r--r-- | editor/pamscale.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/editor/pamscale.c b/editor/pamscale.c index 7c6ee256..2760b298 100644 --- a/editor/pamscale.c +++ b/editor/pamscale.c @@ -2103,33 +2103,45 @@ scaleWithoutMixing(const struct pam * const inpamP, -----------------------------------------------------------------------------*/ tuple * tuplerow; /* An input row */ tuple * newtuplerow; - int row; - int rowInInput; + unsigned int row; + /* The number of the next row to be output */ + unsigned int rowInInput; + /* The number of the next row to be read from the input */ assert(outpamP->maxval == inpamP->maxval); assert(outpamP->depth == inpamP->depth); tuplerow = pnm_allocpamrow(inpamP); - rowInInput = -1; + rowInInput = 0; newtuplerow = pnm_allocpamrow(outpamP); for (row = 0; row < outpamP->height; ++row) { - int col; + unsigned int col; - int const inputRow = (int) (row / yscale); + unsigned int const inputRow = (int) (row / yscale); + /* The number of the input row that we will use for this output + row. + */ - for (; rowInInput < inputRow; ++rowInInput) + for (; rowInInput <= inputRow; ++rowInInput) pnm_readpamrow(inpamP, tuplerow); for (col = 0; col < outpamP->width; ++col) { - int const inputCol = (int) (col / xscale); + unsigned int const inputCol = (int) (col / xscale); pnm_assigntuple(inpamP, newtuplerow[col], tuplerow[inputCol]); } pnm_writepamrow(outpamP, newtuplerow); } + /* Read off and discard rest of rows, because whatever is supplying the + input stream may expect it to be consumed and because Caller will expect + the stream to be positioned to the next image. + */ + for (; rowInInput < inpamP->height; ++rowInInput) + pnm_readpamrow(inpamP, tuplerow); + pnm_freepamrow(tuplerow); pnm_freepamrow(newtuplerow); } |