From 6a5ab0edc0b79ffe93831ec4266a82ecf7fd7245 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 25 Sep 2009 02:27:48 +0000 Subject: [PATCH] - Fixed: FMultiPatchTexture::CopyTrueColorPixels() should clear the buffer first before drawing into it if the copy op passed to it is OP_OVERWRITE. FTexture::FillBuffer() sets this to erase whatever texture might have been in the space it is going into. SVN r1874 (trunk) --- docs/rh-log.txt | 6 ++++++ src/textures/bitmap.cpp | 14 ++++++++++++++ src/textures/bitmap.h | 1 + src/textures/multipatchtexture.cpp | 7 ++++++- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index ac304a52d7..a5bee140ab 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,9 @@ +September 24, 2009 +- Fixed: FMultiPatchTexture::CopyTrueColorPixels() should clear the buffer + first before drawing into it if the copy op passed to it is OP_OVERWRITE. + FTexture::FillBuffer() sets this to erase whatever texture might have been + in the space it is going into. + September 22, 2009 - Added a technique to try and minimize input lag with vsync enabled: Two surfaces are alternately locked for read-only access each frame, forcing diff --git a/src/textures/bitmap.cpp b/src/textures/bitmap.cpp index 913aa507e7..f1d78c478d 100644 --- a/src/textures/bitmap.cpp +++ b/src/textures/bitmap.cpp @@ -477,3 +477,17 @@ void FBitmap::CopyPixelData(int originx, int originy, const BYTE * patch, int sr } } +//=========================================================================== +// +// Clear buffer +// +//=========================================================================== +void FBitmap::Zero() +{ + BYTE *buffer = data; + for (int y = 0; y < Height; ++y) + { + memset(buffer, 0, Width*4); + buffer += Pitch; + } +} diff --git a/src/textures/bitmap.h b/src/textures/bitmap.h index 04bd580cd8..35bdf62a21 100644 --- a/src/textures/bitmap.h +++ b/src/textures/bitmap.h @@ -116,6 +116,7 @@ public: return data; } + void Zero(); virtual void CopyPixelDataRGB(int originx, int originy, const BYTE *patch, int srcwidth, int srcheight, int step_x, int step_y, int rotate, int ct, FCopyInfo *inf = NULL); diff --git a/src/textures/multipatchtexture.cpp b/src/textures/multipatchtexture.cpp index 4b9bd5e1b6..66c5276a3d 100644 --- a/src/textures/multipatchtexture.cpp +++ b/src/textures/multipatchtexture.cpp @@ -550,7 +550,12 @@ int FMultiPatchTexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int w, i if (w < 0 || w > Width) w = Width; if (h < 0 || h > Height) h = Height; - for(int i=0;iop == OP_OVERWRITE) + { + bmp->Zero(); + } + + for(int i = 0; i < NumParts; i++) { int ret = -1;