mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-29 17:07:15 +00:00
Properly parse QXLLineAttrs.style
This commit is contained in:
parent
fe4f90210f
commit
31d2d6e4e4
@ -3027,7 +3027,7 @@ static void canvas_draw_stroke(SpiceCanvas *spice_canvas, SpiceRect *bbox,
|
||||
|
||||
dashed = 0;
|
||||
if (stroke->attr.flags & SPICE_LINE_FLAGS_STYLED) {
|
||||
SPICE_FIXED28_4 *style = (SPICE_FIXED28_4*)SPICE_GET_ADDRESS(stroke->attr.style);
|
||||
SPICE_FIXED28_4 *style = stroke->attr.style;
|
||||
int nseg;
|
||||
|
||||
dashed = 1;
|
||||
|
||||
@ -1590,9 +1590,8 @@ static void gdi_canvas_draw_text(SpiceCanvas *spice_canvas, SpiceRect *bbox, Spi
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t *gdi_get_userstyle(GdiCanvas *canvas, uint8_t nseg, SPICE_ADDRESS addr, int start_is_gap)
|
||||
static uint32_t *gdi_get_userstyle(GdiCanvas *canvas, uint8_t nseg, SPICE_FIXED28_4* style, int start_is_gap)
|
||||
{
|
||||
SPICE_FIXED28_4* style = (SPICE_FIXED28_4*)SPICE_GET_ADDRESS(addr);
|
||||
double offset = 0;
|
||||
uint32_t *local_style;
|
||||
int i;
|
||||
|
||||
@ -557,24 +557,35 @@ static void red_put_rop3(SpiceRop3 *red)
|
||||
static void red_get_stroke_ptr(RedMemSlotInfo *slots, int group_id,
|
||||
SpiceStroke *red, QXLStroke *qxl)
|
||||
{
|
||||
red->path = red_get_path(slots, group_id, qxl->path);
|
||||
red->attr.flags = qxl->attr.flags;
|
||||
if (red->attr.flags & SPICE_LINE_FLAGS_STYLED) {
|
||||
red->attr.style_nseg = qxl->attr.style_nseg;
|
||||
red->attr.style = qxl->attr.style;
|
||||
} else {
|
||||
red->attr.style_nseg = 0;
|
||||
red->attr.style = 0;
|
||||
}
|
||||
red_get_brush_ptr(slots, group_id, &red->brush, &qxl->brush);
|
||||
red->fore_mode = qxl->fore_mode;
|
||||
red->back_mode = qxl->back_mode;
|
||||
red->path = red_get_path(slots, group_id, qxl->path);
|
||||
red->attr.flags = qxl->attr.flags;
|
||||
if (red->attr.flags & SPICE_LINE_FLAGS_STYLED) {
|
||||
int style_nseg;
|
||||
uint8_t *buf;
|
||||
|
||||
style_nseg = qxl->attr.style_nseg;
|
||||
red->attr.style = spice_malloc_n(style_nseg, sizeof(SPICE_FIXED28_4));
|
||||
red->attr.style_nseg = style_nseg;
|
||||
ASSERT(qxl->attr.style);
|
||||
buf = (uint8_t *)get_virt(slots, qxl->attr.style,
|
||||
style_nseg * sizeof(QXLFIXED), group_id);
|
||||
memcpy(red->attr.style, buf, style_nseg * sizeof(QXLFIXED));
|
||||
} else {
|
||||
red->attr.style_nseg = 0;
|
||||
red->attr.style = NULL;
|
||||
}
|
||||
red_get_brush_ptr(slots, group_id, &red->brush, &qxl->brush);
|
||||
red->fore_mode = qxl->fore_mode;
|
||||
red->back_mode = qxl->back_mode;
|
||||
}
|
||||
|
||||
static void red_put_stroke(SpiceStroke *red)
|
||||
{
|
||||
red_put_brush(&red->brush);
|
||||
free(red->path);
|
||||
if (red->attr.flags & SPICE_LINE_FLAGS_STYLED) {
|
||||
free(red->attr.style);
|
||||
}
|
||||
}
|
||||
|
||||
static SpiceString *red_get_string(RedMemSlotInfo *slots, int group_id,
|
||||
|
||||
@ -4093,33 +4093,10 @@ static void localize_mask(RedWorker *worker, SpiceQMask *mask, SpiceImage *image
|
||||
}
|
||||
}
|
||||
|
||||
static void localize_attr(RedWorker *worker, SpiceLineAttr *attr, uint32_t group_id)
|
||||
{
|
||||
if (attr->style_nseg) {
|
||||
uint8_t *buf;
|
||||
uint8_t *data;
|
||||
|
||||
ASSERT(attr->style);
|
||||
buf = (uint8_t *)get_virt(&worker->mem_slots, attr->style, attr->style_nseg * sizeof(uint32_t),
|
||||
group_id);
|
||||
data = spice_malloc_n(attr->style_nseg, sizeof(uint32_t));
|
||||
memcpy(data, buf, attr->style_nseg * sizeof(uint32_t));
|
||||
attr->style = (QXLPHYSICAL)data;
|
||||
}
|
||||
}
|
||||
|
||||
static void unlocalize_attr(SpiceLineAttr *attr)
|
||||
{
|
||||
if (attr->style_nseg) {
|
||||
free((void *)attr->style);
|
||||
attr->style = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
|
||||
{
|
||||
RedSurface *surface;
|
||||
SpiceCanvas *canvas;
|
||||
SpiceCanvas *canvas;
|
||||
SpiceClip clip = drawable->red_drawable->clip;
|
||||
|
||||
surface = &worker->surfaces[drawable->surface_id];
|
||||
@ -4227,10 +4204,8 @@ static void red_draw_qxl_drawable(RedWorker *worker, Drawable *drawable)
|
||||
SpiceStroke stroke = drawable->red_drawable->u.stroke;
|
||||
SpiceImage img1;
|
||||
localize_brush(worker, &stroke.brush, &img1);
|
||||
localize_attr(worker, &stroke.attr, drawable->group_id);
|
||||
canvas->ops->draw_stroke(canvas,
|
||||
&drawable->red_drawable->bbox, &clip, &stroke);
|
||||
unlocalize_attr(&stroke.attr);
|
||||
break;
|
||||
}
|
||||
case QXL_DRAW_TEXT: {
|
||||
@ -6388,15 +6363,11 @@ static void fill_mask(DisplayChannel *display_channel, SpiceMarshaller *m,
|
||||
|
||||
static void fill_attr(DisplayChannel *display_channel, SpiceMarshaller *m, SpiceLineAttr *attr, uint32_t group_id)
|
||||
{
|
||||
RedChannel *channel = &display_channel->base;
|
||||
uint32_t *style;
|
||||
int i;
|
||||
|
||||
if (m && attr->style_nseg) {
|
||||
style = (uint32_t *)get_virt(&channel->worker->mem_slots, attr->style,
|
||||
attr->style_nseg * sizeof(uint32_t), group_id);
|
||||
for (i = 0 ; i < attr->style_nseg; i++) {
|
||||
spice_marshaller_add_uint32(m, style[i]);
|
||||
spice_marshaller_add_uint32(m, attr->style[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -536,7 +536,7 @@ struct LineAttr {
|
||||
} u1 @anon;
|
||||
switch (flags) {
|
||||
case STYLED:
|
||||
fixed28_4 *style[style_nseg];
|
||||
fixed28_4 *style[style_nseg] @c_ptr;
|
||||
} u2 @anon;
|
||||
};
|
||||
|
||||
|
||||
@ -493,7 +493,7 @@ struct LineAttr {
|
||||
uint8 style_nseg;
|
||||
fixed28_4 width @zero;
|
||||
fixed28_4 miter_limit @zero;
|
||||
fixed28_4 *style[style_nseg];
|
||||
fixed28_4 *style[style_nseg] @c_ptr;
|
||||
};
|
||||
|
||||
struct RasterGlyphA1 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user