void update_gdi_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3) { rdpBitmap* bitmap; rdpBitmap* prevBitmap; rdpCache* cache = context->cache; BITMAP_DATA_EX* bitmapData = &cache_bitmap_v3->bitmapData; bitmap = Bitmap_Alloc(context); Bitmap_SetDimensions(context, bitmap, bitmapData->width, bitmapData->height); if (cache_bitmap_v3->bitmapData.bpp == 0) { /* Workaround for Windows 8 bug where bitmapBpp is not set */ cache_bitmap_v3->bitmapData.bpp = context->instance->settings->color_depth; } bitmap->Decompress(context, bitmap, bitmapData->data, bitmap->width, bitmap->height, bitmapData->bpp, bitmapData->length, true, bitmapData->codecID); bitmap->New(context, bitmap); prevBitmap = bitmap_cache_get(cache->bitmap, cache_bitmap_v3->cacheId, cache_bitmap_v3->cacheIndex); if (prevBitmap != NULL) Bitmap_Free(context, prevBitmap); bitmap_cache_put(cache->bitmap, cache_bitmap_v3->cacheId, cache_bitmap_v3->cacheIndex, bitmap); }
void update_gdi_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2) { rdpBitmap* bitmap; rdpBitmap* prevBitmap; rdpCache* cache = context->cache; bitmap = Bitmap_Alloc(context); Bitmap_SetDimensions(context, bitmap, cache_bitmap_v2->bitmapWidth, cache_bitmap_v2->bitmapHeight); if (cache_bitmap_v2->bitmapBpp == 0) { /* Workaround for Windows 8 bug where bitmapBpp is not set */ cache_bitmap_v2->bitmapBpp = context->instance->settings->color_depth; } bitmap->Decompress(context, bitmap, cache_bitmap_v2->bitmapDataStream, cache_bitmap_v2->bitmapWidth, cache_bitmap_v2->bitmapHeight, cache_bitmap_v2->bitmapBpp, cache_bitmap_v2->bitmapLength, cache_bitmap_v2->compressed, CODEC_ID_NONE); bitmap->New(context, bitmap); prevBitmap = bitmap_cache_get(cache->bitmap, cache_bitmap_v2->cacheId, cache_bitmap_v2->cacheIndex); if (prevBitmap != NULL) Bitmap_Free(context, prevBitmap); bitmap_cache_put(cache->bitmap, cache_bitmap_v2->cacheId, cache_bitmap_v2->cacheIndex, bitmap); }
void update_gdi_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cacheBitmapV3) { rdpBitmap* bitmap; rdpBitmap* prevBitmap; BOOL compressed = TRUE; rdpCache* cache = context->cache; rdpSettings* settings = context->settings; BITMAP_DATA_EX* bitmapData = &cacheBitmapV3->bitmapData; bitmap = Bitmap_Alloc(context); Bitmap_SetDimensions(context, bitmap, bitmapData->width, bitmapData->height); if (!cacheBitmapV3->bpp) cacheBitmapV3->bpp = settings->ColorDepth; compressed = (bitmapData->codecID != RDP_CODEC_ID_NONE); bitmap->Decompress(context, bitmap, bitmapData->data, bitmap->width, bitmap->height, bitmapData->bpp, bitmapData->length, compressed, bitmapData->codecID); bitmap->New(context, bitmap); prevBitmap = bitmap_cache_get(cache->bitmap, cacheBitmapV3->cacheId, cacheBitmapV3->cacheIndex); if (prevBitmap) Bitmap_Free(context, prevBitmap); bitmap_cache_put(cache->bitmap, cacheBitmapV3->cacheId, cacheBitmapV3->cacheIndex, bitmap); }
void update_gdi_cache_bitmap_v2(rdpContext* context, CACHE_BITMAP_V2_ORDER* cacheBitmapV2) { rdpBitmap* bitmap; rdpBitmap* prevBitmap; rdpCache* cache = context->cache; rdpSettings* settings = context->settings; bitmap = Bitmap_Alloc(context); Bitmap_SetDimensions(context, bitmap, cacheBitmapV2->bitmapWidth, cacheBitmapV2->bitmapHeight); if (!cacheBitmapV2->bitmapBpp) cacheBitmapV2->bitmapBpp = settings->ColorDepth; if ((settings->ColorDepth == 15) && (cacheBitmapV2->bitmapBpp == 16)) cacheBitmapV2->bitmapBpp = settings->ColorDepth; bitmap->Decompress(context, bitmap, cacheBitmapV2->bitmapDataStream, cacheBitmapV2->bitmapWidth, cacheBitmapV2->bitmapHeight, cacheBitmapV2->bitmapBpp, cacheBitmapV2->bitmapLength, cacheBitmapV2->compressed, RDP_CODEC_ID_NONE); bitmap->New(context, bitmap); prevBitmap = bitmap_cache_get(cache->bitmap, cacheBitmapV2->cacheId, cacheBitmapV2->cacheIndex); if (prevBitmap) Bitmap_Free(context, prevBitmap); bitmap_cache_put(cache->bitmap, cacheBitmapV2->cacheId, cacheBitmapV2->cacheIndex, bitmap); }
void update_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmap_update) { int i; rdpBitmap* bitmap; BITMAP_DATA* bitmap_data; tbool reused = true; rdpCache* cache = context->cache; if (cache->bitmap->bitmap == NULL) { cache->bitmap->bitmap = Bitmap_Alloc(context); cache->bitmap->bitmap->ephemeral = true; reused = false; } bitmap = cache->bitmap->bitmap; for (i = 0; i < (int) bitmap_update->number; i++) { bitmap_data = &bitmap_update->rectangles[i]; bitmap->bpp = bitmap_data->bitsPerPixel; bitmap->length = bitmap_data->bitmapLength; bitmap->compressed = bitmap_data->compressed; Bitmap_SetRectangle(context, bitmap, bitmap_data->destLeft, bitmap_data->destTop, bitmap_data->destRight, bitmap_data->destBottom); Bitmap_SetDimensions(context, bitmap, bitmap_data->width, bitmap_data->height); bitmap->Decompress(context, bitmap, bitmap_data->bitmapDataStream, bitmap_data->width, bitmap_data->height, bitmap_data->bitsPerPixel, bitmap_data->bitmapLength, bitmap_data->compressed, CODEC_ID_NONE); if (reused) bitmap->Free(context, bitmap); else reused = true; bitmap->New(context, bitmap); bitmap->Paint(context, bitmap); } }
BOOL gdi_bitmap_update(rdpContext* context, const BITMAP_UPDATE* bitmapUpdate) { UINT32 index; if (!context || !bitmapUpdate || !context->gdi || !context->codecs) return FALSE; for (index = 0; index < bitmapUpdate->number; index++) { const BITMAP_DATA* bitmap = &(bitmapUpdate->rectangles[index]); rdpBitmap* bmp = Bitmap_Alloc(context); if (!bmp) return FALSE; Bitmap_SetDimensions(bmp, bitmap->width, bitmap->height); Bitmap_SetRectangle(bmp, bitmap->destLeft, bitmap->destTop, bitmap->destRight, bitmap->destBottom); if (!bmp->Decompress(context, bmp, bitmap->bitmapDataStream, bitmap->width, bitmap->height, bitmap->bitsPerPixel, bitmap->bitmapLength, bitmap->compressed, RDP_CODEC_ID_NONE)) { Bitmap_Free(context, bmp); return FALSE; } if (!bmp->New(context, bmp)) { Bitmap_Free(context, bmp); return FALSE; } if (!bmp->Paint(context, bmp)) { Bitmap_Free(context, bmp); return FALSE; } Bitmap_Free(context, bmp); } return TRUE; }
static BOOL update_gdi_cache_bitmap(rdpContext* context, const CACHE_BITMAP_ORDER* cacheBitmap) { rdpBitmap* bitmap; rdpBitmap* prevBitmap; rdpCache* cache = context->cache; bitmap = Bitmap_Alloc(context); if (!bitmap) return FALSE; Bitmap_SetDimensions(bitmap, cacheBitmap->bitmapWidth, cacheBitmap->bitmapHeight); if (!bitmap->Decompress(context, bitmap, cacheBitmap->bitmapDataStream, cacheBitmap->bitmapWidth, cacheBitmap->bitmapHeight, cacheBitmap->bitmapBpp, cacheBitmap->bitmapLength, cacheBitmap->compressed, RDP_CODEC_ID_NONE)) { Bitmap_Free(context, bitmap); return FALSE; } if (!bitmap->New(context, bitmap)) { Bitmap_Free(context, bitmap); return FALSE; } prevBitmap = bitmap_cache_get(cache->bitmap, cacheBitmap->cacheId, cacheBitmap->cacheIndex); Bitmap_Free(context, prevBitmap); return bitmap_cache_put(cache->bitmap, cacheBitmap->cacheId, cacheBitmap->cacheIndex, bitmap); }
void update_gdi_cache_bitmap(rdpContext* context, CACHE_BITMAP_ORDER* cache_bitmap) { rdpBitmap* bitmap; rdpBitmap* prevBitmap; rdpCache* cache = context->cache; bitmap = Bitmap_Alloc(context); Bitmap_SetDimensions(context, bitmap, cache_bitmap->bitmapWidth, cache_bitmap->bitmapHeight); bitmap->Decompress(context, bitmap, cache_bitmap->bitmapDataStream, cache_bitmap->bitmapWidth, cache_bitmap->bitmapHeight, cache_bitmap->bitmapBpp, cache_bitmap->bitmapLength, cache_bitmap->compressed, CODEC_ID_NONE); bitmap->New(context, bitmap); prevBitmap = bitmap_cache_get(cache->bitmap, cache_bitmap->cacheId, cache_bitmap->cacheIndex); if (prevBitmap != NULL) Bitmap_Free(context, prevBitmap); bitmap_cache_put(cache->bitmap, cache_bitmap->cacheId, cache_bitmap->cacheIndex, bitmap); }
void update_gdi_cache_bitmap_v3(rdpContext* context, CACHE_BITMAP_V3_ORDER* cacheBitmapV3) { rdpBitmap* bitmap; rdpBitmap* prevBitmap; BOOL isCompressed = TRUE; rdpCache* cache = context->cache; BITMAP_DATA_EX* bitmapData = &cacheBitmapV3->bitmapData; bitmap = Bitmap_Alloc(context); Bitmap_SetDimensions(context, bitmap, bitmapData->width, bitmapData->height); if (cacheBitmapV3->bitmapData.bpp == 0) { /* Workaround for Windows 8 bug where bitmapBpp is not set */ cacheBitmapV3->bitmapData.bpp = context->instance->settings->ColorDepth; } /* According to http://msdn.microsoft.com/en-us/library/gg441209.aspx * CACHE_BITMAP_REV3_ORDER::bitmapData::codecID = 0x00 (uncompressed) */ isCompressed = (bitmapData->codecID != RDP_CODEC_ID_NONE); bitmap->Decompress(context, bitmap, bitmapData->data, bitmap->width, bitmap->height, bitmapData->bpp, bitmapData->length, isCompressed, bitmapData->codecID); bitmap->New(context, bitmap); prevBitmap = bitmap_cache_get(cache->bitmap, cacheBitmapV3->cacheId, cacheBitmapV3->cacheIndex); if (prevBitmap) Bitmap_Free(context, prevBitmap); bitmap_cache_put(cache->bitmap, cacheBitmapV3->cacheId, cacheBitmapV3->cacheIndex, bitmap); }