1 diff -Naur src/svgalib-1.9.25/utils/gtf/gtfcalc.c src/svgalib-1.9.25.new/utils/gtf/gtfcalc.c
2 --- src/svgalib-1.9.25/utils/gtf/gtfcalc.c 2005-07-10 15:33:16.000000000 -0400
3 +++ src/svgalib-1.9.25/utils/gtf/gtfcalc.c 2009-07-09 15:39:08.743610103 -0400
6 /*-------------------------- Implementation -------------------------------*/
8 -static double round(double v)
9 +static double svg_round(double v);
11 +double svg_round(double v)
13 return floor(v + 0.5);
16 ****************************************************************************/
18 c->margin = GC.margin;
19 - c->cellGran = round(GC.cellGran);
20 - c->minPorch = round(GC.minPorch);
21 - c->vSyncRqd = round(GC.vSyncRqd);
22 + c->cellGran = svg_round(GC.cellGran);
23 + c->minPorch = svg_round(GC.minPorch);
24 + c->vSyncRqd = svg_round(GC.vSyncRqd);
26 c->minVSyncBP = GC.minVSyncBP;
29 vFreq = hFreq = dotClock = freq;
31 /* Round pixels to character cell granularity */
32 - hPixels = round(hPixels / c.cellGran) * c.cellGran;
33 + hPixels = svg_round(hPixels / c.cellGran) * c.cellGran;
35 /* For interlaced mode halve the vertical parameters, and double
36 * the required field refresh rate.
39 - vLines = round(vLines / 2);
40 + vLines = svg_round(vLines / 2);
41 vFieldRate = vFreq * 2;
42 dotClock = dotClock * 2;
46 /* Determine the lines for margins */
48 - topMarginLines = round(c.margin / 100 * vLines);
49 - botMarginLines = round(c.margin / 100 * vLines);
50 + topMarginLines = svg_round(c.margin / 100 * vLines);
51 + botMarginLines = svg_round(c.margin / 100 * vLines);
56 (vLines + (2*topMarginLines) + c.minPorch + interlace) * 1000000;
58 /* Find the number of lines in vSync + back porch */
59 - vSyncBP = round(c.minVSyncBP / hPeriodEst);
60 + vSyncBP = svg_round(c.minVSyncBP / hPeriodEst);
62 else if (type == GTF_lockHF) {
63 /* Find the number of lines in vSync + back porch */
64 - vSyncBP = round((c.minVSyncBP * hFreq) / 1000);
65 + vSyncBP = svg_round((c.minVSyncBP * hFreq) / 1000);
68 /* Find the number of lines in the V back porch alone */
71 /* Find the number of pixels in the left and right margins */
73 - leftMarginPixels = round(hPixels * c.margin) / (100 * c.cellGran);
74 - rightMarginPixels = round(hPixels * c.margin) / (100 * c.cellGran);
75 + leftMarginPixels = svg_round(hPixels * c.margin) / (100 * c.cellGran);
76 + rightMarginPixels = svg_round(hPixels * c.margin) / (100 * c.cellGran);
83 /* Find the number of pixels in blanking time */
84 - hBlankPixels = round((hTotalActivePixels * idealDutyCycle) /
85 + hBlankPixels = svg_round((hTotalActivePixels * idealDutyCycle) /
86 ((100 - idealDutyCycle) * 2 * c.cellGran)) * (2 * c.cellGran);
88 /* Find the total number of pixels */
89 hTotalPixels = hTotalActivePixels + hBlankPixels;
91 /* Find the horizontal back porch */
92 - hBackPorch = round((hBlankPixels / 2) / c.cellGran) * c.cellGran;
93 + hBackPorch = svg_round((hBlankPixels / 2) / c.cellGran) * c.cellGran;
95 /* Find the horizontal sync width */
96 - hSyncWidth = round(((c.hSync/100) * hTotalPixels) / c.cellGran) * c.cellGran;
97 + hSyncWidth = svg_round(((c.hSync/100) * hTotalPixels) / c.cellGran) * c.cellGran;
99 /* Find the horizontal sync + back porch */
100 hSyncBP = hBackPorch + hSyncWidth;
102 hPeriod = 1000 / hFreq;
104 /* Find the number of lines in vSync + back porch */
105 - vSyncBP = round((c.minVSyncBP * hFreq) / 1000);
106 + vSyncBP = svg_round((c.minVSyncBP * hFreq) / 1000);
108 /* Find the number of lines in the V back porch alone */
109 vBackPorch = vSyncBP - c.vSyncRqd;