From da9d55f180cb68999d95b44fb3d53909ea9630b6 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Thu, 9 Aug 2012 22:19:10 -0700 Subject: [PATCH] xorg: offscreen bitmaps, don't remote until used --- xorg/X11R7.6/rdp/rdp.h | 37 ++++ xorg/X11R7.6/rdp/rdpCopyArea.c | 3 + xorg/X11R7.6/rdp/rdpCopyPlane.c | 110 ++++++++--- xorg/X11R7.6/rdp/rdpFillPolygon.c | 68 +++++-- xorg/X11R7.6/rdp/rdpImageGlyphBlt.c | 67 +++++-- xorg/X11R7.6/rdp/rdpImageText16.c | 67 +++++-- xorg/X11R7.6/rdp/rdpImageText8.c | 67 +++++-- xorg/X11R7.6/rdp/rdpPolyArc.c | 69 +++++-- xorg/X11R7.6/rdp/rdpPolyFillArc.c | 69 +++++-- xorg/X11R7.6/rdp/rdpPolyFillRect.c | 147 +++++++++++---- xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c | 67 +++++-- xorg/X11R7.6/rdp/rdpPolyPoint.c | 85 ++++++--- xorg/X11R7.6/rdp/rdpPolyRectangle.c | 109 +++++++---- xorg/X11R7.6/rdp/rdpPolySegment.c | 89 ++++++--- xorg/X11R7.6/rdp/rdpPolyText16.c | 67 +++++-- xorg/X11R7.6/rdp/rdpPolyText8.c | 67 +++++-- xorg/X11R7.6/rdp/rdpPolylines.c | 127 ++++++++----- xorg/X11R7.6/rdp/rdpPushPixels.c | 82 +++++++-- xorg/X11R7.6/rdp/rdpPutImage.c | 88 +++++++-- xorg/X11R7.6/rdp/rdpSetSpans.c | 48 ++++- xorg/X11R7.6/rdp/rdpdraw.c | 271 ++++++++++++++++++++++++++-- xorg/X11R7.6/rdp/rdpmain.c | 1 + xorg/X11R7.6/rdp/rdpup.c | 76 ++++++++ 23 files changed, 1513 insertions(+), 368 deletions(-) diff --git a/xorg/X11R7.6/rdp/rdp.h b/xorg/X11R7.6/rdp/rdp.h index 7bec6726..797df885 100644 --- a/xorg/X11R7.6/rdp/rdp.h +++ b/xorg/X11R7.6/rdp/rdp.h @@ -193,12 +193,31 @@ typedef rdpWindowRec* rdpWindowPtr; #define XR_STYLE_DIALOG (0x80000000) #define XR_EXT_STYLE_DIALOG (0x00040000) +#define RDI_FILL 1 +#define RDI_IMGLL 2 +#define RDI_IMGLY 3 + +struct rdp_draw_item +{ + int type; + int fg_color; + int bg_color; + int opcode; + RegionPtr reg; + struct rdp_draw_item* prev; + struct rdp_draw_item* next; +}; + struct _rdpPixmapRec { int status; int rdpindex; int allocBytes; int con_number; + int is_dirty; + int pad; + struct rdp_draw_item* draw_item_head; + struct rdp_draw_item* draw_item_tail; }; typedef struct _rdpPixmapRec rdpPixmapRec; typedef rdpPixmapRec* rdpPixmapPtr; @@ -265,6 +284,22 @@ hexdump(unsigned char *p, unsigned int len); Bool rdpCloseScreen(int i, ScreenPtr pScreen); + +int +draw_item_add(rdpPixmapRec* priv, struct rdp_draw_item* di); +int +draw_item_remove(rdpPixmapRec* priv, struct rdp_draw_item* di); +int +draw_item_remove_all(rdpPixmapRec* priv); +int +draw_item_pack(rdpPixmapRec* priv); +int +draw_item_add_img_region(rdpPixmapRec* priv, RegionPtr reg, int type); +int +draw_item_add_fill_region(rdpPixmapRec* priv, RegionPtr reg, int color, + int opcode); + + PixmapPtr rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint); @@ -426,6 +461,8 @@ void rdpup_create_window(WindowPtr pWindow, rdpWindowRec* priv); void rdpup_delete_window(WindowPtr pWindow, rdpWindowRec* priv); +int +rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec* pDirtyPriv); #if defined(X_BYTE_ORDER) # if X_BYTE_ORDER == X_LITTLE_ENDIAN diff --git a/xorg/X11R7.6/rdp/rdpCopyArea.c b/xorg/X11R7.6/rdp/rdpCopyArea.c index 27ddab28..ea58577a 100644 --- a/xorg/X11R7.6/rdp/rdpCopyArea.c +++ b/xorg/X11R7.6/rdp/rdpCopyArea.c @@ -367,6 +367,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, can_do_screen_blt = pGC->alu == GXcopy; if (can_do_screen_blt) { + rdpup_check_dirty(pDstPixmap, pDstPriv); return rdpCopyAreaWndToPixmap(pSrcWnd, pDstPixmap, pDstPriv, pGC, srcx, srcy, w, h, dstx, dsty); } @@ -380,6 +381,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, pSrcPriv = GETPIXPRIV(pSrcPixmap); if (XRDP_IS_OS(pSrcPriv)) { + rdpup_check_dirty(pSrcPixmap, pSrcPriv); if (pDst->type == DRAWABLE_WINDOW) { pDstWnd = (WindowPtr)pDst; @@ -395,6 +397,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { + rdpup_check_dirty(pDstPixmap, pDstPriv); return rdpCopyAreaPixmapToPixmap(pSrcPixmap, pSrcPriv, pDstPixmap, pDstPriv, pGC, srcx, srcy, w, h, diff --git a/xorg/X11R7.6/rdp/rdpCopyPlane.c b/xorg/X11R7.6/rdp/rdpCopyPlane.c index f0a54d9e..36c653d6 100644 --- a/xorg/X11R7.6/rdp/rdpCopyPlane.c +++ b/xorg/X11R7.6/rdp/rdpCopyPlane.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -68,22 +69,32 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, RegionPtr rv; RegionRec clip_reg; RegionRec box_reg; + RegionRec reg1; + RegionRec reg2; int cd; int num_clips; int j; int got_id; + int dirty_type; + int post_process; + int reset_surface; BoxRec box; BoxPtr pbox; struct image_data id; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; LLOGLN(10, ("rdpCopyPlane:")); /* do original call */ rv = rdpCopyPlaneOrg(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, bitPlane); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDst->type == DRAWABLE_PIXMAP) { @@ -91,9 +102,21 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpCopyPlane: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLY; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -103,12 +126,13 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, pDstWnd = (WindowPtr)pDst; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { return rv; } @@ -117,41 +141,75 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, cd = rdp_get_clip(&clip_reg, pDst, pGC); if (cd == 1) { - rdpup_begin_update(); - rdpup_send_area(&id, pDst->x + dstx, pDst->y + dsty, w, h); - rdpup_end_update(); + if (dirty_type != 0) + { + box.x1 = pDst->x + dstx; + box.y1 = pDst->y + dsty; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; + RegionInit(®1, &box, 0); + draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_send_area(&id, pDst->x + dstx, pDst->y + dsty, w, h); + rdpup_end_update(); + } } else if (cd == 2) { num_clips = REGION_NUM_RECTS(&clip_reg); if (num_clips > 0) { - rdpup_begin_update(); - box.x1 = pDst->x + dstx; - box.y1 = pDst->y + dsty; - box.x2 = box.x1 + w; - box.y2 = box.y1 + h; - RegionInit(&box_reg, &box, 0); - RegionIntersect(&clip_reg, &clip_reg, &box_reg); - num_clips = REGION_NUM_RECTS(&clip_reg); - if (num_clips < 10) + if (dirty_type != 0) { - for (j = num_clips - 1; j >= 0; j--) - { - box = REGION_RECTS(&clip_reg)[j]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - } + box.x1 = pDst->x + dstx; + box.y1 = pDst->y + dsty; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; + RegionInit(®1, &box, 0); + RegionInit(®2, NullBox, 0); + RegionCopy(®2, &clip_reg); + RegionIntersect(®1, ®1, ®2); + draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + RegionUninit(®1); + RegionUninit(®2); } else { - pbox = RegionExtents(&clip_reg); - rdpup_send_area(&id, pbox->x1, pbox->y1, pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1); + rdpup_begin_update(); + box.x1 = pDst->x + dstx; + box.y1 = pDst->y + dsty; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; + RegionInit(&box_reg, &box, 0); + RegionIntersect(&clip_reg, &clip_reg, &box_reg); + num_clips = REGION_NUM_RECTS(&clip_reg); + if (num_clips < 10) + { + for (j = num_clips - 1; j >= 0; j--) + { + box = REGION_RECTS(&clip_reg)[j]; + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + } + } + else + { + pbox = RegionExtents(&clip_reg); + rdpup_send_area(&id, pbox->x1, pbox->y1, pbox->x2 - pbox->x1, + pbox->y2 - pbox->y1); + } + RegionUninit(&box_reg); + rdpup_end_update(); } - RegionUninit(&box_reg); - rdpup_end_update(); } } RegionUninit(&clip_reg); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } return rv; } diff --git a/xorg/X11R7.6/rdp/rdpFillPolygon.c b/xorg/X11R7.6/rdp/rdpFillPolygon.c index 362e8d15..2976c6d4 100644 --- a/xorg/X11R7.6/rdp/rdpFillPolygon.c +++ b/xorg/X11R7.6/rdp/rdpFillPolygon.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -64,6 +65,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC, { RegionRec clip_reg; RegionRec box_reg; + RegionRec reg1; int num_clips; int cd; int maxx; @@ -73,17 +75,25 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int i; int j; int got_id; + int dirty_type; + int post_process; + int reset_surface; BoxRec box; struct image_data id; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; LLOGLN(10, ("rdpFillPolygon:")); /* do original call */ rdpFillPolygonOrg(pDrawable, pGC, shape, mode, count, pPts); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDrawable->type == DRAWABLE_PIXMAP) { @@ -91,9 +101,21 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpFillPolygon: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLY; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -103,12 +125,13 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC, pDstWnd = (WindowPtr)pDrawable; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { return; } @@ -154,9 +177,18 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC, } if (cd == 1) { - rdpup_begin_update(); - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - rdpup_end_update(); + if (dirty_type != 0) + { + RegionInit(®1, &box, 0); + draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + rdpup_end_update(); + } } else if (cd == 2) { @@ -165,16 +197,26 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC, num_clips = REGION_NUM_RECTS(&clip_reg); if (num_clips > 0) { - rdpup_begin_update(); - for (j = num_clips - 1; j >= 0; j--) + if (dirty_type != 0) { - box = REGION_RECTS(&clip_reg)[j]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + draw_item_add_img_region(pDirtyPriv, &clip_reg, dirty_type); + } + else if (got_id) + { + rdpup_begin_update(); + for (j = num_clips - 1; j >= 0; j--) + { + box = REGION_RECTS(&clip_reg)[j]; + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + } + rdpup_end_update(); } - rdpup_end_update(); } RegionUninit(&box_reg); } RegionUninit(&clip_reg); - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } } diff --git a/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c b/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c index 35c19bc1..dee54283 100644 --- a/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c +++ b/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -68,11 +69,15 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int cd; int j; int got_id; + int dirty_type; + int post_process; + int reset_surface; BoxRec box; struct image_data id; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; LLOGLN(10, ("rdpImageGlyphBlt:")); @@ -84,6 +89,10 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, /* do original call */ rdpImageGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDrawable->type == DRAWABLE_PIXMAP) { @@ -91,9 +100,21 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpImageGlyphBlt: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLL; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -103,12 +124,13 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, pDstWnd = (WindowPtr)pDrawable; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { return; } @@ -124,9 +146,18 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, } if (cd == 1) { - rdpup_begin_update(); - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - rdpup_end_update(); + if (dirty_type != 0) + { + RegionInit(®1, &box, 0); + draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + rdpup_end_update(); + } } else if (cd == 2) { @@ -135,17 +166,27 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, num_clips = REGION_NUM_RECTS(®); if (num_clips > 0) { - rdpup_begin_update(); - for (j = num_clips - 1; j >= 0; j--) + if (dirty_type != 0) { - box = REGION_RECTS(®)[j]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + draw_item_add_img_region(pDirtyPriv, ®, dirty_type); + } + else if (got_id) + { + rdpup_begin_update(); + 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_end_update(); } - rdpup_end_update(); } RegionUninit(®1); } RegionUninit(®); - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } return; } diff --git a/xorg/X11R7.6/rdp/rdpImageText16.c b/xorg/X11R7.6/rdp/rdpImageText16.c index e2261147..2717a9e3 100644 --- a/xorg/X11R7.6/rdp/rdpImageText16.c +++ b/xorg/X11R7.6/rdp/rdpImageText16.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -66,11 +67,15 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, int cd; int j; int got_id; + int dirty_type; + int post_process; + int reset_surface; BoxRec box; struct image_data id; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; LLOGLN(10, ("rdpImageText16:")); @@ -82,6 +87,10 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, /* do original call */ rdpImageText16Org(pDrawable, pGC, x, y, count, chars); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDrawable->type == DRAWABLE_PIXMAP) { @@ -89,9 +98,21 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpImageText16: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLY; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -101,12 +122,13 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, pDstWnd = (WindowPtr)pDrawable; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { return; } @@ -122,9 +144,18 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, } if (cd == 1) { - rdpup_begin_update(); - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - rdpup_end_update(); + if (dirty_type != 0) + { + RegionInit(®1, &box, 0); + draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + rdpup_end_update(); + } } else if (cd == 2) { @@ -133,17 +164,27 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, num_clips = REGION_NUM_RECTS(®); if (num_clips > 0) { - rdpup_begin_update(); - for (j = num_clips - 1; j >= 0; j--) + if (dirty_type != 0) { - box = REGION_RECTS(®)[j]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + draw_item_add_img_region(pDirtyPriv, ®, dirty_type); + } + else if (got_id) + { + rdpup_begin_update(); + 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_end_update(); } - rdpup_end_update(); } RegionUninit(®1); } RegionUninit(®); - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } return; } diff --git a/xorg/X11R7.6/rdp/rdpImageText8.c b/xorg/X11R7.6/rdp/rdpImageText8.c index 34bf35be..6a08ab29 100644 --- a/xorg/X11R7.6/rdp/rdpImageText8.c +++ b/xorg/X11R7.6/rdp/rdpImageText8.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -66,11 +67,15 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, int cd; int j; int got_id; + int dirty_type; + int post_process; + int reset_surface; BoxRec box; struct image_data id; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; LLOGLN(10, ("rdpImageText8:")); @@ -82,6 +87,10 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, /* do original call */ rdpImageText8Org(pDrawable, pGC, x, y, count, chars); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDrawable->type == DRAWABLE_PIXMAP) { @@ -89,9 +98,21 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpImageText8: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLL; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -101,12 +122,13 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, pDstWnd = (WindowPtr)pDrawable; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { return; } @@ -122,9 +144,18 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, } if (cd == 1) { - rdpup_begin_update(); - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - rdpup_end_update(); + if (dirty_type != 0) + { + RegionInit(®1, &box, 0); + draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + rdpup_end_update(); + } } else if (cd == 2) { @@ -133,17 +164,27 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, num_clips = REGION_NUM_RECTS(®); if (num_clips > 0) { - rdpup_begin_update(); - for (j = num_clips - 1; j >= 0; j--) + if (dirty_type != 0) { - box = REGION_RECTS(®)[j]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + draw_item_add_img_region(pDirtyPriv, ®, dirty_type); + } + else if (got_id) + { + rdpup_begin_update(); + 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_end_update(); } - rdpup_end_update(); } RegionUninit(®1); } RegionUninit(®); - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } return; } diff --git a/xorg/X11R7.6/rdp/rdpPolyArc.c b/xorg/X11R7.6/rdp/rdpPolyArc.c index be56821a..bc9745f7 100644 --- a/xorg/X11R7.6/rdp/rdpPolyArc.c +++ b/xorg/X11R7.6/rdp/rdpPolyArc.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -66,12 +67,16 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs) int i; int num_clips; int got_id; + int dirty_type; + int post_process; + int reset_surface; xRectangle* rects; BoxRec box; struct image_data id; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; LLOGLN(10, ("rdpPolyArc:")); @@ -97,6 +102,10 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs) /* do original call */ rdpPolyArcOrg(pDrawable, pGC, narcs, parcs); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDrawable->type == DRAWABLE_PIXMAP) { @@ -104,9 +113,21 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs) pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpPolyArc: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLL; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -116,12 +137,13 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs) pDstWnd = (WindowPtr)pDrawable; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { g_free(rects); return; @@ -137,13 +159,20 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs) num_clips = REGION_NUM_RECTS(tmpRegion); if (num_clips > 0) { - rdpup_begin_update(); - for (i = num_clips - 1; i >= 0; i--) + if (dirty_type != 0) { - box = REGION_RECTS(tmpRegion)[i]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + draw_item_add_img_region(pDirtyPriv, tmpRegion, dirty_type); + } + else if (got_id) + { + rdpup_begin_update(); + 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_end_update(); } - rdpup_end_update(); } RegionDestroy(tmpRegion); } @@ -157,18 +186,28 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs) num_clips = REGION_NUM_RECTS(tmpRegion); if (num_clips > 0) { - rdpup_begin_update(); - for (i = num_clips - 1; i >= 0; i--) + if (dirty_type != 0) + { + draw_item_add_img_region(pDirtyPriv, tmpRegion, dirty_type); + } + else if (got_id) { - box = REGION_RECTS(tmpRegion)[i]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + rdpup_begin_update(); + 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_end_update(); } - rdpup_end_update(); } RegionDestroy(tmpRegion); } } RegionUninit(&clip_reg); g_free(rects); - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } } diff --git a/xorg/X11R7.6/rdp/rdpPolyFillArc.c b/xorg/X11R7.6/rdp/rdpPolyFillArc.c index 91ab7899..3f956a11 100644 --- a/xorg/X11R7.6/rdp/rdpPolyFillArc.c +++ b/xorg/X11R7.6/rdp/rdpPolyFillArc.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -66,12 +67,16 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs) int i; int num_clips; int got_id; + int dirty_type; + int post_process; + int reset_surface; xRectangle* rects; BoxRec box; struct image_data id; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; LLOGLN(10, ("rdpPolyFillArc:")); @@ -97,6 +102,10 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs) /* do original call */ rdpPolyFillArcOrg(pDrawable, pGC, narcs, parcs); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDrawable->type == DRAWABLE_PIXMAP) { @@ -104,9 +113,21 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs) pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpPolyFillArc: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLY; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -116,12 +137,13 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs) pDstWnd = (WindowPtr)pDrawable; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { g_free(rects); return; @@ -137,13 +159,20 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs) num_clips = REGION_NUM_RECTS(tmpRegion); if (num_clips > 0) { - rdpup_begin_update(); - for (i = num_clips - 1; i >= 0; i--) + if (dirty_type != 0) { - box = REGION_RECTS(tmpRegion)[i]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + draw_item_add_img_region(pDirtyPriv, tmpRegion, dirty_type); + } + else if (got_id) + { + rdpup_begin_update(); + 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_end_update(); } - rdpup_end_update(); } RegionDestroy(tmpRegion); } @@ -157,18 +186,28 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs) num_clips = REGION_NUM_RECTS(tmpRegion); if (num_clips > 0) { - rdpup_begin_update(); - for (i = num_clips - 1; i >= 0; i--) + if (dirty_type != 0) + { + draw_item_add_img_region(pDirtyPriv, tmpRegion, dirty_type); + } + else if (got_id) { - box = REGION_RECTS(tmpRegion)[i]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + rdpup_begin_update(); + 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_end_update(); } - rdpup_end_update(); } RegionDestroy(tmpRegion); } } RegionUninit(&clip_reg); g_free(rects); - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } } diff --git a/xorg/X11R7.6/rdp/rdpPolyFillRect.c b/xorg/X11R7.6/rdp/rdpPolyFillRect.c index 070dd255..61657c83 100644 --- a/xorg/X11R7.6/rdp/rdpPolyFillRect.c +++ b/xorg/X11R7.6/rdp/rdpPolyFillRect.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -68,10 +69,15 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, BoxRec box; int got_id; + int dirty_type; + int post_process; + int reset_surface; + struct image_data id; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; LLOGLN(10, ("rdpPolyFillRect:")); @@ -81,16 +87,30 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, /* do original call */ rdpPolyFillRectOrg(pDrawable, pGC, nrectFill, prectInit); - got_id = 0; + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; if (pDrawable->type == DRAWABLE_PIXMAP) { pDstPixmap = (PixmapPtr)pDrawable; pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_FILL; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -100,12 +120,13 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, pDstWnd = (WindowPtr)pDrawable; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { RegionDestroy(fill_reg); return; @@ -115,40 +136,26 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, cd = rdp_get_clip(&clip_reg, pDrawable, pGC); if (cd == 1) /* no clip */ { - rdpup_begin_update(); - if (pGC->fillStyle == 0 && /* solid fill */ - (pGC->alu == GXclear || - pGC->alu == GXset || - pGC->alu == GXinvert || - pGC->alu == GXnoop || - pGC->alu == GXand || - pGC->alu == GXcopy /*|| - pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */ + if (dirty_type != 0) { - rdpup_set_fgcolor(pGC->fgPixel); - rdpup_set_opcode(pGC->alu); - for (j = REGION_NUM_RECTS(fill_reg) - 1; j >= 0; j--) + if (pGC->fillStyle == 0 && /* solid fill */ + (pGC->alu == GXclear || + pGC->alu == GXset || + pGC->alu == GXinvert || + pGC->alu == GXnoop || + pGC->alu == GXand || + pGC->alu == GXcopy /*|| + pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */ { - box = REGION_RECTS(fill_reg)[j]; - rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + draw_item_add_fill_region(pDirtyPriv, fill_reg, pGC->fgPixel, + pGC->alu); } - rdpup_set_opcode(GXcopy); - } - else /* non solid fill */ - { - for (j = REGION_NUM_RECTS(fill_reg) - 1; j >= 0; j--) + else { - box = REGION_RECTS(fill_reg)[j]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + draw_item_add_img_region(pDirtyPriv, fill_reg, RDI_IMGLL); } } - rdpup_end_update(); - } - else if (cd == 2) /* clip */ - { - RegionIntersect(&clip_reg, &clip_reg, fill_reg); - num_clips = REGION_NUM_RECTS(&clip_reg); - if (num_clips > 0) + else if (got_id) { rdpup_begin_update(); if (pGC->fillStyle == 0 && /* solid fill */ @@ -162,25 +169,87 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, { rdpup_set_fgcolor(pGC->fgPixel); rdpup_set_opcode(pGC->alu); - for (j = num_clips - 1; j >= 0; j--) + for (j = REGION_NUM_RECTS(fill_reg) - 1; j >= 0; j--) { - box = REGION_RECTS(&clip_reg)[j]; + box = REGION_RECTS(fill_reg)[j]; rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); } rdpup_set_opcode(GXcopy); } else /* non solid fill */ { - for (j = num_clips - 1; j >= 0; j--) + for (j = REGION_NUM_RECTS(fill_reg) - 1; j >= 0; j--) { - box = REGION_RECTS(&clip_reg)[j]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + box = REGION_RECTS(fill_reg)[j]; + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, + box.y2 - box.y1); } } rdpup_end_update(); } } + else if (cd == 2) /* clip */ + { + RegionIntersect(&clip_reg, &clip_reg, fill_reg); + num_clips = REGION_NUM_RECTS(&clip_reg); + if (num_clips > 0) + { + if (dirty_type != 0) + { + if (pGC->fillStyle == 0 && /* solid fill */ + (pGC->alu == GXclear || + pGC->alu == GXset || + pGC->alu == GXinvert || + pGC->alu == GXnoop || + pGC->alu == GXand || + pGC->alu == GXcopy /*|| + pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */ + { + draw_item_add_fill_region(pDirtyPriv, &clip_reg, pGC->fgPixel, + pGC->alu); + } + else + { + draw_item_add_img_region(pDirtyPriv, &clip_reg, RDI_IMGLL); + } + } + else if (got_id) + { + rdpup_begin_update(); + if (pGC->fillStyle == 0 && /* solid fill */ + (pGC->alu == GXclear || + pGC->alu == GXset || + pGC->alu == GXinvert || + pGC->alu == GXnoop || + pGC->alu == GXand || + pGC->alu == GXcopy /*|| + pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */ + { + rdpup_set_fgcolor(pGC->fgPixel); + rdpup_set_opcode(pGC->alu); + for (j = num_clips - 1; j >= 0; j--) + { + box = REGION_RECTS(&clip_reg)[j]; + rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + } + rdpup_set_opcode(GXcopy); + } + else /* non solid fill */ + { + for (j = num_clips - 1; j >= 0; j--) + { + box = REGION_RECTS(&clip_reg)[j]; + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + } + } + rdpup_end_update(); + } + } + } RegionUninit(&clip_reg); RegionDestroy(fill_reg); - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } } diff --git a/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c b/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c index 871e7cf4..d1c91b4c 100644 --- a/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c +++ b/xorg/X11R7.6/rdp/rdpPolyGlyphBlt.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -68,11 +69,15 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int cd; int j; int got_id; + int dirty_type; + int post_process; + int reset_surface; BoxRec box; struct image_data id; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; LLOGLN(10, ("rdpPolyGlyphBlt:")); @@ -84,6 +89,10 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, /* do original call */ rdpPolyGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDrawable->type == DRAWABLE_PIXMAP) { @@ -91,9 +100,21 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpPolyGlyphBlt: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLY; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -103,12 +124,13 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, pDstWnd = (WindowPtr)pDrawable; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { return; } @@ -124,9 +146,18 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, } if (cd == 1) { - rdpup_begin_update(); - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - rdpup_end_update(); + if (dirty_type != 0) + { + RegionInit(®1, &box, 0); + draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + rdpup_end_update(); + } } else if (cd == 2) { @@ -135,17 +166,27 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, num_clips = REGION_NUM_RECTS(®); if (num_clips > 0) { - rdpup_begin_update(); - for (j = num_clips - 1; j >= 0; j--) + if (dirty_type != 0) { - box = REGION_RECTS(®)[j]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + draw_item_add_img_region(pDirtyPriv, ®, dirty_type); + } + else if (got_id) + { + rdpup_begin_update(); + 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_end_update(); } - rdpup_end_update(); } RegionUninit(®1); } RegionUninit(®); - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } return; } diff --git a/xorg/X11R7.6/rdp/rdpPolyPoint.c b/xorg/X11R7.6/rdp/rdpPolyPoint.c index d6bc5e6b..9e0a43de 100644 --- a/xorg/X11R7.6/rdp/rdpPolyPoint.c +++ b/xorg/X11R7.6/rdp/rdpPolyPoint.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -68,6 +69,9 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int i; int j; int got_id; + int dirty_type; + int post_process; + int reset_surface; BoxRec box; BoxRec total_box; DDXPointPtr pts; @@ -76,6 +80,7 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; LLOGLN(10, ("rdpPolyPoint:")); @@ -123,6 +128,10 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, /* do original call */ rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDrawable->type == DRAWABLE_PIXMAP) { @@ -130,9 +139,21 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpPolyPoint: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLY; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -142,12 +163,13 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, pDstWnd = (WindowPtr)pDrawable; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { return; } @@ -158,15 +180,22 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, { if (npt > 0) { - rdpup_begin_update(); - rdpup_set_fgcolor(pGC->fgPixel); - for (i = 0; i < npt; i++) + if (dirty_type != 0) { - x = pts[i].x; - y = pts[i].y; - rdpup_fill_rect(x, y, 1, 1); + /* TODO */ + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_set_fgcolor(pGC->fgPixel); + for (i = 0; i < npt; i++) + { + x = pts[i].x; + y = pts[i].y; + rdpup_fill_rect(x, y, 1, 1); + } + rdpup_end_update(); } - rdpup_end_update(); } } else if (cd == 2) @@ -174,21 +203,28 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, num_clips = REGION_NUM_RECTS(&clip_reg); if (npt > 0 && num_clips > 0) { - rdpup_begin_update(); - rdpup_set_fgcolor(pGC->fgPixel); - for (j = num_clips - 1; j >= 0; j--) + if (dirty_type != 0) { - box = REGION_RECTS(&clip_reg)[j]; - rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - for (i = 0; i < npt; i++) + /* TODO */ + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_set_fgcolor(pGC->fgPixel); + for (j = num_clips - 1; j >= 0; j--) { - x = pts[i].x; - y = pts[i].y; - rdpup_fill_rect(x, y, 1, 1); + box = REGION_RECTS(&clip_reg)[j]; + rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + for (i = 0; i < npt; i++) + { + x = pts[i].x; + y = pts[i].y; + rdpup_fill_rect(x, y, 1, 1); + } } + rdpup_reset_clip(); + rdpup_end_update(); } - rdpup_reset_clip(); - rdpup_end_update(); } } RegionUninit(&clip_reg); @@ -196,5 +232,8 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, { g_free(pts); } - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } } diff --git a/xorg/X11R7.6/rdp/rdpPolyRectangle.c b/xorg/X11R7.6/rdp/rdpPolyRectangle.c index 0d2beede..96ff058d 100644 --- a/xorg/X11R7.6/rdp/rdpPolyRectangle.c +++ b/xorg/X11R7.6/rdp/rdpPolyRectangle.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -71,6 +72,9 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, int up; int down; int got_id; + int dirty_type; + int post_process; + int reset_surface; xRectangle* regRects; xRectangle* r; xRectangle* rect1; @@ -80,6 +84,7 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; LLOGLN(10, ("rdpPolyRectangle:")); @@ -93,6 +98,10 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, /* do original call */ rdpPolyRectangleOrg(pDrawable, pGC, nrects, rects); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDrawable->type == DRAWABLE_PIXMAP) { @@ -100,9 +109,21 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpPolyRectangle: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLL; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -112,12 +133,13 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, pDstWnd = (WindowPtr)pDrawable; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { g_free(rect1); return; @@ -164,27 +186,34 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, { if (regRects != 0) { - rdpup_begin_update(); - if (pGC->lineStyle == LineSolid) + if (dirty_type != 0) { - rdpup_set_fgcolor(pGC->fgPixel); - rdpup_set_opcode(pGC->alu); - for (i = 0; i < nrects * 4; i++) - { - r = regRects + i; - rdpup_fill_rect(r->x, r->y, r->width, r->height); - } - rdpup_set_opcode(GXcopy); + /* TODO */ } - else + else if (got_id) { - for (i = 0; i < nrects * 4; i++) + rdpup_begin_update(); + if (pGC->lineStyle == LineSolid) { - r = regRects + i; - rdpup_send_area(&id, r->x, r->y, r->width, r->height); + rdpup_set_fgcolor(pGC->fgPixel); + rdpup_set_opcode(pGC->alu); + for (i = 0; i < nrects * 4; i++) + { + r = regRects + i; + rdpup_fill_rect(r->x, r->y, r->width, r->height); + } + rdpup_set_opcode(GXcopy); } + else + { + for (i = 0; i < nrects * 4; i++) + { + r = regRects + i; + rdpup_send_area(&id, r->x, r->y, r->width, r->height); + } + } + rdpup_end_update(); } - rdpup_end_update(); } } else if (cd == 2) @@ -196,27 +225,34 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, num_clips = REGION_NUM_RECTS(&clip_reg); if (num_clips > 0) { - rdpup_begin_update(); - if (pGC->lineStyle == LineSolid) + if (dirty_type != 0) { - rdpup_set_fgcolor(pGC->fgPixel); - rdpup_set_opcode(pGC->alu); - for (j = num_clips - 1; j >= 0; j--) - { - box = REGION_RECTS(&clip_reg)[j]; - rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - } - rdpup_set_opcode(GXcopy); + /* TODO */ } - else + else if (got_id) { - for (j = num_clips - 1; j >= 0; j--) + rdpup_begin_update(); + if (pGC->lineStyle == LineSolid) + { + rdpup_set_fgcolor(pGC->fgPixel); + rdpup_set_opcode(pGC->alu); + for (j = num_clips - 1; j >= 0; j--) + { + box = REGION_RECTS(&clip_reg)[j]; + rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + } + rdpup_set_opcode(GXcopy); + } + else { - box = REGION_RECTS(&clip_reg)[j]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + for (j = num_clips - 1; j >= 0; j--) + { + box = REGION_RECTS(&clip_reg)[j]; + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + } } + rdpup_end_update(); } - rdpup_end_update(); } RegionDestroy(fill_reg); } @@ -224,5 +260,8 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, RegionUninit(&clip_reg); g_free(regRects); g_free(rect1); - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } } diff --git a/xorg/X11R7.6/rdp/rdpPolySegment.c b/xorg/X11R7.6/rdp/rdpPolySegment.c index 2e5609b5..5f195e49 100644 --- a/xorg/X11R7.6/rdp/rdpPolySegment.c +++ b/xorg/X11R7.6/rdp/rdpPolySegment.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -63,12 +64,16 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs) int i; int j; int got_id; + int dirty_type; + int post_process; + int reset_surface; xSegment* segs; BoxRec box; struct image_data id; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; LLOGLN(10, ("rdpPolySegment:")); @@ -88,6 +93,10 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs) /* do original call */ rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDrawable->type == DRAWABLE_PIXMAP) { @@ -95,9 +104,21 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs) pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpPolySegment: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLY; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -107,12 +128,13 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs) pDstWnd = (WindowPtr)pDrawable; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { g_free(segs); return; @@ -124,41 +146,58 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs) { if (segs != 0) { - rdpup_begin_update(); - rdpup_set_fgcolor(pGC->fgPixel); - rdpup_set_opcode(pGC->alu); - rdpup_set_pen(0, pGC->lineWidth); - for (i = 0; i < nseg; i++) + if (dirty_type != 0) { - rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2); + /* TODO */ + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_set_fgcolor(pGC->fgPixel); + rdpup_set_opcode(pGC->alu); + rdpup_set_pen(0, pGC->lineWidth); + for (i = 0; i < nseg; i++) + { + rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2); + } + rdpup_set_opcode(GXcopy); + rdpup_end_update(); } - rdpup_set_opcode(GXcopy); - rdpup_end_update(); } } else if (cd == 2) /* clip */ { if (segs != 0) { - rdpup_begin_update(); - rdpup_set_fgcolor(pGC->fgPixel); - rdpup_set_opcode(pGC->alu); - rdpup_set_pen(0, pGC->lineWidth); - for (j = REGION_NUM_RECTS(&clip_reg) - 1; j >= 0; j--) + if (dirty_type != 0) { - box = REGION_RECTS(&clip_reg)[j]; - rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - for (i = 0; i < nseg; i++) + /* TODO */ + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_set_fgcolor(pGC->fgPixel); + rdpup_set_opcode(pGC->alu); + rdpup_set_pen(0, pGC->lineWidth); + for (j = REGION_NUM_RECTS(&clip_reg) - 1; j >= 0; j--) { - rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2); + box = REGION_RECTS(&clip_reg)[j]; + rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + for (i = 0; i < nseg; i++) + { + rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2); + } } + rdpup_reset_clip(); + rdpup_set_opcode(GXcopy); + rdpup_end_update(); } - rdpup_reset_clip(); - rdpup_set_opcode(GXcopy); - rdpup_end_update(); } } g_free(segs); RegionUninit(&clip_reg); - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } } diff --git a/xorg/X11R7.6/rdp/rdpPolyText16.c b/xorg/X11R7.6/rdp/rdpPolyText16.c index 609df35d..5eb00c46 100644 --- a/xorg/X11R7.6/rdp/rdpPolyText16.c +++ b/xorg/X11R7.6/rdp/rdpPolyText16.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -69,11 +70,15 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, int j; int rv; int got_id; + int dirty_type; + int post_process; + int reset_surface; BoxRec box; struct image_data id; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; LLOGLN(10, ("rdpPolyText16:")); @@ -85,6 +90,10 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, /* do original call */ rv = rdpPolyText16Org(pDrawable, pGC, x, y, count, chars); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDrawable->type == DRAWABLE_PIXMAP) { @@ -92,9 +101,21 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpPolyText16: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLY; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -104,12 +125,13 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, pDstWnd = (WindowPtr)pDrawable; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { return rv; } @@ -125,9 +147,18 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, } if (cd == 1) { - rdpup_begin_update(); - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - rdpup_end_update(); + if (dirty_type != 0) + { + RegionInit(®1, &box, 0); + draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + rdpup_end_update(); + } } else if (cd == 2) { @@ -136,17 +167,27 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, num_clips = REGION_NUM_RECTS(®); if (num_clips > 0) { - rdpup_begin_update(); - for (j = num_clips - 1; j >= 0; j--) + if (dirty_type != 0) { - box = REGION_RECTS(®)[j]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + draw_item_add_img_region(pDirtyPriv, ®, dirty_type); + } + else if (got_id) + { + rdpup_begin_update(); + 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_end_update(); } - rdpup_end_update(); } RegionUninit(®1); } RegionUninit(®); - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } return rv; } diff --git a/xorg/X11R7.6/rdp/rdpPolyText8.c b/xorg/X11R7.6/rdp/rdpPolyText8.c index 3cb7b5a0..c7af8f35 100644 --- a/xorg/X11R7.6/rdp/rdpPolyText8.c +++ b/xorg/X11R7.6/rdp/rdpPolyText8.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -69,11 +70,15 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, int j; int rv; int got_id; + int dirty_type; + int post_process; + int reset_surface; BoxRec box; struct image_data id; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; LLOGLN(10, ("rdpPolyText8:")); @@ -85,6 +90,10 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, /* do original call */ rv = rdpPolyText8Org(pDrawable, pGC, x, y, count, chars); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDrawable->type == DRAWABLE_PIXMAP) { @@ -92,9 +101,21 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpPolyText8: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLY; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -104,12 +125,13 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, pDstWnd = (WindowPtr)pDrawable; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { return rv; } @@ -125,9 +147,18 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, } if (cd == 1) { - rdpup_begin_update(); - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - rdpup_end_update(); + if (dirty_type != 0) + { + RegionInit(®1, &box, 0); + draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + rdpup_end_update(); + } } else if (cd == 2) { @@ -136,17 +167,27 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, num_clips = REGION_NUM_RECTS(®); if (num_clips > 0) { - rdpup_begin_update(); - for (j = num_clips - 1; j >= 0; j--) + if (dirty_type != 0) { - box = REGION_RECTS(®)[j]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + draw_item_add_img_region(pDirtyPriv, ®, dirty_type); + } + else if (got_id) + { + rdpup_begin_update(); + 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_end_update(); } - rdpup_end_update(); } RegionUninit(®1); } RegionUninit(®); - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } return rv; } diff --git a/xorg/X11R7.6/rdp/rdpPolylines.c b/xorg/X11R7.6/rdp/rdpPolylines.c index b8400904..f52e4a17 100644 --- a/xorg/X11R7.6/rdp/rdpPolylines.c +++ b/xorg/X11R7.6/rdp/rdpPolylines.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -70,12 +71,16 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int x2; int y2; int got_id; + int dirty_type; + int post_process; + int reset_surface; BoxRec box; DDXPointPtr ppts; struct image_data id; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; LLOGLN(10, ("rdpPolylines:")); @@ -92,6 +97,10 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, /* do original call */ rdpPolylinesOrg(pDrawable, pGC, mode, npt, pptInit); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDrawable->type == DRAWABLE_PIXMAP) { @@ -99,9 +108,21 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpPolylines: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLL; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -111,12 +132,13 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, pDstWnd = (WindowPtr)pDrawable; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { g_free(ppts); return; @@ -128,45 +150,16 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, { if (ppts != 0) { - rdpup_begin_update(); - 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++) + if (dirty_type != 0) { - 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; + /* TODO */ } - rdpup_set_opcode(GXcopy); - rdpup_end_update(); - } - } - else if (cd == 2) - { - num_clips = REGION_NUM_RECTS(&clip_reg); - if (ppts != 0 && num_clips > 0) - { - rdpup_begin_update(); - rdpup_set_fgcolor(pGC->fgPixel); - rdpup_set_opcode(pGC->alu); - rdpup_set_pen(0, pGC->lineWidth); - for (j = num_clips - 1; j >= 0; j--) + else if (got_id) { - box = REGION_RECTS(&clip_reg)[j]; - rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + rdpup_begin_update(); + 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++) @@ -185,13 +178,59 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, x1 = x2; y1 = y2; } + rdpup_set_opcode(GXcopy); + rdpup_end_update(); + } + } + } + else if (cd == 2) + { + num_clips = REGION_NUM_RECTS(&clip_reg); + if (ppts != 0 && num_clips > 0) + { + if (dirty_type != 0) + { + /* TODO */ + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_set_fgcolor(pGC->fgPixel); + rdpup_set_opcode(pGC->alu); + rdpup_set_pen(0, pGC->lineWidth); + for (j = num_clips - 1; j >= 0; j--) + { + 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++) + { + 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_reset_clip(); + rdpup_set_opcode(GXcopy); + rdpup_end_update(); } - rdpup_reset_clip(); - rdpup_set_opcode(GXcopy); - rdpup_end_update(); } } RegionUninit(&clip_reg); g_free(ppts); - rdpup_switch_os_surface(-1); + 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 5129f0e2..f109a999 100644 --- a/xorg/X11R7.6/rdp/rdpPushPixels.c +++ b/xorg/X11R7.6/rdp/rdpPushPixels.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -62,21 +63,32 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, { RegionRec clip_reg; RegionRec box_reg; + RegionRec reg1; int num_clips; int cd; int j; int got_id; + int dirty_type; + int post_process; + int reset_surface; BoxRec box; struct image_data id; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; - LLOGLN(10, ("rdpPushPixels:")); + LLOGLN(0, ("rdpPushPixels:")); /* do original call */ rdpPushPixelsOrg(pGC, pBitMap, pDst, w, h, x, y); + //return; + + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDst->type == DRAWABLE_PIXMAP) { @@ -84,9 +96,21 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpPutImage: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLY; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -96,12 +120,13 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, pDstWnd = (WindowPtr)pDst; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { return; } @@ -111,27 +136,56 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, cd = rdp_get_clip(&clip_reg, pDst, pGC); if (cd == 1) { - rdpup_begin_update(); - rdpup_send_area(0, x, y, w, h); - rdpup_end_update(); + if (dirty_type != 0) + { + box.x1 = pDst->x + x; + box.y1 = pDst->y + y; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; + RegionInit(®1, &box, 0); + draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_send_area(0, pDst->x + x, pDst->y + y, w, h); + rdpup_end_update(); + } } else if (cd == 2) { + box.x1 = pDst->x + x; + box.y1 = pDst->y + y; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; RegionInit(&box_reg, &box, 0); RegionIntersect(&clip_reg, &clip_reg, &box_reg); num_clips = REGION_NUM_RECTS(&clip_reg); if (num_clips > 0) { - rdpup_begin_update(); - for (j = num_clips - 1; j >= 0; j--) + if (dirty_type != 0) { - box = REGION_RECTS(&clip_reg)[j]; - rdpup_send_area(0, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + RegionInit(®1, &box, 0); + draw_item_add_img_region(pDirtyPriv, &clip_reg, dirty_type); + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + for (j = num_clips - 1; j >= 0; j--) + { + box = REGION_RECTS(&clip_reg)[j]; + rdpup_send_area(0, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + } + rdpup_end_update(); } - rdpup_end_update(); } RegionUninit(&box_reg); } RegionUninit(&clip_reg); - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } } diff --git a/xorg/X11R7.6/rdp/rdpPutImage.c b/xorg/X11R7.6/rdp/rdpPutImage.c index a5072c23..018ddf0e 100644 --- a/xorg/X11R7.6/rdp/rdpPutImage.c +++ b/xorg/X11R7.6/rdp/rdpPutImage.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -64,19 +65,30 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, RegionRec clip_reg; int cd; int j; + int reset_surface; + int post_process; int got_id; + int dirty_type; BoxRec box; struct image_data id; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; + RegionRec reg1; + RegionRec reg2; LLOGLN(10, ("rdpPutImage:")); LLOGLN(10, ("rdpPutImage: drawable id 0x%x", (int)(pDst->id))); /* do original call */ rdpPutImageOrg(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits); + + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDst->type == DRAWABLE_PIXMAP) { @@ -84,9 +96,21 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpPutImage: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLY; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -96,12 +120,13 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, pDstWnd = (WindowPtr)pDst; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { return; } @@ -109,22 +134,55 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, cd = rdp_get_clip(&clip_reg, pDst, pGC); if (cd == 1) { - rdpup_begin_update(); - rdpup_send_area(&id, pDst->x + x, pDst->y + y, w, h); - rdpup_end_update(); + if (dirty_type != 0) + { + box.x1 = pDst->x + x; + box.y1 = pDst->y + y; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; + RegionInit(®1, &box, 0); + draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_send_area(&id, pDst->x + x, pDst->y + y, w, h); + rdpup_end_update(); + } } else if (cd == 2) { - rdpup_begin_update(); - for (j = REGION_NUM_RECTS(&clip_reg) - 1; j >= 0; j--) + if (dirty_type != 0) { - box = REGION_RECTS(&clip_reg)[j]; - rdpup_set_clip(box.x1, box.y1, (box.x2 - box.x1), (box.y2 - box.y1)); - rdpup_send_area(&id, pDst->x + x, pDst->y + y, w, h); + box.x1 = pDst->x + x; + box.y1 = pDst->y + y; + box.x2 = box.x1 + w; + box.y2 = box.y1 + h; + RegionInit(®1, &box, 0); + RegionInit(®2, NullBox, 0); + RegionCopy(®2, &clip_reg); + RegionIntersect(®1, ®1, ®2); + draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + RegionUninit(®1); + RegionUninit(®2); + } + else if (got_id) + { + rdpup_begin_update(); + for (j = REGION_NUM_RECTS(&clip_reg) - 1; j >= 0; j--) + { + box = REGION_RECTS(&clip_reg)[j]; + rdpup_set_clip(box.x1, box.y1, (box.x2 - box.x1), (box.y2 - box.y1)); + rdpup_send_area(&id, pDst->x + x, pDst->y + y, w, h); + } + rdpup_reset_clip(); + rdpup_end_update(); } - rdpup_reset_clip(); - rdpup_end_update(); } RegionUninit(&clip_reg); - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } } diff --git a/xorg/X11R7.6/rdp/rdpSetSpans.c b/xorg/X11R7.6/rdp/rdpSetSpans.c index 7b763091..ed9bc404 100644 --- a/xorg/X11R7.6/rdp/rdpSetSpans.c +++ b/xorg/X11R7.6/rdp/rdpSetSpans.c @@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -63,17 +64,24 @@ rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc, RegionRec clip_reg; int cd; int got_id; + int dirty_type; + int post_process; + int reset_surface; struct image_data id; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; - + rdpPixmapRec* pDirtyPriv; LLOGLN(0, ("rdpSetSpans: todo")); /* do original call */ rdpSetSpansOrg(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDrawable->type == DRAWABLE_PIXMAP) { @@ -81,9 +89,21 @@ rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpSetSpans: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLY; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -93,12 +113,13 @@ rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc, pDstWnd = (WindowPtr)pDrawable; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; } } } - if (!got_id) + if (!post_process) { return; } @@ -106,10 +127,25 @@ rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc, cd = rdp_get_clip(&clip_reg, pDrawable, pGC); if (cd == 1) { + if (dirty_type != 0) + { + } + else if (got_id) + { + } } else if (cd == 2) { + if (dirty_type != 0) + { + } + else if (got_id) + { + } } RegionUninit(&clip_reg); - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } } diff --git a/xorg/X11R7.6/rdp/rdpdraw.c b/xorg/X11R7.6/rdp/rdpdraw.c index 2ba24fb0..cc48550c 100644 --- a/xorg/X11R7.6/rdp/rdpdraw.c +++ b/xorg/X11R7.6/rdp/rdpdraw.c @@ -61,9 +61,12 @@ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */ extern WindowPtr g_invalidate_window; /* in rdpmain.c */ extern int g_use_rail; /* in rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ ColormapPtr g_rdpInstalledColormap; +static int g_doing_font = 0; + GCFuncs g_rdpGCFuncs = { rdpValidateGC, rdpChangeGC, rdpCopyGC, rdpDestroyGC, rdpChangeClip, @@ -317,7 +320,7 @@ rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects) { rdpGCRec* priv; - LLOGLN(0, ("in rdpChangeClip")); + LLOGLN(10, ("in rdpChangeClip")); GC_FUNC_PROLOGUE(pGC); pGC->funcs->ChangeClip(pGC, type, pValue, nrects); GC_FUNC_EPILOGUE(pGC); @@ -379,6 +382,180 @@ rdpCloseScreen(int i, ScreenPtr pScreen) return 1; } +/******************************************************************************/ +int +draw_item_add(rdpPixmapRec* priv, struct rdp_draw_item* di) +{ + if (priv->draw_item_tail == 0) + { + priv->draw_item_tail = di; + priv->draw_item_head = di; + } + else + { + di->prev = priv->draw_item_tail; + priv->draw_item_tail->next = di; + priv->draw_item_tail = di; + } + return 0; +} + +/******************************************************************************/ +int +draw_item_remove(rdpPixmapRec* priv, struct rdp_draw_item* di) +{ + if (di->prev != 0) + { + di->prev->next = di->next; + } + if (di->next != 0) + { + di->next->prev = di->prev; + } + if (priv->draw_item_head == di) + { + priv->draw_item_head = di->next; + } + if (priv->draw_item_tail == di) + { + priv->draw_item_tail = di->prev; + } + RegionDestroy(di->reg); + free(di); + return 0; +} + +/******************************************************************************/ +int +draw_item_remove_all(rdpPixmapRec* priv) +{ + struct rdp_draw_item* di; + + di = priv->draw_item_head; + while (di != 0) + { + draw_item_remove(priv, di); + di = priv->draw_item_head; + } + return 0; +} + +/******************************************************************************/ +int +draw_item_pack(rdpPixmapRec* priv) +{ + struct rdp_draw_item* di; + struct rdp_draw_item* di_prev; + +#if 1 + /* look for repeating draw types */ + if (priv->draw_item_head != 0) + { + if (priv->draw_item_head->next != 0) + { + di_prev = priv->draw_item_head; + di = priv->draw_item_head->next; + while (di != 0) + { + if ((di_prev->type == RDI_IMGLL) && (di->type == RDI_IMGLL)) + { + LLOGLN(10, ("draw_item_pack: packing RDI_IMGLL")); + RegionUnion(di_prev->reg, di_prev->reg, di->reg); + draw_item_remove(priv, di); + di = di_prev->next; + } + else if ((di_prev->type == RDI_IMGLY) && (di->type == RDI_IMGLY)) + { + LLOGLN(10, ("draw_item_pack: packing RDI_IMGLY")); + RegionUnion(di_prev->reg, di_prev->reg, di->reg); + draw_item_remove(priv, di); + di = di_prev->next; + } + else + { + di_prev = di; + di = di_prev->next; + } + } + } + } +#endif +#if 1 + /* subtract regions */ + if (priv->draw_item_tail != 0) + { + if (priv->draw_item_tail->prev != 0) + { + di = priv->draw_item_tail; + while (di->prev != 0) + { + 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; + } + } + } +#endif +#if 1 + /* remove draw items with empty regions */ + di = priv->draw_item_head; + di_prev = 0; + while (di != 0) + { + if (!RegionNotEmpty(di->reg)) + { + LLOGLN(10, ("draw_item_pack: removing empty item type %d", di->type)); + draw_item_remove(priv, di); + di = di_prev == 0 ? priv->draw_item_head : di_prev->next; + } + else + { + di_prev = di; + di = di->next; + } + } +#endif + return 0; +} + +/******************************************************************************/ +int +draw_item_add_img_region(rdpPixmapRec* priv, RegionPtr reg, 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->type = type; + di->reg = RegionCreate(NullBox, 0); + RegionCopy(di->reg, reg); + draw_item_add(priv, di); + return 0; +} + +/******************************************************************************/ +int +draw_item_add_fill_region(rdpPixmapRec* priv, RegionPtr reg, int color, + int opcode) +{ + 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->type = RDI_FILL; + di->fg_color = color; + di->opcode = opcode; + di->reg = RegionCreate(NullBox, 0); + RegionCopy(di->reg, reg); + draw_item_add(priv, di); + return 0; +} + /******************************************************************************/ PixmapPtr rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, @@ -391,12 +568,13 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, org_width = width; /* width must be a multiple of 4 in rdp */ width = (width + 3) & ~3; - LLOGLN(10, ("rdpCreatePixmap: width %d org_width %d", width, org_width)); + LLOGLN(10, ("rdpCreatePixmap: width %d org_width %d depth %d screen depth %d", + width, org_width, depth, g_rdpScreen.depth)); pScreen->CreatePixmap = g_rdpScreen.CreatePixmap; rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint); priv = GETPIXPRIV(rv); priv->rdpindex = -1; - if ((rv->drawable.depth == g_rdpScreen.depth) && + if ((rv->drawable.depth >= g_rdpScreen.depth) && (org_width > 1) && (height > 1)) { priv->allocBytes = width * height * g_Bpp; @@ -406,6 +584,8 @@ 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; @@ -429,6 +609,9 @@ 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); } } pScreen = pPixmap->drawable.pScreen; @@ -833,12 +1016,18 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, RegionRec reg1; RegionRec reg2; DrawablePtr p; + int dirty_type; int j; int num_clips; + int post_process; + int reset_surface; int got_id; + int lx; + int ly; WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; struct image_data id; LLOGLN(10, ("rdpComposite:")); @@ -850,6 +1039,10 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, p = pDst->pDrawable; + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (p->type == DRAWABLE_PIXMAP) { @@ -857,9 +1050,23 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - rdpup_switch_os_surface(pDstPriv->rdpindex); - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; + post_process = 1; + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpComposite: gettig dirty")); + pDstPriv->is_dirty = 1; + dirty_type = g_doing_font ? RDI_IMGLL : RDI_IMGLY; + pDirtyPriv = pDstPriv; + + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + LLOGLN(10, ("rdpComposite: offscreen")); + } } } else @@ -869,12 +1076,14 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, pDstWnd = (WindowPtr)p; if (pDstWnd->viewable) { + post_process = 1; rdpup_get_screen_image_rect(&id); got_id = 1; + LLOGLN(10, ("rdpComposite: screen")); } } } - if (!got_id) + if (!post_process) { return; } @@ -888,19 +1097,27 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, RegionInit(®1, &box, 0); RegionInit(®2, NullBox, 0); RegionCopy(®2, pDst->clientClip); - RegionTranslate(®2, p->x + pDst->clipOrigin.x, - p->y + pDst->clipOrigin.y); + lx = p->x + pDst->clipOrigin.x; + ly = p->y + pDst->clipOrigin.y; + RegionTranslate(®2, lx, ly); RegionIntersect(®1, ®1, ®2); - num_clips = REGION_NUM_RECTS(®1); - if (num_clips > 0) + if (dirty_type != 0) { - rdpup_begin_update(); - for (j = num_clips - 1; j >= 0; j--) + draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + } + else if (got_id) + { + num_clips = REGION_NUM_RECTS(®1); + if (num_clips > 0) { - box = REGION_RECTS(®1)[j]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + rdpup_begin_update(); + for (j = num_clips - 1; j >= 0; j--) + { + box = REGION_RECTS(®1)[j]; + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + } + rdpup_end_update(); } - rdpup_end_update(); } RegionUninit(®1); RegionUninit(®2); @@ -911,11 +1128,23 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, box.y1 = p->y + yDst; box.x2 = box.x1 + width; box.y2 = box.y1 + height; - rdpup_begin_update(); - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - rdpup_end_update(); + if (dirty_type != 0) + { + RegionInit(®1, &box, 0); + draw_item_add_img_region(pDirtyPriv, ®1, dirty_type); + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + rdpup_end_update(); + } + } + if (reset_surface) + { + rdpup_switch_os_surface(-1); } - rdpup_switch_os_surface(-1); } /******************************************************************************/ @@ -931,6 +1160,7 @@ rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, LLOGLN(10, ("rdpGlyphs:")); LLOGLN(10, ("rdpGlyphs: nlists %d len %d", nlists, lists->len)); rdpup_set_hints(1, 1); + g_doing_font = 1; for (index = 0; index < lists->len; index++) { LLOGLN(10, (" index %d size %d refcnt %d width %d height %d", @@ -943,5 +1173,6 @@ rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, nlists, lists, glyphs); ps->Glyphs = rdpGlyphs; rdpup_set_hints(0, 1); + g_doing_font = 0; LLOGLN(10, ("rdpGlyphs: out")); } diff --git a/xorg/X11R7.6/rdp/rdpmain.c b/xorg/X11R7.6/rdp/rdpmain.c index 2bf36771..15a8993d 100644 --- a/xorg/X11R7.6/rdp/rdpmain.c +++ b/xorg/X11R7.6/rdp/rdpmain.c @@ -42,6 +42,7 @@ DevPrivateKeyRec g_rdpPixmapIndex; DeviceIntPtr g_pointer = 0; DeviceIntPtr g_keyboard = 0; +int g_do_dirty_os = 1; /* delay remoting off screen bitmaps */ Bool g_wrapWindow = 1; Bool g_wrapPixmap = 1; diff --git a/xorg/X11R7.6/rdp/rdpup.c b/xorg/X11R7.6/rdp/rdpup.c index 8b45dacc..f1892fae 100644 --- a/xorg/X11R7.6/rdp/rdpup.c +++ b/xorg/X11R7.6/rdp/rdpup.c @@ -1590,3 +1590,79 @@ rdpup_delete_window(WindowPtr pWindow, rdpWindowRec* priv) out_uint32_le(g_out_s, pWindow->drawable.id); /* window_id */ } } + +/******************************************************************************/ +int +rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec* pDirtyPriv) +{ + int index; + int count; + BoxRec box; + struct image_data id; + struct rdp_draw_item* di; + + if (pDirtyPriv == 0) + { + return 0; + } + if (pDirtyPriv->is_dirty == 0) + { + return 0; + } + + /* update uses time / count */ + g_os_bitmaps[pDirtyPriv->rdpindex].stamp = g_os_bitmap_stamp; + g_os_bitmap_stamp++; + + LLOGLN(10, ("-----------------got dirty")); + rdpup_switch_os_surface(pDirtyPriv->rdpindex); + rdpup_get_pixmap_image_rect(pDirtyPixmap, &id); + rdpup_begin_update(); + draw_item_pack(pDirtyPriv); + di = pDirtyPriv->draw_item_head; + while (di != 0) + { + LLOGLN(10, ("rdpup_check_dirty: type %d", di->type)); + switch (di->type) + { + case RDI_FILL: + rdpup_set_fgcolor(di->fg_color); + rdpup_set_opcode(di->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)); + 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); + 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); + } + rdpup_set_hints(0, 1); + break; + case RDI_IMGLY: + 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); + } + break; + } + di = di->next; + } + draw_item_remove_all(pDirtyPriv); + rdpup_end_update(); + pDirtyPriv->is_dirty = 0; + rdpup_switch_os_surface(-1); + return 0; +}