File: FrameCmpl.c

package info (click to toggle)
acm 5.0-19
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 7,852 kB
  • ctags: 4,792
  • sloc: ansic: 42,427; makefile: 706; cpp: 293; perl: 280; sh: 198
file content (111 lines) | stat: -rw-r--r-- 1,734 bytes parent folder | download | duplicates (9)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include <Alib.h>
#include <stdio.h>

extern void EdgeTableToScanLine(AWindow * w), ScanLineDifference(AWindow * w);

void
FrameComplete(AWindow * w)
{

	register ScanLine *tmp;
	register int i;

#ifdef DEBUG
	register int cstop;

#endif

/*
 *  Convert the edge table to scan line segments.
 */

	EdgeTableToScanLine(w);

/*
 *  Determine the differences between this frame and the previous one
 *  an plot the differences.
 */

	ScanLineDifference(w);

/*
 *  This frame now becomes the previous frame; clear the new current frame.
 */

	tmp = w->lastScanLine;
	if (w->doubleBuffered) {
		w->lastScanLine = w->otherLastScanLine;
		w->otherLastScanLine = w->scanLine;
	}
	else {
		w->lastScanLine = w->scanLine;
	}
	w->scanLine = tmp;

	for (i = 0; i < (w->height + 1); ++i) {
		w->scanLine[i].count = 0;
		w->edges[i].head = (Edge *) NULL;
		w->lines[i].head = (Edge *) NULL;
	}

/*
 *  Release the allocated color segments for what was the last frame.
 */

	if (w->curPool == 0) {
		w->curPool = 1;
#ifdef DEBUG
		cstop = w->CSTop1;
#endif
		w->CSTop1 = 0;
	}
	else if (w->curPool == 1) {
		if (w->doubleBuffered) {
			w->curPool = 2;
#ifdef DEBUG
			cstop = w->CSTop2;
#endif
			w->CSTop2 = 0;
		}
		else {
			w->curPool = 0;
#ifdef DEBUG
			cstop = w->CSTop0;
#endif
			w->CSTop0 = 0;
		}
	}
	else {
		w->curPool = 0;
#ifdef DEBUG
		cstop = w->CSTop0;
#endif
		w->CSTop0 = 0;
	}

/*
 *  Release the allocated elements of the edge pool.
 */

#ifdef DEBUG
	printf("color segments = %d; edges = %d\n", cstop, w->EPTop);
#endif

	w->EPTop = 0;

	w->ymin = 0x7FFF;
	w->ymax = -1;

/*
 *  Perform any graphics-dependent finish-up
 */

#ifdef X11
	AX11FlushBufferedSegments(w);
#endif

#ifdef DEBUG
	printf("End of Frame\n");
#endif

}