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);
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. */
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)++;
}
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,
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)
{
/**
}
}
- 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;
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);
}
}
- 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;
{
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;
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;
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;
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);
}
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;
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;
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)
{
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)
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);
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;
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];
{
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;
}
#define TAG FREERDP_TAG("core.orders")
-#ifdef WITH_DEBUG_ORDERS
-
static const char* const PRIMARY_DRAWING_ORDER_STRINGS[] =
{
"DstBlt",
#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,
if (Stream_GetRemainingLength(s) < 1)
return FALSE;
- Stream_Read_UINT8(s, lsi8);
+ Stream_Read_INT8(s, lsi8);
*coord += lsi8;
}
else
if (Stream_GetRemainingLength(s) < 2)
return FALSE;
- Stream_Read_UINT16(s, lsi16);
+ Stream_Read_INT16(s, lsi16);
*coord = lsi16;
}
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);
}
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)
{
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "DstBlt");
IFCALL(primary->DstBlt, context, &primary->dstblt);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "PatBlt");
IFCALL(primary->PatBlt, context, &primary->patblt);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "ScrBlt");
IFCALL(primary->ScrBlt, context, &primary->scrblt);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "OpaqueRect");
IFCALL(primary->OpaqueRect, context, &primary->opaque_rect);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "DrawNineGrid");
IFCALL(primary->DrawNineGrid, context, &primary->draw_nine_grid);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "MultiDstBlt");
IFCALL(primary->MultiDstBlt, context, &primary->multi_dstblt);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "MultiPatBlt");
IFCALL(primary->MultiPatBlt, context, &primary->multi_patblt);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "MultiScrBlt");
IFCALL(primary->MultiScrBlt, context, &primary->multi_scrblt);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "MultiOpaqueRect");
IFCALL(primary->MultiOpaqueRect, context, &primary->multi_opaque_rect);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "MultiDrawNineGrid");
IFCALL(primary->MultiDrawNineGrid, context, &primary->multi_draw_nine_grid);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "LineTo");
IFCALL(primary->LineTo, context, &primary->line_to);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "Polyline");
IFCALL(primary->Polyline, context, &primary->polyline);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "MemBlt");
IFCALL(primary->MemBlt, context, &primary->memblt);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "Mem3Blt");
IFCALL(primary->Mem3Blt, context, &primary->mem3blt);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "SaveBitmap");
IFCALL(primary->SaveBitmap, context, &primary->save_bitmap);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "GlyphIndex");
IFCALL(primary->GlyphIndex, context, &primary->glyph_index);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "FastIndex");
IFCALL(primary->FastIndex, context, &primary->fast_index);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "FastGlyph");
IFCALL(primary->FastGlyph, context, &primary->fast_glyph);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "PolygonSC");
IFCALL(primary->PolygonSC, context, &primary->polygon_sc);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "PolygonCB");
IFCALL(primary->PolygonCB, context, &primary->polygon_cb);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "EllipseSC");
IFCALL(primary->EllipseSC, context, &primary->ellipse_sc);
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "EllipseCB");
IFCALL(primary->EllipseCB, context, &primary->ellipse_cb);
break;
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)
{
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapUncompressed");
IFCALL(secondary->CacheBitmap, context, &(secondary->cache_bitmap_order));
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressed");
IFCALL(secondary->CacheBitmap, context, &(secondary->cache_bitmap_order));
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapUncompressedV2");
IFCALL(secondary->CacheBitmapV2, context, &(secondary->cache_bitmap_v2_order));
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressedV2");
IFCALL(secondary->CacheBitmapV2, context, &(secondary->cache_bitmap_v2_order));
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "CacheBitmapCompressedV3");
IFCALL(secondary->CacheBitmapV3, context, &(secondary->cache_bitmap_v3_order));
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "CacheColorTable");
IFCALL(secondary->CacheColorTable, context,
&(secondary->cache_color_table_order));
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "CacheGlyphV2");
IFCALL(secondary->CacheGlyphV2, context, &(secondary->cache_glyph_v2_order));
}
else
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "CacheGlyph");
IFCALL(secondary->CacheGlyph, context, &(secondary->cache_glyph_order));
}
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "CacheBrush");
IFCALL(secondary->CacheBrush, context, &(secondary->cache_brush_order));
break;
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)
{
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "CreateOffscreenBitmap");
IFCALL(altsec->CreateOffscreenBitmap, context,
&(altsec->create_offscreen_bitmap));
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "SwitchSurface");
IFCALL(altsec->SwitchSurface, context, &(altsec->switch_surface));
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "CreateNineGridBitmap");
IFCALL(altsec->CreateNineGridBitmap, context,
&(altsec->create_nine_grid_bitmap));
break;
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;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "StreamBitmapFirst");
IFCALL(altsec->StreamBitmapFirst, context, &(altsec->stream_bitmap_first));
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "StreamBitmapNext");
IFCALL(altsec->StreamBitmapNext, context, &(altsec->stream_bitmap_next));
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusFirst");
IFCALL(altsec->DrawGdiPlusFirst, context, &(altsec->draw_gdiplus_first));
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusNext");
IFCALL(altsec->DrawGdiPlusNext, context, &(altsec->draw_gdiplus_next));
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusEnd");
IFCALL(altsec->DrawGdiPlusEnd, context, &(altsec->draw_gdiplus_end));
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheFirst");
IFCALL(altsec->DrawGdiPlusCacheFirst, context,
&(altsec->draw_gdiplus_cache_first));
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheNext");
IFCALL(altsec->DrawGdiPlusCacheNext, context,
&(altsec->draw_gdiplus_cache_next));
break;
return FALSE;
}
- WLog_Print(update->log, WLOG_DEBUG, "DrawGdiPlusCacheEnd");
IFCALL(altsec->DrawGdiPlusCacheEnd, context, &(altsec->draw_gdiplus_cache_end));
break;
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:
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++)
{
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++)
{
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;
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++)
{
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++)
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)
{
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),
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;
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;
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;
{
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);
}
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),
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;
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)
{
BYTE* data;
gdiGlyph* gdi_glyph;
+
+ if (!context || !glyph)
+ return FALSE;
+
gdi_glyph = (gdiGlyph*) glyph;
gdi_glyph->hdc = gdi_GetDC();
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;