- 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) 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. - Fixed: The StrifePlayer defined the wrong color range for its translations.
December 19, 2007 December 19, 2007

View File

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

View File

@ -515,13 +515,13 @@ static void BuildTransTable (const PalEntry *palette)
Col2RGB8_LessPrecision[64] = Col2RGB8[64]; Col2RGB8_LessPrecision[64] = Col2RGB8[64];
} }
void DCanvas::Blit (int srcx, int srcy, int srcwidth, int srcheight, void DCanvas::Blit (int destx, int desty, int destwidth, int destheight, DCanvas *src,
DCanvas *dest, int destx, int desty, int destwidth, int destheight) int srcx, int srcy, int srcwidth, int srcheight)
{ {
fixed_t fracxstep, fracystep; fixed_t fracxstep, fracystep;
fixed_t fracx, fracy; fixed_t fracx, fracy;
int x, y; int x, y;
bool lockthis, lockdest; bool lockthis, locksrc;
if ( (lockthis = (LockCount == 0)) ) 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; fracy = srcy << FRACBITS;
@ -542,15 +542,15 @@ void DCanvas::Blit (int srcx, int srcy, int srcwidth, int srcheight,
fracxstep = (srcwidth << FRACBITS) / destwidth; fracxstep = (srcwidth << FRACBITS) / destwidth;
BYTE *destline, *srcline; BYTE *destline, *srcline;
BYTE *destbuffer = dest->Buffer; BYTE *destbuffer = Buffer;
BYTE *srcbuffer = Buffer; BYTE *srcbuffer = src->Buffer;
if (fracxstep == FRACUNIT) if (fracxstep == FRACUNIT)
{ {
for (y = desty; y < desty + destheight; y++, fracy += fracystep) for (y = desty; y < desty + destheight; y++, fracy += fracystep)
{ {
memcpy (destbuffer + y * dest->Pitch + destx, memcpy (destbuffer + y * Pitch + destx,
srcbuffer + (fracy >> FRACBITS) * Pitch + srcx, srcbuffer + (fracy >> FRACBITS) * src->Pitch + srcx,
destwidth); 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) for (y = desty; y < desty + destheight; y++, fracy += fracystep)
{ {
srcline = srcbuffer + (fracy >> FRACBITS) * Pitch + srcx; srcline = srcbuffer + (fracy >> FRACBITS) * src->Pitch + srcx;
destline = destbuffer + y * dest->Pitch + destx; destline = destbuffer + y * Pitch + destx;
for (x = fracx = 0; x < destwidth; x++, fracx += fracxstep) for (x = fracx = 0; x < destwidth; x++, fracx += fracxstep)
{ {
destline[x] = srcline[fracx >> FRACBITS]; destline[x] = srcline[fracx >> FRACBITS];
@ -571,9 +571,9 @@ void DCanvas::Blit (int srcx, int srcy, int srcwidth, int srcheight,
{ {
Unlock (); 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 virtual bool IsLocked () { return Buffer != NULL; } // Returns true if the surface is locked
// Copy blocks from one canvas to another // 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 // Draw a linear block of pixels into the canvas
virtual void DrawBlock (int x, int y, int width, int height, const BYTE *src) const; 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; 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; bool ParseDrawTextureTags (FTexture *img, int x, int y, uint32 tag, va_list tags, DrawParms *parms) const;
DCanvas() {} DCanvas() {}