speedup kfonts

completely rewriting Aelia #2

git-svn-id: svn://kolibrios.org@7286 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
2018-05-22 12:04:44 +00:00
parent 969b1d6c5f
commit aa5f8268a3
11 changed files with 225 additions and 151 deletions

View File

@@ -21,7 +21,7 @@ struct collection
void increase_data_size();
};
void collection::increase_data_size() {
:void collection::increase_data_size() {
int filled_size;
if (realloc_size<4096) realloc_size = 4096;
if (!data_size) {
@@ -34,11 +34,11 @@ void collection::increase_data_size() {
}
}
int collection::add(dword in) {
:int collection::add(dword in) {
return addn(in, strlen(in));
}
int collection::addn(dword in, len) {
:int collection::addn(dword in, len) {
if (count >= 4000) return 0;
if (element_offset[count]+len+2 > data_size) {
increase_data_size();
@@ -51,12 +51,12 @@ int collection::addn(dword in, len) {
return 1;
}
dword collection::get(dword pos) {
:dword collection::get(dword pos) {
if (pos<0) || (pos>=count) return 0;
return data_start + element_offset[pos];
}
void collection::drop() {
:void collection::drop() {
if (data_start) free(data_start);
data_size = data_start = element_offset[count] = count = 0;
}
@@ -74,22 +74,32 @@ struct collection_int
dword element[4096*3];
int add();
dword get();
dword get_last();
void pop();
void drop();
};
int collection_int::add(dword in) {
:int collection_int::add(dword in) {
if (count >= 4096*3) return 0;
element[count] = in;
count++;
return 1;
}
dword collection_int::get(dword pos) {
:dword collection_int::get(dword pos) {
if (pos<0) || (pos>=count) return 0;
return element[pos];
}
void collection_int::drop() {
:dword collection_int::get_last() {
return element[count];
}
:void collection_int::pop() {
if (count>0) count--;
}
:void collection_int::drop() {
element[0] =
count = 0;
}