diff --git a/include/freerdp/cache/glyph.h b/include/freerdp/cache/glyph.h index 20757b297..88ee83d64 100644 --- a/include/freerdp/cache/glyph.h +++ b/include/freerdp/cache/glyph.h @@ -27,6 +27,7 @@ struct _GLYPH_CACHE_ENTRY { void* entry; + void* extra; }; typedef struct _GLYPH_CACHE_ENTRY GLYPH_CACHE_ENTRY; @@ -46,8 +47,8 @@ struct rdp_glyph }; typedef struct rdp_glyph rdpGlyph; -FREERDP_API void* glyph_get(rdpGlyph* glyph, uint8 id, uint16 index); -FREERDP_API void glyph_put(rdpGlyph* glyph, uint8 id, uint16 index, void* entry); +FREERDP_API void* glyph_get(rdpGlyph* glyph, uint8 id, uint16 index, void** extra); +FREERDP_API void glyph_put(rdpGlyph* glyph, uint8 id, uint16 index, void* entry, void* extra); FREERDP_API rdpGlyph* glyph_new(rdpSettings* settings); FREERDP_API void glyph_free(rdpGlyph* glyph); diff --git a/libfreerdp-cache/glyph.c b/libfreerdp-cache/glyph.c index 1d312540d..dc63502ae 100644 --- a/libfreerdp-cache/glyph.c +++ b/libfreerdp-cache/glyph.c @@ -22,7 +22,7 @@ #include -void* glyph_get(rdpGlyph* glyph, uint8 id, uint16 index) +void* glyph_get(rdpGlyph* glyph, uint8 id, uint16 index, void** extra) { void* entry; @@ -40,10 +40,13 @@ void* glyph_get(rdpGlyph* glyph, uint8 id, uint16 index) entry = glyph->glyphCache[id].entries[index].entry; + if (extra != NULL) + *extra = glyph->glyphCache[id].entries[index].extra; + return entry; } -void glyph_put(rdpGlyph* glyph, uint8 id, uint16 index, void* entry) +void glyph_put(rdpGlyph* glyph, uint8 id, uint16 index, void* entry, void* extra) { if (id > 9) { @@ -58,6 +61,9 @@ void glyph_put(rdpGlyph* glyph, uint8 id, uint16 index, void* entry) } glyph->glyphCache[id].entries[index].entry = entry; + + if (extra != NULL) + glyph->glyphCache[id].entries[index].extra = extra; } rdpGlyph* glyph_new(rdpSettings* settings) @@ -72,7 +78,7 @@ rdpGlyph* glyph_new(rdpSettings* settings) glyph->settings = settings; - settings->glyphSupportLevel = GLYPH_SUPPORT_NONE; + //settings->glyphSupportLevel = GLYPH_SUPPORT_FULL; for (i = 0; i < 10; i++) { diff --git a/libfreerdp-core/orders.c b/libfreerdp-core/orders.c index daf32603a..8d73089c9 100644 --- a/libfreerdp-core/orders.c +++ b/libfreerdp-core/orders.c @@ -1617,7 +1617,7 @@ void update_recv_primary_order(rdpUpdate* update, STREAM* s, uint8 flags) orderInfo->deltaCoordinates = (flags & ORDER_DELTA_COORDINATES) ? True : False; -#if 0 +#ifdef WITH_DEBUG_ORDERS if (orderInfo->orderType < PRIMARY_DRAWING_ORDER_COUNT) printf("%s Primary Drawing Order (0x%02X)\n", PRIMARY_DRAWING_ORDER_STRINGS[orderInfo->orderType], orderInfo->orderType); else @@ -1759,7 +1759,7 @@ void update_recv_secondary_order(rdpUpdate* update, STREAM* s, uint8 flags) next = s->p + ((sint16) orderLength) + 7; -#if 0 +#ifdef WITH_DEBUG_ORDERS if (orderType < SECONDARY_DRAWING_ORDER_COUNT) printf("%s Secondary Drawing Order (0x%02X)\n", SECONDARY_DRAWING_ORDER_STRINGS[orderType], orderType); else @@ -1829,7 +1829,7 @@ void update_recv_altsec_order(rdpUpdate* update, STREAM* s, uint8 flags) orderType = flags >>= 2; /* orderType is in higher 6 bits of flags field */ -#if 0 +#ifdef WITH_DEBUG_ORDERS if (orderType < ALTSEC_DRAWING_ORDER_COUNT) printf("%s Alternate Secondary Drawing Order (0x%02X)\n", ALTSEC_DRAWING_ORDER_STRINGS[orderType], orderType); else diff --git a/libfreerdp-core/orders.h b/libfreerdp-core/orders.h index 080c682cb..0b8f0b925 100644 --- a/libfreerdp-core/orders.h +++ b/libfreerdp-core/orders.h @@ -243,4 +243,6 @@ void update_read_draw_gdiplus_cache_first_order(STREAM* s, DRAW_GDIPLUS_CACHE_FI void update_read_draw_gdiplus_cache_next_order(STREAM* s, DRAW_GDIPLUS_CACHE_NEXT_ORDER* draw_gdiplus_cache_next); void update_read_draw_gdiplus_cache_end_order(STREAM* s, DRAW_GDIPLUS_CACHE_END_ORDER* draw_gdiplus_cache_end); +#define WITH_DEBUG_ORDERS 1 + #endif /* __ORDERS_H */ diff --git a/libfreerdp-gdi/gdi.c b/libfreerdp-gdi/gdi.c index 6df1bcab9..08a992de9 100644 --- a/libfreerdp-gdi/gdi.c +++ b/libfreerdp-gdi/gdi.c @@ -636,6 +636,19 @@ void gdi_polyline(rdpUpdate* update, POLYLINE_ORDER* polyline) gdi_DeleteObject((HGDIOBJECT) hPen); } +void gdi_fast_index(rdpUpdate* update, FAST_INDEX_ORDER* fast_index) +{ + uint32 color; + GDI* gdi = GET_GDI(update); + + color = gdi_color_convert(fast_index->foreColor, gdi->srcBpp, 32, gdi->clrconv); + gdi->textColor = gdi_SetTextColor(gdi->drawing->hdc, color); + + + + gdi_SetTextColor(gdi->drawing->hdc, gdi->textColor); +} + void gdi_create_offscreen_bitmap(rdpUpdate* update, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap) { GDI_IMAGE* gdi_bmp; @@ -679,26 +692,58 @@ void gdi_cache_color_table(rdpUpdate* update, CACHE_COLOR_TABLE_ORDER* cache_col void gdi_cache_glyph(rdpUpdate* update, CACHE_GLYPH_ORDER* cache_glyph) { int i; + uint8* extra; GLYPH_DATA* glyph; + GDI_IMAGE* gdi_bmp; GDI* gdi = GET_GDI(update); for (i = 0; i < cache_glyph->cGlyphs; i++) { glyph = cache_glyph->glyphData[i]; - glyph_put(gdi->cache->glyph, cache_glyph->cacheId, glyph->cacheIndex, glyph); + gdi_bmp = (GDI_IMAGE*) malloc(sizeof(GDI_IMAGE)); + + gdi_bmp->hdc = gdi_GetDC(); + gdi_bmp->hdc->bytesPerPixel = 1; + gdi_bmp->hdc->bitsPerPixel = 1; + + extra = gdi_glyph_convert(glyph->cx, glyph->cy, glyph->aj); + gdi_bmp->bitmap = gdi_CreateBitmap(glyph->cx, glyph->cy, 1, extra); + gdi_bmp->bitmap->bytesPerPixel = 1; + gdi_bmp->bitmap->bitsPerPixel = 1; + + gdi_SelectObject(gdi_bmp->hdc, (HGDIOBJECT) gdi_bmp->bitmap); + gdi_bmp->org_bitmap = NULL; + + glyph_put(gdi->cache->glyph, cache_glyph->cacheId, glyph->cacheIndex, glyph, (void*) gdi_bmp); } } void gdi_cache_glyph_v2(rdpUpdate* update, CACHE_GLYPH_V2_ORDER* cache_glyph_v2) { int i; + uint8* extra; GLYPH_DATA_V2* glyph; + GDI_IMAGE* gdi_bmp; GDI* gdi = GET_GDI(update); for (i = 0; i < cache_glyph_v2->cGlyphs; i++) { glyph = cache_glyph_v2->glyphData[i]; - glyph_put(gdi->cache->glyph, cache_glyph_v2->cacheId, glyph->cacheIndex, glyph); + gdi_bmp = (GDI_IMAGE*) malloc(sizeof(GDI_IMAGE)); + + gdi_bmp->hdc = gdi_GetDC(); + gdi_bmp->hdc->bytesPerPixel = 1; + gdi_bmp->hdc->bitsPerPixel = 1; + + extra = gdi_glyph_convert(glyph->cx, glyph->cy, glyph->aj); + gdi_bmp->bitmap = gdi_CreateBitmap(glyph->cx, glyph->cy, 1, extra); + gdi_bmp->bitmap->bytesPerPixel = 1; + gdi_bmp->bitmap->bitsPerPixel = 1; + + gdi_SelectObject(gdi_bmp->hdc, (HGDIOBJECT) gdi_bmp->bitmap); + gdi_bmp->org_bitmap = NULL; + + glyph_put(gdi->cache->glyph, cache_glyph_v2->cacheId, glyph->cacheIndex, glyph, (void*) gdi_bmp); } } @@ -826,7 +871,7 @@ void gdi_register_update_callbacks(rdpUpdate* update) update->Mem3Blt = NULL; update->SaveBitmap = NULL; update->GlyphIndex = NULL; - update->FastIndex = NULL; + update->FastIndex = gdi_fast_index; update->FastGlyph = NULL; update->PolygonSC = NULL; update->PolygonCB = NULL;