mirror of https://github.com/nmlgc/ReC98.git
[Maintenance] [th01] .PTN: Define the transparent color in a single place
Inlined template functions! \o/ Part of P0096, funded by Ember2528.
This commit is contained in:
parent
9cd54f1b13
commit
979f401515
|
@ -57,15 +57,11 @@ ptn_error_t ptn_load_palette_show(int slot, const char *fn)
|
|||
arc_file_get(ptn->unused_zero);
|
||||
arc_file_get(ptn->planes);
|
||||
for(y = 0; y < PTN_H; y++) {
|
||||
// Color #15 (1111) is always the transparent one, meaning that
|
||||
// transparent dots are 1 in all 4 bitplanes. The alpha mask
|
||||
// therefore simply is the negation of ANDing all bitplanes
|
||||
// together. Nifty!
|
||||
ptn->alpha[y] = ~(
|
||||
ptn->planes.B[y]
|
||||
& ptn->planes.R[y]
|
||||
& ptn->planes.G[y]
|
||||
& ptn->planes.E[y]
|
||||
ptn->alpha[y] = ptn_alpha_from(
|
||||
ptn->planes.B[y],
|
||||
ptn->planes.R[y],
|
||||
ptn->planes.G[y],
|
||||
ptn->planes.E[y]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,18 @@
|
|||
/// color #15. Can also be used to store the backgrounds of frequently updated
|
||||
/// VRAM regions, using the functions for raw allocation and VRAM snapping.
|
||||
|
||||
}
|
||||
|
||||
// Color #15 (1111) is always the transparent one, meaning that transparent
|
||||
// dots are 1 in all 4 bitplanes. The alpha mask therefore simply is the
|
||||
// negation of ANDing all bitplanes together. Nifty!
|
||||
template <class T> inline T ptn_alpha_from(T B, T R, T G, T E)
|
||||
{
|
||||
return ~((B) & (R) & (G) & (E));
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
#define PTN_W 32
|
||||
#define PTN_H 32
|
||||
|
||||
|
|
Loading…
Reference in New Issue