Permalink
Browse files

Restore not-in-place bitmap flip (saves one memcpy() per flipped scan…

…line)
  • Loading branch information...
1 parent c4169b1 commit bfe67436298312066cbbc9ca638c02e604d79238 @filofel filofel committed Feb 28, 2012
Showing with 18 additions and 8 deletions.
  1. +18 −8 libfreerdp-codec/bitmap.c
View
@@ -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
{

0 comments on commit bfe6743

Please sign in to comment.