summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/red_parse_qxl.c35
-rw-r--r--server/red_worker.c33
2 files changed, 25 insertions, 43 deletions
diff --git a/server/red_parse_qxl.c b/server/red_parse_qxl.c
index ee099a03..85caa88a 100644
--- a/server/red_parse_qxl.c
+++ b/server/red_parse_qxl.c
@@ -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,
diff --git a/server/red_worker.c b/server/red_worker.c
index 8c36c133..e95d51a5 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -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]);
}
}
}