[project @ 2006-01-02 02:52:53 by rjw]

Allow dynamic memory configuration.

svn path=/import/netsurf/; revision=1938
This commit is contained in:
Richard Wilson 2006-01-02 02:52:53 +00:00
parent e8113b5a6e
commit 1f9a35369b
4 changed files with 16 additions and 10 deletions

View File

@ -110,8 +110,8 @@ void bitmap_initialise_memory(void)
/* calculate our memory block sizes */
if (option_image_memory_direct == -1) {
/* claim 20% of free memory - min 256KB, max 32768KB */
direct_size = available_memory / 5;
/* claim 25% of free memory - min 256KB, max 32768KB */
direct_size = available_memory / 4;
if (direct_size < (256 << 10))
direct_size = (256 << 10);
if (direct_size > (32768 << 10))
@ -120,8 +120,8 @@ void bitmap_initialise_memory(void)
direct_size = (option_image_memory_direct << 10);
}
if (option_image_memory_compressed == -1) {
/* claim 5% of free memory - min 256KB, max 4192KB */
compressed_size = available_memory / 20;
/* claim 10% of free memory - min 256KB, max 4192KB */
compressed_size = available_memory / 10;
if (compressed_size < (256 << 10))
compressed_size = 0;
if (compressed_size > (4192 << 10))
@ -133,10 +133,7 @@ void bitmap_initialise_memory(void)
/* set our values. No fixed buffers here, ho hum. */
bitmap_direct_size = direct_size;
bitmap_compressed_size = compressed_size;
LOG(("Allowing %iKB of memory for compressed images.",
(bitmap_compressed_size >> 10)));
LOG(("Allowing %iKB of memory for uncompressed images.",
(bitmap_direct_size >> 10)));
bitmap_maintenance = bitmap_maintenance_priority = true;
}

View File

@ -41,5 +41,13 @@ extern bool bitmap_maintenance;
*/
extern bool bitmap_maintenance_priority;
/** Maximum amount of memory for direct images
*/
extern unsigned int bitmap_direct_size;
/** Total size of compressed area
*/
extern unsigned int bitmap_compressed_size;
#endif

View File

@ -62,10 +62,12 @@ void ro_gui_configure_initialise(void) {
ro_gui_wimp_event_set_help_prefix(dialog_zoom, "HelpConfigure");
/* add in our option windows */
for (int i = 0; i < 12; i++)
ro_gui_configure_register("con_fonts",
ro_gui_options_fonts_initialise,
ro_gui_wimp_event_finalise);
ro_gui_configure_register("con_memory",
ro_gui_options_memory_initialise,
ro_gui_wimp_event_finalise);
}
void ro_gui_configure_show(void) {

View File

@ -25,5 +25,4 @@ void ro_gui_configure_initialise(void);
void ro_gui_configure_show(void);
void ro_gui_configure_register(const char *window,
bool (*initialise)(wimp_w w), void (*finalise)(wimp_w w));
#endif