summaryrefslogtreecommitdiffstats
path: root/spudec.c
diff options
context:
space:
mode:
Diffstat (limited to 'spudec.c')
-rw-r--r--spudec.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/spudec.c b/spudec.c
index af31bd7aaa..8ec6a4ec20 100644
--- a/spudec.c
+++ b/spudec.c
@@ -116,9 +116,9 @@ static void spudec_process_data(spudec_handle_t *this)
if (alpha[i] == 0)
cmap[i] = 0;
else {
- cmap[i] = ((this->global_palette[this->palette[i]] >> 16) & 0xff) - alpha[i];
- if (cmap[i] < 0)
- cmap[i] = 0;
+ cmap[i] = ((this->global_palette[this->palette[i]] >> 16) & 0xff);
+ if (cmap[i] + alpha[i] > 255)
+ cmap[i] = 256 - alpha[i];
}
}