font.h: update for long text

git-svn-id: svn://kolibrios.org@5816 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2015-09-07 13:07:29 +00:00
parent acf73472eb
commit fa0e64fdcd

View File

@ -15,7 +15,7 @@
}; };
:struct __SIZE :struct __SIZE
{ {
word width,height; dword width,height;
__OFFSET_FONT offset; __OFFSET_FONT offset;
float offset_i,w_italic; float offset_i,w_italic;
byte text; byte text;
@ -39,12 +39,12 @@
byte symbol(word x,y;byte s;dword c); byte symbol(word x,y;byte s;dword c);
byte symbol_size(byte s); byte symbol_size(byte s);
dword prepare(word x,y;dword text1); dword prepare(word x,y;dword text1);
void prepare_buf(word x,y,w,h;dword text1); void prepare_buf(dword x,y,w,h, text1);
void show(); void show();
byte textcenter(word x,y,w,h;dword txt); byte textcenter(word x,y,w,h;dword txt);
dword getsize(dword text1); dword getsize(dword text1);
byte changeSIZE(); byte changeSIZE();
void PixelRGB(word x,y); void PixelRGB(dword x,y);
//dword GetPixel(word x,y); //dword GetPixel(word x,y);
byte no_bg_copy; byte no_bg_copy;
dword bg_color; dword bg_color;
@ -61,12 +61,10 @@ FONT font = 0;
}*/ }*/
:void FONT::PixelRGB(dword x,y) :void FONT::PixelRGB(dword x,y)
{ {
$push ebx dword offs = y*size.width+x*3 + buffer;
EBX = y*size.width+x*3 + buffer; DSBYTE[offs] = r; offs++;
DSBYTE[EBX] = r; EBX++; DSBYTE[offs] = g; offs++;
DSBYTE[EBX] = g; EBX++; DSBYTE[offs] = b;
DSBYTE[EBX] = b;
$pop ebx
} }
:byte FONT::changeSIZE() :byte FONT::changeSIZE()
{ {
@ -320,9 +318,9 @@ inline fastcall dword b24(EBX) { return DSDWORD[EBX] << 8; }
return true; return true;
} }
:void FONT::prepare_buf(word x,y,w,h; dword text1) :void FONT::prepare_buf(dword x,y,w,h; dword text1)
{ {
dword c; dword c, new_buffer_size;
c = color; c = color;
IF(!text1)return; IF(!text1)return;
IF(size.text)IF(!changeSIZE())return; IF(size.text)IF(!changeSIZE())return;
@ -333,15 +331,15 @@ inline fastcall dword b24(EBX) { return DSDWORD[EBX] << 8; }
size.width = w; size.width = w;
size.height = h; size.height = h;
EDX = size.width*size.height*3; new_buffer_size = w*h*3;
IF(buffer_size!=EDX) IF(buffer_size!=new_buffer_size)
{ {
buffer_size = EDX; buffer_size = new_buffer_size;
free(buffer); free(buffer);
buffer = malloc(buffer_size); buffer = malloc(buffer_size);
EBX = font.bg_color; EBX = bg_color;
EDI = font.buffer; EDI = buffer;
EAX = font.buffer_size+font.buffer; EAX = buffer_size+buffer;
WHILE (EDI<EAX) WHILE (EDI<EAX)
{ {
ESDWORD[EDI] = EBX; ESDWORD[EDI] = EBX;