forked from KolibriOS/kolibrios
webview 3.84
- tagicon support - draw_buf => BufIsInvalid() add check
This commit is contained in:
@@ -68,6 +68,7 @@ struct TWebBrowser {
|
|||||||
void tag_a();
|
void tag_a();
|
||||||
void tag_p();
|
void tag_p();
|
||||||
void tag_img();
|
void tag_img();
|
||||||
|
void tag_kosicon();
|
||||||
void tag_div();
|
void tag_div();
|
||||||
void tag_h1234_caption();
|
void tag_h1234_caption();
|
||||||
void tag_ol_ul_dt();
|
void tag_ol_ul_dt();
|
||||||
@@ -176,7 +177,7 @@ void TWebBrowser::ParseHtml(dword _bufpointer, _bufsize){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ESBYTE[bufpos] == '&') {
|
if (ESBYTE[bufpos] == '&') {
|
||||||
bufpos = GetUnicodeSymbol(#linebuf, sizeof(TWebBrowser.linebuf), bufpos+1, bufpointer+bufsize);
|
bufpos = GetUnicodeSymbol(#linebuf, sizeof(TWebBrowser.linebuf)-1, bufpos+1, bufpointer+bufsize);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ESBYTE[bufpos] == '<') && (is_html) {
|
if (ESBYTE[bufpos] == '<') && (is_html) {
|
||||||
|
@@ -67,7 +67,7 @@ bool _tag::parse(dword _bufpos, bufend)
|
|||||||
|
|
||||||
if (!whitepos) || (whitepos > closepos) {
|
if (!whitepos) || (whitepos > closepos) {
|
||||||
//no param
|
//no param
|
||||||
strncpy(#name, bufpos, math.min(closepos - bufpos, sizeof(tag.name)));
|
strncpy(#name, bufpos, math.min(closepos - bufpos, sizeof(tag.name)-1));
|
||||||
bufpos = closepos;
|
bufpos = closepos;
|
||||||
} else {
|
} else {
|
||||||
//we have param
|
//we have param
|
||||||
@@ -76,7 +76,7 @@ bool _tag::parse(dword _bufpos, bufend)
|
|||||||
if (openpos < strchr(closepos+1, '>')) break;
|
if (openpos < strchr(closepos+1, '>')) break;
|
||||||
if (!closepos = EAX) {closepos = bufend;break;}
|
if (!closepos = EAX) {closepos = bufend;break;}
|
||||||
}
|
}
|
||||||
strncpy(#name, bufpos, math.min(whitepos - bufpos, sizeof(tag.name)));
|
strncpy(#name, bufpos, math.min(whitepos - bufpos, sizeof(tag.name)-1));
|
||||||
bufpos = closepos;
|
bufpos = closepos;
|
||||||
|
|
||||||
params = malloc(closepos - whitepos + 1);
|
params = malloc(closepos - whitepos + 1);
|
||||||
|
@@ -151,7 +151,7 @@ bool TWebBrowser::RenderImage(dword cur_img)
|
|||||||
int img_x, img_y, img_w, img_h;
|
int img_x, img_y, img_w, img_h;
|
||||||
dword imgbuf[44];
|
dword imgbuf[44];
|
||||||
|
|
||||||
if (!cur_img) return false;
|
if (!cur_img) || (!buf_data) return false;
|
||||||
|
|
||||||
img_h = ESDWORD[cur_img+8];
|
img_h = ESDWORD[cur_img+8];
|
||||||
img_w = ESDWORD[cur_img+4];
|
img_w = ESDWORD[cur_img+4];
|
||||||
|
@@ -10,6 +10,7 @@ void TWebBrowser::SetStyle()
|
|||||||
if (tag.is("a")) { tag_a(); return; }
|
if (tag.is("a")) { tag_a(); return; }
|
||||||
if (tag.is("p")) { tag_p(); return; }
|
if (tag.is("p")) { tag_p(); return; }
|
||||||
if (tag.is("img")) { tag_img(); return; }
|
if (tag.is("img")) { tag_img(); return; }
|
||||||
|
if (tag.is("kosicon")) { tag_kosicon(); return; }
|
||||||
if (tag.is("div")) { tag_div(); return; }
|
if (tag.is("div")) { tag_div(); return; }
|
||||||
if (tag.is("br")) { /*draw_x++;*/NewLine(); return; }
|
if (tag.is("br")) { /*draw_x++;*/NewLine(); return; }
|
||||||
if (tag.is("nav")) { style.nav = tag.opened; return; }
|
if (tag.is("nav")) { style.nav = tag.opened; return; }
|
||||||
@@ -266,6 +267,17 @@ void TWebBrowser::tag_h1234_caption()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TWebBrowser::tag_kosicon()
|
||||||
|
{
|
||||||
|
dword imgbuf[44];
|
||||||
|
dword shared_i18 = memopen("ICONS18", NULL, SHM_READ);
|
||||||
|
if (shared_i18) && (tag.get_number_of("n")) {
|
||||||
|
if (draw_x + 18 > canvas.bufw) NewLine();
|
||||||
|
canvas.DrawImage(draw_x, draw_y-2, 18, 18, 18*18*4*tag.number+shared_i18);
|
||||||
|
draw_x += 22;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void TWebBrowser::tag_img()
|
void TWebBrowser::tag_img()
|
||||||
{
|
{
|
||||||
@@ -305,7 +317,7 @@ void TWebBrowser::tag_img()
|
|||||||
img_decode stdcall (cache.current_buf, cache.current_size, 0);
|
img_decode stdcall (cache.current_buf, cache.current_size, 0);
|
||||||
if (EAX) goto IMGOK; else goto NOIMG;
|
if (EAX) goto IMGOK; else goto NOIMG;
|
||||||
} else {
|
} else {
|
||||||
img_url.add(#img_path);
|
if (img_url.get_pos_by_name(#img_path)==-1) img_url.add(#img_path);
|
||||||
goto NOIMG;
|
goto NOIMG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -79,7 +79,7 @@ char default_dir[] = "/sys";
|
|||||||
od_filter filter2 = { 22, "TXT\0HTM\0HTML\0DOCX\0\0" };
|
od_filter filter2 = { 22, "TXT\0HTM\0HTML\0DOCX\0\0" };
|
||||||
|
|
||||||
char editURL[URL_SIZE+1];
|
char editURL[URL_SIZE+1];
|
||||||
edit_box omnibox_edit = {, 0, 0, 0xffffff,
|
edit_box omnibox_edit = {250, 0, 0, 0xffffff,
|
||||||
0x94AECE, 0xffffff, 0xffffff,0x10000000,URL_SIZE-2,#editURL,0,,19,19};
|
0x94AECE, 0xffffff, 0xffffff,0x10000000,URL_SIZE-2,#editURL,0,,19,19};
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
@@ -258,6 +258,7 @@ void main()
|
|||||||
free(http.content_pointer);
|
free(http.content_pointer);
|
||||||
GetImg(false);
|
GetImg(false);
|
||||||
}
|
}
|
||||||
|
debugln("end evNetwork");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -516,7 +517,6 @@ bool GetLocalFileData(dword _path)
|
|||||||
bool GetUrl(dword _http_url)
|
bool GetUrl(dword _http_url)
|
||||||
{
|
{
|
||||||
char new_url_full[URL_SIZE+1];
|
char new_url_full[URL_SIZE+1];
|
||||||
|
|
||||||
if (!strncmp(_http_url,"http:",5)) {
|
if (!strncmp(_http_url,"http:",5)) {
|
||||||
http.get(_http_url);
|
http.get(_http_url);
|
||||||
return true;
|
return true;
|
||||||
@@ -571,10 +571,10 @@ void OpenPage(dword _open_URL)
|
|||||||
//INTERNAL PAGE
|
//INTERNAL PAGE
|
||||||
history.add(#new_url);
|
history.add(#new_url);
|
||||||
WB1.custom_encoding = -1;
|
WB1.custom_encoding = -1;
|
||||||
if (streq(#new_url, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#buildin_page_home, sizeof(buildin_page_home));
|
if (streq(#new_url, URL_SERVICE_HOMEPAGE)) LoadInternalPage(#buildin_page_home, sizeof(buildin_page_home)-1);
|
||||||
else if (streq(#new_url, URL_SERVICE_TEST)) LoadInternalPage(#buildin_page_test, sizeof(buildin_page_test));
|
else if (streq(#new_url, URL_SERVICE_TEST)) LoadInternalPage(#buildin_page_test, sizeof(buildin_page_test)-1);
|
||||||
else if (streq(#new_url, URL_SERVICE_HISTORY)) ShowHistory();
|
else if (streq(#new_url, URL_SERVICE_HISTORY)) ShowHistory();
|
||||||
else LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error));
|
else LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)-1);
|
||||||
|
|
||||||
} else if (!strncmp(#new_url,"http:",5)) || (!strncmp(#new_url,"https:",6)) {
|
} else if (!strncmp(#new_url,"http:",5)) || (!strncmp(#new_url,"https:",6)) {
|
||||||
//WEB PAGE
|
//WEB PAGE
|
||||||
@@ -589,7 +589,7 @@ void OpenPage(dword _open_URL)
|
|||||||
|
|
||||||
if (!http.transfer) {
|
if (!http.transfer) {
|
||||||
history.add(#new_url);
|
history.add(#new_url);
|
||||||
LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error));
|
LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)-1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//LOCAL PAGE
|
//LOCAL PAGE
|
||||||
@@ -602,7 +602,7 @@ void OpenPage(dword _open_URL)
|
|||||||
strcpy(#new_url, "/tmp0/1/temp/word/document.xml");
|
strcpy(#new_url, "/tmp0/1/temp/word/document.xml");
|
||||||
}
|
}
|
||||||
if (!GetLocalFileData(#new_url)) {
|
if (!GetLocalFileData(#new_url)) {
|
||||||
LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error));
|
LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -712,7 +712,7 @@ void EventSubmitOmnibox()
|
|||||||
|
|
||||||
void LoadInternalPage(dword _bufdata, _in_bufsize){
|
void LoadInternalPage(dword _bufdata, _in_bufsize){
|
||||||
if (!_bufdata) || (!_in_bufsize) {
|
if (!_bufdata) || (!_in_bufsize) {
|
||||||
LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error));
|
LoadInternalPage(#buildin_page_error, sizeof(buildin_page_error)-1);
|
||||||
} else {
|
} else {
|
||||||
WB1.list.first = 0; //scroll page to the top
|
WB1.list.first = 0; //scroll page to the top
|
||||||
DrawOmnibox();
|
DrawOmnibox();
|
||||||
@@ -920,7 +920,7 @@ dword GetAbsoluteActiveURL()
|
|||||||
void CheckContentType()
|
void CheckContentType()
|
||||||
{
|
{
|
||||||
char content_type[64];
|
char content_type[64];
|
||||||
if (http.header_field("content-type", #content_type, sizeof(content_type))) // application || image
|
if (http.header_field("content-type", #content_type, sizeof(content_type)-1)) // application || image
|
||||||
|
|
||||||
if (content_type[0] == 'i') {
|
if (content_type[0] == 'i') {
|
||||||
EventDownloadAndOpenImage(http.cur_url);
|
EventDownloadAndOpenImage(http.cur_url);
|
||||||
@@ -968,12 +968,14 @@ dword GetImg(bool _new)
|
|||||||
for (i = 0; i < WB1.img_url.count; i++)
|
for (i = 0; i < WB1.img_url.count; i++)
|
||||||
{
|
{
|
||||||
cur_img_url = WB1.img_url.get(i);
|
cur_img_url = WB1.img_url.get(i);
|
||||||
if (debug_mode)
|
|
||||||
{debug("get img: ");debugln(cur_img_url);}
|
|
||||||
if (cache.has(cur_img_url)==false) {
|
if (cache.has(cur_img_url)==false) {
|
||||||
prbar.max = WB1.img_url.count;
|
prbar.max = WB1.img_url.count;
|
||||||
prbar.value = i;
|
prbar.value = i;
|
||||||
if (GetUrl(cur_img_url)) {DrawStatusBar(cur_img_url); DrawProgress(); return;}
|
if (GetUrl(cur_img_url)) {
|
||||||
|
DrawStatusBar(cur_img_url);
|
||||||
|
DrawProgress();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_new) return;
|
if (_new) return;
|
||||||
|
@@ -112,4 +112,4 @@ char editbox_icons[] = FROM "res/editbox_icons.raw";
|
|||||||
|
|
||||||
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
|
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
|
||||||
|
|
||||||
char version[]="WebView 3.83";
|
char version[]="WebView 3.84";
|
@@ -2,38 +2,39 @@
|
|||||||
<title>TEST</title>
|
<title>TEST</title>
|
||||||
<style>a {display:block;font-size:130%;margin:5px 40px 5px 0;}</style>
|
<style>a {display:block;font-size:130%;margin:5px 40px 5px 0;}</style>
|
||||||
<body>
|
<body>
|
||||||
<pre><a href=//wiby.org>wiby.org</a>
|
|
||||||
<a href=//www.xlr8yourmac.com/OSX/os_x_network_cards.html>OSX network cards</a>
|
|
||||||
<a href=//macintoshgarden.org/>Macintosh Garden</a>
|
|
||||||
|
|
||||||
<table><tr><td>Simplest:
|
<pre><h2>HTTP</h2>
|
||||||
<a href=//nostalgy.net.ru/>nostalgy.net.ru</a>
|
<a href=//th99.infania.net>Total Hardware 1999</a>
|
||||||
|
<a href=//wiby.org>wiby.org</a>
|
||||||
|
<a href=//menuetos.net>menuetos.net</a>
|
||||||
|
<a href=//macintosh.garden/>Macintosh Garden</a>
|
||||||
<a href=//pci-ids.ucw.cz>pci.ids</a>
|
<a href=//pci-ids.ucw.cz>pci.ids</a>
|
||||||
<a href=//dgmag.in>dgmag.in</a>
|
|
||||||
<a href=//web.archive.org/web/https://bash.im>bash.im</a>
|
|
||||||
<a href=//web.archive.org/web/https://opennet.ru>opennet</a>
|
|
||||||
<a href=//linux.org.ru>LOR</a>
|
|
||||||
<a href=//web.archive.org/web/https://samlib.ru/b>samlib.ru/b</a>
|
|
||||||
<a href=//web.archive.org/web/https://mirrors.pdp-11.ru>mirrors.pdp-11.ru</a>
|
|
||||||
<a href=//web.archive.org/web/http://gona.mactar.hu/ATI_Mac/>ATI drivers for Mac</a>
|
<a href=//web.archive.org/web/http://gona.mactar.hu/ATI_Mac/>ATI drivers for Mac</a>
|
||||||
<td>Simple:
|
<a href=//toastytech.com/guis/index.html>GUI Gallery</a>
|
||||||
<a href=//web.archive.org/web/http://lionovsky.us>lionovsky.us</a>
|
<a href=//www.weitek.com/textual/support/driver.html>weitek</a>
|
||||||
|
<a href=//www.abandonwarering.com/?Page=Listing>abandonware</a>
|
||||||
|
<a href=//electromyne.de>electromyne.de</a>
|
||||||
|
<a href=//neonfloppy.sytes.net/articles/win3-usb/>neonfloppy</a>
|
||||||
|
<a href=//www.win31.de/eindex.htm>win31.de</a>
|
||||||
|
|
||||||
|
<h3>VPN-only</h3>
|
||||||
|
<a href=//dgmag.in>dgmag.in</a>
|
||||||
|
<a href=//fdd5-25.pdp-11.ru>fdd5-25</a>
|
||||||
|
<a href=//old-dos.ru>old-dos.ru</a>
|
||||||
|
<a href=//artcon.ru>artcon.ru</a>
|
||||||
|
<a href=//nubo.ru>nubo.ru</a>
|
||||||
|
<a href=//mirrors.pdp-11.ru>mirrors.pdp-11.ru</a>
|
||||||
|
<a href=//nostalgy.net.ru/>nostalgy.net.ru</a>
|
||||||
|
|
||||||
|
<h2>HTTPS :(</h2>
|
||||||
<a href=//os-menuet.narod.ru>os-menuet.narod.ru</a>
|
<a href=//os-menuet.narod.ru>os-menuet.narod.ru</a>
|
||||||
<a href=//mestack.narod.ru/index.html>mestack.narod.ru</a>
|
<a href=//mestack.narod.ru/index.html>mestack.narod.ru</a>
|
||||||
<a href=//coolthemes.narod.ru/indexold.html>coolthemes.narod.ru</a>
|
<a href=//coolthemes.narod.ru/indexold.html>coolthemes.narod.ru</a>
|
||||||
<a href=//vetusware.com>vetusware.com</a>
|
<a href=//lionovsky.us>lionovsky.us</a>
|
||||||
<a href=//th99.infania.net>Total Hardware 1999</a>
|
|
||||||
<a href=//toastytech.com/guis/index.html>GUI Gallery</a>
|
|
||||||
<a href=//menuetos.net>menuetos.net</a>
|
|
||||||
<tr><td>
|
|
||||||
Moderate:
|
|
||||||
<a href=//fdd5-25.pdp-11.ru>fdd5-25</a>
|
|
||||||
<a href=//acmp.ru/index.asp?main=tasks>acmp.ru</a>
|
<a href=//acmp.ru/index.asp?main=tasks>acmp.ru</a>
|
||||||
<a href=//old-dos.ru>old-dos.ru</a>
|
<a href=//xn--80abh7bk0c.xn--p1ai>bashorg</a>
|
||||||
<a href=//www.weitek.com/textual/support/driver.html>weitek</a>
|
<a href=//opennet.ru>opennet</a>
|
||||||
<a href=//www.abandonwarering.com/?Page=Listing>abandonware</a>
|
<a href=//linux.org.ru>LOR</a>
|
||||||
<td>Complex:
|
<a href=//www.xlr8yourmac.com/OSX/os_x_network_cards.html>OSX network cards</a>
|
||||||
<a href=//web.archive.org/web/https://artcon.ru>artcon.ru</a>
|
<a href=//samlib.ru/b>samlib.ru/b</a>
|
||||||
<a href=//nubo.ru>nubo.ru</a>
|
<a href=//vetusware.com>vetusware.com</a>
|
||||||
<a href=//electromyne.de>electromyne.de</a>
|
|
||||||
<a href=//web.archive.org/web/20190403215447//www.thg.ru/>thg</a>
|
|
||||||
|
@@ -17,17 +17,25 @@ struct CANVAS {
|
|||||||
void Show();
|
void Show();
|
||||||
void Fill();
|
void Fill();
|
||||||
void DrawBar();
|
void DrawBar();
|
||||||
|
void DrawImage();
|
||||||
void WriteText();
|
void WriteText();
|
||||||
void PutPixel();
|
void PutPixel();
|
||||||
void AlignCenter();
|
void AlignCenter();
|
||||||
void AlignRight();
|
void AlignRight();
|
||||||
void IncreaseBufSize();
|
void IncreaseBufSize();
|
||||||
|
bool BufIsInvalid();
|
||||||
};
|
};
|
||||||
|
|
||||||
char draw_buf_not_enaught_ram[] =
|
char draw_buf_not_enaught_ram[] =
|
||||||
"'CANVAS requested %i MB more memory than the system has.
|
"'CANVAS requested %i MB more memory than the system has.
|
||||||
Application could be unstable.' -E";
|
Application could be unstable.' -E";
|
||||||
|
|
||||||
|
bool CANVAS::BufIsInvalid()
|
||||||
|
{
|
||||||
|
if (!buf_data) || (!bufw) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool CANVAS::Init(dword i_bufx, i_bufy, i_bufw, i_bufh)
|
bool CANVAS::Init(dword i_bufx, i_bufy, i_bufw, i_bufh)
|
||||||
{
|
{
|
||||||
bufx = i_bufx;
|
bufx = i_bufx;
|
||||||
@@ -45,6 +53,7 @@ bool CANVAS::Init(dword i_bufx, i_bufy, i_bufw, i_bufh)
|
|||||||
void CANVAS::Fill(dword start_pointer, i_fill_color)
|
void CANVAS::Fill(dword start_pointer, i_fill_color)
|
||||||
{
|
{
|
||||||
dword max_i = bufw * bufh * 4 - start_pointer/4;
|
dword max_i = bufw * bufh * 4 - start_pointer/4;
|
||||||
|
if (BufIsInvalid()) return;
|
||||||
fill_color = i_fill_color | 0xFF000000; //set background color non-transparent
|
fill_color = i_fill_color | 0xFF000000; //set background color non-transparent
|
||||||
@MEMSETD(buf_data+start_pointer+8, max_i, fill_color);
|
@MEMSETD(buf_data+start_pointer+8, max_i, fill_color);
|
||||||
}
|
}
|
||||||
@@ -52,6 +61,7 @@ void CANVAS::Fill(dword start_pointer, i_fill_color)
|
|||||||
void CANVAS::DrawBar(dword x, y, w, h, color)
|
void CANVAS::DrawBar(dword x, y, w, h, color)
|
||||||
{
|
{
|
||||||
dword i, j;
|
dword i, j;
|
||||||
|
if (BufIsInvalid()) return;
|
||||||
if (y + h >= bufh) IncreaseBufSize();
|
if (y + h >= bufh) IncreaseBufSize();
|
||||||
for (j=0; j<h; j++) {
|
for (j=0; j<h; j++) {
|
||||||
for (i = y+j*bufw+x<<2+8+buf_data; i<y+j*bufw+x+w<<2+8+buf_data; i+=4) {
|
for (i = y+j*bufw+x<<2+8+buf_data; i<y+j*bufw+x+w<<2+8+buf_data; i+=4) {
|
||||||
@@ -60,12 +70,30 @@ void CANVAS::DrawBar(dword x, y, w, h, color)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CANVAS::DrawImage(dword x, y, w, h, img)
|
||||||
|
{
|
||||||
|
dword i, j, p=0;
|
||||||
|
dword ystart;
|
||||||
|
if (BufIsInvalid()) return;
|
||||||
|
if (y < 0) y = 0;
|
||||||
|
if (x < 0) x = 0;
|
||||||
|
while (y + h >= bufh) IncreaseBufSize(); //WHY NOT WORKING?
|
||||||
|
for (j=0; j<h; j++) {
|
||||||
|
ystart = y + j * bufw + x;
|
||||||
|
for (i = ystart<<2+8+buf_data; i<ystart+w<<2+8+buf_data; i+=4) {
|
||||||
|
ESDWORD[i] = ESDWORD[img+p];
|
||||||
|
p+=4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CANVAS::WriteText(dword x, y, byte fontType, dword color, str_offset, strlen)
|
void CANVAS::WriteText(dword x, y, byte fontType, dword color, str_offset, strlen)
|
||||||
{
|
{
|
||||||
#define BUGFIX_32000 32000
|
#define BUGFIX_32000 32000
|
||||||
dword ydiv=0;
|
dword ydiv=0;
|
||||||
dword reserve_data_1, reserve_data_2;
|
dword reserve_data_1, reserve_data_2;
|
||||||
dword new_buf_offset;
|
dword new_buf_offset;
|
||||||
|
if (BufIsInvalid()) return;
|
||||||
if (y + 30 >= bufh) IncreaseBufSize();
|
if (y + 30 >= bufh) IncreaseBufSize();
|
||||||
if (y < BUGFIX_32000) {
|
if (y < BUGFIX_32000) {
|
||||||
ESI = strlen;
|
ESI = strlen;
|
||||||
@@ -92,6 +120,7 @@ void CANVAS::WriteText(dword x, y, byte fontType, dword color, str_offset, strle
|
|||||||
void CANVAS::PutPixel(dword x, y, color)
|
void CANVAS::PutPixel(dword x, y, color)
|
||||||
{
|
{
|
||||||
dword pos = y*bufw+x*4+8+buf_data;
|
dword pos = y*bufw+x*4+8+buf_data;
|
||||||
|
if (BufIsInvalid()) return;
|
||||||
ESDWORD[pos] = color;
|
ESDWORD[pos] = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,6 +128,7 @@ void CANVAS::AlignRight(dword x,y,w,h, content_width)
|
|||||||
{
|
{
|
||||||
dword i, j, l;
|
dword i, j, l;
|
||||||
dword content_left = w - content_width / 2;
|
dword content_left = w - content_width / 2;
|
||||||
|
if (BufIsInvalid()) return;
|
||||||
for (j=0; j<h; j++)
|
for (j=0; j<h; j++)
|
||||||
{
|
{
|
||||||
for (i=j*w+w-x*4, l=j*w+content_width+x*4; (i>=j*w+content_left*4) && (l>=j*w*4); i-=4, l-=4)
|
for (i=j*w+w-x*4, l=j*w+content_width+x*4; (i>=j*w+content_left*4) && (l>=j*w*4); i-=4, l-=4)
|
||||||
@@ -112,6 +142,7 @@ void CANVAS::AlignCenter(dword x,y,w,h, content_width)
|
|||||||
{
|
{
|
||||||
dword i, j, l;
|
dword i, j, l;
|
||||||
dword content_left = w - content_width / 2;
|
dword content_left = w - content_width / 2;
|
||||||
|
if (BufIsInvalid()) return;
|
||||||
for (j=0; j<h; j++)
|
for (j=0; j<h; j++)
|
||||||
{
|
{
|
||||||
for (i=j*w+content_width+content_left*4, l=j*w+content_width+x*4; (i>=j*w+content_left*4) && (l>=j*w*4); i-=4, l-=4)
|
for (i=j*w+content_width+content_left*4, l=j*w+content_width+x*4; (i>=j*w+content_left*4) && (l>=j*w*4); i-=4, l-=4)
|
||||||
@@ -123,6 +154,7 @@ void CANVAS::AlignCenter(dword x,y,w,h, content_width)
|
|||||||
|
|
||||||
void CANVAS::Show(dword _y_offset, _h)
|
void CANVAS::Show(dword _y_offset, _h)
|
||||||
{
|
{
|
||||||
|
if (BufIsInvalid()) return;
|
||||||
PutPaletteImage(_y_offset * bufw * 4 + buf_data+8, bufw, _h, bufx, bufy, 32, 0);
|
PutPaletteImage(_y_offset * bufw * 4 + buf_data+8, bufw, _h, bufx, bufy, 32, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,6 +165,8 @@ void CANVAS::IncreaseBufSize()
|
|||||||
dword free_ram_size;
|
dword free_ram_size;
|
||||||
char error_str[256];
|
char error_str[256];
|
||||||
|
|
||||||
|
if (!bufw) return;
|
||||||
|
|
||||||
if (!buf_data) {
|
if (!buf_data) {
|
||||||
alloc_size = bufh * bufw * 4 + 8;
|
alloc_size = bufh * bufw * 4 + 8;
|
||||||
buf_data = malloc(alloc_size);
|
buf_data = malloc(alloc_size);
|
||||||
|
Reference in New Issue
Block a user