int APP_CC xrdp_cache_add_char(struct xrdp_cache* self, struct xrdp_font_char* font_item) { int i; int j; int oldest; int f; int c; int datasize; struct xrdp_font_char* fi; self->char_stamp++; /* look for match */ for (i = 7; i < 12; i++) { for (j = 0; j < 250; j++) { if (xrdp_font_item_compare(&self->char_items[i][j].font_item, font_item)) { self->char_items[i][j].stamp = self->char_stamp; DEBUG(("found font at %d %d", i, j)); return MAKELONG(j, i); } } } /* look for oldest */ f = 0; c = 0; oldest = 0x7fffffff; for (i = 7; i < 12; i++) { for (j = 0; j < 250; j++) { if (self->char_items[i][j].stamp < oldest) { oldest = self->char_items[i][j].stamp; f = i; c = j; } } } DEBUG(("adding char at %d %d", f, c)); /* set, send char and return */ fi = &self->char_items[f][c].font_item; g_free(fi->data); datasize = FONT_DATASIZE(font_item); fi->data = (char*)g_malloc(datasize, 1); g_memcpy(fi->data, font_item->data, datasize); fi->offset = font_item->offset; fi->baseline = font_item->baseline; fi->width = font_item->width; fi->height = font_item->height; self->char_items[f][c].stamp = self->char_stamp; libxrdp_orders_send_font(self->session, fi, f, c); return MAKELONG(c, f); }
int DEFAULT_CC server_add_char(struct xrdp_mod* mod, int font, int charactor, int offset, int baseline, int width, int height, char* data) { struct xrdp_font_char fi; fi.offset = offset; fi.baseline = baseline; fi.width = width; fi.height = height; fi.incby = 0; fi.data = data; return libxrdp_orders_send_font(((struct xrdp_wm*)mod->wm)->session, &fi, font, charactor); }
int xrdp_server_cache_glyph(xrdpModule* mod, XRDP_MSG_CACHE_GLYPH* msg) { return libxrdp_orders_send_font(mod->session, msg); }