Ticket #36397: patch-draw.c.diff
File patch-draw.c.diff, 3.4 KB (added by stevecheckoway (Stephen Checkoway), 12 years ago) |
---|
-
draw.c
old new 8 8 #include "jgraph.h" 9 9 #include <stdio.h> 10 10 #include <math.h> 11 #include <string.h> 11 12 12 13 static char real_eof = EOF; 13 14 14 float ctop(val, axis) 15 float val; 16 Axis axis; 15 static void draw_footer(Graphs, int); 16 static void draw_header(Graphs, int, int); 17 static void draw_arrow(float, float, float, float, Curve); 18 static void draw_mark(float, float, Curve, Graph); 19 static void draw_curve(Curve, Graph); 20 static void draw_label(Label); 21 22 float ctop(float val, Axis axis) 17 23 { 18 24 if (axis->is_lg) { 19 25 if (val <= 0.0) { … … Axis axis; 29 35 } 30 36 } 31 37 32 float disttop(val, axis) 33 float val; 34 Axis axis; 38 float disttop(float val, Axis axis) 35 39 { 36 40 if (axis->is_lg) { 37 41 return FCPI * val; … … Axis axis; 40 44 } 41 45 } 42 46 43 float intop(val) 44 float val; 47 float intop(float val) 45 48 { 46 49 return FCPI * val; 47 50 } 48 51 49 52 #define MAXIMUM(a,b) ((a > b) ? a : b) 50 53 51 draw_axis(a, other) 52 Axis a, other; 54 void draw_axis(Axis a, Axis other) 53 55 { 54 56 char orientation; 55 57 Hash h; … … Axis a, other; 114 116 } 115 117 116 118 117 draw_label(l) 118 Label l; 119 void draw_label(Label l) 119 120 { 120 121 if (l->label == CNULL) return; 121 122 comment(l->label); 122 123 print_label(l); 123 124 } 124 125 125 set_clip(g) 126 Graph g; 126 static void set_clip(Graph g) 127 127 { 128 128 comment("Setting Clip"); 129 129 printf("newpath\n"); … … Graph g; 133 133 printf(" closepath clip newpath\n"); 134 134 } 135 135 136 draw_curves(g) 137 Graph g; 136 static void draw_curves(Graph g) 138 137 { 139 138 Curve c; 140 139 … … Graph g; 148 147 printf("\n"); 149 148 } 150 149 151 draw_curve(c, g) 152 Curve c; 153 Graph g; 150 void draw_curve(Curve c, Graph g) 154 151 { 155 152 Point p, px, py; 156 153 int i, j; … … Graph g; 267 264 printf("\n"); 268 265 } 269 266 270 draw_mark(x, y, c, g) 271 float x, y; 272 Curve c; 273 Graph g; 267 void draw_mark(float x, float y, Curve c, Graph g) 274 268 { 275 269 Point p; 276 270 float ms0, ms1, scx, scy, trx, try; … … Graph g; 499 493 grestore(); 500 494 } 501 495 502 draw_arrow(x1, y1, x2, y2, c) 503 float x1, y1, x2, y2; 504 Curve c; 496 void draw_arrow(float x1, float y1, float x2, float y2, Curve c) 505 497 { 506 498 float dx, dy; 507 499 float ms0; … … Curve c; 539 531 printf("\n"); 540 532 } 541 533 542 draw_legend(g) 543 Graph g; 534 static void draw_legend(Graph g) 544 535 { 545 536 Curve c; 546 537 Legend l; … … Graph g; 603 594 printf("\n"); 604 595 } 605 596 606 draw_strings(g) 607 Graph g; 597 static void draw_strings(Graph g) 608 598 { 609 599 String s; 610 600 … … Graph g; 613 603 draw_label(s->s); 614 604 } 615 605 616 draw_graph(g) 617 Graph g; 606 static void draw_graph(Graph g) 618 607 { 619 608 comment("Drawing New Graph"); 620 609 printf("%f %f translate\n", g->x_translate, g->y_translate); … … Graph g; 634 623 635 624 } 636 625 637 draw_graphs(gs, pp, landscape) 638 Graphs gs; 639 int pp; 640 int landscape; 626 void draw_graphs(Graphs gs, int pp, int landscape) 641 627 { 642 628 Graphs gs_p; 643 629 Graph g; … … int landscape; 651 637 } 652 638 } 653 639 654 draw_header(gs, pp, landscape) 655 Graphs gs; 656 int pp; 657 int landscape; 640 void draw_header(Graphs gs, int pp, int landscape) 658 641 { 659 642 FILE *f; 660 643 char c; … … int landscape; 685 668 (((11.0 * FCPI) - (gs->bb[3] - gs->bb[1])) / 2.0) - gs->bb[1]); 686 669 } 687 670 } else if (landscape) { 688 printf("%f 0 translate\n", -gs->bb[2] - gs->bb[0]);671 printf("%f 0 translate\n", (double)(-gs->bb[2] - gs->bb[0])); 689 672 } 690 673 printf("1 setlinecap 1 setlinejoin\n"); 691 674 printf("0.700 setlinewidth\n"); … … int landscape; 746 729 } 747 730 } 748 731 749 draw_footer(gs, pp) 750 Graphs gs; 751 int pp; 732 void draw_footer(Graphs gs, int pp) 752 733 { 753 734 FILE *f; 754 735 char c;