/programs/cmm/eolite/include/left_panel.h |
---|
135,7 → 135,7 |
{ |
strcpy(#dev_name, list.get(i)); |
GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name); |
if (strstr(#path, #dev_name)-#path==0) is_active=true; else is_active=false; |
if (strstr(#path, #dev_name)) is_active=true; else is_active=false; |
if (two_panels) |
{ |
name_len = strlen(#dev_name)-1*8; |
/programs/cmm/lib/obj/truetype.h |
---|
0,0 → 1,48 |
// Truetype library |
#ifndef INCLUDE_LIBTRUETYPE_H |
#define INCLUDE_LIBTRUETYPE_H |
#ifndef INCLUDE_KOLIBRI_H |
#include "../lib/kolibri.h" |
#endif |
#ifndef INCLUDE_DLL_H |
#include "../lib/dll.h" |
#endif |
dword libtruetype = #att_libtruetype; |
char att_libtruetype[22] = "/sys/lib/truetype.obj\0"; |
dword truetype = #att_truetype; // truetype(unsigned char *s, stbtt_fontinfo *buffer, char *screen1, int width, int height) |
dword get_length = #att_get_length; // get_length(unsigned char *s, char *buffer, int height, int max_len) |
dword get_width = #att_get_width; // get_width_utf8(unsigned char *s, stbtt_fontinfo *buffer, int height) |
dword text_out = #att_text_out; // text_out(unsigned char *string, char *buffer, int height, int color,int back_color, int x, int y) |
dword init_font = #att_init_font; // init_font(stbtt_fontinfo *font,unsigned char *FontData) |
dword text_out_mem = #att_text_out_mem; // text_out_mem(unsigned char *string, stbtt_fontinfo *buffer, int height, int color,int back_color) |
$DD 2 dup 0 |
char att_truetype[] = "truetype"; |
char att_get_length[] = "get_length"; |
char att_get_width[] = "get_width"; |
char att_text_out[] = "text_out"; |
char att_text_out_mem[] = "text_out_mem"; |
char att_init_font[] = "init_font"; |
//============================================================ |
//============================================================ |
char fontinfo[28]; |
struct stbtt_fontinfo |
{ |
dword userdata; |
dword data; // pointer to .ttf file |
int fontstart; // offset of start of font |
int numGlyphs; // number of glyphs, needed for range checking |
int loca,head,glyf,hhea,hmtx,kern; // table locations as offset from start of .ttf |
int index_map; // a cmap mapping for our chosen character encoding |
int indexToLocFormat; // format needed to map from glyph index to glyph |
}; |
#endif |
/programs/cmm/experimental/ttf_performance/ttf_performance.c |
---|
0,0 → 1,89 |
#define MEMSIZE 397113 |
#include "../lib/kolibri.h" |
#include "../lib/strings.h" |
#include "../lib/mem.h" |
#include "../lib/file_system.h" |
#include "../lib/dll.h" |
#include "../lib/obj/truetype.h" |
proc_info Form; |
dword font_data; |
stbtt_fontinfo font_info; |
inline fastcall dword get_start_time() |
{ |
$mov eax,26 |
$mov ebx,9 |
$int 0x40 |
} |
#define TESTS_NUM 10 |
char test_text[] = "The quick brown fox jumps over the lazy dog"; |
word rez[TESTS_NUM]; |
void main() |
{ |
BDVK FontFile_atr; |
int id, key; |
mem_Init(); |
if (load_dll2(libtruetype, #truetype, 1) != 0) notify("Error: library doesn't exists - truetype"); |
if (param[0]==0) strcpy(#param, "/sys/arial.ttf"); |
GetFileInfo(#param, #FontFile_atr); |
font_data = malloc(FontFile_atr.sizelo); |
ReadFile(0, FontFile_atr.sizelo, #font_data, #param); |
init_font stdcall (#font_info, #font_data); |
if (EAX==0) notify("init_font failed"); |
loop() |
{ |
switch(WaitEvent()) |
{ |
case evButton: |
id=GetButtonID(); |
if (id==1) ExitProcess(); |
break; |
case evKey: |
key = GetKey(); |
IF (key==013){ //Enter |
debug("Tests count: "); |
debugi(TESTS_NUM); |
for (id=0; id<TESTS_NUM; id++) |
{ |
rez[id] = DrawFonts(); |
debugi(rez[id]); |
} |
debugln("Done"); |
} |
break; |
case evReDraw: |
DefineAndDrawWindow(30,100,800,300,0x34,0xFFFFFF,"TTF Viewer v0.1"); |
GetProcessInfo(#Form, SelfInfo); |
WriteTextB(50,85,0x90,0xFF00FF,"Press Enter to start testing"); |
break; |
} |
} |
} |
word DrawFonts() |
{ |
dword time1, time2; |
time1 = get_start_time(); |
text_out stdcall (#test_text, #font_info, 10, time1, 0xFFFfff, 3, 4); |
text_out stdcall (#test_text, #font_info, 12, time1, 0xFFFfff, 3, 18); |
text_out stdcall (#test_text, #font_info, 24, time1, 0xFFFfff, 3, 35); |
text_out stdcall (#test_text, #font_info, 36, time1, 0xFFFfff, 3, 60); |
text_out stdcall (#test_text, #font_info, 48, time1, 0xFFFfff, 3, 110); |
text_out stdcall (#test_text, #font_info, 58, time1, 0xFFFfff, 3, 170); |
time2 = get_start_time(); |
return time2 - time1; |
} |
stop: |
/programs/cmm/experimental/ttf_performance/compile.bat |
---|
0,0 → 1,10 |
C-- ttf_performance.c |
@del ttf_performance |
@rename ttf_performance.com ttf_performance |
kpack ttf_performance |
@del warning.txt |
@pause |
@rem ====== Automatically add binnary to kolibri.img and then run QEMU ===== |
"C:\Program Files (x86)\WinImage\WINIMAGE.exe" D:\Kolibri\work\QEMU\kolibri.img /I /H/Q C:\Users\lee\Desktop\CMM\ttf_performance\ttf_performance |
@cd /d D:\Kolibri\work\QEMU |
D:\Kolibri\work\QEMU\qemu-kos-img.bat |
/programs/cmm/experimental/ttf_performance |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |