Change RGB32k to a union of BYTE[32][32][32] and BYTE[32*32*32]
- Clang's optional runtime array bounds checking doesn't understand when we
intentionally "overflow" by doing this:
RGB32k[0][0][colorval]
It will warn that it was accessed at an index will past the bounds
of type 'BYTE [32]', which makes it less than useful for catching real
array bounds overflows. So now do this:
RGB32k.All[colorval]
And if you want this:
RGB32k[r][g][b]
Now do this:
RGB32k.RGB[r][g][b]
This commit is contained in:
parent
308a036955
commit
e259087c19
13 changed files with 88 additions and 77 deletions
|
|
@ -141,7 +141,7 @@ extern "C" {
|
|||
DWORD Col2RGB8[65][256];
|
||||
DWORD *Col2RGB8_LessPrecision[65];
|
||||
DWORD Col2RGB8_Inverse[65][256];
|
||||
BYTE RGB32k[32][32][32];
|
||||
ColorTable32k RGB32k;
|
||||
}
|
||||
|
||||
static DWORD Col2RGB8_2[63][256];
|
||||
|
|
@ -387,7 +387,7 @@ void DCanvas::Dim (PalEntry color, float damount, int x1, int y1, int w, int h)
|
|||
|
||||
bg = bg2rgb[(*spot)&0xff];
|
||||
bg = (fg+bg) | 0x1f07c1f;
|
||||
*spot = RGB32k[0][0][bg&(bg>>15)];
|
||||
*spot = RGB32k.All[bg&(bg>>15)];
|
||||
spot++;
|
||||
}
|
||||
spot += gap;
|
||||
|
|
@ -658,7 +658,7 @@ static void BuildTransTable (const PalEntry *palette)
|
|||
for (r = 0; r < 32; r++)
|
||||
for (g = 0; g < 32; g++)
|
||||
for (b = 0; b < 32; b++)
|
||||
RGB32k[r][g][b] = ColorMatcher.Pick ((r<<3)|(r>>2), (g<<3)|(g>>2), (b<<3)|(b>>2));
|
||||
RGB32k.RGB[r][g][b] = ColorMatcher.Pick ((r<<3)|(r>>2), (g<<3)|(g>>2), (b<<3)|(b>>2));
|
||||
|
||||
int x, y;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue