Subversion Repositories Kolibri OS

Rev

Rev 8291 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8291 Rev 8320
Line 1... Line 1...
1
struct _img
1
struct _img
2
{
2
{
3
	collection url;
3
	collection url;
4
	collection_int xywh;
4
	collection_int xywh;
5
	collection_int data;
-
 
6
	int getid;
5
	int getid;
7
	dword add();
6
 
8
	void clear();
7
	void clear();
-
 
8
	dword add_pos();
-
 
9
	bool set_size();
-
 
10
 
9
	dword current_url();
11
	dword current_url();
10
	bool next_url();
12
	bool next_url();
-
 
13
	
11
	void set_data();
14
	void draw_all();
12
	void draw();
15
	bool draw();
13
};
16
};
Line -... Line 17...
-
 
17
 
-
 
18
void _img::clear()
-
 
19
{
-
 
20
	url.drop();
14
 
21
	xywh.drop();
-
 
22
	getid = 0;
Line 15... Line 23...
15
#ifndef NO_IMG
23
}
16
 
24
 
17
dword _img::add(dword _path, _x, _y)
25
dword _img::add_pos(dword _path, _x, _y)
18
{
26
{
19
	char full_path[URL_SIZE];
27
	char full_path[URL_SIZE];
Line 20... Line 28...
20
	strncpy(#full_path, _path, URL_SIZE);
28
	strncpy(#full_path, _path, URL_SIZE);
21
	get_absolute_url(#full_path, history.current());		
29
	get_absolute_url(#full_path, history.current());
22
 
30
 
23
	url.add(#full_path);
31
	url.add(#full_path);
24
	xywh.add(_x);
32
	xywh.add(_x);
25
	xywh.add(_y);
33
	xywh.add(_y);
26
	xywh.add(0);
34
	xywh.add(NULL);
Line 27... Line 35...
27
	xywh.add(0);
35
	xywh.add(NULL);
28
	return full_path;
36
	return full_path;
29
}
37
}
30
 
38
 
-
 
39
bool _img::set_size(dword _buf, _size)
31
void _img::clear()
40
{
32
{
41
	char vvv[1000];
-
 
42
	int w, h;
-
 
43
	img_decode stdcall (_buf, _size, 0);
-
 
44
	if (EAX) {
-
 
45
		EDI = EAX;
-
 
46
		w = ESDWORD[EDI+4];
-
 
47
    	h = ESDWORD[EDI+8];
-
 
48
		xywh.set(getid*4+2, ESDWORD[EDI+4]);
33
	url.drop();
49
		xywh.set(getid*4+3, ESDWORD[EDI+8]);
Line 34... Line 50...
34
	xywh.drop();
50
		sprintf(#vvv, "%s w:%i h:%i", current_url(), w, h);
35
	data.drop();
51
		debugln(#vvv);
36
	getid = 0;
52
	}	
Line 49... Line 65...
49
	}
65
	}
50
	return 0;
66
	return 0;
51
}
67
}
52
 
68
 
Line 53... Line -...
53
void _img::set_data(dword _data, _data_len)
-
 
54
{
-
 
55
	data.set(getid, _data);
-
 
56
}
-
 
57
 
-
 
58
void _img::draw(int _x, _y, _start, _height)
69
void _img::draw_all(int _x, _y, _start, _height)
59
{
70
{
60
	int i, img_x, img_y;
71
	int i, img_y;
Line 61... Line 72...
61
 
72
 
62
	for (i=0; i
73
	for (i=0; i
63
	{
-
 
64
		img_x = xywh.get(i*4);
74
	{
Line 65... Line 75...
65
		img_y = xywh.get(i*4 + 1);
75
		img_y = xywh.get(i*4 + 1);
66
 
-
 
67
		if (img_y > _start) && (img_y < _start + _height) 
76
 
68
		{
-
 
69
			if (cache.has(url.get(i)))
-
 
70
			DrawLibimgImage(img_x + _x, img_y-_start + _y, cache.current_buf, cache.current_size);
77
		if (img_y > _start) && (img_y < _start + _height) 
71
		}
78
		&& (cache.has(url.get(i))) draw(_x, _y, _start, i);
Line 72... Line 79...
72
	}
79
	}
73
}
80
}
74
 
81
 
75
void DrawLibimgImage(dword _x, _y, _data, _data_len)
82
bool _img::draw(int _x, _y, _start, i)
76
{
83
{
77
	libimg_image im;
-
 
78
	img_decode stdcall (_data, _data_len, 0);
-
 
79
	$or      eax, eax
84
	libimg_image im;
80
	$jz      __ERROR__
-
 
81
	
85
	img_decode stdcall (cache.current_buf, cache.current_size, 0);
82
	im.image = EAX;
86
	if (EAX) {
83
	im.set_vars();
87
		im.image = EAX;
Line 84... Line 88...
84
	im.draw(_x, _y, im.w, im.h, 0, 0);	
88
		im.draw(xywh.get(i*4) + _x, xywh.get(i*4+1) - _start + _y, im.w, im.h, 0, 0);				
Line 85... Line 89...
85
__ERROR__:
89
	}	
Line 134... Line 138...
134
ImageCache ImgCache;
138
ImageCache ImgCache;
Line 135... Line 139...
135
 
139
 
Line 136... Line -...
136
*/
-
 
137
 
-
 
138
#else
-
 
139
dword _img::add(dword _path, _x, _y) {};
-
 
140
void _img::clear() {};
-
 
141
dword _img::current_url() {};
-
 
142
bool _img::next_url() {};
-
 
143
void _img::set_data(dword _data, _data_len) {};
-
 
144
void _img::draw(int _x, _y, _start, _height) {};
-
 
145
 
140
*/