draw_image can now draw images with x<0, fixes #433
this isn't used at all in the source
This commit is contained in:
parent
0ea5c1d0e0
commit
d4a0ff9ac8
@ -445,26 +445,48 @@ void PIXELMETHODS_CLASS::clearrect(int x, int y, int w, int h)
|
|||||||
|
|
||||||
void PIXELMETHODS_CLASS::draw_image(pixel *img, int x, int y, int w, int h, int a)
|
void PIXELMETHODS_CLASS::draw_image(pixel *img, int x, int y, int w, int h, int a)
|
||||||
{
|
{
|
||||||
int i, j, r, g, b;
|
int startX = 0;
|
||||||
if (!img) return;
|
if (!img)
|
||||||
if(y + h > VIDYRES) h = ((VIDYRES)-y)-1; //Adjust height to prevent drawing off the bottom
|
return;
|
||||||
|
// Adjust height to prevent drawing off the bottom
|
||||||
|
if (y + h > VIDYRES)
|
||||||
|
h = ((VIDYRES)-y)-1;
|
||||||
|
// Too big
|
||||||
|
if (x + w > VIDXRES)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Starts off the top of the screen, adjust
|
||||||
if (y < 0 && -y < h)
|
if (y < 0 && -y < h)
|
||||||
{
|
{
|
||||||
img += -y*w;
|
img += -y*w;
|
||||||
h += y;
|
h += y;
|
||||||
y = 0;
|
y = 0;
|
||||||
}
|
}
|
||||||
if(!h || y < 0) return;
|
// Starts off the left side of the screen, adjust
|
||||||
if(a >= 255)
|
if (x < 0 && -x < w)
|
||||||
for (j=0; j<h; j++)
|
{
|
||||||
for (i=0; i<w; i++)
|
startX = -x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!h || y < 0 || !w)
|
||||||
|
return;
|
||||||
|
if (a >= 255)
|
||||||
|
for (int j = 0; j < h; j++)
|
||||||
|
{
|
||||||
|
img += startX;
|
||||||
|
for (int i = startX; i < w; i++)
|
||||||
{
|
{
|
||||||
vid[(y+j)*(VIDXRES)+(x+i)] = *img;
|
vid[(y+j)*(VIDXRES)+(x+i)] = *img;
|
||||||
img++;
|
img++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
for (j=0; j<h; j++)
|
{
|
||||||
for (i=0; i<w; i++)
|
int r, g, b;
|
||||||
|
for (int j = 0; j < h; j++)
|
||||||
|
{
|
||||||
|
img += startX;
|
||||||
|
for (int i = startX; i < w; i++)
|
||||||
{
|
{
|
||||||
r = PIXR(*img);
|
r = PIXR(*img);
|
||||||
g = PIXG(*img);
|
g = PIXG(*img);
|
||||||
@ -472,6 +494,8 @@ void PIXELMETHODS_CLASS::draw_image(pixel *img, int x, int y, int w, int h, int
|
|||||||
blendpixel(x+i, y+j, r, g, b, a);
|
blendpixel(x+i, y+j, r, g, b, a);
|
||||||
img++;
|
img++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PIXELMETHODS_CLASS::draw_image(const VideoBuffer & vidBuf, int x, int y, int a)
|
void PIXELMETHODS_CLASS::draw_image(const VideoBuffer & vidBuf, int x, int y, int a)
|
||||||
|
Reference in New Issue
Block a user