- replaced another large batch of homegrown type use.
This commit is contained in:
parent
6c6bab73ad
commit
6dee9ff566
57 changed files with 656 additions and 656 deletions
|
|
@ -59,7 +59,7 @@ enum
|
|||
class FBitmap
|
||||
{
|
||||
protected:
|
||||
BYTE *data;
|
||||
uint8_t *data;
|
||||
int Width;
|
||||
int Height;
|
||||
int Pitch;
|
||||
|
|
@ -77,7 +77,7 @@ public:
|
|||
ClipRect.x = ClipRect.y = ClipRect.width = ClipRect.height = 0;
|
||||
}
|
||||
|
||||
FBitmap(BYTE *buffer, int pitch, int width, int height)
|
||||
FBitmap(uint8_t *buffer, int pitch, int width, int height)
|
||||
{
|
||||
data = buffer;
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ public:
|
|||
Pitch = w*4;
|
||||
Width = w;
|
||||
Height = h;
|
||||
data = new BYTE[4*w*h];
|
||||
data = new uint8_t[4*w*h];
|
||||
memset(data, 0, 4*w*h);
|
||||
FreeBuffer = true;
|
||||
ClipRect.x = ClipRect.y = 0;
|
||||
|
|
@ -131,12 +131,12 @@ public:
|
|||
return Pitch;
|
||||
}
|
||||
|
||||
const BYTE *GetPixels() const
|
||||
const uint8_t *GetPixels() const
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
BYTE *GetPixels()
|
||||
uint8_t *GetPixels()
|
||||
{
|
||||
return data;
|
||||
}
|
||||
|
|
@ -164,17 +164,17 @@ public:
|
|||
void Zero();
|
||||
|
||||
|
||||
virtual void CopyPixelDataRGB(int originx, int originy, const BYTE *patch, int srcwidth,
|
||||
virtual void CopyPixelDataRGB(int originx, int originy, const uint8_t *patch, int srcwidth,
|
||||
int srcheight, int step_x, int step_y, int rotate, int ct, FCopyInfo *inf = NULL,
|
||||
/* for PNG tRNS */ int r=0, int g=0, int b=0);
|
||||
virtual void CopyPixelData(int originx, int originy, const BYTE * patch, int srcwidth, int srcheight,
|
||||
virtual void CopyPixelData(int originx, int originy, const uint8_t * patch, int srcwidth, int srcheight,
|
||||
int step_x, int step_y, int rotate, PalEntry * palette, FCopyInfo *inf = NULL);
|
||||
|
||||
|
||||
};
|
||||
|
||||
bool ClipCopyPixelRect(const FClipRect *cr, int &originx, int &originy,
|
||||
const BYTE *&patch, int &srcwidth, int &srcheight,
|
||||
const uint8_t *&patch, int &srcwidth, int &srcheight,
|
||||
int &step_x, int &step_y, int rotate);
|
||||
|
||||
//===========================================================================
|
||||
|
|
@ -188,7 +188,7 @@ struct cRGB
|
|||
static __forceinline unsigned char R(const unsigned char * p) { return p[0]; }
|
||||
static __forceinline unsigned char G(const unsigned char * p) { return p[1]; }
|
||||
static __forceinline unsigned char B(const unsigned char * p) { return p[2]; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, BYTE x, BYTE y, BYTE z) { return 255; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, uint8_t x, uint8_t y, uint8_t z) { return 255; }
|
||||
static __forceinline int Gray(const unsigned char * p) { return (p[0]*77 + p[1]*143 + p[2]*36)>>8; }
|
||||
};
|
||||
|
||||
|
|
@ -197,7 +197,7 @@ struct cRGBT
|
|||
static __forceinline unsigned char R(const unsigned char * p) { return p[0]; }
|
||||
static __forceinline unsigned char G(const unsigned char * p) { return p[1]; }
|
||||
static __forceinline unsigned char B(const unsigned char * p) { return p[2]; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, BYTE r, BYTE g, BYTE b) { return (p[0] != r || p[1] != g || p[2] != b) ? 255 : 0; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, uint8_t r, uint8_t g, uint8_t b) { return (p[0] != r || p[1] != g || p[2] != b) ? 255 : 0; }
|
||||
static __forceinline int Gray(const unsigned char * p) { return (p[0]*77 + p[1]*143 + p[2]*36)>>8; }
|
||||
};
|
||||
|
||||
|
|
@ -213,7 +213,7 @@ struct cRGBA
|
|||
static __forceinline unsigned char R(const unsigned char * p) { return p[0]; }
|
||||
static __forceinline unsigned char G(const unsigned char * p) { return p[1]; }
|
||||
static __forceinline unsigned char B(const unsigned char * p) { return p[2]; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, BYTE x, BYTE y, BYTE z) { return p[3]; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, uint8_t x, uint8_t y, uint8_t z) { return p[3]; }
|
||||
static __forceinline int Gray(const unsigned char * p) { return (p[0]*77 + p[1]*143 + p[2]*36)>>8; }
|
||||
};
|
||||
|
||||
|
|
@ -222,7 +222,7 @@ struct cIA
|
|||
static __forceinline unsigned char R(const unsigned char * p) { return p[0]; }
|
||||
static __forceinline unsigned char G(const unsigned char * p) { return p[0]; }
|
||||
static __forceinline unsigned char B(const unsigned char * p) { return p[0]; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, BYTE x, BYTE y, BYTE z) { return p[1]; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, uint8_t x, uint8_t y, uint8_t z) { return p[1]; }
|
||||
static __forceinline int Gray(const unsigned char * p) { return p[0]; }
|
||||
};
|
||||
|
||||
|
|
@ -231,7 +231,7 @@ struct cCMYK
|
|||
static __forceinline unsigned char R(const unsigned char * p) { return p[3] - (((256-p[0])*p[3]) >> 8); }
|
||||
static __forceinline unsigned char G(const unsigned char * p) { return p[3] - (((256-p[1])*p[3]) >> 8); }
|
||||
static __forceinline unsigned char B(const unsigned char * p) { return p[3] - (((256-p[2])*p[3]) >> 8); }
|
||||
static __forceinline unsigned char A(const unsigned char * p, BYTE x, BYTE y, BYTE z) { return 255; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, uint8_t x, uint8_t y, uint8_t z) { return 255; }
|
||||
static __forceinline int Gray(const unsigned char * p) { return (R(p)*77 + G(p)*143 + B(p)*36)>>8; }
|
||||
};
|
||||
|
||||
|
|
@ -240,7 +240,7 @@ struct cBGR
|
|||
static __forceinline unsigned char R(const unsigned char * p) { return p[2]; }
|
||||
static __forceinline unsigned char G(const unsigned char * p) { return p[1]; }
|
||||
static __forceinline unsigned char B(const unsigned char * p) { return p[0]; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, BYTE x, BYTE y, BYTE z) { return 255; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, uint8_t x, uint8_t y, uint8_t z) { return 255; }
|
||||
static __forceinline int Gray(const unsigned char * p) { return (p[2]*77 + p[1]*143 + p[0]*36)>>8; }
|
||||
};
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ struct cBGRA
|
|||
static __forceinline unsigned char R(const unsigned char * p) { return p[2]; }
|
||||
static __forceinline unsigned char G(const unsigned char * p) { return p[1]; }
|
||||
static __forceinline unsigned char B(const unsigned char * p) { return p[0]; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, BYTE x, BYTE y, BYTE z) { return p[3]; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, uint8_t x, uint8_t y, uint8_t z) { return p[3]; }
|
||||
static __forceinline int Gray(const unsigned char * p) { return (p[2]*77 + p[1]*143 + p[0]*36)>>8; }
|
||||
};
|
||||
|
||||
|
|
@ -272,7 +272,7 @@ struct cARGB
|
|||
static __forceinline unsigned char R(const unsigned char * p) { return p[1]; }
|
||||
static __forceinline unsigned char G(const unsigned char * p) { return p[2]; }
|
||||
static __forceinline unsigned char B(const unsigned char * p) { return p[3]; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, BYTE x, BYTE y, BYTE z) { return p[0]; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, uint8_t x, uint8_t y, uint8_t z) { return p[0]; }
|
||||
static __forceinline int Gray(const unsigned char * p) { return (p[1]*77 + p[2]*143 + p[3]*36)>>8; }
|
||||
};
|
||||
|
||||
|
|
@ -281,16 +281,16 @@ struct cI16
|
|||
static __forceinline unsigned char R(const unsigned char * p) { return p[1]; }
|
||||
static __forceinline unsigned char G(const unsigned char * p) { return p[1]; }
|
||||
static __forceinline unsigned char B(const unsigned char * p) { return p[1]; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, BYTE x, BYTE y, BYTE z) { return 255; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, uint8_t x, uint8_t y, uint8_t z) { return 255; }
|
||||
static __forceinline int Gray(const unsigned char * p) { return p[1]; }
|
||||
};
|
||||
|
||||
struct cRGB555
|
||||
{
|
||||
static __forceinline unsigned char R(const unsigned char * p) { return (((*(WORD*)p)&0x1f)<<3); }
|
||||
static __forceinline unsigned char G(const unsigned char * p) { return (((*(WORD*)p)&0x3e0)>>2); }
|
||||
static __forceinline unsigned char B(const unsigned char * p) { return (((*(WORD*)p)&0x7c00)>>7); }
|
||||
static __forceinline unsigned char A(const unsigned char * p, BYTE x, BYTE y, BYTE z) { return 255; }
|
||||
static __forceinline unsigned char R(const unsigned char * p) { return (((*(uint16_t*)p)&0x1f)<<3); }
|
||||
static __forceinline unsigned char G(const unsigned char * p) { return (((*(uint16_t*)p)&0x3e0)>>2); }
|
||||
static __forceinline unsigned char B(const unsigned char * p) { return (((*(uint16_t*)p)&0x7c00)>>7); }
|
||||
static __forceinline unsigned char A(const unsigned char * p, uint8_t x, uint8_t y, uint8_t z) { return 255; }
|
||||
static __forceinline int Gray(const unsigned char * p) { return (R(p)*77 + G(p)*143 + B(p)*36)>>8; }
|
||||
};
|
||||
|
||||
|
|
@ -299,7 +299,7 @@ struct cPalEntry
|
|||
static __forceinline unsigned char R(const unsigned char * p) { return ((PalEntry*)p)->r; }
|
||||
static __forceinline unsigned char G(const unsigned char * p) { return ((PalEntry*)p)->g; }
|
||||
static __forceinline unsigned char B(const unsigned char * p) { return ((PalEntry*)p)->b; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, BYTE x, BYTE y, BYTE z) { return ((PalEntry*)p)->a; }
|
||||
static __forceinline unsigned char A(const unsigned char * p, uint8_t x, uint8_t y, uint8_t z) { return ((PalEntry*)p)->a; }
|
||||
static __forceinline int Gray(const unsigned char * p) { return (R(p)*77 + G(p)*143 + B(p)*36)>>8; }
|
||||
};
|
||||
|
||||
|
|
@ -353,71 +353,71 @@ struct FCopyInfo
|
|||
|
||||
struct bOverwrite
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = s; }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline void OpC(uint8_t &d, uint8_t s, uint8_t a, FCopyInfo *i) { d = s; }
|
||||
static __forceinline void OpA(uint8_t &d, uint8_t s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline bool ProcessAlpha0() { return true; }
|
||||
};
|
||||
|
||||
struct bCopy
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = s; }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline void OpC(uint8_t &d, uint8_t s, uint8_t a, FCopyInfo *i) { d = s; }
|
||||
static __forceinline void OpA(uint8_t &d, uint8_t s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline bool ProcessAlpha0() { return false; }
|
||||
};
|
||||
|
||||
struct bCopyNewAlpha
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = s; }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = (s*i->alpha) >> BLENDBITS; }
|
||||
static __forceinline void OpC(uint8_t &d, uint8_t s, uint8_t a, FCopyInfo *i) { d = s; }
|
||||
static __forceinline void OpA(uint8_t &d, uint8_t s, FCopyInfo *i) { d = (s*i->alpha) >> BLENDBITS; }
|
||||
static __forceinline bool ProcessAlpha0() { return false; }
|
||||
};
|
||||
|
||||
struct bCopyAlpha
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = (s*a + d*(255-a))/255; }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline void OpC(uint8_t &d, uint8_t s, uint8_t a, FCopyInfo *i) { d = (s*a + d*(255-a))/255; }
|
||||
static __forceinline void OpA(uint8_t &d, uint8_t s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline bool ProcessAlpha0() { return false; }
|
||||
};
|
||||
|
||||
struct bOverlay
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = (s*a + d*(255-a))/255; }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = MAX(s,d); }
|
||||
static __forceinline void OpC(uint8_t &d, uint8_t s, uint8_t a, FCopyInfo *i) { d = (s*a + d*(255-a))/255; }
|
||||
static __forceinline void OpA(uint8_t &d, uint8_t s, FCopyInfo *i) { d = MAX(s,d); }
|
||||
static __forceinline bool ProcessAlpha0() { return false; }
|
||||
};
|
||||
|
||||
struct bBlend
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = (d*i->invalpha + s*i->alpha) >> BLENDBITS; }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline void OpC(uint8_t &d, uint8_t s, uint8_t a, FCopyInfo *i) { d = (d*i->invalpha + s*i->alpha) >> BLENDBITS; }
|
||||
static __forceinline void OpA(uint8_t &d, uint8_t s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline bool ProcessAlpha0() { return false; }
|
||||
};
|
||||
|
||||
struct bAdd
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = MIN<int>((d*BLENDUNIT + s*i->alpha) >> BLENDBITS, 255); }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline void OpC(uint8_t &d, uint8_t s, uint8_t a, FCopyInfo *i) { d = MIN<int>((d*BLENDUNIT + s*i->alpha) >> BLENDBITS, 255); }
|
||||
static __forceinline void OpA(uint8_t &d, uint8_t s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline bool ProcessAlpha0() { return false; }
|
||||
};
|
||||
|
||||
struct bSubtract
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = MAX<int>((d*BLENDUNIT - s*i->alpha) >> BLENDBITS, 0); }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline void OpC(uint8_t &d, uint8_t s, uint8_t a, FCopyInfo *i) { d = MAX<int>((d*BLENDUNIT - s*i->alpha) >> BLENDBITS, 0); }
|
||||
static __forceinline void OpA(uint8_t &d, uint8_t s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline bool ProcessAlpha0() { return false; }
|
||||
};
|
||||
|
||||
struct bReverseSubtract
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = MAX<int>((-d*BLENDUNIT + s*i->alpha) >> BLENDBITS, 0); }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline void OpC(uint8_t &d, uint8_t s, uint8_t a, FCopyInfo *i) { d = MAX<int>((-d*BLENDUNIT + s*i->alpha) >> BLENDBITS, 0); }
|
||||
static __forceinline void OpA(uint8_t &d, uint8_t s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline bool ProcessAlpha0() { return false; }
|
||||
};
|
||||
|
||||
struct bModulate
|
||||
{
|
||||
static __forceinline void OpC(BYTE &d, BYTE s, BYTE a, FCopyInfo *i) { d = (s*d)/255; }
|
||||
static __forceinline void OpA(BYTE &d, BYTE s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline void OpC(uint8_t &d, uint8_t s, uint8_t a, FCopyInfo *i) { d = (s*d)/255; }
|
||||
static __forceinline void OpA(uint8_t &d, uint8_t s, FCopyInfo *i) { d = s; }
|
||||
static __forceinline bool ProcessAlpha0() { return false; }
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue