/*****************************************************************************/ staticint
xrdp_painter_add_dirty_rect(struct xrdp_painter *self, int x, int y, int cx, int cy, struct xrdp_rect *clip_rect)
{ int x2; int y2; struct xrdp_rect rect;
if (clip_rect != 0)
{
x2 = x + cx;
y2 = y + cy;
x = MAX(x, clip_rect->left);
y = MAX(y, clip_rect->top);
x2 = MIN(x2, clip_rect->right);
y2 = MIN(y2, clip_rect->bottom);
cx = x2 - x;
cy = y2 - y;
} if (cx < 1 || cy < 1)
{ return0;
}
rect.left = x;
rect.top = y;
rect.right = x + cx;
rect.bottom = y + cy;
xrdp_region_add_rect(self->dirty_region, &rect);
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_add_dirty_rect: x %d y %d cx %d cy %d",
x, y, cx, cy); return0;
}
/*****************************************************************************/ staticint
xrdp_painter_send_dirty(struct xrdp_painter *self)
{ int cx; int cy; int bpp; int Bpp; int index; int jndex; int error; char *ldata; char *src; char *dst; struct xrdp_rect rect;
/*****************************************************************************/ int
wm_painter_set_target(struct xrdp_painter *self)
{ int surface_index; int index; struct list *del_list;
/*****************************************************************************/ int
xrdp_painter_end_update(struct xrdp_painter *self)
{
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_end_update:"); if (self == 0)
{ return0;
}
self->begin_end_level--;
if (self->painter != 0)
{ #ifdefined(XRDP_PAINTER) if (self->begin_end_level == 0)
{
xrdp_painter_send_dirty(self); return0;
} #endif
}
libxrdp_orders_send(self->session); return0;
}
/*****************************************************************************/ int
xrdp_painter_font_needed(struct xrdp_painter *self)
{ if (self->font == 0)
{
self->font = self->wm->default_font;
}
return0;
}
#if0 /*****************************************************************************/ /* returns boolean, true if there is something to draw */ staticint
xrdp_painter_clip_adj(struct xrdp_painter *self, int *x, int *y, int *cx, int *cy)
{ int dx; int dy;
/*****************************************************************************/ int
xrdp_painter_set_clip(struct xrdp_painter *self, int x, int y, int cx, int cy)
{
self->use_clip = &self->clip;
self->clip.left = x;
self->clip.top = y;
self->clip.right = x + cx;
self->clip.bottom = y + cy; return0;
}
/*****************************************************************************/ staticint
get_rgb_from_rdp_color(struct xrdp_painter *self, int rdp_color)
{ if (self->wm->screen->bpp < 24)
{ return rdp_color;
} /* well, this is really BGR2RGB */ return XR_RGB2BGR(rdp_color);
}
#endif
/*****************************************************************************/ /* fill in an area of the screen with one color */ int
xrdp_painter_fill_rect(struct xrdp_painter *self, struct xrdp_bitmap *dst, int x, int y, int cx, int cy)
{ struct xrdp_rect clip_rect; struct xrdp_rect draw_rect; struct xrdp_rect rect; struct xrdp_region *region; struct xrdp_brush brush; int k; int dx; int dy; int rop;
while (xrdp_region_get_rect(region, k, &rect) == 0)
{ if (rect_intersect(&rect, &clip_rect, &draw_rect))
{
libxrdp_orders_pat_blt(self->session, x, y, cx, cy,
rop, self->bg_color, self->fg_color,
&brush, &draw_rect);
}
k++;
}
}
xrdp_region_delete(region); return0;
}
/*****************************************************************************/ staticint
xrdp_painter_draw_utf32(struct xrdp_painter *self, struct xrdp_bitmap *dst, int x, int y,
char32_t utf32[], unsignedint utf32len)
{ int i; int f; int c; int k; int x1; int y1; int flags; unsignedint index; int total_width; int total_height; int dx; int dy; char *data; struct xrdp_region *region; struct xrdp_rect rect; struct xrdp_rect clip_rect; struct xrdp_rect draw_rect; struct xrdp_font *font; struct xrdp_font_char *font_item;
if (dst->type != WND_TYPE_OFFSCREEN)
{
ldst = self->wm->screen;
font = self->font;
// Calculate total width and height fields
total_width = 0;
total_height = 0;
for (index = 0 ; index < utf32len; ++index)
{
font_item = XRDP_FONT_GET_CHAR(font, utf32[index]);
k = font_item->incby;
total_width += k; /* Use the nominal height of the font to work out the
* actual height of this glyph */ int glyph_height =
font->body_height + font_item->baseline + font_item->height;
total_height = MAX(total_height, glyph_height);
}
font = self->font;
f = 0;
k = 0;
total_width = 0;
total_height = 0;
index = 0;
data = (char *)g_malloc(utf32len * 2, 1);
for (index = 0 ; index < utf32len; ++index)
{
font_item = XRDP_FONT_GET_CHAR(font, utf32[index]);
i = xrdp_cache_add_char(self->wm->cache, font_item);
f = HIWORD(i);
c = LOWORD(i);
data[index * 2] = c;
data[index * 2 + 1] = k;
k = font_item->incby;
total_width += k; /* Use the nominal height of the font to work out the
* actual height of this glyph */ int glyph_height =
font->body_height + font_item->baseline + font_item->height;
total_height = MAX(total_height, glyph_height);
}
xrdp_bitmap_get_screen_clip(dst, self, &clip_rect, &dx, &dy);
region = xrdp_region_create(self->wm);
if (dst->type != WND_TYPE_OFFSCREEN)
{
xrdp_wm_get_vis_region(self->wm, dst, x, y, total_width, total_height,
region, self->clip_children);
} else
{
xrdp_region_add_rect(region, &clip_rect);
}
x += dx;
y += dy;
k = 0;
while (xrdp_region_get_rect(region, k, &rect) == 0)
{ if (rect_intersect(&rect, &clip_rect, &draw_rect))
{
x1 = x;
y1 = y + font->body_height;
flags = 0x03; /* 0x03 0x73; TEXT2_IMPLICIT_X and something else */
libxrdp_orders_text(self->session, f, flags, 0,
self->fg_color, 0,
x - 1, y - 1, x + total_width, y + total_height, 0, 0, 0, 0,
x1, y1, data, utf32len * 2, &draw_rect);
}
/*****************************************************************************/ int
xrdp_painter_draw_text(struct xrdp_painter *self, struct xrdp_bitmap *dst, int x, int y, constchar *text)
{ int rv = 0; unsignedint c32_count = utf8_char_count(text);
if (c32_count > 0)
{
char32_t *utf32 = (char32_t *)malloc(c32_count * sizeof(char32_t)); if (utf32 == NULL)
{
rv = 1;
} else
{ unsignedint i = 0;
char32_t c32;
/*****************************************************************************/ int
xrdp_painter_draw_text2(struct xrdp_painter *self, struct xrdp_bitmap *dst, int font, int flags, int mixmode, int clip_left, int clip_top, int clip_right, int clip_bottom, int box_left, int box_top, int box_right, int box_bottom, int x, int y, char *data, int data_len)
{ struct xrdp_rect clip_rect; struct xrdp_rect draw_rect; struct xrdp_rect rect; struct xrdp_region *region; int k; int dx; int dy;
/*****************************************************************************/ int
xrdp_painter_draw_char(struct xrdp_painter *self, struct xrdp_bitmap *dst, int x, int y, char32_t chr, unsignedint repeat_count)
{ int rv = 0;
/*****************************************************************************/ int
xrdp_painter_copy(struct xrdp_painter *self, struct xrdp_bitmap *src, struct xrdp_bitmap *dst, int x, int y, int cx, int cy, int srcx, int srcy)
{ struct xrdp_rect clip_rect; struct xrdp_rect draw_rect; struct xrdp_rect rect1; struct xrdp_rect rect2; struct xrdp_region *region; struct xrdp_bitmap *b; int i; int j; int k; int dx; int dy; int palette_id; int bitmap_id; int cache_id; int cache_idx; int dstx; int dsty; int w; int h; int index; struct list *del_list;
xrdp_bitmap_get_screen_clip(dst, self, &clip_rect, &dx, &dy);
region = xrdp_region_create(self->wm);
xrdp_wm_get_vis_region(self->wm, dst, x, y, cx, cy, region,
self->clip_children);
x += dx;
y += dy;
k = 0;
painter_set_rop(self->painter, self->rop); while (xrdp_region_get_rect(region, k, &rect1) == 0)
{ if (rect_intersect(&rect1, &clip_rect, &draw_rect))
{
painter_set_clip(self->painter,
draw_rect.left, draw_rect.top,
draw_rect.right - draw_rect.left,
draw_rect.bottom - draw_rect.top);
LOG_DEVEL(LOG_LEVEL_DEBUG, " x %d y %d cx %d cy %d srcx %d srcy %d",
x, y, cx, cy, srcx, srcy);
painter_copy(self->painter, &dst_pb, x, y, cx, cy,
&src_pb, srcx, srcy);
xrdp_painter_add_dirty_rect(self, x, y, cx, cy,
&draw_rect);
}
k++;
}
painter_clear_clip(self->painter);
xrdp_region_delete(region);
}
return0; #endif
}
/* todo data */
if (dst->type == WND_TYPE_BITMAP)
{ return0;
}
if (src->type == WND_TYPE_SCREEN)
{
xrdp_bitmap_get_screen_clip(dst, self, &clip_rect, &dx, &dy);
region = xrdp_region_create(self->wm);
if (dst->type != WND_TYPE_OFFSCREEN)
{
xrdp_wm_get_vis_region(self->wm, dst, x, y, cx, cy,
region, self->clip_children);
} else
{
xrdp_region_add_rect(region, &clip_rect);
}
x += dx;
y += dy;
srcx += dx;
srcy += dy;
k = 0;
while (xrdp_region_get_rect(region, k, &rect1) == 0)
{ if (rect_intersect(&rect1, &clip_rect, &draw_rect))
{
libxrdp_orders_screen_blt(self->session, x, y, cx, cy,
srcx, srcy, self->rop, &draw_rect);
}
xrdp_bitmap_get_screen_clip(dst, self, &clip_rect, &dx, &dy);
region = xrdp_region_create(self->wm);
if (dst->type != WND_TYPE_OFFSCREEN)
{
LOG(LOG_LEVEL_DEBUG, "off screen to screen");
xrdp_wm_get_vis_region(self->wm, dst, x, y, cx, cy,
region, self->clip_children);
} else
{
LOG(LOG_LEVEL_DEBUG, "off screen to off screen");
xrdp_region_add_rect(region, &clip_rect);
}
x += dx;
y += dy;
palette_id = 0;
cache_id = 255; // todo
cache_idx = src->item_index; // todo
if (src->tab_stop == 0)
{
LOG(LOG_LEVEL_WARNING, "xrdp_painter_copy: warning src not created");
del_list = self->wm->cache->xrdp_os_del_list;
index = list_index_of(del_list, cache_idx);
list_remove_item(del_list, index);
libxrdp_orders_send_create_os_surface(self->session,
cache_idx,
src->width,
src->height,
del_list);
src->tab_stop = 1;
list_clear(del_list);
}
k = 0;
while (xrdp_region_get_rect(region, k, &rect1) == 0)
{ if (rect_intersect(&rect1, &clip_rect, &rect2))
{
MAKERECT(rect1, x, y, cx, cy);
if (rect_intersect(&rect2, &rect1, &draw_rect))
{
libxrdp_orders_mem_blt(self->session, cache_id, palette_id,
x, y, cx, cy, self->rop, srcx, srcy,
cache_idx, &draw_rect);
}
}
k++;
}
xrdp_region_delete(region);
} elseif (src->data != 0) /* todo, the non bitmap cache part is gone, it should be put back */
{
xrdp_bitmap_get_screen_clip(dst, self, &clip_rect, &dx, &dy);
region = xrdp_region_create(self->wm);
if (dst->type != WND_TYPE_OFFSCREEN)
{
xrdp_wm_get_vis_region(self->wm, dst, x, y, cx, cy,
region, self->clip_children);
} else
{
xrdp_region_add_rect(region, &clip_rect);
}
x += dx;
y += dy;
palette_id = 0;
j = srcy;
while (j < (srcy + cy))
{
i = srcx;
while (i < (srcx + cx))
{
w = MIN(64, ((srcx + cx) - i));
h = MIN(64, ((srcy + cy) - j));
b = xrdp_bitmap_create(w, h, src->bpp, 0, self->wm); #if1
xrdp_bitmap_copy_box_with_crc(src, b, i, j, w, h); #else
xrdp_bitmap_copy_box(src, b, i, j, w, h);
xrdp_bitmap_hash_crc(b); #endif
bitmap_id = xrdp_cache_add_bitmap(self->wm->cache, b, self->wm->hints);
cache_id = HIWORD(bitmap_id);
cache_idx = LOWORD(bitmap_id);
dstx = (x + i) - srcx;
dsty = (y + j) - srcy;
k = 0;
while (xrdp_region_get_rect(region, k, &rect1) == 0)
{ if (rect_intersect(&rect1, &clip_rect, &rect2))
{
MAKERECT(rect1, dstx, dsty, w, h);
/*****************************************************************************/ int
xrdp_painter_composite(struct xrdp_painter *self, struct xrdp_bitmap *src, int srcformat, int srcwidth, int srcrepeat, struct xrdp_bitmap *dst, int *srctransform, int mskflags, struct xrdp_bitmap *msk, int mskformat, int mskwidth, int mskrepeat, int op, int srcx, int srcy, int mskx, int msky, int dstx, int dsty, int width, int height, int dstformat)
{ struct xrdp_rect clip_rect; struct xrdp_rect draw_rect; struct xrdp_rect rect1; struct xrdp_rect rect2; struct xrdp_region *region; int k; int dx; int dy; int cache_srcidx; int cache_mskidx;
/*****************************************************************************/ int
xrdp_painter_line(struct xrdp_painter *self, struct xrdp_bitmap *dst, int x1, int y1, int x2, int y2)
{ struct xrdp_rect clip_rect; struct xrdp_rect draw_rect; struct xrdp_rect rect; struct xrdp_region *region; int k; int dx; int dy; int rop;
LOG_DEVEL(LOG_LEVEL_DEBUG, "xrdp_painter_line:"); if (self == 0)
{ return0;
} if (self->painter != 0)
{ #ifdefined(XRDP_PAINTER) int x; int y; int cx; int cy; struct painter_bitmap dst_pb; struct xrdp_bitmap *ldst;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.