Bug fixes, refactoring.
This commit is contained in:
parent
960bc26e9a
commit
f9a89ae6b4
4
include/freerdp/cache/cache.h
vendored
4
include/freerdp/cache/cache.h
vendored
@ -43,10 +43,6 @@ struct rdp_cache
|
||||
rdpOffscreenCache* offscreen; /* 4 */
|
||||
rdpPaletteCache* palette; /* 5 */
|
||||
rdpNineGridCache* nine_grid; /* 6 */
|
||||
|
||||
/* internal */
|
||||
|
||||
rdpSettings* settings;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -129,8 +129,8 @@
|
||||
|
||||
struct gdi_palette
|
||||
{
|
||||
UINT32 format;
|
||||
UINT32 palette[256];
|
||||
UINT32 format;
|
||||
UINT32 palette[256];
|
||||
};
|
||||
typedef struct gdi_palette gdiPalette;
|
||||
|
||||
@ -269,7 +269,7 @@ static const char* GetColorFormatName(UINT32 format)
|
||||
}
|
||||
|
||||
static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
|
||||
BYTE* _b, BYTE* _a, const gdiPalette* palette)
|
||||
BYTE* _b, BYTE* _a, const gdiPalette* palette)
|
||||
{
|
||||
UINT32 tmp;
|
||||
|
||||
@ -521,28 +521,32 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
|
||||
|
||||
/* 8bpp formats */
|
||||
case PIXEL_FORMAT_RGB8:
|
||||
if (color <= 0xFF)
|
||||
{
|
||||
tmp = palette->palette[color];
|
||||
SplitColor(tmp, palette->format, _r, _g, _b, _a, NULL);
|
||||
}
|
||||
if (color <= 0xFF)
|
||||
{
|
||||
tmp = palette->palette[color];
|
||||
SplitColor(tmp, palette->format, _r, _g, _b, _a, NULL);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
/* 1bpp formats */
|
||||
case PIXEL_FORMAT_MONO:
|
||||
if (_r)
|
||||
*_r = (color) ? 0xFF : 0x00;
|
||||
|
||||
if (_g)
|
||||
*_g = (color) ? 0xFF : 0x00;
|
||||
|
||||
if (_b)
|
||||
*_b = (color) ? 0xFF : 0x00;
|
||||
|
||||
if (_a)
|
||||
*_a = (color) ? 0xFF : 0x00;
|
||||
|
||||
break;
|
||||
|
||||
/* 4 bpp formats */
|
||||
case PIXEL_FORMAT_A4:
|
||||
|
||||
|
||||
default:
|
||||
WLog_ERR("xxxxx", "Unsupported format %s", GetColorFormatName(format));
|
||||
break;
|
||||
@ -593,28 +597,28 @@ static INLINE UINT32 GetColor(UINT32 format, BYTE r, BYTE g, BYTE b, BYTE a)
|
||||
/* 16bpp formats */
|
||||
case PIXEL_FORMAT_RGB16:
|
||||
return (((_r >> 3) & 0x1F) << 11) | (((_g >> 2) & 0x3F) << 5) | ((
|
||||
_b >> 3) & 0x1F);
|
||||
_b >> 3) & 0x1F);
|
||||
|
||||
case PIXEL_FORMAT_BGR16:
|
||||
return (((_b >> 3) & 0x1F) << 11) | (((_g >> 2) & 0x3F) << 5) | ((
|
||||
_r >> 3) & 0x1F);
|
||||
_r >> 3) & 0x1F);
|
||||
|
||||
case PIXEL_FORMAT_ARGB15:
|
||||
return (((_r >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((
|
||||
_b >> 3) & 0x1F);
|
||||
_b >> 3) & 0x1F);
|
||||
|
||||
case PIXEL_FORMAT_ABGR15:
|
||||
return (((_b >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((
|
||||
_r >> 3) & 0x1F);
|
||||
_r >> 3) & 0x1F);
|
||||
|
||||
/* 15bpp formats */
|
||||
case PIXEL_FORMAT_RGB15:
|
||||
return (((_r >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((
|
||||
_b >> 3) & 0x1F);
|
||||
_b >> 3) & 0x1F);
|
||||
|
||||
case PIXEL_FORMAT_BGR15:
|
||||
return (((_b >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((
|
||||
_r >> 3) & 0x1F);;
|
||||
_r >> 3) & 0x1F);;
|
||||
|
||||
/* 8bpp formats */
|
||||
case PIXEL_FORMAT_RGB8:
|
||||
@ -653,7 +657,7 @@ static INLINE UINT32 ReadColor(const BYTE* src, UINT32 format)
|
||||
{
|
||||
case 32:
|
||||
color = ((UINT32)src[0] << 24) | ((UINT32)src[1] << 16) |
|
||||
((UINT32)src[2] << 8) | src[3];
|
||||
((UINT32)src[2] << 8) | src[3];
|
||||
break;
|
||||
|
||||
case 24:
|
||||
@ -718,7 +722,7 @@ static INLINE BOOL WriteColor(BYTE* dst, UINT32 format, UINT32 color)
|
||||
}
|
||||
|
||||
static INLINE UINT32 ConvertColor(UINT32 color, UINT32 srcFormat,
|
||||
UINT32 dstFormat, const gdiPalette* palette)
|
||||
UINT32 dstFormat, const gdiPalette* palette)
|
||||
{
|
||||
BYTE r = 0;
|
||||
BYTE g = 0;
|
||||
@ -734,15 +738,15 @@ static INLINE UINT32 GetBytesPerPixel(UINT32 format)
|
||||
}
|
||||
|
||||
FREERDP_API BYTE* freerdp_glyph_convert(UINT32 width, UINT32 height,
|
||||
const BYTE* data);
|
||||
const BYTE* data);
|
||||
|
||||
FREERDP_API BOOL freerdp_image_copy_from_monochrome(BYTE* pDstData,
|
||||
UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight,
|
||||
const BYTE* pSrcData,
|
||||
UINT32 backColor, UINT32 foreColor,
|
||||
const gdiPalette* palette);
|
||||
UINT32 DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight,
|
||||
const BYTE* pSrcData,
|
||||
UINT32 backColor, UINT32 foreColor,
|
||||
const gdiPalette* palette);
|
||||
|
||||
FREERDP_API BOOL freerdp_image_copy_from_pointer_data(
|
||||
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
|
||||
@ -752,15 +756,15 @@ FREERDP_API BOOL freerdp_image_copy_from_pointer_data(
|
||||
UINT32 xorBpp, const gdiPalette* palette);
|
||||
|
||||
FREERDP_API BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
|
||||
INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight,
|
||||
const BYTE* pSrcData, DWORD SrcFormat,
|
||||
INT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
|
||||
const gdiPalette* palette);
|
||||
INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight,
|
||||
const BYTE* pSrcData, DWORD SrcFormat,
|
||||
INT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
|
||||
const gdiPalette* palette);
|
||||
|
||||
FREERDP_API BOOL freerdp_image_fill(BYTE* pDstData, DWORD DstFormat,
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight, UINT32 color);
|
||||
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
|
||||
UINT32 nWidth, UINT32 nHeight, UINT32 color);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
47
libfreerdp/cache/cache.c
vendored
47
libfreerdp/cache/cache.c
vendored
@ -30,50 +30,49 @@
|
||||
rdpCache* cache_new(rdpSettings* settings)
|
||||
{
|
||||
rdpCache* cache;
|
||||
|
||||
cache = (rdpCache*) calloc(1, sizeof(rdpCache));
|
||||
|
||||
if (!cache)
|
||||
return NULL;
|
||||
|
||||
cache->settings = settings;
|
||||
cache->glyph = glyph_cache_new(settings);
|
||||
|
||||
if (!cache->glyph)
|
||||
goto error_glyph;
|
||||
goto error;
|
||||
|
||||
cache->brush = brush_cache_new(settings);
|
||||
|
||||
if (!cache->brush)
|
||||
goto error_brush;
|
||||
goto error;
|
||||
|
||||
cache->pointer = pointer_cache_new(settings);
|
||||
|
||||
if (!cache->pointer)
|
||||
goto error_pointer;
|
||||
goto error;
|
||||
|
||||
cache->bitmap = bitmap_cache_new(settings);
|
||||
|
||||
if (!cache->bitmap)
|
||||
goto error_bitmap;
|
||||
goto error;
|
||||
|
||||
cache->offscreen = offscreen_cache_new(settings);
|
||||
|
||||
if (!cache->offscreen)
|
||||
goto error_offscreen;
|
||||
goto error;
|
||||
|
||||
cache->palette = palette_cache_new(settings);
|
||||
|
||||
if (!cache->palette)
|
||||
goto error_palette;
|
||||
goto error;
|
||||
|
||||
cache->nine_grid = nine_grid_cache_new(settings);
|
||||
|
||||
if (!cache->nine_grid)
|
||||
goto error_ninegrid;
|
||||
goto error;
|
||||
|
||||
return cache;
|
||||
|
||||
error_ninegrid:
|
||||
palette_cache_free(cache->palette);
|
||||
error_palette:
|
||||
offscreen_cache_free(cache->offscreen);
|
||||
error_offscreen:
|
||||
bitmap_cache_free(cache->bitmap);
|
||||
error_bitmap:
|
||||
pointer_cache_free(cache->pointer);
|
||||
error_pointer:
|
||||
brush_cache_free(cache->brush);
|
||||
error_brush:
|
||||
glyph_cache_free(cache->glyph);
|
||||
error_glyph:
|
||||
free(cache);
|
||||
error:
|
||||
cache_free(cache);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
26
libfreerdp/cache/offscreen.c
vendored
26
libfreerdp/cache/offscreen.c
vendored
@ -32,18 +32,19 @@
|
||||
|
||||
#define TAG FREERDP_TAG("cache.offscreen")
|
||||
|
||||
static void offscreen_cache_put(rdpOffscreenCache* offscreen_cache, UINT32 index, rdpBitmap* bitmap);
|
||||
static void offscreen_cache_put(rdpOffscreenCache* offscreen_cache,
|
||||
UINT32 index, rdpBitmap* bitmap);
|
||||
static void offscreen_cache_delete(rdpOffscreenCache* offscreen, UINT32 index);
|
||||
|
||||
static BOOL update_gdi_create_offscreen_bitmap(rdpContext* context,
|
||||
const CREATE_OFFSCREEN_BITMAP_ORDER* createOffscreenBitmap)
|
||||
const CREATE_OFFSCREEN_BITMAP_ORDER* createOffscreenBitmap)
|
||||
{
|
||||
int i;
|
||||
UINT32 i;
|
||||
UINT16 index;
|
||||
rdpBitmap* bitmap;
|
||||
rdpCache* cache = context->cache;
|
||||
|
||||
bitmap = Bitmap_Alloc(context);
|
||||
|
||||
if (!bitmap)
|
||||
return FALSE;
|
||||
|
||||
@ -59,19 +60,20 @@ static BOOL update_gdi_create_offscreen_bitmap(rdpContext* context,
|
||||
offscreen_cache_delete(cache->offscreen, createOffscreenBitmap->id);
|
||||
offscreen_cache_put(cache->offscreen, createOffscreenBitmap->id, bitmap);
|
||||
|
||||
if(cache->offscreen->currentSurface == createOffscreenBitmap->id)
|
||||
if (cache->offscreen->currentSurface == createOffscreenBitmap->id)
|
||||
Bitmap_SetSurface(context, bitmap, FALSE);
|
||||
|
||||
for (i = 0; i < (int) createOffscreenBitmap->deleteList.cIndices; i++)
|
||||
for (i = 0; i < createOffscreenBitmap->deleteList.cIndices; i++)
|
||||
{
|
||||
index = createOffscreenBitmap->deleteList.indices[i];
|
||||
offscreen_cache_delete(cache->offscreen, index);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL update_gdi_switch_surface(rdpContext* context,
|
||||
const SWITCH_SURFACE_ORDER* switchSurface)
|
||||
const SWITCH_SURFACE_ORDER* switchSurface)
|
||||
{
|
||||
rdpCache* cache = context->cache;
|
||||
|
||||
@ -111,7 +113,8 @@ rdpBitmap* offscreen_cache_get(rdpOffscreenCache* offscreenCache, UINT32 index)
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
void offscreen_cache_put(rdpOffscreenCache* offscreenCache, UINT32 index, rdpBitmap* bitmap)
|
||||
void offscreen_cache_put(rdpOffscreenCache* offscreenCache, UINT32 index,
|
||||
rdpBitmap* bitmap)
|
||||
{
|
||||
if (index >= offscreenCache->maxEntries)
|
||||
{
|
||||
@ -150,7 +153,6 @@ void offscreen_cache_register_callbacks(rdpUpdate* update)
|
||||
rdpOffscreenCache* offscreen_cache_new(rdpSettings* settings)
|
||||
{
|
||||
rdpOffscreenCache* offscreenCache;
|
||||
|
||||
offscreenCache = (rdpOffscreenCache*) calloc(1, sizeof(rdpOffscreenCache));
|
||||
|
||||
if (!offscreenCache)
|
||||
@ -158,20 +160,20 @@ rdpOffscreenCache* offscreen_cache_new(rdpSettings* settings)
|
||||
|
||||
offscreenCache->settings = settings;
|
||||
offscreenCache->update = ((freerdp*) settings->instance)->update;
|
||||
|
||||
offscreenCache->currentSurface = SCREEN_BITMAP_SURFACE;
|
||||
offscreenCache->maxSize = 7680;
|
||||
offscreenCache->maxEntries = 2000;
|
||||
|
||||
settings->OffscreenCacheSize = offscreenCache->maxSize;
|
||||
settings->OffscreenCacheEntries = offscreenCache->maxEntries;
|
||||
offscreenCache->entries = (rdpBitmap**) calloc(offscreenCache->maxEntries,
|
||||
sizeof(rdpBitmap*));
|
||||
|
||||
offscreenCache->entries = (rdpBitmap**) calloc(offscreenCache->maxEntries, sizeof(rdpBitmap*));
|
||||
if (!offscreenCache->entries)
|
||||
{
|
||||
free(offscreenCache);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return offscreenCache;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -39,6 +39,6 @@ set(${MODULE_PREFIX}_SRCS
|
||||
freerdp_module_add(${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
if(BUILD_TESTING)
|
||||
# add_subdirectory(test)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
|
@ -585,9 +585,10 @@ static BOOL BitBlt_SPna(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
|
||||
UINT32 color;
|
||||
UINT32 colorA = ReadColor(srcp, hdcSrc->format);
|
||||
UINT32 colorB = ReadColor(patp, hdcDest->format);
|
||||
colorA = ConvertColor(colorA, hdcSrc->format,
|
||||
hdcDest->format, palette);
|
||||
colorB = ConvertColor(colorB, hdcDest->format,
|
||||
hdcSrc->format, palette);
|
||||
color = colorA & ~colorB;
|
||||
color = ConvertColor(color, hdcSrc->format, hdcDest->format, palette);
|
||||
WriteColor(dstp, hdcDest->format, color);
|
||||
}
|
||||
}
|
||||
@ -740,6 +741,8 @@ BOOL gdi_BitBlt(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
|
||||
if (!gdi_InvalidateRegion(hdcDest, nXDest, nYDest, nWidth, nHeight))
|
||||
return FALSE;
|
||||
|
||||
WLog_DBG(TAG, "%s [%s]", __FUNCTION__, gdi_rop_to_string(rop));
|
||||
|
||||
switch (rop)
|
||||
{
|
||||
case GDI_SRCCOPY:
|
||||
|
@ -584,9 +584,9 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
UINT32 nXSrc = 0;
|
||||
UINT32 nYSrc = 0;
|
||||
foreColor = ConvertColor(patblt->foreColor, SrcFormat,
|
||||
gdi->dstFormat, &gdi->palette);
|
||||
gdi->drawing->hdc->format, &gdi->palette);
|
||||
backColor = ConvertColor(patblt->backColor, SrcFormat,
|
||||
gdi->dstFormat, &gdi->palette);
|
||||
gdi->drawing->hdc->format, &gdi->palette);
|
||||
originalColor = gdi_SetTextColor(gdi->drawing->hdc, foreColor);
|
||||
|
||||
switch (brush->style)
|
||||
@ -616,7 +616,8 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
{
|
||||
const BYTE* hatched;
|
||||
HGDI_BITMAP hBmp;
|
||||
BYTE* data = (BYTE*) _aligned_malloc(8 * 8 * GetBytesPerPixel(gdi->dstFormat),
|
||||
BYTE* data = (BYTE*) _aligned_malloc(8 * 8 * GetBytesPerPixel(
|
||||
gdi->drawing->hdc->format),
|
||||
16);
|
||||
|
||||
if (!data)
|
||||
@ -626,7 +627,8 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
}
|
||||
|
||||
hatched = GDI_BS_HATCHED_PATTERNS + (8 * brush->hatch);
|
||||
freerdp_image_copy_from_monochrome(data, gdi->dstFormat, 0, 0, 0, 8, 8,
|
||||
freerdp_image_copy_from_monochrome(data, gdi->drawing->hdc->format, 0, 0, 0, 8,
|
||||
8,
|
||||
hatched, backColor, foreColor, &gdi->palette);
|
||||
hBmp = gdi_CreateBitmap(8, 8, gdi->drawing->hdc->format, data);
|
||||
|
||||
@ -665,7 +667,8 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
{
|
||||
HGDI_BITMAP hBmp;
|
||||
UINT32 brushFormat;
|
||||
BYTE* data = (BYTE*) _aligned_malloc(8 * 8 * GetBytesPerPixel(gdi->dstFormat),
|
||||
BYTE* data = (BYTE*) _aligned_malloc(8 * 8 * GetBytesPerPixel(
|
||||
gdi->drawing->hdc->format),
|
||||
16);
|
||||
|
||||
if (!data)
|
||||
@ -678,7 +681,7 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
{
|
||||
brushFormat = gdi_get_pixel_format(brush->bpp, FALSE);
|
||||
|
||||
if (!freerdp_image_copy(data, gdi->dstFormat, 0, 0, 0,
|
||||
if (!freerdp_image_copy(data, gdi->drawing->hdc->format, 0, 0, 0,
|
||||
8, 8, brush->data, brushFormat, 0, 0, 0,
|
||||
&gdi->palette))
|
||||
{
|
||||
@ -689,7 +692,8 @@ static BOOL gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!freerdp_image_copy_from_monochrome(data, gdi->dstFormat, 0, 0, 0, 8, 8,
|
||||
if (!freerdp_image_copy_from_monochrome(data, gdi->drawing->hdc->format, 0, 0,
|
||||
0, 8, 8,
|
||||
brush->data, backColor, foreColor, &gdi->palette))
|
||||
{
|
||||
_aligned_free(data);
|
||||
@ -762,8 +766,8 @@ static BOOL gdi_opaque_rect(rdpContext* context,
|
||||
UINT32 SrcFormat = gdi_get_pixel_format(context->settings->ColorDepth, FALSE);
|
||||
gdi_CRgnToRect(opaque_rect->nLeftRect, opaque_rect->nTopRect,
|
||||
opaque_rect->nWidth, opaque_rect->nHeight, &rect);
|
||||
brush_color = ConvertColor(opaque_rect->color, SrcFormat,
|
||||
gdi->dstFormat, &gdi->palette);
|
||||
brush_color = ConvertColor(opaque_rect->color, PIXEL_FORMAT_RGB16,
|
||||
gdi->drawing->hdc->format, &gdi->palette);
|
||||
|
||||
if (!(hBrush = gdi_CreateSolidBrush(brush_color)))
|
||||
return FALSE;
|
||||
@ -791,7 +795,7 @@ static BOOL gdi_multi_opaque_rect(rdpContext* context,
|
||||
gdi_CRgnToRect(rectangle->left, rectangle->top,
|
||||
rectangle->width, rectangle->height, &rect);
|
||||
brush_color = ConvertColor(multi_opaque_rect->color, SrcFormat,
|
||||
gdi->dstFormat, &gdi->palette);
|
||||
gdi->drawing->hdc->format, &gdi->palette);
|
||||
hBrush = gdi_CreateSolidBrush(brush_color);
|
||||
|
||||
if (!hBrush)
|
||||
@ -881,9 +885,9 @@ static BOOL gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
|
||||
const rdpBrush* brush = &mem3blt->brush;
|
||||
gdiBitmap* bitmap = (gdiBitmap*) mem3blt->bitmap;
|
||||
const UINT32 foreColor = ConvertColor(mem3blt->foreColor, SrcFormat,
|
||||
gdi->dstFormat, &gdi->palette);
|
||||
gdi->drawing->hdc->format, &gdi->palette);
|
||||
const UINT32 backColor = ConvertColor(mem3blt->backColor, SrcFormat,
|
||||
gdi->dstFormat, &gdi->palette);
|
||||
gdi->drawing->hdc->format, &gdi->palette);
|
||||
const UINT32 originalColor = gdi_SetTextColor(gdi->drawing->hdc, foreColor);
|
||||
|
||||
switch (brush->style)
|
||||
@ -1263,11 +1267,8 @@ BOOL gdi_init_ex(freerdp* instance, UINT32 format, UINT32 stride, BYTE* buffer,
|
||||
if (!gdi_init_primary(gdi, stride, buffer, pfree))
|
||||
goto fail;
|
||||
|
||||
if (!context->cache)
|
||||
{
|
||||
if (!(context->cache = cache_new(instance->settings)))
|
||||
goto fail;
|
||||
}
|
||||
if (!(context->cache = cache_new(instance->settings)))
|
||||
goto fail;
|
||||
|
||||
if (!freerdp_client_codecs_prepare(context->codecs, FREERDP_CODEC_ALL,
|
||||
gdi->width, gdi->height))
|
||||
@ -1309,13 +1310,8 @@ void gdi_free(freerdp* instance)
|
||||
}
|
||||
|
||||
context = instance->context;
|
||||
|
||||
if (context->cache)
|
||||
{
|
||||
cache_free(context->cache);
|
||||
context->cache = NULL;
|
||||
}
|
||||
|
||||
cache_free(context->cache);
|
||||
context->cache = NULL;
|
||||
instance->context->gdi = (rdpGdi*) NULL;
|
||||
}
|
||||
|
||||
|
@ -124,24 +124,26 @@ static BOOL gdi_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
|
||||
}
|
||||
|
||||
static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
||||
const BYTE* data, UINT32 width, UINT32 height,
|
||||
const BYTE* pSrcData, UINT32 width, UINT32 height,
|
||||
UINT32 bpp, UINT32 length, BOOL compressed,
|
||||
UINT32 codecId)
|
||||
{
|
||||
int status;
|
||||
UINT16 size;
|
||||
const BYTE* pSrcData;
|
||||
BYTE* pDstData;
|
||||
UINT32 SrcSize;
|
||||
UINT32 SrcSize = length;
|
||||
UINT32 SrcFormat;
|
||||
UINT32 bytesPerPixel;
|
||||
rdpGdi* gdi = context->gdi;
|
||||
bytesPerPixel = (bpp + 7) / 8;
|
||||
size = width * height * 4;
|
||||
bitmap->data = (BYTE*) _aligned_malloc(size, 16);
|
||||
pSrcData = data;
|
||||
SrcSize = (UINT32) length;
|
||||
pDstData = bitmap->data;
|
||||
|
||||
if (!bitmap->data)
|
||||
return FALSE;
|
||||
|
||||
bitmap->compressed = FALSE;
|
||||
bitmap->length = size;
|
||||
bitmap->format = gdi->dstFormat;
|
||||
|
||||
if (compressed)
|
||||
{
|
||||
@ -150,14 +152,14 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
||||
status = interleaved_decompress(context->codecs->interleaved,
|
||||
pSrcData, SrcSize,
|
||||
bpp,
|
||||
pDstData, gdi->dstFormat,
|
||||
bitmap->data, bitmap->format,
|
||||
0, 0, 0, width, height,
|
||||
&gdi->palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = planar_decompress(context->codecs->planar, pSrcData, SrcSize,
|
||||
pDstData, gdi->dstFormat, 0, 0, 0,
|
||||
bitmap->data, bitmap->format, 0, 0, 0,
|
||||
width, height, TRUE);
|
||||
}
|
||||
|
||||
@ -170,14 +172,11 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
|
||||
else
|
||||
{
|
||||
SrcFormat = gdi_get_pixel_format(bpp, FALSE);
|
||||
status = freerdp_image_copy(pDstData, gdi->dstFormat, 0, 0, 0,
|
||||
status = freerdp_image_copy(bitmap->data, bitmap->format, 0, 0, 0,
|
||||
width, height, pSrcData, SrcFormat,
|
||||
0, 0, 0, &gdi->palette);
|
||||
}
|
||||
|
||||
bitmap->compressed = FALSE;
|
||||
bitmap->length = size;
|
||||
bitmap->format = gdi->dstFormat;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -264,8 +263,10 @@ static BOOL gdi_Glyph_BeginDraw(rdpContext* context, UINT32 x, UINT32 y,
|
||||
BOOL ret = FALSE;
|
||||
UINT32 SrcFormat = gdi_get_pixel_format(context->settings->ColorDepth, FALSE);
|
||||
/* TODO: handle fOpRedundant! See xf_Glyph_BeginDraw() */
|
||||
bgcolor = ConvertColor(bgcolor, SrcFormat, gdi->dstFormat, &gdi->palette);
|
||||
fgcolor = ConvertColor(fgcolor, SrcFormat, gdi->dstFormat, &gdi->palette);
|
||||
bgcolor = ConvertColor(bgcolor, SrcFormat, gdi->drawing->hdc->format,
|
||||
&gdi->palette);
|
||||
fgcolor = ConvertColor(fgcolor, SrcFormat, gdi->drawing->hdc->format,
|
||||
&gdi->palette);
|
||||
|
||||
if (!(brush = gdi_CreateSolidBrush(fgcolor)))
|
||||
goto out;
|
||||
@ -284,7 +285,7 @@ static BOOL gdi_Glyph_EndDraw(rdpContext* context, UINT32 x, UINT32 y,
|
||||
rdpGdi* gdi = context->gdi;
|
||||
UINT32 SrcFormat = gdi_get_pixel_format(context->settings->ColorDepth, FALSE);
|
||||
bgcolor = ConvertColor(bgcolor, SrcFormat,
|
||||
gdi->dstFormat, &gdi->palette);
|
||||
gdi->drawing->hdc->format, &gdi->palette);
|
||||
gdi->textColor = gdi_SetTextColor(gdi->drawing->hdc, bgcolor);
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user