svn-id: r39593
This commit is contained in:
Filippos Karapetis
2009-03-21 16:42:45 +00:00
parent a8672bc492
commit 2ea883adb2
2 changed files with 7 additions and 22 deletions
+7 -16
View File
@@ -123,11 +123,8 @@ void apply_mod(gfx_res_mod_t *mod, gfx_pixmap_t *pxm) {
pxm->palette = pal;
}
switch (mod->type) {
case GFX_RES_MULTIPLY_FIXED: {
for (i = 0; i < pal_size; i++) {
int v;
for (i = 0; i < pal_size; i++) {
int v;
#define UPDATE_COL(nm, idx) \
v = nm; \
@@ -135,19 +132,13 @@ void apply_mod(gfx_res_mod_t *mod, gfx_pixmap_t *pxm) {
v >>= 4; \
nm = (v > 255)? 255 : v;
PaletteEntry c = pal->getColor(i);
UPDATE_COL(c.r, 0);
UPDATE_COL(c.g, 1);
UPDATE_COL(c.b, 2);
pal->setColor(i, c.r, c.g, c.b);
PaletteEntry c = pal->getColor(i);
UPDATE_COL(c.r, 0);
UPDATE_COL(c.g, 1);
UPDATE_COL(c.b, 2);
pal->setColor(i, c.r, c.g, c.b);
#undef UPDATE_COL
}
break;
}
default:
GFXERROR("Using unexpected visual resource modifier %d\n", mod->type);
}
}
-6
View File
@@ -40,8 +40,6 @@ struct gfx_res_pattern_t {
/* GFX resource assignments */
struct gfx_res_assign_t {
short type; /* GFX_RES_ASSIGN_TYPE_* */
union {
struct {
int colors_nr;
@@ -53,11 +51,7 @@ struct gfx_res_assign_t {
/* GFX resource modifications */
#define GFX_RES_MULTIPLY_FIXED 0 /* Linear palette update */
struct gfx_res_mod_t {
short type; /* GFX_RES_ASSIGN_TYPE_* */
union {
byte factor[3]; /* divide by 16 to retrieve factor */
} mod;