diff options
author | fvogel <fvogelnew1@free.fr> | 2021-11-08 20:34:23 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2021-11-08 20:34:23 (GMT) |
commit | f6798d72d197be46991c90e29502db412adc22ae (patch) | |
tree | 8bc68e334da881bdf6cee882c816fbce95c1d97a /generic/tkImgPPM.c | |
parent | 9c88848c95f3fa2fc84dca2a6e29741a093d256b (diff) | |
download | tk-f6798d72d197be46991c90e29502db412adc22ae.zip tk-f6798d72d197be46991c90e29502db412adc22ae.tar.gz tk-f6798d72d197be46991c90e29502db412adc22ae.tar.bz2 |
Fix [440c528a99]: 16 bit Portable GrayMap broken.
Diffstat (limited to 'generic/tkImgPPM.c')
-rw-r--r-- | generic/tkImgPPM.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/generic/tkImgPPM.c b/generic/tkImgPPM.c index fed1ca7..a53213e 100644 --- a/generic/tkImgPPM.c +++ b/generic/tkImgPPM.c @@ -240,7 +240,7 @@ FileReadPPM( unsigned char *p; unsigned int value; - for (p = pixelPtr; count > 0; count--, p += 2) { + for (p = pixelPtr; count > 0; count -= 2, p += 2) { value = ((unsigned int) p[0]) * 256 + ((unsigned int) p[1]); value = value * 255 / maxIntensity; p[0] = p[1] = (unsigned char) value; @@ -602,8 +602,8 @@ StringReadPPM( } else { unsigned int value; - for (p = pixelPtr,count=nBytes; count > 1; count-=2, p += 2) { - value = ((unsigned int) p[0]) * 256 + ((unsigned int) p[1]); + for (p = pixelPtr,count=nBytes; count > 1; count-=2, p += 2, dataBuffer += 2) { + value = ((unsigned int)dataBuffer[0]) * 256 + ((unsigned int)dataBuffer[1]); value = value * 255 / maxIntensity; p[0] = p[1] = (unsigned char) value; } |