Last change
on this file since 48 was
2,
checked in by Sam Hocevar, 17 years ago
|
- imported original 0.7.0 tarball
|
File size:
668 bytes
|
Line | |
---|
1 | #include "points.hpp" |
---|
2 | #include <string.h> |
---|
3 | |
---|
4 | #include "dev.hpp" |
---|
5 | |
---|
6 | |
---|
7 | point_list::point_list(unsigned char how_many, unsigned char *Data) |
---|
8 | { |
---|
9 | tot=how_many; |
---|
10 | if (tot) |
---|
11 | { |
---|
12 | data=(unsigned char *)jmalloc((int)how_many*2,"point list"); |
---|
13 | memcpy(data,Data,(int)tot*2); |
---|
14 | } else data=NULL; |
---|
15 | } |
---|
16 | |
---|
17 | point_list::point_list(bFILE *fp) |
---|
18 | { |
---|
19 | fp->read(&tot,1); |
---|
20 | if (tot) |
---|
21 | { |
---|
22 | data=(unsigned char *)jmalloc((int)tot*2,"point list : loaded"); |
---|
23 | fp->read(data,(int)tot*2); |
---|
24 | |
---|
25 | int i; |
---|
26 | for (i=0;i<tot*2;i++) |
---|
27 | data[i]=data[i]*scale_mult/scale_div; |
---|
28 | |
---|
29 | } else data=NULL; |
---|
30 | } |
---|
31 | |
---|
32 | void point_list::save(bFILE *fp) |
---|
33 | { |
---|
34 | fp->write(&tot,1); |
---|
35 | if (tot) fp->write(data,(int)tot*2); |
---|
36 | } |
---|
37 | |
---|
38 | |
---|
39 | |
---|
Note: See
TracBrowser
for help on using the repository browser.