Merge pull request #472 from filofel/master

Remove the use of in place bitmap flipping from bitmap_decompress()
This commit is contained in:
Marc-André Moreau 2012-02-28 12:52:41 -08:00
commit 3e5a978bb9
2 changed files with 26 additions and 16 deletions

View File

@ -437,10 +437,14 @@ static boolean bitmap_decompress4(uint8* srcData, uint8* dstData, int width, int
*/
boolean bitmap_decompress(uint8* srcData, uint8* dstData, int width, int height, int size, int srcBpp, int dstBpp)
{
uint8 * TmpBfr;
if (srcBpp == 16 && dstBpp == 16)
{
RleDecompress16to16(srcData, size, dstData, width * 2, width, height);
freerdp_bitmap_flip(dstData, dstData, width * 2, height);
TmpBfr = (uint8*) xmalloc(width * height * 2);
RleDecompress16to16(srcData, size, TmpBfr, width * 2, width, height);
freerdp_bitmap_flip(TmpBfr, dstData, width * 2, height);
xfree(TmpBfr);
}
else if (srcBpp == 32 && dstBpp == 32)
{
@ -449,18 +453,24 @@ boolean bitmap_decompress(uint8* srcData, uint8* dstData, int width, int height,
}
else if (srcBpp == 15 && dstBpp == 15)
{
RleDecompress16to16(srcData, size, dstData, width * 2, width, height);
freerdp_bitmap_flip(dstData, dstData, width * 2, height);
TmpBfr = (uint8*) xmalloc(width * height * 2);
RleDecompress16to16(srcData, size, TmpBfr, width * 2, width, height);
freerdp_bitmap_flip(TmpBfr, dstData, width * 2, height);
xfree(TmpBfr);
}
else if (srcBpp == 8 && dstBpp == 8)
{
RleDecompress8to8(srcData, size, dstData, width, width, height);
freerdp_bitmap_flip(dstData, dstData, width, height);
TmpBfr = (uint8*) xmalloc(width * height);
RleDecompress8to8(srcData, size, TmpBfr, width, width, height);
freerdp_bitmap_flip(TmpBfr, dstData, width, height);
xfree(TmpBfr);
}
else if (srcBpp == 24 && dstBpp == 24)
{
RleDecompress24to24(srcData, size, dstData, width * 3, width, height);
freerdp_bitmap_flip(dstData, dstData, width * 3, height);
TmpBfr = (uint8*) xmalloc(width * height * 3);
RleDecompress24to24(srcData, size, TmpBfr, width * 3, width, height);
freerdp_bitmap_flip(TmpBfr, dstData, width * 3, height);
xfree(TmpBfr);
}
else
{

View File

@ -373,7 +373,7 @@ uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int
{
if (dstData == NULL)
dstData = (uint8*) malloc(width * height * 2);
dst16 = (uint16 *) dstData;
for (i = width * height; i > 0; i--)
{
@ -392,7 +392,7 @@ uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int
{
if (dstData == NULL)
dstData = (uint8*) malloc(width * height * 2);
dst16 = (uint16 *) dstData;
for (i = width * height; i > 0; i--)
{
@ -411,7 +411,7 @@ uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int
{
if (dstData == NULL)
dstData = (uint8*) malloc(width * height * 4);
src8 = (uint8*) srcData;
dst32 = (uint32*) dstData;
for (i = width * height; i > 0; i--)
@ -455,7 +455,7 @@ uint8* freerdp_image_convert_15bpp(uint8* srcData, uint8* dstData, int width, in
{
if (dstData == NULL)
dstData = (uint8*) malloc(width * height * 4);
src16 = (uint16 *) srcData;
dst32 = (uint32 *) dstData;
for (i = width * height; i > 0; i--)
@ -473,7 +473,7 @@ uint8* freerdp_image_convert_15bpp(uint8* srcData, uint8* dstData, int width, in
{
if (dstData == NULL)
dstData = (uint8*) malloc(width * height * 2);
src16 = (uint16 *) srcData;
dst16 = (uint16 *) dstData;
for (i = width * height; i > 0; i--)
@ -596,7 +596,7 @@ uint8* freerdp_image_convert_24bpp(uint8* srcData, uint8* dstData, int width, in
uint8 *dstp;
if (dstData == NULL)
dstData = (uint8*) malloc(width * height * 4);
dstp = dstData;
for (i = width * height; i > 0; i--)
{
@ -698,7 +698,7 @@ uint8* freerdp_image_convert_32bpp(uint8* srcData, uint8* dstData, int width, in
memcpy(dstData, srcData, width * height * 4);
}
return dstData;
}
@ -744,7 +744,7 @@ void freerdp_bitmap_flip(uint8 * src, uint8 * dst, int scanLineSz, int height)
int half = height / 2;
/* Flip buffer in place by line permutations through the temp
* scan line buffer.
* Not that if height has an odd number of line, we don't need
* Note that if height has an odd number of line, we don't need
* to move the center scanline anyway.
* Also note that in place flipping takes three memcpy() calls
* to process two scanlines while src to distinct dest would