/** * bitmap decompression routine */ BOOL bitmap_decompress(BYTE* srcData, BYTE* dstData, int width, int height, int size, int srcBpp, int dstBpp) { BYTE* TmpBfr; if (srcBpp == 16 && dstBpp == 16) { TmpBfr = (BYTE*) malloc(width * height * 2); RleDecompress16to16(srcData, size, TmpBfr, width * 2, width, height); freerdp_bitmap_flip(TmpBfr, dstData, width * 2, height); free(TmpBfr); } else if (srcBpp == 32 && dstBpp == 32) { if (freerdp_bitmap_planar_decompress(srcData, dstData, width, height, size) < 0) return FALSE; } else if (srcBpp == 15 && dstBpp == 15) { TmpBfr = (BYTE*) malloc(width * height * 2); RleDecompress16to16(srcData, size, TmpBfr, width * 2, width, height); freerdp_bitmap_flip(TmpBfr, dstData, width * 2, height); free(TmpBfr); } else if (srcBpp == 8 && dstBpp == 8) { TmpBfr = (BYTE*) malloc(width * height); RleDecompress8to8(srcData, size, TmpBfr, width, width, height); freerdp_bitmap_flip(TmpBfr, dstData, width, height); free(TmpBfr); } else if (srcBpp == 24 && dstBpp == 24) { TmpBfr = (BYTE*) malloc(width * height * 3); RleDecompress24to24(srcData, size, TmpBfr, width * 3, width, height); freerdp_bitmap_flip(TmpBfr, dstData, width * 3, height); free(TmpBfr); } else { return FALSE; } return TRUE; }
void wf_Pointer_New(wfContext* wfc, rdpPointer* pointer) { HCURSOR hCur; ICONINFO info; BYTE *data; info.fIcon = FALSE; info.xHotspot = pointer->xPos; info.yHotspot = pointer->yPos; if (pointer->xorBpp == 1) { data = (BYTE*) malloc(pointer->lengthAndMask + pointer->lengthXorMask); CopyMemory(data, pointer->andMaskData, pointer->lengthAndMask); CopyMemory(data + pointer->lengthAndMask, pointer->xorMaskData, pointer->lengthXorMask); info.hbmMask = CreateBitmap(pointer->width, pointer->height * 2, 1, 1, data); free(data); info.hbmColor = NULL; } else { data = (BYTE*) malloc(pointer->lengthAndMask); freerdp_bitmap_flip(pointer->andMaskData, data, (pointer->width + 7) / 8, pointer->height); info.hbmMask = CreateBitmap(pointer->width, pointer->height, 1, 1, data); free(data); data = (BYTE*) malloc(pointer->lengthXorMask); freerdp_image_flip(pointer->xorMaskData, data, pointer->width, pointer->height, pointer->xorBpp); info.hbmColor = CreateBitmap(pointer->width, pointer->height, 1, pointer->xorBpp, data); free(data); } hCur = CreateIconIndirect(&info); ((wfPointer*) pointer)->cursor = hCur; if (info.hbmMask) DeleteObject(info.hbmMask); if (info.hbmColor) DeleteObject(info.hbmColor); }