Bitmaps now remember their format.
This commit is contained in:
parent
bb92655339
commit
0e7bb508c1
@ -61,7 +61,7 @@ struct rdp_bitmap
|
||||
UINT32 bottom; /* 19 */
|
||||
UINT32 width; /* 20 */
|
||||
UINT32 height; /* 21 */
|
||||
UINT32 bpp; /* 22 */
|
||||
UINT32 format; /* 22 */
|
||||
UINT32 flags; /* 23 */
|
||||
UINT32 length; /* 24 */
|
||||
BYTE* data; /* 25 */
|
||||
|
26
libfreerdp/cache/bitmap.c
vendored
26
libfreerdp/cache/bitmap.c
vendored
@ -31,6 +31,7 @@
|
||||
|
||||
#include <freerdp/log.h>
|
||||
#include <freerdp/cache/bitmap.h>
|
||||
#include <freerdp/gdi/bitmap.h>
|
||||
|
||||
#define TAG FREERDP_TAG("cache.bitmap")
|
||||
|
||||
@ -112,12 +113,14 @@ static BOOL update_gdi_cache_bitmap(rdpContext* context,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bitmap->New(context, bitmap);
|
||||
if (!bitmap->New(context, bitmap))
|
||||
return FALSE;
|
||||
|
||||
prevBitmap = bitmap_cache_get(cache->bitmap, cacheBitmap->cacheId, cacheBitmap->cacheIndex);
|
||||
|
||||
if (prevBitmap != NULL)
|
||||
Bitmap_Free(context, prevBitmap);
|
||||
prevBitmap->Free(context, prevBitmap);
|
||||
|
||||
|
||||
bitmap_cache_put(cache->bitmap, cacheBitmap->cacheId, cacheBitmap->cacheIndex, bitmap);
|
||||
return TRUE;
|
||||
@ -157,12 +160,14 @@ static BOOL update_gdi_cache_bitmap_v2(rdpContext* context,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bitmap->New(context, bitmap);
|
||||
|
||||
prevBitmap = bitmap_cache_get(cache->bitmap, cacheBitmapV2->cacheId, cacheBitmapV2->cacheIndex);
|
||||
|
||||
if (bitmap->New(context, bitmap))
|
||||
return FALSE;
|
||||
|
||||
if (prevBitmap)
|
||||
Bitmap_Free(context, prevBitmap);
|
||||
prevBitmap->Free(context, prevBitmap);
|
||||
|
||||
bitmap_cache_put(cache->bitmap, cacheBitmapV2->cacheId, cacheBitmapV2->cacheIndex, bitmap);
|
||||
return TRUE;
|
||||
@ -194,12 +199,13 @@ static BOOL update_gdi_cache_bitmap_v3(rdpContext* context,
|
||||
bitmapData->bpp, bitmapData->length, compressed,
|
||||
bitmapData->codecID);
|
||||
|
||||
bitmap->New(context, bitmap);
|
||||
if (bitmap->New(context, bitmap))
|
||||
return FALSE;
|
||||
|
||||
prevBitmap = bitmap_cache_get(cache->bitmap, cacheBitmapV3->cacheId, cacheBitmapV3->cacheIndex);
|
||||
|
||||
if (prevBitmap)
|
||||
Bitmap_Free(context, prevBitmap);
|
||||
prevBitmap->Free(context, prevBitmap);
|
||||
|
||||
bitmap_cache_put(cache->bitmap, cacheBitmapV3->cacheId, cacheBitmapV3->cacheIndex, bitmap);
|
||||
return TRUE;
|
||||
@ -211,7 +217,6 @@ static BOOL update_gdi_bitmap_update(rdpContext* context,
|
||||
UINT32 i;
|
||||
BOOL reused = TRUE;
|
||||
rdpBitmap* bitmap;
|
||||
BITMAP_DATA* bitmapData;
|
||||
rdpCache* cache = context->cache;
|
||||
|
||||
if (!cache->bitmap->bitmap)
|
||||
@ -225,9 +230,9 @@ static BOOL update_gdi_bitmap_update(rdpContext* context,
|
||||
|
||||
for (i = 0; i < (int) bitmapUpdate->number; i++)
|
||||
{
|
||||
bitmapData = &bitmapUpdate->rectangles[i];
|
||||
const BITMAP_DATA* bitmapData = &bitmapUpdate->rectangles[i];
|
||||
|
||||
bitmap->bpp = bitmapData->bitsPerPixel;
|
||||
bitmap->format = gdi_get_pixel_format(bitmapData->bitsPerPixel, FALSE);
|
||||
bitmap->length = bitmapData->bitmapLength;
|
||||
bitmap->compressed = bitmapData->compressed;
|
||||
|
||||
@ -244,9 +249,8 @@ static BOOL update_gdi_bitmap_update(rdpContext* context,
|
||||
|
||||
if (reused)
|
||||
bitmap->Free(context, bitmap);
|
||||
else
|
||||
reused = TRUE;
|
||||
|
||||
reused = TRUE;
|
||||
bitmap->New(context, bitmap);
|
||||
|
||||
bitmap->Paint(context, bitmap);
|
||||
|
@ -174,10 +174,6 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
||||
{
|
||||
if (bpp < 32)
|
||||
{
|
||||
if (!freerdp_client_codecs_prepare(gdi->codecs, FREERDP_CODEC_INTERLEAVED,
|
||||
gdi->width, gdi->height))
|
||||
return FALSE;
|
||||
|
||||
status = interleaved_decompress(gdi->codecs->interleaved,
|
||||
pSrcData, SrcSize,
|
||||
bpp,
|
||||
@ -187,12 +183,8 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!freerdp_client_codecs_prepare(gdi->codecs, FREERDP_CODEC_PLANAR,
|
||||
gdi->width, gdi->height))
|
||||
return FALSE;
|
||||
|
||||
status = planar_decompress(gdi->codecs->planar, pSrcData, SrcSize, &pDstData,
|
||||
gdi->dstFormat, -1, 0, 0, width, height, TRUE);
|
||||
status = planar_decompress(gdi->codecs->planar, pSrcData, SrcSize, pDstData,
|
||||
gdi->dstFormat, -1, 0, 0, width, height, TRUE);
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user