Added overlapped copy support.

This commit is contained in:
Armin Novak 2016-04-20 09:57:42 +02:00
parent 716c5c53e9
commit c12c5dd2f5

View File

@ -472,14 +472,94 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
if (FREERDP_PIXEL_FORMAT_FLIP_MASKED(SrcFormat) ==
FREERDP_PIXEL_FORMAT_FLIP_MASKED(DstFormat))
{
UINT32 y;
INT32 y;
if (pDstData == pSrcData)
{
/* Copy down */
if (nYDst > nYSrc)
{
for (y = 0; y < nHeight; y++)
{
const BYTE* srcLine = &pSrcData[(y + nYSrc) * nSrcStep * srcVMultiplier +
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
nSrcStep * srcVMultiplier +
srcVOffset];
BYTE* dstLine = &pDstData[(y + nYDst) * nDstStep * dstVMultiplier + dstVOffset];
memcpy(&dstLine[xDstOffset], &srcLine[xSrcOffset], copyDstWidth);
BYTE* dstLine = &pDstData[(y + nYDst) *
nDstStep * dstVMultiplier +
dstVOffset];
memcpy(&dstLine[xDstOffset],
&srcLine[xSrcOffset], copyDstWidth);
}
}
/* Copy up */
else if (nYDst < nYSrc)
{
for (y = nHeight - 1; y >= 0; y--)
{
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
nSrcStep * srcVMultiplier +
srcVOffset];
BYTE* dstLine = &pDstData[(y + nYDst) *
nDstStep * dstVMultiplier +
dstVOffset];
memcpy(&dstLine[xDstOffset],
&srcLine[xSrcOffset], copyDstWidth);
}
}
/* Copy left */
else if (nXSrc > nXDst)
{
for (y = 0; y < nHeight; y++)
{
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
nSrcStep * srcVMultiplier +
srcVOffset];
BYTE* dstLine = &pDstData[(y + nYDst) *
nDstStep * dstVMultiplier +
dstVOffset];
memmove(&dstLine[xDstOffset],
&srcLine[xSrcOffset], copyDstWidth);
}
}
/* Copy right */
else if (nXSrc < nXDst)
{
for (y = nHeight - 1; y >= 0; y--)
{
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
nSrcStep * srcVMultiplier +
srcVOffset];
BYTE* dstLine = &pDstData[(y + nYDst) *
nDstStep * dstVMultiplier +
dstVOffset];
memove(&dstLine[xDstOffset],
&srcLine[xSrcOffset], copyDstWidth);
}
}
/* Source and destination are equal... */
else
{
}
}
else if (nYDst < nYSrc)
{
for (y = 0; y < nHeight; y++)
{
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
nSrcStep * srcVMultiplier +
srcVOffset];
BYTE* dstLine = &pDstData[(y + nYDst) *
nDstStep * dstVMultiplier +
dstVOffset];
memcpy(&dstLine[xDstOffset],
&srcLine[xSrcOffset], copyDstWidth);
}
}
}
else
@ -488,9 +568,11 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
for (y = 0; y < nHeight; y++)
{
const BYTE* srcLine = &pSrcData[(y + nYSrc) * nSrcStep * srcVMultiplier +
const BYTE* srcLine = &pSrcData[(y + nYSrc) *
nSrcStep * srcVMultiplier +
srcVOffset];
BYTE* dstLine = &pDstData[(y + nYDst) * nDstStep * dstVMultiplier + dstVOffset];
BYTE* dstLine = &pDstData[(y + nYDst) *
nDstStep * dstVMultiplier + dstVOffset];
for (x = 0; x < nWidth; x++)
{