summaryrefslogtreecommitdiffstats
path: root/generic/tkImgPhoto.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2009-09-25 08:48:52 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2009-09-25 08:48:52 (GMT)
commit14767d92e8525b24e10d6c5de874a5cf92a02cba (patch)
tree5a95e83cfd6a065c9db0d329aed824abf767bd11 /generic/tkImgPhoto.c
parent7ddd685d9afb4397ba47bb464c385ef27f3d31ed (diff)
downloadtk-14767d92e8525b24e10d6c5de874a5cf92a02cba.zip
tk-14767d92e8525b24e10d6c5de874a5cf92a02cba.tar.gz
tk-14767d92e8525b24e10d6c5de874a5cf92a02cba.tar.bz2
Correct generation of grayscale data from an image. Reported by Keith Vetter
on comp.lang.tcl.
Diffstat (limited to 'generic/tkImgPhoto.c')
-rw-r--r--generic/tkImgPhoto.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c
index 9ffbb3d..6e385a4 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -17,7 +17,7 @@
* Department of Computer Science,
* Australian National University.
*
- * RCS: @(#) $Id: tkImgPhoto.c,v 1.76.2.3 2009/02/06 08:13:23 das Exp $
+ * RCS: @(#) $Id: tkImgPhoto.c,v 1.76.2.4 2009/09/25 08:48:53 dkf Exp $
*/
#include "tkInt.h"
@@ -5681,8 +5681,8 @@ ImgGetPhoto(
} else if (optPtr->options & OPT_GRAYSCALE) {
for (y = blockPtr->height; y > 0; y--) {
for (x = blockPtr->width; x > 0; x--) {
- *destPtr = (unsigned char)
- (srcPtr[0]*11+srcPtr[1]*16+srcPtr[2]*5 + 16) >> 5;
+ *destPtr = (unsigned char) ((srcPtr[0]*11 + srcPtr[1]*16
+ + srcPtr[2]*5 + 16) >> 5);
srcPtr += blockPtr->pixelSize;
destPtr += newPixelSize;
}