-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathACKOVER.C
72 lines (60 loc) · 1.54 KB
/
ACKOVER.C
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
//#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
//#include <dos.h>
//#include <mem.h>
//#include <io.h>
//#include <fcntl.h>
#include <time.h>
#include <string.h>
//#include <sys\stat.h>
#include "ACK3D.H"
#include "ACKENG.H"
//±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
// Creates an overlay buffer that contains non-transparent information
// about the image. Position and length of the non-transparent areas is
// stored for later processing after the drawing phase. Theoretically the
// amount of information stored in the overlay buffer could exceed the
// actual size of the image.
//±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
short AckCreateOverlay(ACKENG *ae,UCHAR *sBuf)
{
USHORT bPos,vPos,vLen;
USHORT len,sPos,sPos1;
vLen = (ae->WinEndY - ae->WinStartY) * BYTES_PER_ROW;
vPos = ae->WinStartY * BYTES_PER_ROW;
bPos = 0;
sPos = vPos;
while (vLen > 0)
{
if (sBuf[sPos])
{
sPos1 = sPos;
while (vLen > 0 && sBuf[sPos1++])
vLen--;
len = (sPos1 - sPos) - 1;
(*(short *)&ae->ScreenBuffer[bPos]) = len;
bPos += 2;
(*(short *)&ae->ScreenBuffer[bPos]) = sPos;
bPos += 2;
memmove(&ae->ScreenBuffer[bPos],&sBuf[sPos],len);
bPos += len;
sPos = sPos1;
}
else
{
sPos++;
vLen--;
}
}
(*(short *)&ae->ScreenBuffer[bPos]) = 0;
bPos += 2;
ae->OverlayBuffer = (UCHAR*)AckMalloc(bPos);
if (ae->OverlayBuffer != NULL)
{
memmove(ae->OverlayBuffer,ae->ScreenBuffer,bPos);
return(0);
}
return(ERR_NOMEMORY);
}
// **** End of Source ****