Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 6637 → Rev 6636

/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