Cleanups.

This commit is contained in:
Armin Novak 2016-07-18 17:45:30 +02:00
parent bc49c16c60
commit 17fd5526ac
8 changed files with 177 additions and 122 deletions

View File

@ -240,7 +240,7 @@ static BOOL update_gdi_bitmap_update(rdpContext* context,
bitmap = cache->bitmap->bitmap;
for (i = 0; i < (int) bitmapUpdate->number; i++)
for (i = 0; i < bitmapUpdate->number; i++)
{
const BITMAP_DATA* bitmapData = &bitmapUpdate->rectangles[i];
bitmap->format = gdi_get_pixel_format(bitmapData->bitsPerPixel, FALSE);

View File

@ -43,20 +43,28 @@ static void* glyph_cache_fragment_get(rdpGlyphCache* glyph, UINT32 index,
static void glyph_cache_fragment_put(rdpGlyphCache* glyph, UINT32 index,
UINT32 count, void* entry);
static void update_process_glyph(rdpContext* context, const BYTE* data,
static BOOL update_process_glyph(rdpContext* context, const BYTE* data,
UINT32* index, UINT32* x, UINT32* y,
UINT32 cacheId, UINT32 ulCharInc, UINT32 flAccel)
{
UINT32 offset;
INT32 offset;
rdpGlyph* glyph;
UINT32 cacheIndex;
rdpGraphics* graphics;
rdpGlyphCache* glyph_cache;
if (!context || !data || !index || !x || !y || !context->graphics
|| !context->cache || !context->cache->glyph)
return FALSE;
graphics = context->graphics;
glyph_cache = context->cache->glyph;
cacheIndex = data[*index];
glyph = glyph_cache_get(glyph_cache, cacheId, cacheIndex);
if (!glyph)
return FALSE;
if ((ulCharInc == 0) && (!(flAccel & SO_CHAR_INC_EQUAL_BM_BASE)))
{
/* Contrary to fragments, the offset is added before the glyph. */
@ -65,7 +73,7 @@ static void update_process_glyph(rdpContext* context, const BYTE* data,
if (offset & 0x80)
{
offset = data[*index + 1] | ((int)((signed char)data[*index + 2]) << 8);
offset = data[*index + 1] | ((INT32)data[*index + 2]) << 8;
(*index)++;
(*index)++;
}
@ -78,11 +86,14 @@ static void update_process_glyph(rdpContext* context, const BYTE* data,
if (glyph != NULL)
{
glyph->Draw(context, glyph, glyph->x + *x, glyph->y + *y);
if (!glyph->Draw(context, glyph, glyph->x + *x, glyph->y + *y))
return FALSE;
if (flAccel & SO_CHAR_INC_EQUAL_BM_BASE)
*x += glyph->cx;
}
return TRUE;
}
static BOOL update_process_glyph_fragments(rdpContext* context,
@ -105,10 +116,18 @@ static BOOL update_process_glyph_fragments(rdpContext* context,
rdpGraphics* graphics;
rdpGlyphCache* glyph_cache;
rdpGlyph* glyph;
if (!context || !data || !context->graphics || !context->cache
|| !context->cache->glyph)
return FALSE;
graphics = context->graphics;
glyph_cache = context->cache->glyph;
glyph = graphics->Glyph_Prototype;
if (!glyph)
return FALSE;
if (opX + opWidth > context->settings->DesktopWidth)
{
/**
@ -144,12 +163,12 @@ static BOOL update_process_glyph_fragments(rdpContext* context,
}
}
while (index < (int) length)
while (index < length)
{
switch (data[index])
{
case GLYPH_FRAGMENT_USE:
if (index + 2 > (int) length)
if (index + 2 > length)
{
/* at least one byte need to follow */
index = length = 0;
@ -161,7 +180,7 @@ static BOOL update_process_glyph_fragments(rdpContext* context,
if (fragments != NULL)
{
for (n = 0; n < (int) size; n++)
for (n = 0; n < size; n++)
{
update_process_glyph(context, fragments, &n, &x, &y, cacheId, ulCharInc,
flAccel);
@ -177,14 +196,14 @@ static BOOL update_process_glyph_fragments(rdpContext* context,
}
}
index += (index + 2 < (int) length) ? 3 : 2;
index += (index + 2 < length) ? 3 : 2;
length -= index;
data = &(data[index]);
index = 0;
break;
case GLYPH_FRAGMENT_ADD:
if (index + 3 > (int) length)
if (index + 3 > length)
{
/* at least two bytes need to follow */
index = length = 0;
@ -225,6 +244,10 @@ static BOOL update_gdi_glyph_index(rdpContext* context,
{
rdpGlyphCache* glyph_cache;
int bkWidth, bkHeight, opWidth, opHeight;
if (!context || !glyphIndex || !context->cache)
return FALSE;
glyph_cache = context->cache->glyph;
bkWidth = glyphIndex->bkRight - glyphIndex->bkLeft;
opWidth = glyphIndex->opRight - glyphIndex->opLeft;
@ -246,6 +269,10 @@ static BOOL update_gdi_fast_index(rdpContext* context,
INT32 opLeft, opTop;
INT32 opRight, opBottom;
rdpGlyphCache* glyph_cache;
if (!context || !fastIndex || !context->cache)
return FALSE;
glyph_cache = context->cache->glyph;
opLeft = fastIndex->opLeft;
opTop = fastIndex->opTop;
@ -304,12 +331,15 @@ static BOOL update_gdi_fast_glyph(rdpContext* context,
const FAST_GLYPH_ORDER* fastGlyph)
{
INT32 x, y;
rdpGlyph* glyph;
BYTE text_data[2];
INT32 opLeft, opTop;
INT32 opRight, opBottom;
const GLYPH_DATA_V2* glyphData;
rdpCache* cache = context->cache;
rdpCache* cache;
if (!context || !fastGlyph || !context->cache)
return FALSE;
cache = context->cache;
opLeft = fastGlyph->opLeft;
opTop = fastGlyph->opTop;
opRight = fastGlyph->opRight;
@ -353,26 +383,37 @@ static BOOL update_gdi_fast_glyph(rdpContext* context,
if ((fastGlyph->cbData > 1) && (fastGlyph->glyphData.aj))
{
/* got option font that needs to go into cache */
glyphData = &fastGlyph->glyphData;
rdpGlyph* glyph;
const GLYPH_DATA_V2* glyphData = &fastGlyph->glyphData;
if (!glyphData)
return FALSE;
glyph = Glyph_Alloc(context);
if (!glyph)
return FALSE;
glyph->x = glyphData->x;
glyph->y = glyphData->y;
glyph->x = x;
glyph->y = y;
glyph->cx = glyphData->cx;
glyph->cy = glyphData->cy;
glyph->cb = glyphData->cb;
glyph->aj = malloc(glyphData->cb);
if (!glyph->aj)
goto error_aj;
{
IFCALL(glyph->Free, context, glyph);
return FALSE;
}
CopyMemory(glyph->aj, glyphData->aj, glyph->cb);
if (!glyph->New(context, glyph))
goto error_glyph_new;
{
IFCALL(glyph->Free, context, glyph);
return FALSE;
}
glyph_cache_put(cache->glyph, fastGlyph->cacheId, fastGlyph->data[0], glyph);
}
@ -387,26 +428,28 @@ static BOOL update_gdi_fast_glyph(rdpContext* context,
opLeft, opTop,
opRight - opLeft, opBottom - opTop,
FALSE);
error_glyph_new:
error_aj:
IFCALL(glyph->Free, context, glyph);
return FALSE;
}
static BOOL update_gdi_cache_glyph(rdpContext* context,
const CACHE_GLYPH_ORDER* cacheGlyph)
{
UINT32 i;
rdpGlyph* glyph;
const GLYPH_DATA* glyph_data;
rdpCache* cache = context->cache;
rdpCache* cache;
if (!context || !cacheGlyph || !context->cache)
return FALSE;
cache = context->cache;
for (i = 0; i < cacheGlyph->cGlyphs; i++)
{
glyph_data = &cacheGlyph->glyphData[i];
glyph = Glyph_Alloc(context);
const GLYPH_DATA* glyph_data = &cacheGlyph->glyphData[i];
rdpGlyph* glyph;
if (!glyph)
if (!glyph_data)
return FALSE;
if (!(glyph = Glyph_Alloc(context)))
return FALSE;
glyph->x = glyph_data->x;
@ -433,19 +476,25 @@ static BOOL update_gdi_cache_glyph_v2(rdpContext* context,
const CACHE_GLYPH_V2_ORDER* cacheGlyphV2)
{
UINT32 i;
rdpGlyph* glyph;
rdpCache* cache = context->cache;
rdpCache* cache;
if (!context || !cacheGlyphV2 || !context->cache)
return FALSE;
cache = context->cache;
for (i = 0; i < cacheGlyphV2->cGlyphs; i++)
{
const GLYPH_DATA_V2* glyphData = &cacheGlyphV2->glyphData[i];
rdpGlyph* glyph;
if (!glyphData)
return FALSE;
glyph = Glyph_Alloc(context);
if (!glyph)
{
/* TODO: cleanup perviosly allocated glyph memory in error case */
return FALSE;
}
glyph->x = glyphData->x;
glyph->y = glyphData->y;
@ -470,7 +519,8 @@ static BOOL update_gdi_cache_glyph_v2(rdpContext* context,
rdpGlyph* glyph_cache_get(rdpGlyphCache* glyphCache, UINT32 id, UINT32 index)
{
rdpGlyph* glyph;
WLog_DBG(TAG, "GlyphCacheGet: id: %d index: %d", id, index);
WLog_Print(glyphCache->log, WLOG_DEBUG, "GlyphCacheGet: id: %d index: %d", id,
index);
if (id > 9)
{
@ -509,7 +559,8 @@ BOOL glyph_cache_put(rdpGlyphCache* glyphCache, UINT32 id, UINT32 index,
return FALSE;
}
WLog_DBG(TAG, "GlyphCachePut: id: %d index: %d", id, index);
WLog_Print(glyphCache->log, WLOG_DEBUG, "GlyphCachePut: id: %d index: %d", id,
index);
prevGlyph = glyphCache->glyphCache[id].entries[index];
if (prevGlyph)
@ -532,7 +583,8 @@ void* glyph_cache_fragment_get(rdpGlyphCache* glyphCache, UINT32 index,
fragment = glyphCache->fragCache.entries[index].fragment;
*size = (BYTE) glyphCache->fragCache.entries[index].size;
WLog_DBG(TAG, "GlyphCacheFragmentGet: index: %d size: %d", index, *size);
WLog_Print(glyphCache->log, WLOG_DEBUG,
"GlyphCacheFragmentGet: index: %d size: %d", index, *size);
if (!fragment)
WLog_ERR(TAG, "invalid glyph fragment at index:%d", index);
@ -551,7 +603,8 @@ void glyph_cache_fragment_put(rdpGlyphCache* glyphCache, UINT32 index,
return;
}
WLog_DBG(TAG, "GlyphCacheFragmentPut: index: %d size: %d", index, size);
WLog_Print(glyphCache->log, WLOG_DEBUG,
"GlyphCacheFragmentPut: index: %d size: %d", index, size);
prevFragment = glyphCache->fragCache.entries[index].fragment;
glyphCache->fragCache.entries[index].fragment = fragment;
glyphCache->fragCache.entries[index].size = size;
@ -603,9 +656,9 @@ void glyph_cache_free(rdpGlyphCache* glyphCache)
for (i = 0; i < 10; i++)
{
int j;
UINT32 j;
for (j = 0; j < (int) glyphCache->glyphCache[i].number; j++)
for (j = 0; j < glyphCache->glyphCache[i].number; j++)
{
rdpGlyph* glyph;
glyph = glyphCache->glyphCache[i].entries[j];

View File

@ -158,14 +158,21 @@ rdpGlyph* Glyph_Alloc(rdpContext* context)
{
rdpGlyph* glyph;
rdpGraphics* graphics;
if (!context || !context->graphics)
return NULL;
graphics = context->graphics;
if (!graphics->Glyph_Prototype)
return NULL;
glyph = (rdpGlyph*) calloc(1, graphics->Glyph_Prototype->size);
if (glyph)
{
CopyMemory(glyph, graphics->Glyph_Prototype, sizeof(rdpGlyph));
}
if (!glyph)
return NULL;
*glyph = *graphics->Glyph_Prototype;
return glyph;
}

View File

@ -36,8 +36,6 @@
#define TAG FREERDP_TAG("core.orders")
#ifdef WITH_DEBUG_ORDERS
static const char* const PRIMARY_DRAWING_ORDER_STRINGS[] =
{
"DstBlt",
@ -102,8 +100,6 @@ static const char* const ALTSEC_DRAWING_ORDER_STRINGS[] =
#define ALTSEC_DRAWING_ORDER_COUNT (ARRAYSIZE(ALTSEC_DRAWING_ORDER_STRINGS))
#endif /* WITH_DEBUG_ORDERS */
const BYTE PRIMARY_DRAWING_ORDER_FIELD_BYTES[] =
{
DSTBLT_ORDER_FIELD_BYTES,
@ -187,7 +183,7 @@ static INLINE BOOL update_read_coord(wStream* s, INT32* coord, BOOL delta)
if (Stream_GetRemainingLength(s) < 1)
return FALSE;
Stream_Read_UINT8(s, lsi8);
Stream_Read_INT8(s, lsi8);
*coord += lsi8;
}
else
@ -195,7 +191,7 @@ static INLINE BOOL update_read_coord(wStream* s, INT32* coord, BOOL delta)
if (Stream_GetRemainingLength(s) < 2)
return FALSE;
Stream_Read_UINT16(s, lsi16);
Stream_Read_INT16(s, lsi16);
*coord = lsi16;
}
@ -1279,6 +1275,9 @@ static BOOL update_read_polyline_order(wStream* s, ORDER_INFO* orderInfo,
static BOOL update_read_memblt_order(wStream* s, ORDER_INFO* orderInfo,
MEMBLT_ORDER* memblt)
{
if (!s || !orderInfo || !memblt)
return FALSE;
ORDER_FIELD_UINT16(1, memblt->cacheId);
ORDER_FIELD_COORD(2, memblt->nLeftRect);
ORDER_FIELD_COORD(3, memblt->nTopRect);
@ -2955,10 +2954,8 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
}
orderInfo->deltaCoordinates = (flags & ORDER_DELTA_COORDINATES) ? TRUE : FALSE;
#ifdef WITH_DEBUG_ORDERS
WLog_DBG(TAG, "%s Primary Drawing Order (0x%02X)",
PRIMARY_DRAWING_ORDER_STRINGS[orderInfo->orderType], orderInfo->orderType);
#endif
WLog_Print(update->log, WLOG_DEBUG, "%s Primary Drawing Order (0x%02X)",
PRIMARY_DRAWING_ORDER_STRINGS[orderInfo->orderType], orderInfo->orderType);
switch (orderInfo->orderType)
{
@ -2969,7 +2966,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "DstBlt");
IFCALL(primary->DstBlt, context, &primary->dstblt);
break;
@ -2980,7 +2976,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "PatBlt");
IFCALL(primary->PatBlt, context, &primary->patblt);
break;
@ -2991,7 +2986,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "ScrBlt");
IFCALL(primary->ScrBlt, context, &primary->scrblt);
break;
@ -3003,7 +2997,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "OpaqueRect");
IFCALL(primary->OpaqueRect, context, &primary->opaque_rect);
break;
@ -3015,7 +3008,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "DrawNineGrid");
IFCALL(primary->DrawNineGrid, context, &primary->draw_nine_grid);
break;
@ -3027,7 +3019,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "MultiDstBlt");
IFCALL(primary->MultiDstBlt, context, &primary->multi_dstblt);
break;
@ -3039,7 +3030,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "MultiPatBlt");
IFCALL(primary->MultiPatBlt, context, &primary->multi_patblt);
break;
@ -3051,7 +3041,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "MultiScrBlt");
IFCALL(primary->MultiScrBlt, context, &primary->multi_scrblt);
break;
@ -3064,7 +3053,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "MultiOpaqueRect");
IFCALL(primary->MultiOpaqueRect, context, &primary->multi_opaque_rect);
break;
@ -3077,7 +3065,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "MultiDrawNineGrid");
IFCALL(primary->MultiDrawNineGrid, context, &primary->multi_draw_nine_grid);
break;
@ -3088,7 +3075,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "LineTo");
IFCALL(primary->LineTo, context, &primary->line_to);
break;
@ -3099,7 +3085,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "Polyline");
IFCALL(primary->Polyline, context, &primary->polyline);
break;
@ -3110,7 +3095,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "MemBlt");
IFCALL(primary->MemBlt, context, &primary->memblt);
break;
@ -3121,7 +3105,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "Mem3Blt");
IFCALL(primary->Mem3Blt, context, &primary->mem3blt);
break;
@ -3133,7 +3116,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "SaveBitmap");
IFCALL(primary->SaveBitmap, context, &primary->save_bitmap);
break;
@ -3145,7 +3127,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "GlyphIndex");
IFCALL(primary->GlyphIndex, context, &primary->glyph_index);
break;
@ -3156,7 +3137,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "FastIndex");
IFCALL(primary->FastIndex, context, &primary->fast_index);
break;
@ -3167,7 +3147,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "FastGlyph");
IFCALL(primary->FastGlyph, context, &primary->fast_glyph);
break;
@ -3178,7 +3157,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "PolygonSC");
IFCALL(primary->PolygonSC, context, &primary->polygon_sc);
break;
@ -3189,7 +3167,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "PolygonCB");
IFCALL(primary->PolygonCB, context, &primary->polygon_cb);
break;
@ -3200,7 +3177,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "EllipseSC");
IFCALL(primary->EllipseSC, context, &primary->ellipse_sc);
break;
@ -3211,7 +3187,6 @@ BOOL update_recv_primary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "EllipseCB");
IFCALL(primary->EllipseCB, context, &primary->ellipse_cb);
break;
@ -3245,15 +3220,13 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
Stream_Read_UINT16(s, extraFlags); /* extraFlags (2 bytes) */
Stream_Read_UINT8(s, orderType); /* orderType (1 byte) */
next = Stream_Pointer(s) + ((INT16) orderLength) + 7;
#ifdef WITH_DEBUG_ORDERS
if (orderType < SECONDARY_DRAWING_ORDER_COUNT)
WLog_DBG(TAG, "%s Secondary Drawing Order (0x%02X)",
SECONDARY_DRAWING_ORDER_STRINGS[orderType], orderType);
WLog_Print(update->log, WLOG_DEBUG, "%s Secondary Drawing Order (0x%02X)",
SECONDARY_DRAWING_ORDER_STRINGS[orderType], orderType);
else
WLog_DBG(TAG, "Unknown Secondary Drawing Order (0x%02X)", orderType);
#endif
WLog_Print(update->log, WLOG_DEBUG, "Unknown Secondary Drawing Order (0x%02X)",
orderType);
switch (orderType)
{
@ -3266,7 +3239,6 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapUncompressed");
IFCALL(secondary->CacheBitmap, context, &(secondary->cache_bitmap_order));
break;
@ -3279,7 +3251,6 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressed");
IFCALL(secondary->CacheBitmap, context, &(secondary->cache_bitmap_order));
break;
@ -3292,7 +3263,6 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapUncompressedV2");
IFCALL(secondary->CacheBitmapV2, context, &(secondary->cache_bitmap_v2_order));
break;
@ -3305,7 +3275,6 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressedV2");
IFCALL(secondary->CacheBitmapV2, context, &(secondary->cache_bitmap_v2_order));
break;
@ -3318,7 +3287,6 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressedV3");
IFCALL(secondary->CacheBitmapV3, context, &(secondary->cache_bitmap_v3_order));
break;
@ -3331,7 +3299,6 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheColorTable");
IFCALL(secondary->CacheColorTable, context,
&(secondary->cache_color_table_order));
break;
@ -3347,7 +3314,6 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheGlyphV2");
IFCALL(secondary->CacheGlyphV2, context, &(secondary->cache_glyph_v2_order));
}
else
@ -3360,7 +3326,6 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheGlyph");
IFCALL(secondary->CacheGlyph, context, &(secondary->cache_glyph_order));
}
@ -3375,7 +3340,6 @@ BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CacheBrush");
IFCALL(secondary->CacheBrush, context, &(secondary->cache_brush_order));
break;
@ -3393,15 +3357,14 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s,
rdpContext* context = update->context;
rdpAltSecUpdate* altsec = update->altsec;
orderType = flags >>= 2; /* orderType is in higher 6 bits of flags field */
#ifdef WITH_DEBUG_ORDERS
if (orderType < ALTSEC_DRAWING_ORDER_COUNT)
WLog_DBG(TAG, "%s Alternate Secondary Drawing Order (0x%02X)",
ALTSEC_DRAWING_ORDER_STRINGS[orderType], orderType);
WLog_Print(update->log, WLOG_DEBUG,
"%s Alternate Secondary Drawing Order (0x%02X)",
ALTSEC_DRAWING_ORDER_STRINGS[orderType], orderType);
else
WLog_DBG(TAG, "Unknown Alternate Secondary Drawing Order: 0x%02X", orderType);
#endif
WLog_Print(update->log, WLOG_DEBUG,
"Unknown Alternate Secondary Drawing Order: 0x%02X", orderType);
switch (orderType)
{
@ -3414,7 +3377,6 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s,
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CreateOffscreenBitmap");
IFCALL(altsec->CreateOffscreenBitmap, context,
&(altsec->create_offscreen_bitmap));
break;
@ -3427,7 +3389,6 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s,
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "SwitchSurface");
IFCALL(altsec->SwitchSurface, context, &(altsec->switch_surface));
break;
@ -3440,7 +3401,6 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s,
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "CreateNineGridBitmap");
IFCALL(altsec->CreateNineGridBitmap, context,
&(altsec->create_nine_grid_bitmap));
break;
@ -3453,8 +3413,6 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s,
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "AltSecFrameMarker: action: %s (%d)",
(!altsec->frame_marker.action) ? "Begin" : "End", altsec->frame_marker.action);
IFCALL(altsec->FrameMarker, context, &(altsec->frame_marker));
break;
@ -3466,7 +3424,6 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s,
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "StreamBitmapFirst");
IFCALL(altsec->StreamBitmapFirst, context, &(altsec->stream_bitmap_first));
break;
@ -3478,7 +3435,6 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s,
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "StreamBitmapNext");
IFCALL(altsec->StreamBitmapNext, context, &(altsec->stream_bitmap_next));
break;
@ -3490,7 +3446,6 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s,
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusFirst");
IFCALL(altsec->DrawGdiPlusFirst, context, &(altsec->draw_gdiplus_first));
break;
@ -3502,7 +3457,6 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s,
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusNext");
IFCALL(altsec->DrawGdiPlusNext, context, &(altsec->draw_gdiplus_next));
break;
@ -3514,7 +3468,6 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s,
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusEnd");
IFCALL(altsec->DrawGdiPlusEnd, context, &(altsec->draw_gdiplus_end));
break;
@ -3527,7 +3480,6 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s,
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheFirst");
IFCALL(altsec->DrawGdiPlusCacheFirst, context,
&(altsec->draw_gdiplus_cache_first));
break;
@ -3541,7 +3493,6 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s,
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheNext");
IFCALL(altsec->DrawGdiPlusCacheNext, context,
&(altsec->draw_gdiplus_cache_next));
break;
@ -3555,7 +3506,6 @@ static BOOL update_recv_altsec_order(rdpUpdate* update, wStream* s,
return FALSE;
}
WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheEnd");
IFCALL(altsec->DrawGdiPlusCacheEnd, context, &(altsec->draw_gdiplus_cache_end));
break;

View File

@ -741,8 +741,6 @@ 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:

View File

@ -543,7 +543,7 @@ static BOOL BitBlt_BLACKNESS(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
UINT32 nWidth, UINT32 nHeight)
{
UINT32 x, y;
UINT32 color = GetColor(hdcDest->format, 0, 0, 0, 0xFF);
const UINT32 color = GetColor(hdcDest->format, 0, 0, 0, 0xFF);
for (y = 0; y < nHeight; y++)
{
@ -563,7 +563,7 @@ static BOOL BitBlt_WHITENESS(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
UINT32 nWidth, UINT32 nHeight)
{
UINT32 x, y;
UINT32 color = GetColor(hdcDest->format, 0xFF, 0xFF, 0xFF, 0xFF);
const UINT32 color = GetColor(hdcDest->format, 0xFF, 0xFF, 0xFF, 0xFF);
for (y = 0; y < nHeight; y++)
{
@ -583,6 +583,11 @@ BOOL gdi_PatBlt(HGDI_DC hdc, UINT32 nXLeft, UINT32 nYLeft,
UINT32 nWidth, UINT32 nHeight, DWORD rop,
HGDI_DC hdcSrc, UINT32 nXSrc, UINT32 nYSrc)
{
WLog_INFO(TAG, "%s [%s] x=%lu, y=%lu, w=%lu, h=%lu [x=%lu, y=%lu] %s %s",
__FUNCTION__, gdi_rop_to_string(rop), nXLeft, nYLeft,
nWidth, nHeight, nXSrc, nYSrc, hdc ? GetColorFormatName(hdc->format) : "NULL",
hdcSrc ? GetColorFormatName(hdcSrc->format) : "NULL");
if (!gdi_ClipCoords(hdc, &nXLeft, &nYLeft, &nWidth, &nHeight, NULL, NULL))
return TRUE;

View File

@ -474,8 +474,14 @@ static BOOL gdi_bitmap_update(rdpContext* context,
const BITMAP_UPDATE* bitmapUpdate)
{
UINT32 index;
rdpGdi* gdi = context->gdi;
rdpCodecs* codecs = context->codecs;
rdpGdi* gdi;
rdpCodecs* codecs;
if (!context || !bitmapUpdate || !context->gdi || !context->codecs)
return FALSE;
gdi = context->gdi;
codecs = context->codecs;
for (index = 0; index < bitmapUpdate->number; index++)
{
@ -544,7 +550,12 @@ static BOOL gdi_palette_update(rdpContext* context,
const PALETTE_UPDATE* palette)
{
UINT32 index;
rdpGdi* gdi = context->gdi;
rdpGdi* gdi;
if (!context || !palette)
return FALSE;
gdi = context->gdi;
gdi->palette.format = gdi->dstFormat;
for (index = 0; index < palette->number; index++)
@ -559,7 +570,12 @@ static BOOL gdi_palette_update(rdpContext* context,
static BOOL gdi_set_bounds(rdpContext* context, const rdpBounds* bounds)
{
rdpGdi* gdi = context->gdi;
rdpGdi* gdi;
if (!context)
return FALSE;
gdi = context->gdi;
if (bounds)
{
@ -765,7 +781,12 @@ out_error:
static BOOL gdi_scrblt(rdpContext* context, const SCRBLT_ORDER* scrblt)
{
rdpGdi* gdi = context->gdi;
rdpGdi* gdi;
if (!context || !context->gdi)
return FALSE;
gdi = context->gdi;
return gdi_BitBlt(gdi->drawing->hdc, scrblt->nLeftRect, scrblt->nTopRect,
scrblt->nWidth, scrblt->nHeight, gdi->primary->hdc,
scrblt->nXSrc, scrblt->nYSrc, gdi_rop3_code(scrblt->bRop),
@ -782,6 +803,9 @@ static BOOL gdi_opaque_rect(rdpContext* context,
BOOL ret;
gdi_CRgnToRect(opaque_rect->nLeftRect, opaque_rect->nTopRect,
opaque_rect->nWidth, opaque_rect->nHeight, &rect);
WLog_INFO(TAG, "%s x=%lu, y=%lu, w=%lu, h=%lu",
__FUNCTION__, opaque_rect->nLeftRect, opaque_rect->nTopRect,
opaque_rect->nWidth, opaque_rect->nHeight);
if (!gdi_decode_color(gdi, opaque_rect->color, &brush_color, NULL))
return FALSE;
@ -803,6 +827,9 @@ static BOOL gdi_multi_opaque_rect(rdpContext* context,
UINT32 brush_color;
rdpGdi* gdi = context->gdi;
BOOL ret = TRUE;
WLog_INFO(TAG, "%s x=%lu, y=%lu, w=%lu, h=%lu",
__FUNCTION__, multi_opaque_rect->nLeftRect, multi_opaque_rect->nTopRect,
multi_opaque_rect->nWidth, multi_opaque_rect->nHeight);
if (!gdi_decode_color(gdi, multi_opaque_rect->color, &brush_color, NULL))
return FALSE;
@ -830,6 +857,9 @@ static BOOL gdi_line_to(rdpContext* context, const LINE_TO_ORDER* lineTo)
HGDI_PEN hPen;
UINT32 SrcFormat;
rdpGdi* gdi = context->gdi;
WLog_INFO(TAG, "%s x=%lu, y=%lu, w=%lu, h=%lu",
__FUNCTION__, lineTo->nXStart, lineTo->nYStart,
lineTo->nXEnd, lineTo->nYEnd);
if (!gdi_decode_color(gdi, lineTo->backColor, &color, &SrcFormat))
return FALSE;
@ -874,6 +904,8 @@ static BOOL gdi_polyline(rdpContext* context, const POLYLINE_ORDER* polyline)
{
x += points[i].x;
y += points[i].y;
WLog_INFO(TAG, "%s x=%lu, y=%lu",
__FUNCTION__, x, y);
gdi_LineTo(gdi->drawing->hdc, x, y);
gdi_MoveToEx(gdi->drawing->hdc, x, y, NULL);
}
@ -884,8 +916,14 @@ static BOOL gdi_polyline(rdpContext* context, const POLYLINE_ORDER* polyline)
static BOOL gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
{
gdiBitmap* bitmap = (gdiBitmap*) memblt->bitmap;
rdpGdi* gdi = context->gdi;
gdiBitmap* bitmap;
rdpGdi* gdi;
if (!context || !memblt || !context->gdi || !memblt->bitmap)
return FALSE;
bitmap = (gdiBitmap*) memblt->bitmap;
gdi = context->gdi;
return gdi_BitBlt(gdi->drawing->hdc, memblt->nLeftRect, memblt->nTopRect,
memblt->nWidth, memblt->nHeight, bitmap->hdc,
memblt->nXSrc, memblt->nYSrc, gdi_rop3_code(memblt->bRop),

View File

@ -95,6 +95,7 @@ static BOOL gdi_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
return FALSE;
}
gdi_bitmap->hdc->format = gdi_bitmap->bitmap->format;
gdi_SelectObject(gdi_bitmap->hdc, (HGDIOBJECT) gdi_bitmap->bitmap);
gdi_bitmap->org_bitmap = NULL;
return TRUE;
@ -134,7 +135,7 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
UINT32 bytesPerPixel;
rdpGdi* gdi = context->gdi;
bytesPerPixel = (bpp + 7) / 8;
size = width * height * 4;
size = width * height * GetBytesPerPixel(gdi->dstFormat);
bitmap->data = (BYTE*) _aligned_malloc(size, 16);
if (!bitmap->data)
@ -195,6 +196,10 @@ static BOOL gdi_Glyph_New(rdpContext* context, rdpGlyph* glyph)
{
BYTE* data;
gdiGlyph* gdi_glyph;
if (!context || !glyph)
return FALSE;
gdi_glyph = (gdiGlyph*) glyph;
gdi_glyph->hdc = gdi_GetDC();
@ -220,7 +225,6 @@ static BOOL gdi_Glyph_New(rdpContext* context, rdpGlyph* glyph)
return FALSE;
}
gdi_glyph->bitmap->format = PIXEL_FORMAT_MONO;
gdi_SelectObject(gdi_glyph->hdc, (HGDIOBJECT) gdi_glyph->bitmap);
gdi_glyph->org_bitmap = NULL;
return TRUE;