- Fixed: DCanvas::Blit unlocked the destination twice instead of unlocking

both dest and src. Also changed this function so that it is owned by the
  destination canvas of the operation which is necessary if it needs to 
  be overridden by subclasses.


SVN r607 (trunk)
This commit is contained in:
Christoph Oelckers 2007-12-20 14:05:08 +00:00
parent a7bc9262d9
commit 457976d88d
4 changed files with 21 additions and 17 deletions

View file

@ -1,4 +1,8 @@
December 20, 2007 (Changes by Graf Zahl)
- Fixed: DCanvas::Blit unlocked the destination twice instead of unlocking
both dest and src. Also changed this function so that it is owned by the
destination canvas of the operation which is necessary if it needs to
be overridden by subclasses.
- Fixed: The StrifePlayer defined the wrong color range for its translations.
December 19, 2007

View file

@ -1077,8 +1077,8 @@ static void M_DrawSaveLoadCommon ()
M_DrawFrame (savepicLeft, savepicTop, savepicWidth, savepicHeight);
if (SavePic != NULL)
{
SavePic->Blit (0, 0, SavePic->GetWidth(), SavePic->GetHeight(),
screen, savepicLeft, savepicTop, savepicWidth, savepicHeight);
screen->Blit(savepicLeft, savepicTop, savepicWidth, savepicHeight,
SavePic, 0, 0, SavePic->GetWidth(), SavePic->GetHeight());
}
else
{

View file

@ -515,13 +515,13 @@ static void BuildTransTable (const PalEntry *palette)
Col2RGB8_LessPrecision[64] = Col2RGB8[64];
}
void DCanvas::Blit (int srcx, int srcy, int srcwidth, int srcheight,
DCanvas *dest, int destx, int desty, int destwidth, int destheight)
void DCanvas::Blit (int destx, int desty, int destwidth, int destheight, DCanvas *src,
int srcx, int srcy, int srcwidth, int srcheight)
{
fixed_t fracxstep, fracystep;
fixed_t fracx, fracy;
int x, y;
bool lockthis, lockdest;
bool lockthis, locksrc;
if ( (lockthis = (LockCount == 0)) )
{
@ -532,9 +532,9 @@ void DCanvas::Blit (int srcx, int srcy, int srcwidth, int srcheight,
}
}
if ( (lockdest = (dest->LockCount == 0)) )
if ( (locksrc = (src->LockCount == 0)) )
{
dest->Lock ();
src->Lock ();
}
fracy = srcy << FRACBITS;
@ -542,15 +542,15 @@ void DCanvas::Blit (int srcx, int srcy, int srcwidth, int srcheight,
fracxstep = (srcwidth << FRACBITS) / destwidth;
BYTE *destline, *srcline;
BYTE *destbuffer = dest->Buffer;
BYTE *srcbuffer = Buffer;
BYTE *destbuffer = Buffer;
BYTE *srcbuffer = src->Buffer;
if (fracxstep == FRACUNIT)
{
for (y = desty; y < desty + destheight; y++, fracy += fracystep)
{
memcpy (destbuffer + y * dest->Pitch + destx,
srcbuffer + (fracy >> FRACBITS) * Pitch + srcx,
memcpy (destbuffer + y * Pitch + destx,
srcbuffer + (fracy >> FRACBITS) * src->Pitch + srcx,
destwidth);
}
}
@ -558,8 +558,8 @@ void DCanvas::Blit (int srcx, int srcy, int srcwidth, int srcheight,
{
for (y = desty; y < desty + destheight; y++, fracy += fracystep)
{
srcline = srcbuffer + (fracy >> FRACBITS) * Pitch + srcx;
destline = destbuffer + y * dest->Pitch + destx;
srcline = srcbuffer + (fracy >> FRACBITS) * src->Pitch + srcx;
destline = destbuffer + y * Pitch + destx;
for (x = fracx = 0; x < destwidth; x++, fracx += fracxstep)
{
destline[x] = srcline[fracx >> FRACBITS];
@ -571,9 +571,9 @@ void DCanvas::Blit (int srcx, int srcy, int srcwidth, int srcheight,
{
Unlock ();
}
if (lockdest)
if (locksrc)
{
Unlock ();
src->Unlock ();
}
}

View file

@ -145,7 +145,7 @@ public:
virtual bool IsLocked () { return Buffer != NULL; } // Returns true if the surface is locked
// Copy blocks from one canvas to another
virtual void Blit (int srcx, int srcy, int srcwidth, int srcheight, DCanvas *dest, int destx, int desty, int destwidth, int destheight);
virtual void Blit (int destx, int desty, int destwidth, int destheight, DCanvas *src, int srcx, int srcy, int srcwidth, int srcheight);
// Draw a linear block of pixels into the canvas
virtual void DrawBlock (int x, int y, int width, int height, const BYTE *src) const;
@ -217,7 +217,7 @@ protected:
};
bool ClipBox (int &left, int &top, int &width, int &height, const BYTE *&src, const int srcpitch) const;
void STACK_ARGS DrawTextureV (FTexture *img, int x, int y, uint32 tag, va_list tags);
virtual void STACK_ARGS DrawTextureV (FTexture *img, int x, int y, uint32 tag, va_list tags);
bool ParseDrawTextureTags (FTexture *img, int x, int y, uint32 tag, va_list tags, DrawParms *parms) const;
DCanvas() {}