Rev 7756 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7756 | Rev 7757 | ||
---|---|---|---|
1 | struct s_image |
1 | struct s_image |
2 | { |
2 | { |
3 | dword *image; |
3 | dword *image; |
4 | char path[4096]; |
4 | char path[4096]; |
5 | }; |
5 | }; |
6 | 6 | ||
7 | s_image pics[100]; //pics = mem_Alloc( 100*sizeof(s_image) ); |
7 | s_image pics[100]; //pics = mem_Alloc( 100*sizeof(s_image) ); |
8 | 8 | ||
9 | struct ImageCache { |
9 | struct ImageCache { |
10 | int pics_count; |
10 | int pics_count; |
11 | void Free(); |
11 | void Free(); |
12 | int GetImage(); |
12 | int GetImage(); |
13 | void Images(); |
13 | void Images(); |
14 | }; |
14 | }; |
15 | 15 | ||
16 | void ImageCache::Free() |
16 | void ImageCache::Free() |
17 | { |
17 | { |
18 | for ( ; pics_count>0; pics_count--) |
18 | for ( ; pics_count>0; pics_count--) |
19 | { |
19 | { |
20 | if (pics[pics_count].image) img_destroy stdcall (pics[pics_count].image); |
20 | if (pics[pics_count].image) img_destroy stdcall (pics[pics_count].image); |
21 | pics[pics_count].path = NULL; |
21 | pics[pics_count].path = NULL; |
22 | } |
22 | } |
23 | } |
23 | } |
24 | 24 | ||
25 | int ImageCache::GetImage(dword i_path) |
25 | int ImageCache::GetImage(dword i_path) |
26 | { |
26 | { |
27 | int i; |
27 | int i; |
28 | for (i=0; i<=pics_count; i++) if (!strcmp(#pics[i].path, i_path)) return i; //image exists |
28 | for (i=0; i<=pics_count; i++) if (!strcmp(#pics[i].path, i_path)) return i; //image exists |
29 | // Load image and add it to Cache |
29 | // Load image and add it to Cache |
30 | pics_count++; |
30 | pics_count++; |
31 | pics[pics_count].image = load_image(i_path); |
31 | pics[pics_count].image = load_image(i_path); |
32 | strcpy(#pics[pics_count].path, i_path); |
32 | strcpy(#pics[pics_count].path, i_path); |
33 | return pics_count; |
33 | return pics_count; |
34 | } |
34 | } |
35 | 35 | ||
36 | 36 | ||
37 | void ImageCache::Images(dword left1, top1, width1) |
37 | void ImageCache::Images(dword left1, top1, width1) |
38 | { |
38 | { |
39 | dword image; |
39 | dword image; |
40 | dword imgw=0, imgh=0, img_lines_first=0, cur_pic=0; |
40 | dword imgw=0, imgh=0, img_lines_first=0, cur_pic=0; |
41 | 41 | ||
42 | //GetAbsoluteURL(#img_path); |
42 | //GetAbsoluteURL(#img_path); |
43 | //cur_pic = GetImage(#img_path); |
43 | //cur_pic = GetImage(#img_path); |
44 | 44 | ||
45 | if (!pics[cur_pic].image) |
45 | if (!pics[cur_pic].image) |
46 | { |
46 | { |
47 | //cur_pic = GetImage("/sys/network/noimg.png"); |
47 | //cur_pic = GetImage("/sys/network/noimg.png"); |
48 | return; |
48 | return; |
49 | } |
49 | } |
50 | 50 | ||
51 | imgw = DSWORD[pics[cur_pic].image+4]; |
51 | imgw = DSWORD[pics[cur_pic].image+4]; |
52 | imgh = DSWORD[pics[cur_pic].image+8]; |
52 | imgh = DSWORD[pics[cur_pic].image+8]; |
53 | if (imgw > width1) imgw = width1; |
53 | if (imgw > width1) imgw = width1; |
- | 54 | ||
54 | 55 | /* |
|
- | 56 | draw_y += imgh + 5; TEMPORARY TURN OFF!!! |
|
55 | //draw_y += imgh + 5; TEMPORARY TURN OFF!!! |
57 | |
56 | if (top1+imgh |
58 | if (top1+imgh |
57 | if (top1 |
59 | if (top1 |
58 | { |
60 | { |
59 | img_lines_first=WB1.list.y-top1; |
61 | img_lines_first=WB1.list.y-top1; |
60 | imgh=imgh-img_lines_first; |
62 | imgh=imgh-img_lines_first; |
61 | top1=WB1.list.y; |
63 | top1=WB1.list.y; |
62 | } |
64 | } |
63 | if (top1>WB1.list.y+WB1.list.h-imgh-5) //if image partly visible (at the bottom) |
65 | if (top1>WB1.list.y+WB1.list.h-imgh-5) //if image partly visible (at the bottom) |
64 | { |
66 | { |
65 | imgh=WB1.list.y+WB1.list.h-top1-5; |
67 | imgh=WB1.list.y+WB1.list.h-top1-5; |
66 | } |
68 | } |
67 | if (imgh<=0) return; |
69 | if (imgh<=0) return; |
68 | 70 | ||
69 | img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first); |
71 | img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first); |
70 | DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, page_bg); |
72 | DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, page_bg); |
71 | DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.item_h + WB1.list.item_h, page_bg); |
73 | DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.item_h + WB1.list.item_h, page_bg); |
72 | /* |
- | |
73 | if (link) |
74 | if (link) |
74 | { |
75 | { |
75 | UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); |
76 | UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9); |
76 | PageLinks.AddText(0, imgw, imgh-1, NOLINE, 1); |
77 | PageLinks.AddText(0, imgw, imgh-1, NOLINE, 1); |
77 | WB1.DrawPage(); |
78 | WB1.DrawPage(); |
78 | } |
79 | } |
79 | */ |
80 | */ |
80 | } |
81 | } |
81 | 82 | ||
82 | ImageCache ImgCache;=0)>=pics_count;> |
83 | ImageCache ImgCache;=0)>=pics_count;> |