forked from KolibriOS/kolibrios
WebView and draw_buf.h: show error notification if requested memory size is more than free RAM size
git-svn-id: svn://kolibrios.org@6724 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
9ac0ede851
commit
e4b55f0dfb
@ -30,7 +30,7 @@
|
|||||||
char homepage[] = FROM "html\\homepage.htm""\0";
|
char homepage[] = FROM "html\\homepage.htm""\0";
|
||||||
|
|
||||||
#ifdef LANG_RUS
|
#ifdef LANG_RUS
|
||||||
char version[]="’¥ªáâ®¢ë© ¡à 㧥à 1.5";
|
char version[]="’¥ªáâ®¢ë© ¡à 㧥à 1.51";
|
||||||
?define IMAGES_CACHE_CLEARED "Šíè ª à⨮ª ®ç¨é¥"
|
?define IMAGES_CACHE_CLEARED "Šíè ª à⨮ª ®ç¨é¥"
|
||||||
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤¨© á« ©¤"
|
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤¨© á« ©¤"
|
||||||
char loading[] = "‡ £à㧪 áâà ¨æë...<br>";
|
char loading[] = "‡ £à㧪 áâà ¨æë...<br>";
|
||||||
@ -43,7 +43,7 @@ char rmb_menu[] =
|
|||||||
Žç¨áâ¨âì ªíè ª à⨮ª
|
Žç¨áâ¨âì ªíè ª à⨮ª
|
||||||
Œ¥¥¤¦¥à § £à㧮ª";
|
Œ¥¥¤¦¥à § £à㧮ª";
|
||||||
#else
|
#else
|
||||||
char version[]="Text-based Browser 1.5";
|
char version[]="Text-based Browser 1.51";
|
||||||
?define IMAGES_CACHE_CLEARED "Images cache cleared"
|
?define IMAGES_CACHE_CLEARED "Images cache cleared"
|
||||||
?define T_LAST_SLIDE "This slide is the last"
|
?define T_LAST_SLIDE "This slide is the last"
|
||||||
char loading[] = "Loading...<br>";
|
char loading[] = "Loading...<br>";
|
||||||
@ -263,8 +263,7 @@ void SetElementSizes()
|
|||||||
WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
|
WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
|
||||||
WB1.list.visible = WB1.list.h - 5 / WB1.list.item_h;
|
WB1.list.visible = WB1.list.h - 5 / WB1.list.item_h;
|
||||||
if (WB1.list.w!=WB1.DrawBuf.bufw) {
|
if (WB1.list.w!=WB1.DrawBuf.bufw) {
|
||||||
if (WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 2048 * WB1.list.item_h) == false)
|
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 2048 * WB1.list.item_h);
|
||||||
die("Memory allocation error! Seems to be too little RAM.");
|
|
||||||
ProcessEvent(REFRESH_BUTTON);
|
ProcessEvent(REFRESH_BUTTON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,13 +25,29 @@ struct DrawBufer {
|
|||||||
|
|
||||||
bool DrawBufer::Init(int i_bufx, i_bufy, i_bufw, i_bufh)
|
bool DrawBufer::Init(int i_bufx, i_bufy, i_bufw, i_bufh)
|
||||||
{
|
{
|
||||||
|
dword alloc_size, free_ram_size;
|
||||||
|
char error_str[256];
|
||||||
if (!zoom) zoom = 1;
|
if (!zoom) zoom = 1;
|
||||||
bufx = i_bufx;
|
bufx = i_bufx;
|
||||||
bufy = i_bufy;
|
bufy = i_bufy;
|
||||||
bufw = i_bufw * zoom;
|
bufw = i_bufw * zoom;
|
||||||
bufh = i_bufh * zoom;
|
bufh = i_bufh * zoom;
|
||||||
free(buf_data);
|
free(buf_data);
|
||||||
buf_data = malloc(bufw * bufh * 4 + 8);
|
$mov eax, 18
|
||||||
|
$mov ebx, 16
|
||||||
|
$int 0x40
|
||||||
|
free_ram_size = EAX * 1024;
|
||||||
|
alloc_size = bufw * bufh * 4 + 8;
|
||||||
|
if (alloc_size >= free_ram_size) {
|
||||||
|
sprintf(#error_str,
|
||||||
|
"'DrawBufer needs more memory than currenly available.
|
||||||
|
Application could be unstable.
|
||||||
|
|
||||||
|
Requested size: %i Kb.
|
||||||
|
Free RAM: %i Kb' -E", alloc_size/1024, free_ram_size/1024);
|
||||||
|
notify(#error_str);
|
||||||
|
}
|
||||||
|
buf_data = malloc(alloc_size);
|
||||||
//debugval("buf_data",buf_data);
|
//debugval("buf_data",buf_data);
|
||||||
if (!buf_data) return false;
|
if (!buf_data) return false;
|
||||||
ESDWORD[buf_data] = bufw;
|
ESDWORD[buf_data] = bufw;
|
||||||
|
Loading…
Reference in New Issue
Block a user