Skip to content

Commit

Permalink
Remove some extra instructions from ComplexCopy
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Nov 3, 2024
1 parent 0756c5b commit b076d14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Dllmain/BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 7256
#define BUILD_NUMBER 7257
7 changes: 3 additions & 4 deletions ddraw/IDirectDrawSurfaceX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6368,6 +6368,7 @@ void SimpleColorKeyCopy(T ColorKey, BYTE* SrcBuffer, BYTE* DestBuffer, INT SrcPi
{
T* SrcBufferLoop = reinterpret_cast<T*>(SrcBuffer);
T* DestBufferLoop = reinterpret_cast<T*>(DestBuffer);

for (LONG y = 0; y < DestRectHeight; y++)
{
for (LONG x = 0; x < DestRectWidth; x++)
Expand All @@ -6393,21 +6394,19 @@ void ComplexCopy(T ColorKey, D3DLOCKED_RECT SrcLockRect, D3DLOCKED_RECT DestLock
T* SrcBufferLoop = reinterpret_cast<T*>(SrcLockRect.pBits);
T* DestBufferLoop = reinterpret_cast<T*>(DestLockRect.pBits);

DWORD sx;

for (LONG y = 0; y < DestRectHeight; y++)
{
for (LONG x = 0; x < DestRectWidth; x++)
{
sx = (DWORD)((float)x * WidthRatio + 0.5f);
DWORD sx = (DWORD)((float)x * WidthRatio);
T PixelColor = SrcBufferLoop[IsMirrorLeftRight ? SrcRectWidth - sx - 1 : sx];

if (!IsColorKey || PixelColor != ColorKey)
{
DestBufferLoop[x] = PixelColor;
}
}
sx = min((DWORD)((float)(y + 1) * HeightRatio + 0.5f), (DWORD)SrcRectHeight - 1);
DWORD sx = (DWORD)((float)(y + 1) * HeightRatio);
SrcBufferLoop = reinterpret_cast<T*>((BYTE*)SrcLockRect.pBits + SrcLockRect.Pitch * (IsMirrorUpDown ? SrcRectHeight - sx - 1 : sx));
DestBufferLoop = reinterpret_cast<T*>((BYTE*)DestBufferLoop + DestLockRect.Pitch);
}
Expand Down

0 comments on commit b076d14

Please sign in to comment.