diff --git a/xorg/X11R7.6/rdp/rdp.h b/xorg/X11R7.6/rdp/rdp.h index 797df885..00f121ac 100644 --- a/xorg/X11R7.6/rdp/rdp.h +++ b/xorg/X11R7.6/rdp/rdp.h @@ -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 diff --git a/xorg/X11R7.6/rdp/rdpCopyArea.c b/xorg/X11R7.6/rdp/rdpCopyArea.c index ea58577a..6e799a7c 100644 --- a/xorg/X11R7.6/rdp/rdpCopyArea.c +++ b/xorg/X11R7.6/rdp/rdpCopyArea.c @@ -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(); diff --git a/xorg/X11R7.6/rdp/rdpCopyPlane.c b/xorg/X11R7.6/rdp/rdpCopyPlane.c index 36c653d6..78b1c338 100644 --- a/xorg/X11R7.6/rdp/rdpCopyPlane.c +++ b/xorg/X11R7.6/rdp/rdpCopyPlane.c @@ -148,7 +148,7 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, box.x2 = box.x1 + w; box.y2 = box.y1 + h; RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type); RegionUninit(®1); } else if (got_id) @@ -173,7 +173,7 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, RegionInit(®2, NullBox, 0); RegionCopy(®2, &clip_reg); RegionIntersect(®1, ®1, ®2); - draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type); RegionUninit(®1); RegionUninit(®2); } diff --git a/xorg/X11R7.6/rdp/rdpFillPolygon.c b/xorg/X11R7.6/rdp/rdpFillPolygon.c index 2976c6d4..38216019 100644 --- a/xorg/X11R7.6/rdp/rdpFillPolygon.c +++ b/xorg/X11R7.6/rdp/rdpFillPolygon.c @@ -180,7 +180,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC, if (dirty_type != 0) { RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type); RegionUninit(®1); } 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) { diff --git a/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c b/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c index dee54283..25d23a51 100644 --- a/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c +++ b/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c @@ -149,7 +149,7 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, if (dirty_type != 0) { RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type); RegionUninit(®1); } else if (got_id) @@ -168,7 +168,7 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, ®, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type); } else if (got_id) { diff --git a/xorg/X11R7.6/rdp/rdpImageText16.c b/xorg/X11R7.6/rdp/rdpImageText16.c index 2717a9e3..103344c6 100644 --- a/xorg/X11R7.6/rdp/rdpImageText16.c +++ b/xorg/X11R7.6/rdp/rdpImageText16.c @@ -147,7 +147,7 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, if (dirty_type != 0) { RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type); RegionUninit(®1); } else if (got_id) @@ -166,7 +166,7 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, ®, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®, 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(®)[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(); } diff --git a/xorg/X11R7.6/rdp/rdpImageText8.c b/xorg/X11R7.6/rdp/rdpImageText8.c index 6a08ab29..ba958a21 100644 --- a/xorg/X11R7.6/rdp/rdpImageText8.c +++ b/xorg/X11R7.6/rdp/rdpImageText8.c @@ -147,7 +147,7 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, if (dirty_type != 0) { RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type); RegionUninit(®1); } else if (got_id) @@ -166,7 +166,7 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, ®, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®, 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(®)[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(); } diff --git a/xorg/X11R7.6/rdp/rdpPolyArc.c b/xorg/X11R7.6/rdp/rdpPolyArc.c index bc9745f7..ba890f0c 100644 --- a/xorg/X11R7.6/rdp/rdpPolyArc.c +++ b/xorg/X11R7.6/rdp/rdpPolyArc.c @@ -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(); } diff --git a/xorg/X11R7.6/rdp/rdpPolyFillArc.c b/xorg/X11R7.6/rdp/rdpPolyFillArc.c index 3f956a11..cb8f2801 100644 --- a/xorg/X11R7.6/rdp/rdpPolyFillArc.c +++ b/xorg/X11R7.6/rdp/rdpPolyFillArc.c @@ -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(); } diff --git a/xorg/X11R7.6/rdp/rdpPolyFillRect.c b/xorg/X11R7.6/rdp/rdpPolyFillRect.c index 61657c83..5dda6b7e 100644 --- a/xorg/X11R7.6/rdp/rdpPolyFillRect.c +++ b/xorg/X11R7.6/rdp/rdpPolyFillRect.c @@ -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) diff --git a/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c b/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c index d1c91b4c..89ae85b4 100644 --- a/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c +++ b/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c @@ -149,7 +149,7 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, if (dirty_type != 0) { RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type); RegionUninit(®1); } else if (got_id) @@ -168,7 +168,7 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, ®, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®, 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(®)[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(); } diff --git a/xorg/X11R7.6/rdp/rdpPolyRectangle.c b/xorg/X11R7.6/rdp/rdpPolyRectangle.c index 96ff058d..e2b38394 100644 --- a/xorg/X11R7.6/rdp/rdpPolyRectangle.c +++ b/xorg/X11R7.6/rdp/rdpPolyRectangle.c @@ -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) { diff --git a/xorg/X11R7.6/rdp/rdpPolySegment.c b/xorg/X11R7.6/rdp/rdpPolySegment.c index 5f195e49..466c6b8c 100644 --- a/xorg/X11R7.6/rdp/rdpPolySegment.c +++ b/xorg/X11R7.6/rdp/rdpPolySegment.c @@ -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(); diff --git a/xorg/X11R7.6/rdp/rdpPolyText16.c b/xorg/X11R7.6/rdp/rdpPolyText16.c index 5eb00c46..aaea2434 100644 --- a/xorg/X11R7.6/rdp/rdpPolyText16.c +++ b/xorg/X11R7.6/rdp/rdpPolyText16.c @@ -150,7 +150,7 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, if (dirty_type != 0) { RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type); RegionUninit(®1); } else if (got_id) @@ -169,7 +169,7 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, ®, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type); } else if (got_id) { diff --git a/xorg/X11R7.6/rdp/rdpPolyText8.c b/xorg/X11R7.6/rdp/rdpPolyText8.c index c7af8f35..0b16cf26 100644 --- a/xorg/X11R7.6/rdp/rdpPolyText8.c +++ b/xorg/X11R7.6/rdp/rdpPolyText8.c @@ -150,7 +150,7 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, if (dirty_type != 0) { RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type); RegionUninit(®1); } else if (got_id) @@ -169,7 +169,7 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, { if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, ®, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®, GXcopy, dirty_type); } else if (got_id) { diff --git a/xorg/X11R7.6/rdp/rdpPolylines.c b/xorg/X11R7.6/rdp/rdpPolylines.c index f52e4a17..60c29e0c 100644 --- a/xorg/X11R7.6/rdp/rdpPolylines.c +++ b/xorg/X11R7.6/rdp/rdpPolylines.c @@ -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); diff --git a/xorg/X11R7.6/rdp/rdpPushPixels.c b/xorg/X11R7.6/rdp/rdpPushPixels.c index f109a999..02f15fea 100644 --- a/xorg/X11R7.6/rdp/rdpPushPixels.c +++ b/xorg/X11R7.6/rdp/rdpPushPixels.c @@ -143,7 +143,7 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, box.x2 = box.x1 + w; box.y2 = box.y1 + h; RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type); RegionUninit(®1); } else if (got_id) @@ -167,7 +167,7 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, if (dirty_type != 0) { RegionInit(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, &clip_reg, dirty_type); + draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type); RegionUninit(®1); } else if (got_id) diff --git a/xorg/X11R7.6/rdp/rdpPutImage.c b/xorg/X11R7.6/rdp/rdpPutImage.c index 018ddf0e..798016f3 100644 --- a/xorg/X11R7.6/rdp/rdpPutImage.c +++ b/xorg/X11R7.6/rdp/rdpPutImage.c @@ -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(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type); RegionUninit(®1); } else if (got_id) @@ -163,7 +163,7 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, RegionInit(®2, NullBox, 0); RegionCopy(®2, &clip_reg); RegionIntersect(®1, ®1, ®2); - draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type); RegionUninit(®1); RegionUninit(®2); } diff --git a/xorg/X11R7.6/rdp/rdpdraw.c b/xorg/X11R7.6/rdp/rdpdraw.c index cc48550c..ac52daf3 100644 --- a/xorg/X11R7.6/rdp/rdpdraw.c +++ b/xorg/X11R7.6/rdp/rdpdraw.c @@ -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(®1, ®1, ®2); if (dirty_type != 0) { - draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®1, 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(®1, &box, 0); - draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, dirty_type); RegionUninit(®1); } else if (got_id) diff --git a/xorg/X11R7.6/rdp/rdpup.c b/xorg/X11R7.6/rdp/rdpup.c index f1892fae..1001be90 100644 --- a/xorg/X11R7.6/rdp/rdpup.c +++ b/xorg/X11R7.6/rdp/rdpup.c @@ -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;