changed scaler proc signature so that srcPtr is const (this can help optimizer by simplifying aliasing detection; thanks to Bertrand Augereau for pointing this out)
svn-id: r7939
This commit is contained in:
parent
e827a569d2
commit
9b70fee5f3
4 changed files with 30 additions and 32 deletions
|
@ -118,10 +118,8 @@ public:
|
|||
void copy_rect_overlay(const int16 *buf, int pitch, int x, int y, int w, int h);
|
||||
|
||||
static OSystem *create(int gfx_mode, bool full_screen);
|
||||
private:
|
||||
typedef void ScalerProc(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr,
|
||||
uint8 *dstPtr, uint32 dstPitch, int width, int height);
|
||||
|
||||
private:
|
||||
SDL_Surface *sdl_tmpscreen; // temporary screen (for scalers/overlay)
|
||||
SDL_Surface *sdl_hwscreen; // hardware screen
|
||||
bool _overlay_visible;
|
||||
|
|
|
@ -124,9 +124,6 @@ public:
|
|||
static OSystem *create(int gfx_mode, bool full_screen);
|
||||
|
||||
protected:
|
||||
typedef void ScalerProc(uint8 *srcPtr, uint32 srcPitch,
|
||||
uint8 *dstPtr, uint32 dstPitch, int width, int height);
|
||||
|
||||
OSystem_SDL_Common();
|
||||
virtual ~OSystem_SDL_Common();
|
||||
|
||||
|
|
|
@ -155,8 +155,8 @@ static inline uint32 Q_INTERPOLATE(uint32 A, uint32 B, uint32 C, uint32 D) {
|
|||
#define RED_MASK555 0x7C007C00
|
||||
#define GREEN_MASK555 0x03E003E0
|
||||
|
||||
void Super2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
uint16 *bP;
|
||||
void Super2xSaI(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
const uint16 *bP;
|
||||
uint8 *dP;
|
||||
uint32 inc_bP;
|
||||
|
||||
|
@ -165,7 +165,7 @@ void Super2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
|||
inc_bP = 1;
|
||||
|
||||
while (height--) {
|
||||
bP = (uint16 *)srcPtr;
|
||||
bP = (const uint16 *)srcPtr;
|
||||
dP = (uint8 *)dstPtr;
|
||||
|
||||
for (uint32 finish = width; finish; finish -= inc_bP) {
|
||||
|
@ -271,9 +271,9 @@ void Super2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
|||
}
|
||||
}
|
||||
|
||||
void SuperEagle(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
void SuperEagle(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
uint8 *dP;
|
||||
uint16 *bP;
|
||||
const uint16 *bP;
|
||||
uint32 inc_bP;
|
||||
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ void SuperEagle(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
|||
uint32 Nextline = srcPitch >> 1;
|
||||
|
||||
while (height--) {
|
||||
bP = (uint16 *)srcPtr;
|
||||
bP = (const uint16 *)srcPtr;
|
||||
dP = dstPtr;
|
||||
for (uint32 finish = width; finish; finish -= inc_bP) {
|
||||
uint32 color4, color5, color6;
|
||||
|
@ -388,9 +388,9 @@ void SuperEagle(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
|||
}
|
||||
}
|
||||
|
||||
void _2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
void _2xSaI(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int width, int height) {
|
||||
uint8 *dP;
|
||||
uint16 *bP;
|
||||
const uint16 *bP;
|
||||
uint32 inc_bP;
|
||||
|
||||
{
|
||||
|
@ -399,7 +399,7 @@ void _2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch, int
|
|||
uint32 Nextline = srcPitch >> 1;
|
||||
|
||||
while (height--) {
|
||||
bP = (uint16 *)srcPtr;
|
||||
bP = (const uint16 *)srcPtr;
|
||||
dP = dstPtr;
|
||||
|
||||
for (uint32 finish = width; finish; finish -= inc_bP) {
|
||||
|
@ -582,10 +582,10 @@ static uint32 Bilinear4(uint32 A, uint32 B, uint32 C, uint32 D, uint32 x, uint32
|
|||
// FIXME: Scale_2xSaI is not used anywhere; however, contrary to the _2xSaI function,
|
||||
// it seems to allow for arbitrary scale factors, not just 2x... hence I leave this in
|
||||
// for now, as that seems to be a very useful feature
|
||||
void Scale_2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
||||
void Scale_2xSaI(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
||||
uint32 dstWidth, uint32 dstHeight, int width, int height) {
|
||||
uint8 *dP;
|
||||
uint16 *bP;
|
||||
const uint16 *bP;
|
||||
|
||||
uint32 w;
|
||||
uint32 h;
|
||||
|
@ -605,7 +605,7 @@ void Scale_2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
|||
uint32 y1, y2;
|
||||
|
||||
y1 = h & 0xffff; // fraction part of fixed point
|
||||
bP = (uint16 *)(srcPtr + ((h >> 16) * srcPitch));
|
||||
bP = (const uint16 *)(srcPtr + ((h >> 16) * srcPitch));
|
||||
dP = dstPtr;
|
||||
y2 = 0x10000 - y1;
|
||||
|
||||
|
@ -713,10 +713,10 @@ void Scale_2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
|||
}
|
||||
}
|
||||
|
||||
void AdvMame2x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
||||
void AdvMame2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
||||
int width, int height) {
|
||||
unsigned int nextlineSrc = srcPitch / sizeof(uint16);
|
||||
uint16 *p = (uint16 *)srcPtr;
|
||||
const uint16 *p = (const uint16 *)srcPtr;
|
||||
|
||||
unsigned int nextlineDst = dstPitch / sizeof(uint16);
|
||||
uint16 *q = (uint16 *)dstPtr;
|
||||
|
@ -749,10 +749,10 @@ void AdvMame2x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
|||
}
|
||||
}
|
||||
|
||||
void AdvMame3x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
||||
void AdvMame3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
||||
int width, int height) {
|
||||
unsigned int nextlineSrc = srcPitch / sizeof(uint16);
|
||||
uint16 *p = (uint16 *)srcPtr;
|
||||
const uint16 *p = (const uint16 *)srcPtr;
|
||||
|
||||
unsigned int nextlineDst = dstPitch / sizeof(uint16);
|
||||
uint16 *q = (uint16 *)dstPtr;
|
||||
|
@ -790,7 +790,7 @@ void AdvMame3x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
|||
}
|
||||
}
|
||||
|
||||
void Normal1x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
||||
void Normal1x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
||||
int width, int height) {
|
||||
while (height--) {
|
||||
memcpy(dstPtr, srcPtr, 2 * width);
|
||||
|
@ -799,14 +799,14 @@ void Normal1x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
|||
}
|
||||
}
|
||||
|
||||
void Normal2x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
||||
void Normal2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
||||
int width, int height) {
|
||||
uint8 *r;
|
||||
|
||||
while (height--) {
|
||||
r = dstPtr;
|
||||
for (int i = 0; i < width; ++i, r += 4) {
|
||||
uint16 color = *(((uint16 *)srcPtr) + i);
|
||||
uint16 color = *(((const uint16 *)srcPtr) + i);
|
||||
|
||||
*(uint16 *)(r + 0) = color;
|
||||
*(uint16 *)(r + 2) = color;
|
||||
|
@ -818,7 +818,7 @@ void Normal2x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
|||
}
|
||||
}
|
||||
|
||||
void Normal3x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
||||
void Normal3x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
||||
int width, int height) {
|
||||
uint8 *r;
|
||||
uint32 dstPitch2 = dstPitch * 2;
|
||||
|
@ -827,7 +827,7 @@ void Normal3x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
|||
while (height--) {
|
||||
r = dstPtr;
|
||||
for (int i = 0; i < width; ++i, r += 6) {
|
||||
uint16 color = *(((uint16 *)srcPtr) + i);
|
||||
uint16 color = *(((const uint16 *)srcPtr) + i);
|
||||
|
||||
*(uint16 *)(r + 0) = color;
|
||||
*(uint16 *)(r + 2) = color;
|
||||
|
@ -844,10 +844,10 @@ void Normal3x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
|||
}
|
||||
}
|
||||
|
||||
void TV2x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
||||
void TV2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
||||
int width, int height) {
|
||||
unsigned int nextlineSrc = srcPitch / sizeof(uint16);
|
||||
uint16 *p = (uint16 *)srcPtr;
|
||||
const uint16 *p = (const uint16 *)srcPtr;
|
||||
|
||||
unsigned int nextlineDst = dstPitch / sizeof(uint16);
|
||||
uint16 *q = (uint16 *)dstPtr;
|
||||
|
@ -874,11 +874,11 @@ static inline uint16 DOT_16(uint16 c, int j, int i) {
|
|||
return c - ((c >> 2) & *(dotmatrix + ((j & 3) << 2) + (i & 3)));
|
||||
}
|
||||
|
||||
void DotMatrix(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
||||
void DotMatrix(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
|
||||
int width, int height)
|
||||
{
|
||||
unsigned int nextlineSrc = srcPitch / sizeof(uint16);
|
||||
uint16 *p = (uint16 *)srcPtr;
|
||||
const uint16 *p = (const uint16 *)srcPtr;
|
||||
|
||||
unsigned int nextlineDst = dstPitch / sizeof(uint16);
|
||||
uint16 *q = (uint16 *)dstPtr;
|
||||
|
|
|
@ -23,8 +23,11 @@
|
|||
|
||||
extern int Init_2xSaI (uint32 BitFormat);
|
||||
|
||||
typedef void ScalerProc(const uint8 *srcPtr, uint32 srcPitch,
|
||||
uint8 *dstPtr, uint32 dstPitch, int width, int height);
|
||||
|
||||
#define DECLARE_SCALER(x) \
|
||||
extern void x(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, \
|
||||
extern void x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, \
|
||||
uint32 dstPitch, int width, int height)
|
||||
|
||||
DECLARE_SCALER(_2xSaI);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue