Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4485 → Rev 4486

/programs/cmm/TWB/img_cache.h
3,31 → 3,38
dword *image;
char path[4096];
};
 
s_image pics[100]; //pics = mem_Alloc( 100*sizeof(s_image) );
int num_of_pics;
 
int GetOrSetPicNum(dword i_path)
struct ImgCache {
int pics_count;
void Free();
int GetImage();
void Images();
} ImgCache1;
 
void ImgCache::Free()
{
int i;
for (i=0; i<num_of_pics; i++)
for ( ; pics_count>0; pics_count--)
{
if (!strcmp(#pics[i].path, i_path)) return i;
if (pics[pics_count].image) img_destroy stdcall (pics[pics_count].image);
pics[pics_count].path = NULL;
}
num_of_pics++;
return num_of_pics;
}
 
void FreeImgCache()
int ImgCache::GetImage(dword i_path)
{
for ( ; num_of_pics>0; num_of_pics--)
{
if (pics[num_of_pics].image) img_destroy stdcall (pics[num_of_pics].image);
pics[num_of_pics].path = NULL;
int i;
for (i=0; i<pics_count; i++) if (!strcmp(#pics[i].path, i_path)) return i; //image exists
// Load image and add it to Cache
pics_count++;
pics[pics_count].image = load_image(i_path);
strcpy(#pics[pics_count].path, i_path);
return pics_count;
}
}
 
 
void Images(int left1, top1, width1)
void ImgCache::Images(int left1, top1, width1)
{
dword image;
char img_path[4096], alt[4096];
49,14 → 56,9
img_path[strrchr(#img_path, '/')] = '\0';
strcat(#img_path, #options);
}
cur_pic=GetOrSetPicNum(#img_path);
if (!pics[cur_pic].path)
{
pics[cur_pic].image=load_image(#img_path);
strcpy(#pics[cur_pic].path, #img_path);
cur_pic = GetImage(#img_path);
}
}
}
if (!strcmp(#parametr,"alt="))
{
strcpy(#alt, "[");