Optimized freerdp_image_fill

This commit is contained in:
Armin Novak 2017-01-16 11:36:35 +01:00
parent 6b7b1cec39
commit 6be6eb2f18
1 changed files with 11 additions and 7 deletions

View File

@ -556,16 +556,20 @@ BOOL freerdp_image_fill(BYTE* pDstData, DWORD DstFormat,
UINT32 nWidth, UINT32 nHeight, UINT32 color)
{
UINT32 x, y;
const UINT32 bpp = GetBytesPerPixel(DstFormat);
BYTE* pFirstDstLine = &pDstData[nYDst * nDstStep];
BYTE* pFirstDstLineXOffset = &pFirstDstLine[nXDst * bpp];
for (y = 0; y < nHeight; y++)
for (x = 0; x < nWidth; x++)
{
BYTE* pDstLine = &pDstData[(y + nYDst) * nDstStep];
BYTE* pDst = &pFirstDstLine[(x + nXDst) * bpp];
WriteColor(pDst, DstFormat, color);
}
for (x = 0; x < nWidth; x++)
{
BYTE* pDst = &pDstLine[(x + nXDst) * GetBytesPerPixel(DstFormat)];
WriteColor(pDst, DstFormat, color);
}
for (y = 1; y < nHeight; y++)
{
BYTE* pDstLine = &pDstData[(y + nYDst) * nDstStep + nXDst * bpp];
memcpy(pDstLine, pFirstDstLineXOffset, nWidth * bpp);
}
return TRUE;