Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commits (1)
  • Deucе's avatar
    Optimize color_value() and fix RIP reset · 75bd66f1
    Deucе authored
    color_value() is in the hot drawing path, so should be as fast
    as possible... remove all the bit shifting and have the palette
    just be colour values.
    
    For RIP, the reset wasn't resetting the global coordinates, so a
    scaled image would cause everything to be scaled down later.
    75bd66f1
...@@ -23,13 +23,7 @@ ...@@ -23,13 +23,7 @@
#include "vidmodes.h" #include "vidmodes.h"
#include "bitmap_con.h" #include "bitmap_con.h"
struct palette_entry { static uint32_t palette[65536];
uint8_t red;
uint8_t green;
uint8_t blue;
};
static struct palette_entry palette[65536];
#if 0 #if 0
...@@ -441,8 +435,9 @@ static uint32_t color_value(uint32_t col) ...@@ -441,8 +435,9 @@ static uint32_t color_value(uint32_t col)
if (col & 0x80000000) if (col & 0x80000000)
return col; return col;
if (col < sizeof(palette) / sizeof(palette[0])) if (col < sizeof(palette) / sizeof(palette[0]))
return (0xff << 24) | (palette[col].red << 16) | (palette[col].green << 8) | palette[col].blue; return palette[col];
fprintf(stderr, "Invalid colour value: %08x\n", col); fprintf(stderr, "Invalid colour value: %08x\n", col);
return 0xff000000;
} }
static struct rectlist *get_full_rectangle_locked(struct bitmap_screen *screen) static struct rectlist *get_full_rectangle_locked(struct bitmap_screen *screen)
...@@ -1545,9 +1540,7 @@ int bitmap_setpalette(uint32_t index, uint16_t r, uint16_t g, uint16_t b) ...@@ -1545,9 +1540,7 @@ int bitmap_setpalette(uint32_t index, uint16_t r, uint16_t g, uint16_t b)
pthread_mutex_lock(&blinker_lock); pthread_mutex_lock(&blinker_lock);
pthread_mutex_lock(&screena.screenlock); pthread_mutex_lock(&screena.screenlock);
pthread_mutex_lock(&screenb.screenlock); pthread_mutex_lock(&screenb.screenlock);
palette[index].red = r>>8; palette[index] = (0xff << 24) | ((r>>8) << 16) | ((g>>8) << 8) | (b>>8);
palette[index].green = g>>8;
palette[index].blue = b>>8;
screena.update_pixels = 1; screena.update_pixels = 1;
screenb.update_pixels = 1; screenb.update_pixels = 1;
pthread_mutex_unlock(&screenb.screenlock); pthread_mutex_unlock(&screenb.screenlock);
...@@ -1676,9 +1669,7 @@ int bitmap_drv_init(void (*drawrect_cb) (struct rectlist *data) ...@@ -1676,9 +1669,7 @@ int bitmap_drv_init(void (*drawrect_cb) (struct rectlist *data)
pthread_mutex_lock(&screena.screenlock); pthread_mutex_lock(&screena.screenlock);
pthread_mutex_lock(&screenb.screenlock); pthread_mutex_lock(&screenb.screenlock);
for (i = 0; i < sizeof(dac_default)/sizeof(struct dac_colors); i++) { for (i = 0; i < sizeof(dac_default)/sizeof(struct dac_colors); i++) {
palette[i].red = dac_default[i].red; palette[i] = (0xff << 24) | (dac_default[i].red << 16) | (dac_default[i].green << 8) | dac_default[i].blue;
palette[i].green = dac_default[i].green;
palette[i].blue = dac_default[i].blue;
} }
pthread_mutex_unlock(&screenb.screenlock); pthread_mutex_unlock(&screenb.screenlock);
pthread_mutex_unlock(&screena.screenlock); pthread_mutex_unlock(&screena.screenlock);
......
...@@ -598,7 +598,7 @@ static void ciolib_window(struct cterminal *cterm,int sx, int sy, int ex, int ey ...@@ -598,7 +598,7 @@ static void ciolib_window(struct cterminal *cterm,int sx, int sy, int ex, int ey
GOTOXY(1,1); GOTOXY(1,1);
} }
static int ciolib_cputs(struct cterminal *cterm, char *str) static int ciolib_cputs(struct cterminal *cterm, const char *str)
{ {
int pos; int pos;
int ret=0; int ret=0;
......
...@@ -238,7 +238,7 @@ struct cterminal { ...@@ -238,7 +238,7 @@ struct cterminal {
int (*ciolib_putch) (struct cterminal *,int); int (*ciolib_putch) (struct cterminal *,int);
int (*ciolib_puttext) (struct cterminal *,int,int,int,int,void *); int (*ciolib_puttext) (struct cterminal *,int,int,int,int,void *);
void (*ciolib_window) (struct cterminal *,int,int,int,int); void (*ciolib_window) (struct cterminal *,int,int,int,int);
int (*ciolib_cputs) (struct cterminal *,char *); int (*ciolib_cputs) (struct cterminal *,const char *);
int (*ciolib_setfont) (struct cterminal *,int font, int force, int font_num); int (*ciolib_setfont) (struct cterminal *,int font, int force, int font_num);
#else #else
void (*ciolib_gotoxy) (int,int); void (*ciolib_gotoxy) (int,int);
...@@ -260,7 +260,7 @@ struct cterminal { ...@@ -260,7 +260,7 @@ struct cterminal {
int (*ciolib_puttext) (int,int,int,int,void *); int (*ciolib_puttext) (int,int,int,int,void *);
int (*ciolib_vmem_puttext) (int,int,int,int,struct vmem_cell *); int (*ciolib_vmem_puttext) (int,int,int,int,struct vmem_cell *);
void (*ciolib_window) (int,int,int,int); void (*ciolib_window) (int,int,int,int);
int (*ciolib_cputs) (char *); int (*ciolib_cputs) (const char *);
int (*ciolib_setfont) (int font, int force, int font_num); int (*ciolib_setfont) (int font, int force, int font_num);
#endif #endif
int *_wscroll; int *_wscroll;
......
...@@ -7614,6 +7614,21 @@ rv_reset(const char * const var, const void * const data) ...@@ -7614,6 +7614,21 @@ rv_reset(const char * const var, const void * const data)
} }
// TODO: Figure out what all gets reset here... // TODO: Figure out what all gets reset here...
rip.color = 0; rip.color = 0;
pthread_mutex_lock(&vstatlock);
rip.x_max = vstat.scrnwidth;
rip.y_max = vstat.scrnheight;
pthread_mutex_unlock(&vstatlock);
rip.x_dim = 640;
rip.y_dim = 350;
if (rip.x_max > rip.x_dim)
rip.x_max = rip.x_dim;
if (rip.y_max > rip.y_dim)
rip.y_max = rip.y_dim;
// TODO: Hack... we should likely scale both directions...
FREE_AND_NULL(rip.xmap);
FREE_AND_NULL(rip.ymap);
FREE_AND_NULL(rip.xunmap);
FREE_AND_NULL(rip.yunmap);
rip.viewport.sx = 0; rip.viewport.sx = 0;
rip.viewport.sy = 0; rip.viewport.sy = 0;
rip.viewport.ex = rip.x_dim - 1; rip.viewport.ex = rip.x_dim - 1;
......