summaryrefslogtreecommitdiffstats
path: root/generic/tkImgPhoto.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2015-05-05 19:38:12 (GMT)
committerdgp <dgp@users.sourceforge.net>2015-05-05 19:38:12 (GMT)
commit307c22d55990d4b2ff2981d1a37ef39f88aca78b (patch)
treec3e41a4c66546f44f48d553fbf447659aa824e28 /generic/tkImgPhoto.c
parent22ebc724fe95500c9c01576ef1f2fc97f849a56a (diff)
parentd1dd76e66ac3f2e94f74fa863b4f90c76e278db4 (diff)
downloadtk-307c22d55990d4b2ff2981d1a37ef39f88aca78b.zip
tk-307c22d55990d4b2ff2981d1a37ef39f88aca78b.tar.gz
tk-307c22d55990d4b2ff2981d1a37ef39f88aca78b.tar.bz2
[06c3fcb136] ImgGetPhoto() had some code misplaced in an earlier commit
so that it failed to tell all callers when the alpha channel was fully opaque. This triggered another bug in the PNG writer where the alpha vs. non-alpha format choice was broken and confused, leading to corrupt png image files.
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 9527c93..63e2fa8 100644
--- a/generic/tkImgPhoto.c
+++ b/generic/tkImgPhoto.c
@@ -3683,6 +3683,9 @@ ImgGetPhoto(
break;
}
}
+ if (!alphaOffset) {
+ blockPtr->offset[3]= -1; /* Tell caller alpha need not be read */
+ }
greenOffset = blockPtr->offset[1] - blockPtr->offset[0];
blueOffset = blockPtr->offset[2] - blockPtr->offset[0];
if (((optPtr->options & OPT_BACKGROUND) && alphaOffset) ||
@@ -3803,9 +3806,6 @@ ImgGetPhoto(
blockPtr->offset[2] = 0;
blockPtr->offset[3]= 1;
}
- if (!alphaOffset) {
- blockPtr->offset[3]= -1;
- }
return data;
}
return NULL;