Skip to content

Commit ae0e4ee

Browse files
authored
[WIN32K:DIB] Fix some bugs in DIB_8BPP_BitBltSrcCopy (reactos#9119)
- Fix destination row stride; - Fix source stride and double translation in the flip path. Related to CORE-2965
1 parent 9dce9a8 commit ae0e4ee

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎win32ss/gdi/dib/dib8bpp.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ DIB_8BPP_BitBltSrcCopy(PBLTINFO BltInfo)
323323
DPRINT("Flip is bTopToBottom.\n");
324324

325325
DWORD Index;
326+
LONG SrcDelta;
326327

327328
/* Allocate enough pixels for a column in BYTE's */
328329
BYTE *store = ExAllocatePoolWithTag(NonPagedPool,
@@ -344,6 +345,7 @@ DIB_8BPP_BitBltSrcCopy(PBLTINFO BltInfo)
344345
SourceLine = (PBYTE)BltInfo->DestSurface->pvScan0 +
345346
(BltInfo->DestRect.top * BltInfo->DestSurface->lDelta) + BltInfo->DestRect.left +
346347
(BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1) * BltInfo->DestSurface->lDelta;
348+
SrcDelta = BltInfo->DestSurface->lDelta;
347349
}
348350
else
349351
{
@@ -352,6 +354,7 @@ DIB_8BPP_BitBltSrcCopy(PBLTINFO BltInfo)
352354
((BltInfo->SourcePoint.y + BltInfo->DestRect.bottom - BltInfo->DestRect.top - 1)
353355
* BltInfo->SourceSurface->lDelta) +
354356
BltInfo->SourcePoint.x;
357+
SrcDelta = BltInfo->SourceSurface->lDelta;
355358
}
356359

357360
/* This set the DestLine to the top line */
@@ -371,9 +374,9 @@ DIB_8BPP_BitBltSrcCopy(PBLTINFO BltInfo)
371374
/* Read up the column and store the pixels */
372375
for (j = BltInfo->DestRect.top; j < BltInfo->DestRect.bottom; j++)
373376
{
374-
store[Index] = (BYTE)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits);
377+
store[Index] = OneDone ? *SourceBits : (BYTE)XLATEOBJ_iXlate(BltInfo->XlateSourceToDest, *SourceBits);
375378
/* Go up a line */
376-
SourceBits -= BltInfo->SourceSurface->lDelta;
379+
SourceBits -= SrcDelta;
377380
Index++;
378381
}
379382

@@ -384,7 +387,7 @@ DIB_8BPP_BitBltSrcCopy(PBLTINFO BltInfo)
384387
{
385388
*DestBits = store[Index];
386389
/* Go down a line */
387-
DestBits += BltInfo->SourceSurface->lDelta;
390+
DestBits += BltInfo->DestSurface->lDelta;
388391
Index++;
389392
}
390393
/* Index to next column */

0 commit comments

Comments
 (0)