summaryrefslogtreecommitdiffstats
path: root/generic/tkImgPhInstance.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-08-27 19:48:23 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-08-27 19:48:23 (GMT)
commit55ad282f48e04748a7cf3d375ad3fc2abb47c0a1 (patch)
treec8cd1c66faa65fac8be9a9a85c0fc3ba7b8a564f /generic/tkImgPhInstance.c
parentbd27ced6025b5ce285080806ecd44c8b9bc1786a (diff)
parentef65c6ff80f269b8e94aa1ff98e76831b93c4550 (diff)
downloadtk-55ad282f48e04748a7cf3d375ad3fc2abb47c0a1.zip
tk-55ad282f48e04748a7cf3d375ad3fc2abb47c0a1.tar.gz
tk-55ad282f48e04748a7cf3d375ad3fc2abb47c0a1.tar.bz2
Generate -errorcode values to go with errors. Generate messages and postscript
using Tcl_Obj API, not the string result API.
Diffstat (limited to 'generic/tkImgPhInstance.c')
-rw-r--r--generic/tkImgPhInstance.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c
index 5429ee3..3097489 100644
--- a/generic/tkImgPhInstance.c
+++ b/generic/tkImgPhInstance.c
@@ -1068,8 +1068,7 @@ GetColorTable(
* Allocate colors for this color table if necessary.
*/
- if ((colorPtr->numColors == 0)
- && ((colorPtr->flags & BLACK_AND_WHITE) == 0)) {
+ if ((colorPtr->numColors == 0) && !(colorPtr->flags & BLACK_AND_WHITE)) {
AllocateColors(colorPtr);
}
}
@@ -1104,12 +1103,12 @@ FreeColorTable(
}
if (force) {
- if ((colorPtr->flags & DISPOSE_PENDING) != 0) {
+ if (colorPtr->flags & DISPOSE_PENDING) {
Tcl_CancelIdleCall(DisposeColorTable, colorPtr);
colorPtr->flags &= ~DISPOSE_PENDING;
}
DisposeColorTable(colorPtr);
- } else if ((colorPtr->flags & DISPOSE_PENDING) == 0) {
+ } else if (!(colorPtr->flags & DISPOSE_PENDING)) {
Tcl_DoWhenIdle(DisposeColorTable, colorPtr);
colorPtr->flags |= DISPOSE_PENDING;
}
@@ -1813,11 +1812,11 @@ TkImgDitherInstance(
}
c = ((c + 2056) >> 4) - 128;
- if ((masterPtr->flags & COLOR_IMAGE) == 0) {
- c += srcPtr[0];
- } else {
+ if (masterPtr->flags & COLOR_IMAGE) {
c += (unsigned) (srcPtr[0] * 11 + srcPtr[1] * 16
+ srcPtr[2] * 5 + 16) >> 5;
+ } else {
+ c += srcPtr[0];
}
srcPtr += 4;
@@ -1886,11 +1885,11 @@ TkImgDitherInstance(
}
c = ((c + 2056) >> 4) - 128;
- if ((masterPtr->flags & COLOR_IMAGE) == 0) {
- c += srcPtr[0];
- } else {
+ if (masterPtr->flags & COLOR_IMAGE) {
c += (unsigned)(srcPtr[0] * 11 + srcPtr[1] * 16
+ srcPtr[2] * 5 + 16) >> 5;
+ } else {
+ c += srcPtr[0];
}
srcPtr += 4;