summaryrefslogtreecommitdiffstats
path: root/generic/tkCanvLine.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2010-08-11 09:39:08 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2010-08-11 09:39:08 (GMT)
commit4122c77d4999c3ead1140dd12f7c2b8d8ebca150 (patch)
tree1c2909002baa3105d29e99b39708272b0a19bde3 /generic/tkCanvLine.c
parent0ff0c1cae7c3fd5086f30c5e4182592dbc620b1b (diff)
downloadtk-4122c77d4999c3ead1140dd12f7c2b8d8ebca150.zip
tk-4122c77d4999c3ead1140dd12f7c2b8d8ebca150.tar.gz
tk-4122c77d4999c3ead1140dd12f7c2b8d8ebca150.tar.bz2
* generic/tkCanvLine.c (LineDeleteCoords): [Bug 2900121]: Backport of
fix to sense of test.
Diffstat (limited to 'generic/tkCanvLine.c')
-rw-r--r--generic/tkCanvLine.c57
1 files changed, 34 insertions, 23 deletions
diff --git a/generic/tkCanvLine.c b/generic/tkCanvLine.c
index b0e122c..d2954f2 100644
--- a/generic/tkCanvLine.c
+++ b/generic/tkCanvLine.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkCanvLine.c,v 1.22 2007/12/13 15:24:13 dgp Exp $
+ * RCS: @(#) $Id: tkCanvLine.c,v 1.22.2.1 2010/08/11 09:39:08 dkf Exp $
*/
#include <stdio.h>
@@ -1151,7 +1151,7 @@ LineDeleteCoords(
double *coordPtr;
Tk_State state = itemPtr->state;
- if(state == TK_STATE_NULL) {
+ if (state == TK_STATE_NULL) {
state = ((TkCanvas *)canvas)->canvas_state;
}
@@ -1175,15 +1175,24 @@ LineDeleteCoords(
linePtr->coordPtr[length-2] = linePtr->lastArrowPtr[0];
linePtr->coordPtr[length-1] = linePtr->lastArrowPtr[1];
}
- first1 = first; last1 = last;
- if(first1>0) first1 -= 2;
- if(last1<length-2) last1 += 2;
+ first1 = first;
+ last1 = last;
+ if (first1 > 0) {
+ first1 -= 2;
+ }
+ if (last1 < length-2) {
+ last1 += 2;
+ }
if (linePtr->smooth) {
- if(first1>0) first1 -= 2;
- if(last1<length-2) last1 += 2;
+ if (first1 > 0) {
+ first1 -= 2;
+ }
+ if (last1 < length-2) {
+ last1 += 2;
+ }
}
- if((first1<2) && (last1 >= length-2)) {
+ if (!(first1 < 2) && (last1 >= length-2)) {
/*
* This is some optimizing code that will result that only the part of
* the line that changed (and the objects that are overlapping with
@@ -1196,7 +1205,7 @@ LineDeleteCoords(
itemPtr->redraw_flags |= TK_ITEM_DONT_REDRAW;
itemPtr->x1 = itemPtr->x2 = (int) linePtr->coordPtr[first1];
itemPtr->y1 = itemPtr->y2 = (int) linePtr->coordPtr[first1+1];
- if ((linePtr->firstArrowPtr != NULL) && (first1<2)) {
+ if ((linePtr->firstArrowPtr != NULL) && (first1 < 2)) {
/*
* Include old first arrow.
*/
@@ -1206,7 +1215,7 @@ LineDeleteCoords(
TkIncludePoint(itemPtr, coordPtr);
}
}
- if ((linePtr->lastArrowPtr != NULL) && (last1>=length-2)) {
+ if ((linePtr->lastArrowPtr != NULL) && (last1 >= length-2)) {
/*
* Include old last arrow.
*/
@@ -1219,7 +1228,7 @@ LineDeleteCoords(
coordPtr = linePtr->coordPtr+first1+2;
for (i=first1+2; i<=last1; i+=2) {
TkIncludePoint(itemPtr, coordPtr);
- coordPtr+=2;
+ coordPtr += 2;
}
}
@@ -1237,13 +1246,13 @@ LineDeleteCoords(
linePtr->lastArrowPtr = NULL;
}
if (linePtr->arrow != ARROWS_NONE) {
- ConfigureArrows(canvas, linePtr);
+ ConfigureArrows(canvas, linePtr);
}
- if(itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW) {
+ if (itemPtr->redraw_flags & TK_ITEM_DONT_REDRAW) {
double width;
int intWidth;
- if ((linePtr->firstArrowPtr != NULL) && (first1<4)) {
+ if ((linePtr->firstArrowPtr != NULL) && (first1 < 4)) {
/*
* Include new first arrow.
*/
@@ -1253,7 +1262,7 @@ LineDeleteCoords(
TkIncludePoint(itemPtr, coordPtr);
}
}
- if ((linePtr->lastArrowPtr != NULL) && (last1>(length-4))) {
+ if ((linePtr->lastArrowPtr != NULL) && (last1 > length-4)) {
/*
* Include new right arrow.
*/
@@ -1265,20 +1274,22 @@ LineDeleteCoords(
}
width = linePtr->outline.width;
if (((TkCanvas *)canvas)->currentItemPtr == itemPtr) {
- if (linePtr->outline.activeWidth>width) {
- width = linePtr->outline.activeWidth;
- }
+ if (linePtr->outline.activeWidth > width) {
+ width = linePtr->outline.activeWidth;
+ }
} else if (state==TK_STATE_DISABLED) {
- if (linePtr->outline.disabledWidth>0) {
- width = linePtr->outline.disabledWidth;
- }
+ if (linePtr->outline.disabledWidth > 0) {
+ width = linePtr->outline.disabledWidth;
+ }
}
intWidth = (int) (width + 0.5);
if (intWidth < 1) {
intWidth = 1;
}
- itemPtr->x1 -= intWidth; itemPtr->y1 -= intWidth;
- itemPtr->x2 += intWidth; itemPtr->y2 += intWidth;
+ itemPtr->x1 -= intWidth;
+ itemPtr->y1 -= intWidth;
+ itemPtr->x2 += intWidth;
+ itemPtr->y2 += intWidth;
Tk_CanvasEventuallyRedraw(canvas, itemPtr->x1, itemPtr->y1,
itemPtr->x2, itemPtr->y2);
}