BOOL update_gdi_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cacheGlyph) { int i; rdpGlyph* glyph; GLYPH_DATA* glyph_data; rdpCache* cache = context->cache; for (i = 0; i < (int) cacheGlyph->cGlyphs; i++) { glyph_data = &cacheGlyph->glyphData[i]; glyph = Glyph_Alloc(context); if (!glyph) return FALSE; glyph->x = glyph_data->x; glyph->y = glyph_data->y; glyph->cx = glyph_data->cx; glyph->cy = glyph_data->cy; glyph->cb = glyph_data->cb; glyph->aj = glyph_data->aj; if (!Glyph_New(context, glyph)) { Glyph_Free(context, glyph); return FALSE; } glyph_cache_put(cache->glyph, cacheGlyph->cacheId, glyph_data->cacheIndex, glyph); } return TRUE; }
BOOL update_gdi_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cacheGlyphV2) { int i; rdpGlyph* glyph; GLYPH_DATA_V2* glyphData; rdpCache* cache = context->cache; for (i = 0; i < (int) cacheGlyphV2->cGlyphs; i++) { glyphData = &cacheGlyphV2->glyphData[i]; 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; glyph->cx = glyphData->cx; glyph->cy = glyphData->cy; glyph->cb = glyphData->cb; glyph->aj = glyphData->aj; Glyph_New(context, glyph); glyph_cache_put(cache->glyph, cacheGlyphV2->cacheId, glyphData->cacheIndex, glyph); } return TRUE; }
void update_gdi_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cache_glyph_v2) { int i; rdpGlyph* glyph; GLYPH_DATA_V2* glyph_data; rdpCache* cache = context->cache; for (i = 0; i < (int) cache_glyph_v2->cGlyphs; i++) { glyph_data = cache_glyph_v2->glyphData[i]; glyph = Glyph_Alloc(context); glyph->x = glyph_data->x; glyph->y = glyph_data->y; glyph->cx = glyph_data->cx; glyph->cy = glyph_data->cy; glyph->aj = glyph_data->aj; glyph->cb = glyph_data->cb; Glyph_New(context, glyph); glyph_cache_put(cache->glyph, cache_glyph_v2->cacheId, glyph_data->cacheIndex, glyph); cache_glyph_v2->glyphData[i] = NULL; free(glyph_data); } }
static BOOL update_gdi_cache_glyph_v2(rdpContext* context, const CACHE_GLYPH_V2_ORDER* cacheGlyphV2) { UINT32 i; 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, glyphData->x, glyphData->y, glyphData->cx, glyphData->cy, glyphData->cb, glyphData->aj); if (!glyph) return FALSE; if (!glyph_cache_put(cache->glyph, cacheGlyphV2->cacheId, glyphData->cacheIndex, glyph)) { glyph->Free(context, glyph); return FALSE; } } return TRUE; }
BOOL update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fastGlyph) { INT32 x, y; rdpGlyph* glyph; BYTE text_data[2]; INT32 opLeft, opTop; INT32 opRight, opBottom; GLYPH_DATA_V2* glyphData; rdpCache* cache = context->cache; opLeft = fastGlyph->opLeft; opTop = fastGlyph->opTop; opRight = fastGlyph->opRight; opBottom = fastGlyph->opBottom; x = fastGlyph->x; y = fastGlyph->y; if (opBottom == -32768) { BYTE flags = (BYTE) (opTop & 0x0F); if (flags & 0x01) opBottom = fastGlyph->bkBottom; if (flags & 0x02) opRight = fastGlyph->bkRight; if (flags & 0x04) opTop = fastGlyph->bkTop; if (flags & 0x08) opLeft = fastGlyph->bkLeft; } if (opLeft == 0) opLeft = fastGlyph->bkLeft; if (opRight == 0) opRight = fastGlyph->bkRight; if (x == -32768) x = fastGlyph->bkLeft; if (y == -32768) y = fastGlyph->bkTop; if ((fastGlyph->cbData > 1) && (fastGlyph->glyphData.aj)) { /* got option font that needs to go into cache */ glyphData = &fastGlyph->glyphData; glyph = Glyph_Alloc(context); if (!glyph) return FALSE; glyph->x = glyphData->x; glyph->y = glyphData->y; glyph->cx = glyphData->cx; glyph->cy = glyphData->cy; glyph->cb = glyphData->cb; glyph->aj = malloc(glyphData->cb); if (!glyph->aj) goto error_aj; CopyMemory(glyph->aj, glyphData->aj, glyph->cb); if (!Glyph_New(context, glyph)) goto error_glyph_new; glyph_cache_put(cache->glyph, fastGlyph->cacheId, fastGlyph->data[0], glyph); } text_data[0] = fastGlyph->data[0]; text_data[1] = 0; return update_process_glyph_fragments(context, text_data, 1, fastGlyph->cacheId, fastGlyph->ulCharInc, fastGlyph->flAccel, fastGlyph->backColor, fastGlyph->foreColor, x, y, fastGlyph->bkLeft, fastGlyph->bkTop, fastGlyph->bkRight - fastGlyph->bkLeft, fastGlyph->bkBottom - fastGlyph->bkTop, opLeft, opTop, opRight - opLeft, opBottom - opTop, FALSE); error_glyph_new: free(glyph->aj); glyph->aj = NULL; error_aj: Glyph_Free(context, glyph); return FALSE; }
static BOOL update_gdi_fast_glyph(rdpContext* context, const FAST_GLYPH_ORDER* fastGlyph) { INT32 x, y; BYTE text_data[2]; INT32 opLeft, opTop; INT32 opRight, opBottom; INT32 opWidth = 0, opHeight = 0; INT32 bkWidth = 0, bkHeight = 0; rdpCache* cache; if (!context || !fastGlyph || !context->cache) return FALSE; cache = context->cache; opLeft = fastGlyph->opLeft; opTop = fastGlyph->opTop; opRight = fastGlyph->opRight; opBottom = fastGlyph->opBottom; x = fastGlyph->x; y = fastGlyph->y; if (opBottom == -32768) { BYTE flags = (BYTE)(opTop & 0x0F); if (flags & 0x01) opBottom = fastGlyph->bkBottom; if (flags & 0x02) opRight = fastGlyph->bkRight; if (flags & 0x04) opTop = fastGlyph->bkTop; if (flags & 0x08) opLeft = fastGlyph->bkLeft; } if (opLeft == 0) opLeft = fastGlyph->bkLeft; if (opRight == 0) opRight = fastGlyph->bkRight; /* See update_gdi_fast_index opRight comment. */ if (opRight > context->instance->settings->DesktopWidth) opRight = context->instance->settings->DesktopWidth; if (x == -32768) x = fastGlyph->bkLeft; if (y == -32768) y = fastGlyph->bkTop; if ((fastGlyph->cbData > 1) && (fastGlyph->glyphData.aj)) { /* got option font that needs to go into cache */ rdpGlyph* glyph; const GLYPH_DATA_V2* glyphData = &fastGlyph->glyphData; if (!glyphData) return FALSE; glyph = Glyph_Alloc(context, glyphData->x, glyphData->y, glyphData->cx, glyphData->cy, glyphData->cb, glyphData->aj); if (!glyph) return FALSE; if (!glyph_cache_put(cache->glyph, fastGlyph->cacheId, fastGlyph->data[0], glyph)) { glyph->Free(context, glyph); return FALSE; } } text_data[0] = fastGlyph->data[0]; text_data[1] = 0; if (fastGlyph->bkRight > fastGlyph->bkLeft) bkWidth = fastGlyph->bkRight - fastGlyph->bkLeft + 1; if (fastGlyph->bkBottom > fastGlyph->bkTop) bkHeight = fastGlyph->bkBottom - fastGlyph->bkTop + 1; if (opRight > opLeft) opWidth = opRight - opLeft + 1; if (opBottom > opTop) opHeight = opBottom - opTop + 1; return update_process_glyph_fragments(context, text_data, 1, fastGlyph->cacheId, fastGlyph->ulCharInc, fastGlyph->flAccel, fastGlyph->backColor, fastGlyph->foreColor, x, y, fastGlyph->bkLeft, fastGlyph->bkTop, bkWidth, bkHeight, opLeft, opTop, opWidth, opHeight, FALSE); }
void update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fast_glyph) { INT32 opLeft, opTop, opRight, opBottom; INT32 x, y; GLYPH_DATA_V2* glyph_data; rdpGlyph* glyph; rdpCache* cache = context->cache; BYTE text_data[2]; opLeft = fast_glyph->opLeft; opTop = fast_glyph->opTop; opRight = fast_glyph->opRight; opBottom = fast_glyph->opBottom; x = fast_glyph->x; y = fast_glyph->y; if (opBottom == -32768) { BYTE flags = (BYTE) (opTop & 0x0F); if (flags & 0x01) opBottom = fast_glyph->bkBottom; if (flags & 0x02) opRight = fast_glyph->bkRight; if (flags & 0x04) opTop = fast_glyph->bkTop; if (flags & 0x08) opLeft = fast_glyph->bkLeft; } if (opLeft == 0) opLeft = fast_glyph->bkLeft; if (opRight == 0) opRight = fast_glyph->bkRight; if (x == -32768) x = fast_glyph->bkLeft; if (y == -32768) y = fast_glyph->bkTop; if (fast_glyph->glyph_data != NULL) { /* got option font that needs to go into cache */ glyph_data = (GLYPH_DATA_V2*) (fast_glyph->glyph_data); glyph = Glyph_Alloc(context); glyph->x = glyph_data->x; glyph->y = glyph_data->y; glyph->cx = glyph_data->cx; glyph->cy = glyph_data->cy; glyph->aj = glyph_data->aj; glyph->cb = glyph_data->cb; Glyph_New(context, glyph); glyph_cache_put(cache->glyph, fast_glyph->cacheId, fast_glyph->data[0], glyph); free(fast_glyph->glyph_data); fast_glyph->glyph_data = NULL; } text_data[0] = fast_glyph->data[0]; text_data[1] = 0; update_process_glyph_fragments(context, text_data, 1, fast_glyph->cacheId, fast_glyph->ulCharInc, fast_glyph->flAccel, fast_glyph->backColor, fast_glyph->foreColor, x, y, fast_glyph->bkLeft, fast_glyph->bkTop, fast_glyph->bkRight - fast_glyph->bkLeft, fast_glyph->bkBottom - fast_glyph->bkTop, opLeft, opTop, opRight - opLeft, opBottom - opTop); }