[WIN32K] Fix brain-fail of mine

Copying e.g. (2;2);(6;6) to (0;0);(4;4) also needs to have an intermediate buffer.
This commit is contained in:
Jérôme Gardou 2021-03-31 16:55:30 +02:00
parent 30886e74f2
commit 40f7e86347

View file

@ -69,6 +69,7 @@ DIB_1BPP_BitBltSrcCopy_From1BPP (
LONG Width = RECTL_lGetWidth(DestRect); LONG Width = RECTL_lGetWidth(DestRect);
BOOLEAN XorBit = !!XLATEOBJ_iXlate(pxlo, 0); BOOLEAN XorBit = !!XLATEOBJ_iXlate(pxlo, 0);
BOOLEAN Overlap = FALSE; BOOLEAN Overlap = FALSE;
BYTE *DstStart, *DstEnd, *SrcStart, *SrcEnd;
/* Make sure this is as expected */ /* Make sure this is as expected */
ASSERT(DestRect->left >= 0); ASSERT(DestRect->left >= 0);
@ -78,14 +79,11 @@ DIB_1BPP_BitBltSrcCopy_From1BPP (
/* /*
* Check if we need to allocate a buffer for our operation. * Check if we need to allocate a buffer for our operation.
* NB: if we're not mirroring, we're doing a memmove-like operation, so this is always fine.
*/ */
if (bTopToBottom || bLeftToRight) DstStart = (BYTE*)DestSurf->pvScan0 + DestRect->top * DestSurf->lDelta + DestRect->left / 8;
{ DstEnd = (BYTE*)DestSurf->pvScan0 + (DestRect->bottom - 1) * DestSurf->lDelta + (DestRect->right) / 8;
BYTE* DstStart = (BYTE*)DestSurf->pvScan0 + DestRect->top * DestSurf->lDelta + DestRect->left / 8; SrcStart = (BYTE*)SourceSurf->pvScan0 + SourcePoint->y * SourceSurf->lDelta + SourcePoint->x / 8;
BYTE* DstEnd = (BYTE*)DestSurf->pvScan0 + (DestRect->bottom - 1) * DestSurf->lDelta + (DestRect->right) / 8; SrcEnd = (BYTE*)SourceSurf->pvScan0 + (SourcePoint->y + Height - 1) * SourceSurf->lDelta + (SourcePoint->x + Width) / 8;
BYTE* SrcStart = (BYTE*)SourceSurf->pvScan0 + SourcePoint->y * SourceSurf->lDelta + SourcePoint->x / 8;
BYTE* SrcEnd = (BYTE*)SourceSurf->pvScan0 + (SourcePoint->y + Height - 1) * SourceSurf->lDelta + (SourcePoint->x + Width) / 8;
/* Beware of bitmaps with negative pitch! */ /* Beware of bitmaps with negative pitch! */
if (DstStart > DstEnd) if (DstStart > DstEnd)
@ -104,7 +102,6 @@ DIB_1BPP_BitBltSrcCopy_From1BPP (
/* We allocate a new buffer when the two buffers overlap */ /* We allocate a new buffer when the two buffers overlap */
Overlap = ((SrcStart >= DstStart) && (SrcStart < DstEnd)) || ((SrcEnd >= DstStart) && (SrcEnd < DstEnd)); Overlap = ((SrcStart >= DstStart) && (SrcStart < DstEnd)) || ((SrcEnd >= DstStart) && (SrcEnd < DstEnd));
}
if (!Overlap) if (!Overlap)
{ {