Enable/disable caching of native bitmaps in gfx board mem

svn path=/trunk/netsurf/; revision=6393
This commit is contained in:
Chris Young 2009-02-07 10:45:58 +00:00
parent 19321017a9
commit a588aa92c9
3 changed files with 43 additions and 13 deletions

View File

@ -45,7 +45,8 @@ The options file is stored in @{"Resources/Options" link Resources/Options/Main}
@{b}arexx_dir@{ub} Path to ARexx scripts dir
@{b}download_dir@{ub} default download destination
@{b}quick_text@{ub} enable for local charset text only (not recommended)
@{b}delay_redraw@{ub} slows down redraw interval
@{b}faster_scroll@{ub} enable faster scrolling (experimental)
@{b}cache_bitmaps@{ub} cache bitmaps in native format in gfx mem (0=off, 1=sclaed, 2=all)
@endnode

View File

@ -25,7 +25,7 @@ extern char *option_url_file;
extern char *option_hotlist_file;
extern char *option_use_pubscreen;
extern char *option_modeid;
extern int option_screen_depth;
extern int option_cache_bitmaps;
extern char *option_theme;
extern bool option_no_iframes;
extern bool option_utf8_clipboard;
@ -47,7 +47,7 @@ char *option_url_file = 0; \
char *option_hotlist_file = 0; \
char *option_use_pubscreen = 0; \
char *option_modeid = 0; \
int option_screen_depth = 16; \
int option_cache_bitmaps = 0; \
char *option_theme = 0; \
bool option_no_iframes = false; \
bool option_utf8_clipboard = false; \
@ -69,7 +69,7 @@ bool option_faster_scroll = false; \
{ "hotlist_file", OPTION_STRING, &option_hotlist_file }, \
{ "use_pubscreen", OPTION_STRING, &option_use_pubscreen}, \
{ "screen_modeid", OPTION_STRING, &option_modeid}, \
{ "screen_depth", OPTION_INTEGER, &option_screen_depth}, \
{ "cache_bitmaps", OPTION_INTEGER, &option_cache_bitmaps}, \
{ "theme", OPTION_STRING, &option_theme}, \
{ "no_iframes", OPTION_BOOL, &option_no_iframes}, \
{ "clipboard_write_utf8", OPTION_BOOL, &option_utf8_clipboard}, \

View File

@ -477,9 +477,21 @@ bool ami_bitmap(int x, int y, int width, int height,
BLITA_UseSrcAlpha,!bitmap->opaque,
TAG_DONE);
bitmap->nativebm = scaledbm;
//p96FreeBitMap(scaledbm);
if(option_cache_bitmaps >= 1)
{
if(bitmap->nativebm)
{
p96FreeBitMap(bitmap->nativebm);
}
bitmap->nativebm = scaledbm;
}
else
{
p96FreeBitMap(scaledbm);
}
p96FreeBitMap(tbm);
}
else
{
@ -494,7 +506,19 @@ bool ami_bitmap(int x, int y, int width, int height,
BLITA_UseSrcAlpha,!bitmap->opaque,
TAG_DONE);
bitmap->nativebm = tbm;
if(option_cache_bitmaps == 2)
{
if(bitmap->nativebm)
{
p96FreeBitMap(bitmap->nativebm);
}
bitmap->nativebm = tbm;
}
else
{
p96FreeBitMap(tbm);
}
}
bitmap->nativebmwidth = width;
@ -514,8 +538,6 @@ bool ami_bitmap(int x, int y, int width, int height,
TAG_DONE);
}
// p96FreeBitMap(tbm);
return true;
}
@ -557,9 +579,13 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
InitRastPort(&trp);
trp.BitMap = tbm;
p96WritePixelArray((struct RenderInfo *)&ri,0,0,&trp,0,0,bitmap->width,bitmap->height);
bitmap->nativebm = tbm;
bitmap->nativebmwidth = bitmap->width;
bitmap->nativebmheight = bitmap->height;
if(option_cache_bitmaps == 2)
{
bitmap->nativebm = tbm;
bitmap->nativebmwidth = bitmap->width;
bitmap->nativebmheight = bitmap->height;
}
}
max_width = (repeat_x ? scrn->Width : width);
@ -603,7 +629,10 @@ bool ami_bitmap_tile(int x, int y, int width, int height,
}
}
// p96FreeBitMap(tbm);
if(option_cache_bitmaps != 2)
{
p96FreeBitMap(tbm);
}
return true;
}