Subversion Repositories Kolibri OS

Rev

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

Rev 6728 Rev 6795
Line 21... Line 21...
21
	void PutPixel();
21
	void PutPixel();
22
	void AlignCenter();
22
	void AlignCenter();
23
	void AlignRight();
23
	void AlignRight();
24
};
24
};
Line -... Line 25...
-
 
25
 
-
 
26
char draw_buf_not_enaught_ram[] = 
-
 
27
"'DrawBufer needs more memory than currenly available.
-
 
28
Application could be unstable.
-
 
29
 
-
 
30
Requested size: %i Kb
-
 
31
Free RAM: %i Kb' -E";
25
 
32
 
26
bool DrawBufer::Init(int i_bufx, i_bufy, i_bufw, i_bufh)
33
bool DrawBufer::Init(int i_bufx, i_bufy, i_bufw, i_bufh)
27
{
34
{
28
	dword alloc_size, free_ram_size;
35
	dword alloc_size, free_ram_size;
29
	char error_str[256];
36
	char error_str[256];
30
	if (!zoom) zoom = 1;
37
	if (!zoom) zoom = 1;
31
	bufx = i_bufx;
38
	bufx = i_bufx;
32
	bufy = i_bufy;
39
	bufy = i_bufy;
33
	bufw = i_bufw * zoom; 
40
	bufw = i_bufw * zoom; 
34
	bufh = i_bufh * zoom;
41
	bufh = i_bufh * zoom;
35
	free(buf_data);
-
 
36
	$mov eax, 18
-
 
37
	$mov ebx, 16
-
 
38
	$int 0x40
42
	free(buf_data);
39
	free_ram_size = EAX * 1024;
43
	free_ram_size = GetFreeRAM() * 1024;
40
	alloc_size = bufw * bufh * 4 + 8;
44
	alloc_size = bufw * bufh * 4 + 8;
41
	if (alloc_size >= free_ram_size) {
-
 
42
		sprintf(#error_str,
-
 
43
"'DrawBufer needs more memory than currenly available.
-
 
44
Application could be unstable.
-
 
45
 
-
 
46
Requested size: %i Kb
45
	if (alloc_size >= free_ram_size) {
47
Free RAM: %i Kb' -E", alloc_size/1024, free_ram_size/1024);
46
		sprintf(#error_str, #draw_buf_not_enaught_ram, alloc_size/1024, free_ram_size/1024);
48
		notify(#error_str);
47
		notify(#error_str);
49
	}
48
	}
50
	buf_data = malloc(alloc_size);
49
	buf_data = malloc(alloc_size);
51
	//debugval("buf_data",buf_data);
50
	//debugval("buf_data",buf_data);
Line 65... Line 64...
65
void DrawBufer::DrawBar(unsigned x, y, w, h, color)
64
void DrawBufer::DrawBar(unsigned x, y, w, h, color)
66
{
65
{
67
	int i, j;
66
	int i, j;
68
	for (j=0; j
67
	for (j=0; j
69
	{
68
	{
70
		for (i = y+j*bufw+x*4+8+buf_data; i
69
		for (i = y+j*bufw+x<<2+8+buf_data; i
71
	}
70
	}
72
}
71
}
Line 73... Line 72...
73
 
72
 
74
void DrawBufer::PutPixel(unsigned x, y, color)
73
void DrawBufer::PutPixel(unsigned x, y, color)