File: fix-graphs.patch

package info (click to toggle)
blt 3.0~1%2B08570046%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 45,556 kB
  • sloc: ansic: 278,852; tcl: 96,434; sh: 3,410; makefile: 2,026; cpp: 374
file content (47 lines) | stat: -rw-r--r-- 1,582 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--- a/src/bltGraph.c
+++ b/src/bltGraph.c
@@ -2018,19 +2018,21 @@
             return TCL_ERROR;
         }
         Tk_SizeOfImage(tkImage, &iw, &ih);
-        reqWidth = iw;
-        reqHeight = ih;
-        if (args.flags & MAXPECT) {
-            double xs, ys;
+        if (iw > 0 && ih > 0) {
+            reqWidth = iw;
+            reqHeight = ih;
+            if (args.flags & MAXPECT) {
+                double xs, ys;
             
-            xs = (double)iw / w;
-            ys = (double)ih / h;
-            if (xs > ys) {
-                reqWidth = (int)(w * ys);
-                reqHeight = (int)(h * ys);
-            } else {
-                reqWidth = (int)(w * xs);
-                reqHeight = (int)(h * xs);
+                xs = (double)iw / w;
+                ys = (double)ih / h;
+                if (xs > ys) {
+                    reqWidth = (int)(w * ys);
+                    reqHeight = (int)(h * ys);
+                } else {
+                    reqWidth = (int)(w * xs);
+                    reqHeight = (int)(h * xs);
+                }
             }
         }
     }
--- a/src/bltGrLine2.c
+++ b/src/bltGrLine2.c
@@ -3740,7 +3740,7 @@
             if (elemPtr->yHigh.numValues > p->index) {
                 yHigh = elemPtr->yHigh.values[p->index];
             } else if (elemPtr->yError.numValues > p->index) {
-                yHigh = elemPtr->y.values[p->index] - 
+                yHigh = elemPtr->y.values[p->index] + 
                     elemPtr->yError.values[p->index];
             } else {
                 yHigh = Blt_NaN();