don't load font unless needed

ulab-original
jsorg71 20 years ago
parent 750f55b6ef
commit 5a149e01ae

@ -216,6 +216,7 @@ struct xrdp_painter* xrdp_painter_create(struct xrdp_wm* wn);
void xrdp_painter_delete(struct xrdp_painter* self); void xrdp_painter_delete(struct xrdp_painter* self);
int xrdp_painter_begin_update(struct xrdp_painter* self); int xrdp_painter_begin_update(struct xrdp_painter* self);
int xrdp_painter_end_update(struct xrdp_painter* self); int xrdp_painter_end_update(struct xrdp_painter* self);
int xrdp_painter_font_needed(struct xrdp_painter* self);
int xrdp_painter_set_clip(struct xrdp_painter* self, int xrdp_painter_set_clip(struct xrdp_painter* self,
int x, int y, int cx, int cy); int x, int y, int cx, int cy);
int xrdp_painter_clr_clip(struct xrdp_painter* self); int xrdp_painter_clr_clip(struct xrdp_painter* self);

@ -233,6 +233,7 @@ int xrdp_bitmap_set_focus(struct xrdp_bitmap* self, int focused)
return 0; return 0;
} }
painter = xrdp_painter_create(self->wm); painter = xrdp_painter_create(self->wm);
xrdp_painter_font_needed(painter);
xrdp_painter_begin_update(painter); xrdp_painter_begin_update(painter);
if (focused) if (focused)
{ {
@ -827,6 +828,7 @@ int xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
if (self->type == WND_TYPE_BITMAP) /* if 0, bitmap, leave */ if (self->type == WND_TYPE_BITMAP) /* if 0, bitmap, leave */
return 0; return 0;
painter = xrdp_painter_create(self->wm); painter = xrdp_painter_create(self->wm);
xrdp_painter_font_needed(painter);
painter->rop = 0xcc; /* copy */ painter->rop = 0xcc; /* copy */
if (rect == 0) if (rect == 0)
painter->use_clip = 0; painter->use_clip = 0;

@ -73,6 +73,7 @@ struct xrdp_font* xrdp_font_create(struct xrdp_wm* wm)
int datasize; int datasize;
struct xrdp_font_item* f; struct xrdp_font_item* f;
//g_printf("loading font\n");
self = (struct xrdp_font*)g_malloc(sizeof(struct xrdp_font), 1); self = (struct xrdp_font*)g_malloc(sizeof(struct xrdp_font), 1);
self->wm = wm; self->wm = wm;
make_stream(s); make_stream(s);

@ -31,7 +31,6 @@ struct xrdp_painter* xrdp_painter_create(struct xrdp_wm* wm)
self->wm = wm; self->wm = wm;
self->orders = wm->orders; self->orders = wm->orders;
self->rop = 0xcc; /* copy */ self->rop = 0xcc; /* copy */
self->font = xrdp_font_create(wm);
self->clip_children = 1; self->clip_children = 1;
return self; return self;
} }
@ -61,6 +60,16 @@ int xrdp_painter_end_update(struct xrdp_painter* self)
return 0; return 0;
} }
/*****************************************************************************/
int xrdp_painter_font_needed(struct xrdp_painter* self)
{
if (self->font == 0)
{
self->font = xrdp_font_create(self->wm);
}
return 0;
}
/*****************************************************************************/ /*****************************************************************************/
/* returns boolean, true if there is something to draw */ /* returns boolean, true if there is something to draw */
int xrdp_painter_clip_adj(struct xrdp_painter* self, int* x, int* y, int xrdp_painter_clip_adj(struct xrdp_painter* self, int* x, int* y,
@ -415,6 +424,7 @@ int xrdp_painter_text_width(struct xrdp_painter* self, char* text)
int len; int len;
struct xrdp_font_item* font_item; struct xrdp_font_item* font_item;
xrdp_painter_font_needed(self);
rv = 0; rv = 0;
len = g_strlen(text); len = g_strlen(text);
for (index = 0; index < len; index++) for (index = 0; index < len; index++)
@ -433,6 +443,7 @@ int xrdp_painter_text_height(struct xrdp_painter* self, char* text)
int len; int len;
struct xrdp_font_item* font_item; struct xrdp_font_item* font_item;
xrdp_painter_font_needed(self);
rv = 0; rv = 0;
len = g_strlen(text); len = g_strlen(text);
for (index = 0; index < len; index++) for (index = 0; index < len; index++)
@ -480,6 +491,7 @@ int xrdp_painter_draw_text(struct xrdp_painter* self,
{ {
return 0; return 0;
} }
xrdp_painter_font_needed(self);
font = self->font; font = self->font;
f = 0; f = 0;
k = 0; k = 0;

Loading…
Cancel
Save