xorg: work on dirty updates for bandwidth

ulab-next
Jay Sorg 12 years ago
parent 68ef36cc02
commit ea98b503ca

@ -194,18 +194,50 @@ typedef rdpWindowRec* rdpWindowPtr;
#define XR_EXT_STYLE_DIALOG (0x00040000)
#define RDI_FILL 1
#define RDI_IMGLL 2
#define RDI_IMGLY 3
#define RDI_IMGLL 2 /* lossless */
#define RDI_IMGLY 3 /* lossy */
#define RDI_LINE 4
struct rdp_draw_item
struct urdp_draw_item_fill
{
int type;
int opcode;
int fg_color;
int bg_color;
int pad0;
};
struct urdp_draw_item_img
{
int opcode;
RegionPtr reg;
int pad0;
};
struct urdp_draw_item_line
{
int opcode;
int fg_color;
int bg_color;
int width;
xSegment* segs;
int nseg;
int flags;
};
union urdp_draw_item
{
struct urdp_draw_item_fill fill;
struct urdp_draw_item_img img;
struct urdp_draw_item_line line;
};
struct rdp_draw_item
{
int type;
int flags;
struct rdp_draw_item* prev;
struct rdp_draw_item* next;
RegionPtr reg;
union urdp_draw_item u;
};
struct _rdpPixmapRec
@ -215,7 +247,7 @@ struct _rdpPixmapRec
int allocBytes;
int con_number;
int is_dirty;
int pad;
int pad0;
struct rdp_draw_item* draw_item_head;
struct rdp_draw_item* draw_item_tail;
};
@ -294,10 +326,15 @@ draw_item_remove_all(rdpPixmapRec* priv);
int
draw_item_pack(rdpPixmapRec* priv);
int
draw_item_add_img_region(rdpPixmapRec* priv, RegionPtr reg, int type);
draw_item_add_img_region(rdpPixmapRec* priv, RegionPtr reg, int opcode,
int type);
int
draw_item_add_fill_region(rdpPixmapRec* priv, RegionPtr reg, int color,
int opcode);
int
draw_item_add_line_region(rdpPixmapRec* priv, RegionPtr reg, int color,
int opcode, int width, xSegment* segs, int nsegs,
int is_segment);
PixmapPtr

@ -241,11 +241,13 @@ rdpCopyAreaPixmapToWnd(PixmapPtr pSrcPixmap, rdpPixmapRec* pSrcPriv,
if (num_clips > 0)
{
rdpup_begin_update();
LLOGLN(10, ("rdpCopyAreaPixmapToWnd: num_clips %d", num_clips));
for (j = 0; j < num_clips; j++)
{
box = REGION_RECTS(&clip_reg)[j];
LLOGLN(10, ("rdpCopyAreaPixmapToWnd: %d %d %d %d", box.x1, box.y1, box.x2, box.y2));
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
LLOGLN(10, ("rdpCopyAreaPixmapToWnd: %d %d", w, h));
rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy);
}
rdpup_reset_clip();
@ -281,6 +283,7 @@ rdpCopyAreaPixmapToPixmap(PixmapPtr pSrcPixmap, rdpPixmapRec* pSrcPriv,
pGC, srcx, srcy, w, h, dstx, dsty);
RegionInit(&clip_reg, NullBox, 0);
cd = rdp_get_clip(&clip_reg, &(pDstPixmap->drawable), pGC);
LLOGLN(10, ("rdpCopyAreaPixmapToPixmap: cd %d", cd));
ldstx = pDstPixmap->drawable.x + dstx;
ldsty = pDstPixmap->drawable.y + dsty;
lsrcx = pSrcPixmap->drawable.x + srcx;
@ -290,6 +293,7 @@ rdpCopyAreaPixmapToPixmap(PixmapPtr pSrcPixmap, rdpPixmapRec* pSrcPriv,
rdpup_switch_os_surface(pDstPriv->rdpindex);
rdpup_begin_update();
rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy);
LLOGLN(10, ("%d %d %d %d %d %d", ldstx, ldsty, w, h, lsrcx, lsrcy));
rdpup_end_update();
rdpup_switch_os_surface(-1);
}
@ -300,11 +304,13 @@ rdpCopyAreaPixmapToPixmap(PixmapPtr pSrcPixmap, rdpPixmapRec* pSrcPriv,
{
rdpup_switch_os_surface(pDstPriv->rdpindex);
rdpup_begin_update();
LLOGLN(10, ("rdpCopyAreaPixmapToPixmap: num_clips %d", num_clips));
for (j = 0; j < num_clips; j++)
{
box = REGION_RECTS(&clip_reg)[j];
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
rdpup_paint_rect_os(ldstx, ldsty, w, h, pSrcPriv->rdpindex, lsrcx, lsrcy);
LLOGLN(10, ("%d %d %d %d %d %d", ldstx, ldsty, w, h, lsrcx, lsrcy));
}
rdpup_reset_clip();
rdpup_end_update();

@ -148,7 +148,7 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
RegionUninit(&reg1);
}
else if (got_id)
@ -173,7 +173,7 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
RegionInit(&reg2, NullBox, 0);
RegionCopy(&reg2, &clip_reg);
RegionIntersect(&reg1, &reg1, &reg2);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
RegionUninit(&reg1);
RegionUninit(&reg2);
}

@ -180,7 +180,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
RegionUninit(&reg1);
}
else if (got_id)
@ -199,7 +199,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
{
if (dirty_type != 0)
{
draw_item_add_img_region(pDirtyPriv, &clip_reg, dirty_type);
draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
}
else if (got_id)
{

@ -149,7 +149,7 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
RegionUninit(&reg1);
}
else if (got_id)
@ -168,7 +168,7 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
{
if (dirty_type != 0)
{
draw_item_add_img_region(pDirtyPriv, &reg, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
}
else if (got_id)
{

@ -147,7 +147,7 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
RegionUninit(&reg1);
}
else if (got_id)
@ -166,7 +166,7 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
{
if (dirty_type != 0)
{
draw_item_add_img_region(pDirtyPriv, &reg, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
}
else if (got_id)
{
@ -174,7 +174,8 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
for (j = num_clips - 1; j >= 0; j--)
{
box = REGION_RECTS(&reg)[j];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
box.y2 - box.y1);
}
rdpup_end_update();
}

@ -147,7 +147,7 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
RegionUninit(&reg1);
}
else if (got_id)
@ -166,7 +166,7 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
{
if (dirty_type != 0)
{
draw_item_add_img_region(pDirtyPriv, &reg, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
}
else if (got_id)
{
@ -174,7 +174,8 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
for (j = num_clips - 1; j >= 0; j--)
{
box = REGION_RECTS(&reg)[j];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
box.y2 - box.y1);
}
rdpup_end_update();
}

@ -161,7 +161,7 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
{
if (dirty_type != 0)
{
draw_item_add_img_region(pDirtyPriv, tmpRegion, dirty_type);
draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
}
else if (got_id)
{
@ -169,7 +169,8 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
for (i = num_clips - 1; i >= 0; i--)
{
box = REGION_RECTS(tmpRegion)[i];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
box.y2 - box.y1);
}
rdpup_end_update();
}
@ -188,7 +189,7 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
{
if (dirty_type != 0)
{
draw_item_add_img_region(pDirtyPriv, tmpRegion, dirty_type);
draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
}
else if (got_id)
{
@ -196,7 +197,8 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
for (i = num_clips - 1; i >= 0; i--)
{
box = REGION_RECTS(tmpRegion)[i];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
box.y2 - box.y1);
}
rdpup_end_update();
}

@ -161,7 +161,7 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
{
if (dirty_type != 0)
{
draw_item_add_img_region(pDirtyPriv, tmpRegion, dirty_type);
draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
}
else if (got_id)
{
@ -169,7 +169,8 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
for (i = num_clips - 1; i >= 0; i--)
{
box = REGION_RECTS(tmpRegion)[i];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
box.y2 - box.y1);
}
rdpup_end_update();
}
@ -188,7 +189,7 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
{
if (dirty_type != 0)
{
draw_item_add_img_region(pDirtyPriv, tmpRegion, dirty_type);
draw_item_add_img_region(pDirtyPriv, tmpRegion, GXcopy, dirty_type);
}
else if (got_id)
{
@ -196,7 +197,8 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
for (i = num_clips - 1; i >= 0; i--)
{
box = REGION_RECTS(tmpRegion)[i];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
box.y2 - box.y1);
}
rdpup_end_update();
}

@ -152,7 +152,7 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
}
else
{
draw_item_add_img_region(pDirtyPriv, fill_reg, RDI_IMGLL);
draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, RDI_IMGLL);
}
}
else if (got_id)
@ -210,7 +210,7 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
}
else
{
draw_item_add_img_region(pDirtyPriv, &clip_reg, RDI_IMGLL);
draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, RDI_IMGLL);
}
}
else if (got_id)

@ -149,7 +149,7 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
RegionUninit(&reg1);
}
else if (got_id)
@ -168,7 +168,7 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
{
if (dirty_type != 0)
{
draw_item_add_img_region(pDirtyPriv, &reg, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
}
else if (got_id)
{
@ -176,7 +176,8 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
for (j = num_clips - 1; j >= 0; j--)
{
box = REGION_RECTS(&reg)[j];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
box.y2 - box.y1);
}
rdpup_end_update();
}

@ -188,7 +188,17 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
{
if (dirty_type != 0)
{
/* TODO */
fill_reg = RegionFromRects(nrects * 4, regRects, CT_NONE);
if (pGC->lineStyle == LineSolid)
{
draw_item_add_fill_region(pDirtyPriv, fill_reg, pGC->fgPixel,
pGC->alu);
}
else
{
draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, dirty_type);
}
RegionDestroy(fill_reg);
}
else if (got_id)
{
@ -227,7 +237,15 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
{
if (dirty_type != 0)
{
/* TODO */
if (pGC->lineStyle == LineSolid)
{
draw_item_add_fill_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
pGC->alu);
}
else
{
draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
}
}
else if (got_id)
{

@ -55,6 +55,10 @@ rdpPolySegmentOrg(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
GC_OP_EPILOGUE(pGC);
}
/* in rdpPolylines.c */
void
RegionAroundSegs(RegionPtr reg, xSegment* segs, int nsegs);
/******************************************************************************/
void
rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
@ -75,7 +79,7 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpPolySegment:"));
LLOGLN(10, ("rdpPolySegment: %d", nseg));
segs = 0;
if (nseg) /* get the rects */
@ -142,13 +146,18 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
RegionInit(&clip_reg, NullBox, 0);
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
LLOGLN(10, ("rdpPolySegment: cd %d", cd));
if (cd == 1) /* no clip */
{
if (segs != 0)
{
if (dirty_type != 0)
{
/* TODO */
RegionUninit(&clip_reg);
RegionInit(&clip_reg, NullBox, 0);
RegionAroundSegs(&clip_reg, segs, nseg);
draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
pGC->alu, pGC->lineWidth, segs, nseg, 1);
}
else if (got_id)
{
@ -171,7 +180,8 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
{
if (dirty_type != 0)
{
/* TODO */
draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
pGC->alu, pGC->lineWidth, segs, nseg, 1);
}
else if (got_id)
{
@ -186,6 +196,8 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
for (i = 0; i < nseg; i++)
{
rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
LLOGLN(10, (" %d %d %d %d", segs[i].x1, segs[i].y1,
segs[i].x2, segs[i].y2));
}
}
rdpup_reset_clip();

@ -150,7 +150,7 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
RegionUninit(&reg1);
}
else if (got_id)
@ -169,7 +169,7 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
{
if (dirty_type != 0)
{
draw_item_add_img_region(pDirtyPriv, &reg, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
}
else if (got_id)
{

@ -150,7 +150,7 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
RegionUninit(&reg1);
}
else if (got_id)
@ -169,7 +169,7 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
{
if (dirty_type != 0)
{
draw_item_add_img_region(pDirtyPriv, &reg, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg, GXcopy, dirty_type);
}
else if (got_id)
{

@ -56,6 +56,46 @@ rdpPolylinesOrg(DrawablePtr pDrawable, GCPtr pGC, int mode,
GC_OP_EPILOGUE(pGC);
}
/******************************************************************************/
void
RegionAroundSegs(RegionPtr reg, xSegment* segs, int nseg)
{
int index;
BoxRec box;
RegionRec treg;
index = 0;
while (index < nseg)
{
if (segs[index].x1 < segs[index].x2)
{
box.x1 = segs[index].x1;
box.x2 = segs[index].x2;
}
else
{
box.x1 = segs[index].x2;
box.x2 = segs[index].x1;
}
box.x2++;
if (segs[index].y1 < segs[index].y2)
{
box.y1 = segs[index].y1;
box.y2 = segs[index].y2;
}
else
{
box.y1 = segs[index].y2;
box.y2 = segs[index].y1;
}
box.y2++;
RegionInit(&treg, &box, 0);
RegionUnion(reg, reg, &treg);
RegionUninit(&treg);
index++;
}
}
/******************************************************************************/
void
rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
@ -66,32 +106,58 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
int cd;
int i;
int j;
int x1;
int y1;
int x2;
int y2;
int got_id;
int dirty_type;
int post_process;
int reset_surface;
BoxRec box;
DDXPointPtr ppts;
xSegment* segs;
int nseg;
struct image_data id;
WindowPtr pDstWnd;
PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpPolylines:"));
LLOGLN(0, ("rdpPolylines:"));
ppts = 0;
if (npt > 0)
/* convert lines to line segments */
nseg = npt - 1;
segs = 0;
if (npt > 1)
{
ppts = (DDXPointPtr)g_malloc(sizeof(DDXPointRec) * npt, 0);
for (i = 0; i < npt; i++)
segs = (xSegment*)g_malloc(sizeof(xSegment) * npt - 1, 0);
segs[0].x1 = pptInit[0].x + pDrawable->x;
segs[0].y1 = pptInit[0].y + pDrawable->y;
if (mode == CoordModeOrigin)
{
ppts[i] = pptInit[i];
segs[0].x2 = pptInit[1].x + pDrawable->x;
segs[0].y2 = pptInit[1].y + pDrawable->y;
}
else
{
segs[0].x2 = segs[0].x1 + pptInit[1].x;
segs[0].y2 = segs[0].y1 + pptInit[1].y;
}
for (i = 2; i < npt; i++)
{
segs[i - 1].x1 = segs[i - 2].x2;
segs[i - 1].y1 = segs[i - 2].y2;
if (mode == CoordModeOrigin)
{
segs[i - 1].x2 = pptInit[i].x + pDrawable->x;
segs[i - 1].y2 = pptInit[i].x + pDrawable->x;
}
else
{
segs[i - 1].x2 = segs[i - 2].x2 + pptInit[i].x;
segs[i - 1].y2 = segs[i - 2].y2 + pptInit[i].y;
}
}
}
else
{
LLOGLN(10, ("rdpPolylines: weird npt [%d]", npt));
}
/* do original call */
@ -114,7 +180,7 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
LLOGLN(10, ("rdpPolylines: gettig dirty"));
pDstPriv->is_dirty = 1;
pDirtyPriv = pDstPriv;
dirty_type = RDI_IMGLL;
dirty_type = RDI_LINE;
}
else
{
@ -140,7 +206,7 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
}
if (!post_process)
{
g_free(ppts);
g_free(segs);
return;
}
@ -148,11 +214,15 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
if (cd == 1)
{
if (ppts != 0)
if (segs != 0)
{
if (dirty_type != 0)
{
/* TODO */
RegionUninit(&clip_reg);
RegionInit(&clip_reg, NullBox, 0);
RegionAroundSegs(&clip_reg, segs, nseg);
draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
pGC->alu, pGC->lineWidth, segs, nseg, 0);
}
else if (got_id)
{
@ -160,23 +230,9 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
rdpup_set_fgcolor(pGC->fgPixel);
rdpup_set_opcode(pGC->alu);
rdpup_set_pen(0, pGC->lineWidth);
x1 = ppts[0].x + pDrawable->x;
y1 = ppts[0].y + pDrawable->y;
for (i = 1; i < npt; i++)
for (i = 0; i < nseg; i++)
{
if (mode == CoordModeOrigin)
{
x2 = pDrawable->x + ppts[i].x;
y2 = pDrawable->y + ppts[i].y;
}
else
{
x2 = x1 + ppts[i].x;
y2 = y1 + ppts[i].y;
}
rdpup_draw_line(x1, y1, x2, y2);
x1 = x2;
y1 = y2;
rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
}
rdpup_set_opcode(GXcopy);
rdpup_end_update();
@ -186,11 +242,12 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
else if (cd == 2)
{
num_clips = REGION_NUM_RECTS(&clip_reg);
if (ppts != 0 && num_clips > 0)
if (nseg != 0 && num_clips > 0)
{
if (dirty_type != 0)
{
/* TODO */
draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
pGC->alu, pGC->lineWidth, segs, nseg, 0);
}
else if (got_id)
{
@ -202,23 +259,9 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
{
box = REGION_RECTS(&clip_reg)[j];
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
x1 = ppts[0].x + pDrawable->x;
y1 = ppts[0].y + pDrawable->y;
for (i = 1; i < npt; i++)
for (i = 0; i < nseg; i++)
{
if (mode == CoordModeOrigin)
{
x2 = pDrawable->x + ppts[i].x;
y2 = pDrawable->y + ppts[i].y;
}
else
{
x2 = x1 + ppts[i].x;
y2 = y1 + ppts[i].y;
}
rdpup_draw_line(x1, y1, x2, y2);
x1 = x2;
y1 = y2;
rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
}
}
rdpup_reset_clip();
@ -227,8 +270,8 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
}
}
}
g_free(segs);
RegionUninit(&clip_reg);
g_free(ppts);
if (reset_surface)
{
rdpup_switch_os_surface(-1);

@ -143,7 +143,7 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
RegionUninit(&reg1);
}
else if (got_id)
@ -167,7 +167,7 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &clip_reg, dirty_type);
draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type);
RegionUninit(&reg1);
}
else if (got_id)

@ -141,7 +141,7 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
RegionUninit(&reg1);
}
else if (got_id)
@ -163,7 +163,7 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
RegionInit(&reg2, NullBox, 0);
RegionCopy(&reg2, &clip_reg);
RegionIntersect(&reg1, &reg1, &reg2);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
RegionUninit(&reg1);
RegionUninit(&reg2);
}

@ -420,8 +420,15 @@ draw_item_remove(rdpPixmapRec* priv, struct rdp_draw_item* di)
{
priv->draw_item_tail = di->prev;
}
if (di->type == RDI_LINE)
{
if (di->u.line.segs != 0)
{
free(di->u.line.segs);
}
}
RegionDestroy(di->reg);
free(di);
g_free(di);
return 0;
}
@ -489,12 +496,20 @@ draw_item_pack(rdpPixmapRec* priv)
di = priv->draw_item_tail;
while (di->prev != 0)
{
di_prev = di->prev;
while (di_prev != 0)
/* skip subtract flag
* draw items like line can't be used to clear(subtract) previous
* draw items since they are not opaque
* eg they can not be the 'S' in 'D = M - S'
* the region for line draw items is the clip region */
if ((di->flags & 1) == 0)
{
/* D = M - S */
RegionSubtract(di_prev->reg, di_prev->reg, di->reg);
di_prev = di_prev->prev;
di_prev = di->prev;
while (di_prev != 0)
{
/* D = M - S */
RegionSubtract(di_prev->reg, di_prev->reg, di->reg);
di_prev = di_prev->prev;
}
}
di = di->prev;
}
@ -525,15 +540,16 @@ draw_item_pack(rdpPixmapRec* priv)
/******************************************************************************/
int
draw_item_add_img_region(rdpPixmapRec* priv, RegionPtr reg, int type)
draw_item_add_img_region(rdpPixmapRec* priv, RegionPtr reg, int opcode,
int type)
{
struct rdp_draw_item* di;
di = (struct rdp_draw_item*)malloc(sizeof(struct rdp_draw_item));
memset(di, 0, sizeof(struct rdp_draw_item));
di = (struct rdp_draw_item*)g_malloc(sizeof(struct rdp_draw_item), 1);
di->type = type;
di->reg = RegionCreate(NullBox, 0);
RegionCopy(di->reg, reg);
di->u.img.opcode = opcode;
draw_item_add(priv, di);
return 0;
}
@ -545,12 +561,39 @@ draw_item_add_fill_region(rdpPixmapRec* priv, RegionPtr reg, int color,
{
struct rdp_draw_item* di;
di = (struct rdp_draw_item*)malloc(sizeof(struct rdp_draw_item));
memset(di, 0, sizeof(struct rdp_draw_item));
di = (struct rdp_draw_item*)g_malloc(sizeof(struct rdp_draw_item), 1);
di->type = RDI_FILL;
di->fg_color = color;
di->opcode = opcode;
di->u.fill.fg_color = color;
di->u.fill.opcode = opcode;
di->reg = RegionCreate(NullBox, 0);
RegionCopy(di->reg, reg);
draw_item_add(priv, di);
return 0;
}
/******************************************************************************/
int
draw_item_add_line_region(rdpPixmapRec* priv, RegionPtr reg, int color,
int opcode, int width, xSegment* segs, int nseg,
int is_segment)
{
struct rdp_draw_item* di;
LLOGLN(10, ("draw_item_add_line_region:"));
di = (struct rdp_draw_item*)g_malloc(sizeof(struct rdp_draw_item), 1);
di->type = RDI_LINE;
di->u.line.fg_color = color;
di->u.line.opcode = opcode;
di->u.line.width = width;
di->u.line.segs = (xSegment*)g_malloc(sizeof(xSegment) * nseg, 1);
memcpy(di->u.line.segs, segs, sizeof(xSegment) * nseg);
di->u.line.nseg = nseg;
if (is_segment)
{
di->u.line.flags = 1;
}
di->reg = RegionCreate(NullBox, 0);
di->flags |= 1;
RegionCopy(di->reg, reg);
draw_item_add(priv, di);
return 0;
@ -584,14 +627,14 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
priv->status = 1;
rdpup_create_os_surface(priv->rdpindex, width, height);
}
//priv->reg_lossy = RegionCreate(NullBox, 0);
//priv->reg_lossless = RegionCreate(NullBox, 0);
}
pScreen->ModifyPixmapHeader(rv, org_width, 0, 0, 0, 0, 0);
pScreen->CreatePixmap = rdpCreatePixmap;
return rv;
}
extern struct rdpup_os_bitmap* g_os_bitmaps;
/******************************************************************************/
Bool
rdpDestroyPixmap(PixmapPtr pPixmap)
@ -609,8 +652,6 @@ rdpDestroyPixmap(PixmapPtr pPixmap)
{
rdpup_remove_os_bitmap(priv->rdpindex);
rdpup_delete_os_surface(priv->rdpindex);
//RegionDestroy(priv->reg_lossy);
//RegionDestroy(priv->reg_lossless);
draw_item_remove_all(priv);
}
}
@ -1103,7 +1144,7 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
RegionIntersect(&reg1, &reg1, &reg2);
if (dirty_type != 0)
{
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
}
else if (got_id)
{
@ -1131,7 +1172,7 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
if (dirty_type != 0)
{
RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
draw_item_add_img_region(pDirtyPriv, &reg1, GXcopy, dirty_type);
RegionUninit(&reg1);
}
else if (got_id)

@ -215,7 +215,8 @@ rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv)
int
rdpup_remove_os_bitmap(int rdpindex)
{
LLOGLN(10, ("rdpup_remove_os_bitmap: index %d", rdpindex));
LLOGLN(10, ("rdpup_remove_os_bitmap: index %d stamp %d",
rdpindex, g_os_bitmaps[rdpindex].stamp));
if (g_os_bitmaps == 0)
{
return 1;
@ -1203,7 +1204,7 @@ rdpup_create_os_surface(int rdpindex, int width, int height)
LLOGLN(10, ("rdpup_create_os_surface:"));
if (g_connected)
{
LLOGLN(10, (" rdpup_create_os_surface"));
LLOGLN(10, (" rdpup_create_os_surface width %d height %d", width, height));
rdpup_pre_check(12);
out_uint16_le(g_out_s, 20);
out_uint16_le(g_out_s, 12);
@ -1596,8 +1597,11 @@ int
rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec* pDirtyPriv)
{
int index;
int clip_index;
int count;
int num_clips;
BoxRec box;
xSegment* seg;
struct image_data id;
struct rdp_draw_item* di;
@ -1610,7 +1614,7 @@ rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec* pDirtyPriv)
return 0;
}
/* update uses time / count */
/* update use time / count */
g_os_bitmaps[pDirtyPriv->rdpindex].stamp = g_os_bitmap_stamp;
g_os_bitmap_stamp++;
@ -1626,36 +1630,69 @@ rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec* pDirtyPriv)
switch (di->type)
{
case RDI_FILL:
rdpup_set_fgcolor(di->fg_color);
rdpup_set_opcode(di->opcode);
rdpup_set_fgcolor(di->u.fill.fg_color);
rdpup_set_opcode(di->u.fill.opcode);
count = REGION_NUM_RECTS(di->reg);
for (index = 0; index < count; index++)
{
box = REGION_RECTS(di->reg)[index];
LLOGLN(10, (" RDI_FILL %d %d %d %d", box.x1, box.y1, box.x2, box.y2));
LLOGLN(10, (" RDI_FILL %d %d %d %d", box.x1, box.y1,
box.x2, box.y2));
rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
}
rdpup_set_opcode(GXcopy);
break;
case RDI_IMGLL:
rdpup_set_hints(1, 1);
rdpup_set_opcode(di->u.img.opcode);
count = REGION_NUM_RECTS(di->reg);
for (index = 0; index < count; index++)
{
box = REGION_RECTS(di->reg)[index];
LLOGLN(10, (" RDI_IMGLL %d %d %d %d", box.x1, box.y1, box.x2, box.y2));
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
LLOGLN(10, (" RDI_IMGLL %d %d %d %d", box.x1, box.y1,
box.x2, box.y2));
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
box.y2 - box.y1);
}
rdpup_set_opcode(GXcopy);
rdpup_set_hints(0, 1);
break;
case RDI_IMGLY:
rdpup_set_opcode(di->u.img.opcode);
count = REGION_NUM_RECTS(di->reg);
for (index = 0; index < count; index++)
{
box = REGION_RECTS(di->reg)[index];
LLOGLN(10, (" RDI_IMGLY %d %d %d %d", box.x1, box.y1, box.x2, box.y2));
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
LLOGLN(10, (" RDI_IMGLY %d %d %d %d", box.x1, box.y1,
box.x2, box.y2));
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
box.y2 - box.y1);
}
rdpup_set_opcode(GXcopy);
break;
case RDI_LINE:
LLOGLN(10, (" RDI_LINE"));
num_clips = REGION_NUM_RECTS(di->reg);
if (num_clips > 0)
{
rdpup_set_fgcolor(di->u.line.fg_color);
rdpup_set_opcode(di->u.line.opcode);
rdpup_set_pen(0, di->u.line.width);
for (clip_index = num_clips - 1; clip_index >= 0; clip_index--)
{
box = REGION_RECTS(di->reg)[clip_index];
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
for (index = 0; index < di->u.line.nseg; index++)
{
seg = di->u.line.segs + index;
LLOGLN(10, (" RDI_LINE %d %d %d %d", seg->x1, seg->y1,
seg->x2, seg->y2));
rdpup_draw_line(seg->x1, seg->y1, seg->x2, seg->y2);
}
}
}
rdpup_reset_clip();
rdpup_set_opcode(GXcopy);
break;
}
di = di->next;

Loading…
Cancel
Save