Subversion Repositories Kolibri OS

Rev

Rev 7970 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4411 leency 1
struct s_image
2
{
3
	dword *image;
4
	char path[4096];
5
};
4486 leency 6
 
4411 leency 7
s_image pics[100]; //pics = mem_Alloc( 100*sizeof(s_image) );
8
 
4491 leency 9
struct ImageCache {
4486 leency 10
	int pics_count;
11
	void Free();
5718 leency 12
	int GetImage();
4486 leency 13
	void Images();
4491 leency 14
};
4486 leency 15
 
4491 leency 16
void ImageCache::Free()
4411 leency 17
{
4486 leency 18
	for ( ; pics_count>0; pics_count--)
4411 leency 19
	{
4486 leency 20
		if (pics[pics_count].image) img_destroy stdcall (pics[pics_count].image);
21
		pics[pics_count].path = NULL;
4411 leency 22
	}
23
}
24
 
5718 leency 25
int ImageCache::GetImage(dword i_path)
4411 leency 26
{
4486 leency 27
	int i;
7995 leency 28
	return 0;
4550 leency 29
	for (i=0; i<=pics_count; i++) if (!strcmp(#pics[i].path, i_path)) return i; //image exists
4486 leency 30
	// Load image and add it to Cache
31
	pics_count++;
7995 leency 32
	//pics[pics_count].image = load_EEERRRR_image(i_path);
33
	//strcpy(#pics[pics_count].path, i_path);
4486 leency 34
	return pics_count;
4411 leency 35
}
36
 
37
 
6803 leency 38
void ImageCache::Images(dword left1, top1, width1)
4411 leency 39
{
40
	dword image;
6803 leency 41
    dword imgw=0, imgh=0, img_lines_first=0, cur_pic=0;
4411 leency 42
 
7742 leency 43
	//GetAbsoluteURL(#img_path);
44
	//cur_pic = GetImage(#img_path);
4411 leency 45
 
46
	if (!pics[cur_pic].image)
47
	{
5746 leency 48
		//cur_pic = GetImage("/sys/network/noimg.png");
4411 leency 49
		return;
50
	}
51
 
4674 leency 52
	imgw = DSWORD[pics[cur_pic].image+4];
53
	imgh = DSWORD[pics[cur_pic].image+8];
54
	if (imgw > width1) imgw = width1;
4411 leency 55
 
7757 leency 56
	/*
57
	draw_y += imgh + 5; TEMPORARY TURN OFF!!!
58
 
5718 leency 59
	if (top1+imghWB1.list.y+WB1.list.h-10) return; //if all image is out of visible area
60
	if (top1
4411 leency 61
	{
4414 leency 62
		img_lines_first=WB1.list.y-top1;
4674 leency 63
		imgh=imgh-img_lines_first;
4414 leency 64
		top1=WB1.list.y;
4411 leency 65
	}
5718 leency 66
	if (top1>WB1.list.y+WB1.list.h-imgh-5) //if image partly visible (at the bottom)
4411 leency 67
	{
4674 leency 68
		imgh=WB1.list.y+WB1.list.h-top1-5;
4411 leency 69
	}
4674 leency 70
	if (imgh<=0) return;
4411 leency 71
 
4674 leency 72
	img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first);
7743 leency 73
	DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, page_bg);
74
	DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.item_h + WB1.list.item_h, page_bg);
5718 leency 75
	if (link)
4550 leency 76
	{
7970 leency 77
		UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, links.count + 400 + BT_HIDE, 0xB5BFC9);
78
		links.AddText(0, imgw, imgh-1, NOLINE, 1);
7756 leency 79
		WB1.DrawPage();
4550 leency 80
	}
7756 leency 81
	*/
4491 leency 82
}
83
 
84
ImageCache ImgCache;