diff options
author | LawrenceK <github@lklyne.co.uk> | 2012-08-20 19:36:29 +0100 |
---|---|---|
committer | LawrenceK <github@lklyne.co.uk> | 2012-08-20 19:36:29 +0100 |
commit | 69389e4a63e955151c14110f54bf6c8aa9496f33 (patch) | |
tree | 63ef9f6015dd4f773443ed972d09c6691a7e9336 /xorg/X11R7.6/rdp | |
parent | 2dfc213abeeb433559d37e87ac6ad1fcb6791f0e (diff) | |
parent | c5862f367ca68763dd3070598a36ea82db7f3566 (diff) | |
download | xrdp-proprietary-69389e4a63e955151c14110f54bf6c8aa9496f33.tar.gz xrdp-proprietary-69389e4a63e955151c14110f54bf6c8aa9496f33.zip |
Merge branch 'master' of git://github.com/FreeRDP/xrdp
Diffstat (limited to 'xorg/X11R7.6/rdp')
28 files changed, 2274 insertions, 580 deletions
diff --git a/xorg/X11R7.6/rdp/Makefile b/xorg/X11R7.6/rdp/Makefile index a4d405c1..7373f51a 100644 --- a/xorg/X11R7.6/rdp/Makefile +++ b/xorg/X11R7.6/rdp/Makefile @@ -57,6 +57,7 @@ CFLAGS = -O2 -Wall -fno-strength-reduce \ -I../../render \ -I../xfree86/common \ -I../xfree86/os-support \ + -I../../../common \ -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_REENTRANT \ -DGLX_USE_MESA -DXRECORD -D_GNU_SOURCE -DXAPPGROUP \ -DTOGCUP -DSINGLEDEPTH -DXFree86Server \ diff --git a/xorg/X11R7.6/rdp/rdp.h b/xorg/X11R7.6/rdp/rdp.h index 0da7d967..695a2bde 100644 --- a/xorg/X11R7.6/rdp/rdp.h +++ b/xorg/X11R7.6/rdp/rdp.h @@ -70,7 +70,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "exevents.h" #include "xserver-properties.h" #include "xkbsrv.h" -#include "../../../common/xrdp_client_info.h" +/* in xrdp/common */ +#include "xrdp_client_info.h" +#include "xrdp_constants.h" //#include "colormapst.h" @@ -175,12 +177,79 @@ typedef rdpWindowRec* rdpWindowPtr; #define GETWINPRIV(_pWindow) \ (rdpWindowPtr)dixGetPrivateAddr(&(_pWindow->devPrivates), &g_rdpWindowIndex) +#define XR_IS_ROOT(_pWindow) ((_pWindow)->drawable.pScreen->root == (_pWindow)) + +/* for tooltips */ +#define XR_STYLE_TOOLTIP (0x80000000) +#define XR_EXT_STYLE_TOOLTIP (0x00000080 | 0x00000008) + +/* for normal desktop windows */ +/* WS_TILEDWINDOW (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | + WS_MINIMIZEBOX | WS_MAXIMIZEBOX) */ +#define XR_STYLE_NORMAL (0x00C00000 | 0x00080000 | 0x00040000 | 0x00010000 | 0x00020000) +#define XR_EXT_STYLE_NORMAL (0x00040000) + +/* for dialogs */ +#define XR_STYLE_DIALOG (0x80000000) +#define XR_EXT_STYLE_DIALOG (0x00040000) + +#define RDI_FILL 1 +#define RDI_IMGLL 2 /* lossless */ +#define RDI_IMGLY 3 /* lossy */ +#define RDI_LINE 4 + +struct urdp_draw_item_fill +{ + int opcode; + int fg_color; + int bg_color; + int pad0; +}; + +struct urdp_draw_item_img +{ + int opcode; + 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 { int status; int rdpindex; int allocBytes; int con_number; + int is_dirty; + int pad0; + struct rdp_draw_item* draw_item_head; + struct rdp_draw_item* draw_item_tail; }; typedef struct _rdpPixmapRec rdpPixmapRec; typedef rdpPixmapRec* rdpPixmapPtr; @@ -242,11 +311,34 @@ int g_chmod_hex(const char* filename, int flags); void hexdump(unsigned char *p, unsigned int len); +void +RegionAroundSegs(RegionPtr reg, xSegment* segs, int nseg); /* rdpdraw.c */ 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 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 rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint); @@ -404,6 +496,12 @@ rdpup_paint_rect_os(int x, int y, int cx, int cy, int rdpindex, int srcx, int srcy); void rdpup_set_hints(int hints, int mask); +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..4b35d9fb 100644 --- a/xorg/X11R7.6/rdp/rdpCopyArea.c +++ b/xorg/X11R7.6/rdp/rdpCopyArea.c @@ -37,6 +37,8 @@ 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_can_do_pix_to_pix; /* from rdpmain.c */ +extern int g_do_dirty_os; /* in rdpmain.c */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */ @@ -241,11 +243,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 +285,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 +295,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 +306,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(); @@ -323,11 +331,15 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, RegionPtr rv; RegionRec clip_reg; RegionRec box_reg; + RegionRec reg1; int num_clips; int cd; int j; int can_do_screen_blt; int got_id; + int dirty_type; + int post_process; + int reset_surface; struct image_data id; BoxRec box; BoxPtr pbox; @@ -335,6 +347,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, PixmapPtr pDstPixmap; rdpPixmapRec* pSrcPriv; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; WindowPtr pDstWnd; WindowPtr pSrcWnd; @@ -367,6 +380,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); } @@ -385,6 +399,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, pDstWnd = (WindowPtr)pDst; if (pDstWnd->viewable) { + rdpup_check_dirty(pSrcPixmap, pSrcPriv); return rdpCopyAreaPixmapToWnd(pSrcPixmap, pSrcPriv, pDstWnd, pGC, srcx, srcy, w, h, dstx, dsty); } @@ -395,10 +410,15 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, pDstPriv = GETPIXPRIV(pDstPixmap); if (XRDP_IS_OS(pDstPriv)) { - return rdpCopyAreaPixmapToPixmap(pSrcPixmap, pSrcPriv, - pDstPixmap, pDstPriv, - pGC, srcx, srcy, w, h, - dstx, dsty); + if (g_can_do_pix_to_pix) + { + rdpup_check_dirty(pSrcPixmap, pSrcPriv); + rdpup_check_dirty(pDstPixmap, pDstPriv); + return rdpCopyAreaPixmapToPixmap(pSrcPixmap, pSrcPriv, + pDstPixmap, pDstPriv, + pGC, srcx, srcy, w, h, + dstx, dsty); + } } } } @@ -407,6 +427,10 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, /* do original call */ rv = rdpCopyAreaOrg(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDst->type == DRAWABLE_PIXMAP) { @@ -414,9 +438,21 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, 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, ("rdpCopyArea: 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 @@ -426,12 +462,13 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, 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; } @@ -440,43 +477,73 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, 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, GXcopy, 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(&box_reg, &box, 0); + RegionIntersect(&clip_reg, &clip_reg, &box_reg); + draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type); + RegionUninit(&box_reg); } - else + else if (got_id) { - 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); - rdpup_switch_os_surface(-1); + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } return rv; } diff --git a/xorg/X11R7.6/rdp/rdpCopyPlane.c b/xorg/X11R7.6/rdp/rdpCopyPlane.c index f0a54d9e..389dc6e1 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,33 @@ 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 +103,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_IMGLL; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -103,12 +127,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 +142,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, GXcopy, 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, GXcopy, dirty_type); + RegionUninit(®1); + RegionUninit(®2); } - else + else if (got_id) { - 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..bf71c094 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,60 @@ 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:")); + box.x1 = 0; + box.y1 = 0; + box.x2 = 0; + box.y2 = 0; + if (count > 0) + { + maxx = pPts[0].x; + maxy = pPts[0].y; + minx = maxx; + miny = maxy; + for (i = 1; i < count; i++) + { + if (pPts[i].x > maxx) + { + maxx = pPts[i].x; + } + if (pPts[i].x < minx) + { + minx = pPts[i].x; + } + if (pPts[i].y > maxy) + { + maxy = pPts[i].y; + } + if (pPts[i].y < miny) + { + miny = pPts[i].y; + } + } + box.x1 = pDrawable->x + minx; + box.y1 = pDrawable->y + miny; + box.x2 = pDrawable->x + maxx + 1; + box.y2 = pDrawable->y + maxy + 1; + } + /* 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 +136,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_IMGLL; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -103,60 +160,33 @@ 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; } RegionInit(&clip_reg, NullBox, 0); cd = rdp_get_clip(&clip_reg, pDrawable, pGC); - if (cd != 0) + if (cd == 1) { - box.x1 = 0; - box.y1 = 0; - box.x2 = 0; - box.y2 = 0; - if (count > 0) + if (dirty_type != 0) { - maxx = pPts[0].x; - maxy = pPts[0].y; - minx = maxx; - miny = maxy; - for (i = 1; i < count; i++) - { - if (pPts[i].x > maxx) - { - maxx = pPts[i].x; - } - if (pPts[i].x < minx) - { - minx = pPts[i].x; - } - if (pPts[i].y > maxy) - { - maxy = pPts[i].y; - } - if (pPts[i].y < miny) - { - miny = pPts[i].y; - } - box.x1 = pDrawable->x + minx; - box.y1 = pDrawable->y + miny; - box.x2 = pDrawable->x + maxx + 1; - box.y2 = pDrawable->y + maxy + 1; - } + RegionInit(®1, &box, 0); + draw_item_add_img_region(pDirtyPriv, ®1, GXcopy, 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 (cd == 1) - { - 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 +195,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, GXcopy, 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/rdpFillSpans.c b/xorg/X11R7.6/rdp/rdpFillSpans.c index 1f655d01..5c3dcc67 100644 --- a/xorg/X11R7.6/rdp/rdpFillSpans.c +++ b/xorg/X11R7.6/rdp/rdpFillSpans.c @@ -68,7 +68,7 @@ rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit, PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; - LLOGLN(0, ("rdpFillSpans: todo")); + LLOGLN(10, ("rdpFillSpans: todo")); /* do original call */ rdpFillSpansOrg(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); diff --git a/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c b/xorg/X11R7.6/rdp/rdpImageGlyphBlt.c index 35c19bc1..25d23a51 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, GXcopy, 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, ®, GXcopy, 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..103344c6 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, GXcopy, 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,28 @@ 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, ®, GXcopy, 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..ba958a21 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, GXcopy, 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,28 @@ 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, ®, GXcopy, 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..ba890f0c 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,21 @@ 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, GXcopy, 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 +187,29 @@ 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, GXcopy, 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..cb8f2801 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,21 @@ 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, GXcopy, 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 +187,29 @@ 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, GXcopy, 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..5dda6b7e 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, GXcopy, 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, GXcopy, 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..89ae85b4 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, GXcopy, 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,28 @@ 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, ®, GXcopy, 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..cbbc4a98 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 */ @@ -61,6 +62,8 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr in_pts) { RegionRec clip_reg; + RegionRec reg1; + RegionRec reg2; int num_clips; int cd; int x; @@ -68,6 +71,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,8 +82,10 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, WindowPtr pDstWnd; PixmapPtr pDstPixmap; rdpPixmapRec* pDstPriv; + rdpPixmapRec* pDirtyPriv; LLOGLN(10, ("rdpPolyPoint:")); + LLOGLN(10, ("rdpPolyPoint: npt %d", npt)); if (npt > 32) { @@ -123,6 +131,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 +142,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_IMGLL; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -142,12 +166,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 +183,35 @@ 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); + RegionInit(®1, NullBox, 0); + for (i = 0; i < npt; i++) + { + box.x1 = pts[i].x; + box.y1 = pts[i].y; + box.x2 = box.x1 + 1; + box.y2 = box.y1 + 1; + RegionInit(®2, &box, 0); + RegionUnion(®1, ®1, ®2); + RegionUninit(®2); + } + draw_item_add_fill_region(pDirtyPriv, ®1, pGC->fgPixel, + pGC->alu); + RegionUninit(®1); + } + 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 +219,42 @@ 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); + RegionInit(®1, NullBox, 0); for (i = 0; i < npt; i++) { - x = pts[i].x; - y = pts[i].y; - rdpup_fill_rect(x, y, 1, 1); + box.x1 = pts[i].x; + box.y1 = pts[i].y; + box.x2 = box.x1 + 1; + box.y2 = box.y1 + 1; + RegionInit(®2, &box, 0); + RegionUnion(®1, ®1, ®2); + RegionUninit(®2); } + RegionIntersect(®1, ®1, &clip_reg); + draw_item_add_fill_region(pDirtyPriv, ®1, pGC->fgPixel, + pGC->alu); + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_set_fgcolor(pGC->fgPixel); + 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); + 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 +262,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..e2b38394 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,44 @@ 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++) + 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 { - r = regRects + i; - rdpup_fill_rect(r->x, r->y, r->width, r->height); + draw_item_add_img_region(pDirtyPriv, fill_reg, GXcopy, dirty_type); } - rdpup_set_opcode(GXcopy); + RegionDestroy(fill_reg); } - 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 +235,42 @@ 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--) + if (pGC->lineStyle == LineSolid) { - box = REGION_RECTS(&clip_reg)[j]; - rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + draw_item_add_fill_region(pDirtyPriv, &clip_reg, pGC->fgPixel, + pGC->alu); + } + else + { + draw_item_add_img_region(pDirtyPriv, &clip_reg, GXcopy, dirty_type); } - rdpup_set_opcode(GXcopy); } - else + else if (got_id) { - for (j = num_clips - 1; j >= 0; j--) + rdpup_begin_update(); + if (pGC->lineStyle == LineSolid) { - box = REGION_RECTS(&clip_reg)[j]; - rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + 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 + { + 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 +278,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..efab3cc0 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,14 +64,19 @@ 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:")); + LLOGLN(10, (" nseg %d", nseg)); segs = 0; if (nseg) /* get the rects */ @@ -88,6 +94,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 +105,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_IMGLL; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } } else @@ -107,12 +129,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; @@ -120,45 +143,70 @@ 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) { - 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); + 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) + { + 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++) + draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel, + pGC->alu, pGC->lineWidth, segs, nseg, 1); + } + 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); + LLOGLN(10, (" %d %d %d %d", 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..aaea2434 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, GXcopy, 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, ®, GXcopy, 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..0b16cf26 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, GXcopy, 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, ®, GXcopy, 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..cbaf9c3e 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 */ @@ -65,33 +66,82 @@ 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:")); - - ppts = 0; - if (npt > 0) + LLOGLN(10, (" npt %d mode %d x %d y %d", npt, mode, + pDrawable->x, pDrawable->y)); +#if 0 + LLOGLN(0, (" points")); + for (i = 0; i < npt; i++) + { + LLOGLN(0, (" %d %d", pptInit[i].x, pptInit[i].y)); + } +#endif + /* 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) * nseg, 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; + for (i = 2; i < npt; i++) + { + segs[i - 1].x1 = segs[i - 2].x2; + segs[i - 1].y1 = segs[i - 2].y2; + segs[i - 1].x2 = pptInit[i].x + pDrawable->x; + segs[i - 1].y2 = pptInit[i].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; + segs[i - 1].x2 = segs[i - 1].x1 + pptInit[i].x; + segs[i - 1].y2 = segs[i - 1].y1 + pptInit[i].y; + } + } + } + else + { + LLOGLN(0, ("rdpPolylines: weird npt [%d]", npt)); } +#if 0 + LLOGLN(0, (" segments")); + for (i = 0; i < nseg; i++) + { + LLOGLN(0, (" %d %d %d %d", segs[i].x1, segs[i].y1, + segs[i].x2, segs[i].y2)); + } +#endif /* 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 +149,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,14 +173,15 @@ 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); + g_free(segs); return; } @@ -126,72 +189,66 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, cd = rdp_get_clip(&clip_reg, pDrawable, pGC); if (cd == 1) { - if (ppts != 0) + if (segs != 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 + 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) + { + 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++) { - x2 = x1 + ppts[i].x; - y2 = y1 + ppts[i].y; + rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2); } - rdpup_draw_line(x1, y1, x2, y2); - x1 = x2; - y1 = y2; + rdpup_set_opcode(GXcopy); + rdpup_end_update(); } - 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 (nseg != 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--) + if (dirty_type != 0) + { + draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel, + pGC->alu, pGC->lineWidth, segs, nseg, 0); + } + 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); - x1 = ppts[0].x + pDrawable->x; - y1 = ppts[0].y + pDrawable->y; - for (i = 1; i < npt; i++) + 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--) { - if (mode == CoordModeOrigin) + 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++) { - x2 = pDrawable->x + ppts[i].x; - y2 = pDrawable->y + ppts[i].y; + rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2); } - 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(); } } + g_free(segs); 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..06c5ba9f 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,30 @@ 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:")); /* do original call */ rdpPushPixelsOrg(pGC, pBitMap, pDst, w, h, x, y); + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; got_id = 0; if (pDst->type == DRAWABLE_PIXMAP) { @@ -84,9 +94,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 +118,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 +134,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, GXcopy, 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, GXcopy, 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..798016f3 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, GXcopy, 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, GXcopy, 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..aab36f88 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")); + LLOGLN(10, ("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 7cc7c66a..78b2aa3d 100644 --- a/xorg/X11R7.6/rdp/rdpdraw.c +++ b/xorg/X11R7.6/rdp/rdpdraw.c @@ -46,14 +46,6 @@ Xserver drawing ops and funcs #include "rdpPolyGlyphBlt.h" #include "rdpPushPixels.h" -#if 1 -#define DEBUG_OUT_FUNCS(arg) -#define DEBUG_OUT_OPS(arg) -#else -#define DEBUG_OUT_FUNCS(arg) ErrorF arg -#define DEBUG_OUT_OPS(arg) ErrorF arg -#endif - #define LOG_LEVEL 1 #define LLOG(_level, _args) \ do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0) @@ -67,9 +59,14 @@ 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 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, @@ -287,7 +284,7 @@ rdpChangeGC(GCPtr pGC, unsigned long mask) { rdpGCRec* priv; - DEBUG_OUT_FUNCS(("in rdpChangeGC\n")); + LLOGLN(10, ("in rdpChangeGC")); GC_FUNC_PROLOGUE(pGC); pGC->funcs->ChangeGC(pGC, mask); GC_FUNC_EPILOGUE(pGC); @@ -299,7 +296,7 @@ rdpCopyGC(GCPtr src, unsigned long mask, GCPtr dst) { rdpGCRec* priv; - DEBUG_OUT_FUNCS(("in rdpCopyGC\n")); + LLOGLN(10, ("in rdpCopyGC")); GC_FUNC_PROLOGUE(dst); dst->funcs->CopyGC(src, mask, dst); GC_FUNC_EPILOGUE(dst); @@ -311,7 +308,7 @@ rdpDestroyGC(GCPtr pGC) { rdpGCRec* priv; - DEBUG_OUT_FUNCS(("in rdpDestroyGC\n")); + LLOGLN(10, ("in rdpDestroyGC")); GC_FUNC_PROLOGUE(pGC); pGC->funcs->DestroyGC(pGC); GC_FUNC_EPILOGUE(pGC); @@ -323,7 +320,7 @@ rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects) { rdpGCRec* priv; - DEBUG_OUT_FUNCS(("in rdpChangeClip\n")); + LLOGLN(10, ("in rdpChangeClip")); GC_FUNC_PROLOGUE(pGC); pGC->funcs->ChangeClip(pGC, type, pValue, nrects); GC_FUNC_EPILOGUE(pGC); @@ -335,7 +332,7 @@ rdpDestroyClip(GCPtr pGC) { rdpGCRec* priv; - DEBUG_OUT_FUNCS(("in rdpDestroyClip\n")); + LLOGLN(10, ("in rdpDestroyClip")); GC_FUNC_PROLOGUE(pGC); pGC->funcs->DestroyClip(pGC); GC_FUNC_EPILOGUE(pGC); @@ -347,7 +344,7 @@ rdpCopyClip(GCPtr dst, GCPtr src) { rdpGCRec* priv; - DEBUG_OUT_FUNCS(("in rdpCopyClip\n")); + LLOGLN(0, ("in rdpCopyClip")); GC_FUNC_PROLOGUE(dst); dst->funcs->CopyClip(dst, src); GC_FUNC_EPILOGUE(dst); @@ -374,7 +371,7 @@ rdpCopyClip(GCPtr dst, GCPtr src) Bool rdpCloseScreen(int i, ScreenPtr pScreen) { - DEBUG_OUT_OPS(("in rdpCloseScreen\n")); + LLOGLN(10, ("in rdpCloseScreen")); pScreen->CloseScreen = g_rdpScreen.CloseScreen; pScreen->CreateGC = g_rdpScreen.CreateGC; //pScreen->PaintWindowBackground = g_rdpScreen.PaintWindowBackground; @@ -386,6 +383,223 @@ rdpCloseScreen(int i, ScreenPtr pScreen) } /******************************************************************************/ +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; + } + if (di->type == RDI_LINE) + { + if (di->u.line.segs != 0) + { + g_free(di->u.line.segs); + } + } + RegionDestroy(di->reg); + g_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) + { + /* 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) + { + 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 opcode, + int type) +{ + struct rdp_draw_item* di; + + 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; +} + +/******************************************************************************/ +int +draw_item_add_fill_region(rdpPixmapRec* priv, RegionPtr reg, int color, + int opcode) +{ + struct rdp_draw_item* di; + + di = (struct rdp_draw_item*)g_malloc(sizeof(struct rdp_draw_item), 1); + di->type = RDI_FILL; + 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; +} + +/******************************************************************************/ PixmapPtr rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint) @@ -397,12 +611,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; @@ -418,6 +633,8 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, return rv; } +extern struct rdpup_os_bitmap* g_os_bitmaps; + /******************************************************************************/ Bool rdpDestroyPixmap(PixmapPtr pPixmap) @@ -435,6 +652,7 @@ rdpDestroyPixmap(PixmapPtr pPixmap) { rdpup_remove_os_bitmap(priv->rdpindex); rdpup_delete_os_surface(priv->rdpindex); + draw_item_remove_all(priv); } } pScreen = pPixmap->drawable.pScreen; @@ -452,13 +670,16 @@ rdpCreateWindow(WindowPtr pWindow) rdpWindowRec* priv; Bool rv; - ErrorF("rdpCreateWindow:\n"); + LLOGLN(10, ("rdpCreateWindow:")); priv = GETWINPRIV(pWindow); - //ErrorF(" %p status %d\n", priv, priv->status); + LLOGLN(10, (" %p status %d", priv, priv->status)); pScreen = pWindow->drawable.pScreen; pScreen->CreateWindow = g_rdpScreen.CreateWindow; rv = pScreen->CreateWindow(pWindow); pScreen->CreateWindow = rdpCreateWindow; + if (g_use_rail) + { + } return rv; } @@ -470,12 +691,15 @@ rdpDestroyWindow(WindowPtr pWindow) rdpWindowRec* priv; Bool rv; - ErrorF("rdpDestroyWindow:\n"); + LLOGLN(10, ("rdpDestroyWindow:")); priv = GETWINPRIV(pWindow); pScreen = pWindow->drawable.pScreen; pScreen->DestroyWindow = g_rdpScreen.DestroyWindow; rv = pScreen->DestroyWindow(pWindow); pScreen->DestroyWindow = rdpDestroyWindow; + if (g_use_rail) + { + } return rv; } @@ -487,12 +711,20 @@ rdpPositionWindow(WindowPtr pWindow, int x, int y) rdpWindowRec* priv; Bool rv; - ErrorF("rdpPositionWindow:\n"); + LLOGLN(10, ("rdpPositionWindow:")); priv = GETWINPRIV(pWindow); pScreen = pWindow->drawable.pScreen; pScreen->PositionWindow = g_rdpScreen.PositionWindow; rv = pScreen->PositionWindow(pWindow, x, y); pScreen->PositionWindow = rdpPositionWindow; + if (g_use_rail) + { + if (priv->status == 1) + { + LLOGLN(10, ("rdpPositionWindow:")); + LLOGLN(10, (" x %d y %d", x, y)); + } + } return rv; } @@ -504,12 +736,30 @@ rdpRealizeWindow(WindowPtr pWindow) rdpWindowRec* priv; Bool rv; - ErrorF("rdpRealizeWindow:\n"); + LLOGLN(10, ("rdpRealizeWindow:")); priv = GETWINPRIV(pWindow); pScreen = pWindow->drawable.pScreen; pScreen->RealizeWindow = g_rdpScreen.RealizeWindow; rv = pScreen->RealizeWindow(pWindow); pScreen->RealizeWindow = rdpRealizeWindow; + if (g_use_rail) + { + if ((pWindow != g_invalidate_window) && (pWindow->parent != 0)) + { + if (XR_IS_ROOT(pWindow->parent)) + { + LLOGLN(10, ("rdpRealizeWindow:")); + LLOGLN(10, (" pWindow %p id 0x%x pWindow->parent %p id 0x%x x %d " + "y %d width %d height %d", + pWindow, pWindow->drawable.id, + pWindow->parent, pWindow->parent->drawable.id, + pWindow->drawable.x, pWindow->drawable.y, + pWindow->drawable.width, pWindow->drawable.height)); + priv->status = 1; + rdpup_create_window(pWindow, priv); + } + } + } return rv; } @@ -521,12 +771,21 @@ rdpUnrealizeWindow(WindowPtr pWindow) rdpWindowRec* priv; Bool rv; - ErrorF("rdpUnrealizeWindow:\n"); + LLOGLN(10, ("rdpUnrealizeWindow:")); priv = GETWINPRIV(pWindow); pScreen = pWindow->drawable.pScreen; pScreen->UnrealizeWindow = g_rdpScreen.UnrealizeWindow; rv = pScreen->UnrealizeWindow(pWindow); pScreen->UnrealizeWindow = rdpUnrealizeWindow; + if (g_use_rail) + { + if (priv->status == 1) + { + LLOGLN(10, ("rdpUnrealizeWindow:")); + priv->status = 0; + rdpup_delete_window(pWindow, priv); + } + } return rv; } @@ -538,12 +797,15 @@ rdpChangeWindowAttributes(WindowPtr pWindow, unsigned long mask) rdpWindowRec* priv; Bool rv; - ErrorF("rdpChangeWindowAttributes:\n"); + LLOGLN(10, ("rdpChangeWindowAttributes:")); priv = GETWINPRIV(pWindow); pScreen = pWindow->drawable.pScreen; pScreen->ChangeWindowAttributes = g_rdpScreen.ChangeWindowAttributes; rv = pScreen->ChangeWindowAttributes(pWindow, mask); pScreen->ChangeWindowAttributes = rdpChangeWindowAttributes; + if (g_use_rail) + { + } return rv; } @@ -554,11 +816,14 @@ rdpWindowExposures(WindowPtr pWindow, RegionPtr pRegion, RegionPtr pBSRegion) ScreenPtr pScreen; rdpWindowRec* priv; - ErrorF("rdpWindowExposures:\n"); + LLOGLN(10, ("rdpWindowExposures:")); priv = GETWINPRIV(pWindow); pScreen = pWindow->drawable.pScreen; pScreen->WindowExposures = g_rdpScreen.WindowExposures; pScreen->WindowExposures(pWindow, pRegion, pBSRegion); + if (g_use_rail) + { + } pScreen->WindowExposures = rdpWindowExposures; } @@ -569,7 +834,7 @@ rdpCreateGC(GCPtr pGC) rdpGCRec* priv; Bool rv; - DEBUG_OUT_OPS(("in rdpCreateGC\n")); + LLOGLN(10, ("in rdpCreateGC\n")); priv = GETGCPRIV(pGC); g_pScreen->CreateGC = g_rdpScreen.CreateGC; rv = g_pScreen->CreateGC(pGC); @@ -602,7 +867,7 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) BoxRec box1; BoxRec box2; - DEBUG_OUT_OPS(("in rdpCopyWindow\n")); + LLOGLN(10, ("in rdpCopyWindow")); RegionInit(®, NullBox, 0); RegionCopy(®, pOldRegion); g_pScreen->CopyWindow = g_rdpScreen.CopyWindow; @@ -661,7 +926,7 @@ rdpClearToBackground(WindowPtr pWin, int x, int y, int w, int h, BoxRec box; RegionRec reg; - DEBUG_OUT_OPS(("in rdpClearToBackground\n")); + LLOGLN(10, ("in rdpClearToBackground")); g_pScreen->ClearToBackground = g_rdpScreen.ClearToBackground; g_pScreen->ClearToBackground(pWin, x, y, w, h, generateExposures); if (!generateExposures) @@ -703,7 +968,7 @@ rdpRestoreAreas(WindowPtr pWin, RegionPtr prgnExposed) int j; BoxRec box; - DEBUG_OUT_OPS(("in rdpRestoreAreas\n")); + LLOGLN(10, ("in rdpRestoreAreas")); RegionInit(®, NullBox, 0); RegionCopy(®, prgnExposed); g_pScreen->RestoreAreas = g_rdpScreen.RestoreAreas; @@ -792,12 +1057,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:")); @@ -809,6 +1080,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) { @@ -816,9 +1091,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 @@ -828,12 +1117,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; } @@ -847,19 +1138,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, GXcopy, 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); @@ -870,11 +1169,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, GXcopy, 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); } /******************************************************************************/ @@ -889,10 +1200,8 @@ rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, LLOGLN(10, ("rdpGlyphs:")); LLOGLN(10, ("rdpGlyphs: nlists %d len %d", nlists, lists->len)); - if (g_rdpScreen.client_info.jpeg) - { - rdpup_set_hints(1, 1); - } + 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", @@ -904,9 +1213,7 @@ rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, ps->Glyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlists, lists, glyphs); ps->Glyphs = rdpGlyphs; - if (g_rdpScreen.client_info.jpeg) - { - rdpup_set_hints(0, 1); - } + rdpup_set_hints(0, 1); + g_doing_font = 0; LLOGLN(10, ("rdpGlyphs: out")); } diff --git a/xorg/X11R7.6/rdp/rdpinput.c b/xorg/X11R7.6/rdp/rdpinput.c index 84418dc8..1256d0e0 100644 --- a/xorg/X11R7.6/rdp/rdpinput.c +++ b/xorg/X11R7.6/rdp/rdpinput.c @@ -791,6 +791,25 @@ check_keysa(void) /******************************************************************************/ void +sendDownUpKeyEvent(int type, int x_scancode) +{ + /* if type is keydown, send keydown + keyup */ + /* this allows us to ignore keyup events */ + if (type == KeyPress) + { + rdpEnqueueKey(KeyPress, x_scancode); + rdpEnqueueKey(KeyRelease, x_scancode); + } +} + +/** + * @param down - true for KeyDown events, false otherwise + * @param param1 - ASCII code of pressed key + * @param param2 - + * @param param3 - scancode of pressed key + * @param param4 - + ******************************************************************************/ +void KbdAddEvent(int down, int param1, int param2, int param3, int param4) { int rdp_scancode; @@ -799,63 +818,75 @@ KbdAddEvent(int down, int param1, int param2, int param3, int param4) int is_spe; int type; +#if 0 + fprintf(stderr, "down=0x%x param1=0x%x param2=0x%x param3=0x%x " + "param4=0x%x\n", down, param1, param2, param3, param4); +#endif + type = down ? KeyPress : KeyRelease; rdp_scancode = param3; is_ext = param4 & 256; /* 0x100 */ is_spe = param4 & 512; /* 0x200 */ x_scancode = 0; + switch (rdp_scancode) { + case 58: /* caps lock */ + case 42: /* left shift */ + case 54: /* right shift */ + case 70: /* scroll lock */ + x_scancode = rdp_scancode + MIN_KEY_CODE; + if (x_scancode > 0) + { + rdpEnqueueKey(type, x_scancode); + } + + break; + + case 56: /* left - right alt button */ + if (is_ext) + { + x_scancode = 113; /* right alt button */ + } + else + { + x_scancode = 64; /* left alt button */ + } + + rdpEnqueueKey(type, x_scancode); + break; + case 15: /* tab */ if (!down && !g_tab_down) { - check_keysa(); - /* leave x_scancode 0 here, we don't want the tab key up */ + check_keysa(); /* leave x_scancode 0 here, we don't want the tab key up */ } else { - x_scancode = 23; + sendDownUpKeyEvent(type, 23); } + g_tab_down = down; break; - case 28: /* Enter or Return */ - x_scancode = is_ext ? 108 : 36; - break; + case 29: /* left or right ctrl */ - /* this is to handle special case with pause key sending - control first */ + /* this is to handle special case with pause key sending control first */ if (is_spe) { if (down) { - g_pause_spe = 1; + g_pause_spe = 1; + /* leave x_scancode 0 here, we don't want the control key down */ } - /* leave x_scancode 0 here, we don't want the control key down */ } else { x_scancode = is_ext ? 109 : 37; g_ctrl_down = down ? x_scancode : 0; + rdpEnqueueKey(type, x_scancode); } break; - case 42: /* left shift */ - x_scancode = 50; - g_shift_down = down ? x_scancode : 0; - break; - case 53: /* / */ - x_scancode = is_ext ? 112 : 61; - break; - case 54: /* right shift */ - x_scancode = 62; - g_shift_down = down ? x_scancode : 0; - break; - case 55: /* * on KP or Print Screen */ - x_scancode = is_ext ? 111 : 63; - break; - case 56: /* left or right alt */ - x_scancode = is_ext ? 113 : 64; - g_alt_down = down ? x_scancode : 0; - break; + case 69: /* Pause or Num Lock */ if (g_pause_spe) { @@ -867,63 +898,96 @@ KbdAddEvent(int down, int param1, int param2, int param3, int param4) } else { - x_scancode = g_ctrl_down ? 110 : 77; + x_scancode = g_ctrl_down ? 110 : 77; } + sendDownUpKeyEvent(type, x_scancode); break; - case 70: /* scroll lock */ - x_scancode = 78; - if (!down) - { - g_scroll_lock_down = !g_scroll_lock_down; - } + + case 28: /* Enter or Return */ + x_scancode = is_ext ? 108 : 36; + sendDownUpKeyEvent(type, x_scancode); break; + + case 53: /* / */ + x_scancode = is_ext ? 112 : 61; + sendDownUpKeyEvent(type, x_scancode); + break; + + case 55: /* * on KP or Print Screen */ + x_scancode = is_ext ? 111 : 63; + sendDownUpKeyEvent(type, x_scancode); + break; + case 71: /* 7 or Home */ x_scancode = is_ext ? 97 : 79; + sendDownUpKeyEvent(type, x_scancode); break; + case 72: /* 8 or Up */ x_scancode = is_ext ? 98 : 80; + sendDownUpKeyEvent(type, x_scancode); break; + case 73: /* 9 or PgUp */ x_scancode = is_ext ? 99 : 81; + sendDownUpKeyEvent(type, x_scancode); break; + case 75: /* 4 or Left */ x_scancode = is_ext ? 100 : 83; + sendDownUpKeyEvent(type, x_scancode); break; + case 77: /* 6 or Right */ x_scancode = is_ext ? 102 : 85; + sendDownUpKeyEvent(type, x_scancode); break; + case 79: /* 1 or End */ x_scancode = is_ext ? 103 : 87; + sendDownUpKeyEvent(type, x_scancode); break; + case 80: /* 2 or Down */ x_scancode = is_ext ? 104 : 88; + sendDownUpKeyEvent(type, x_scancode); break; + case 81: /* 3 or PgDn */ x_scancode = is_ext ? 105 : 89; + sendDownUpKeyEvent(type, x_scancode); break; + case 82: /* 0 or Insert */ x_scancode = is_ext ? 106 : 90; + sendDownUpKeyEvent(type, x_scancode); break; + case 83: /* . or Delete */ x_scancode = is_ext ? 107 : 91; + sendDownUpKeyEvent(type, x_scancode); break; + case 91: /* left win key */ - x_scancode = 115; + rdpEnqueueKey(type, 115); break; + case 92: /* right win key */ - x_scancode = 116; + rdpEnqueueKey(type, 116); break; + case 93: /* menu key */ - x_scancode = 117; + rdpEnqueueKey(type, 117); break; + default: x_scancode = rdp_scancode + MIN_KEY_CODE; + if (x_scancode > 0) + { + sendDownUpKeyEvent(type, x_scancode); + } break; } - if (x_scancode > 0) - { - rdpEnqueueKey(type, x_scancode); - } } /******************************************************************************/ diff --git a/xorg/X11R7.6/rdp/rdpmain.c b/xorg/X11R7.6/rdp/rdpmain.c index c453cb05..48f5a2e9 100644 --- a/xorg/X11R7.6/rdp/rdpmain.c +++ b/xorg/X11R7.6/rdp/rdpmain.c @@ -42,9 +42,16 @@ DevPrivateKeyRec g_rdpPixmapIndex; DeviceIntPtr g_pointer = 0; DeviceIntPtr g_keyboard = 0; -Bool g_wrapWindow = 0; +int g_can_do_pix_to_pix = 1; +int g_do_dirty_os = 1; /* delay remoting off screen bitmaps */ +Bool g_wrapWindow = 1; Bool g_wrapPixmap = 1; +/* if true, running in RemoteApp / RAIL mode */ +int g_use_rail = 0; + +WindowPtr g_invalidate_window = 0; + /* if true, use a unix domain socket instead of a tcp socket */ int g_use_uds = 0; char g_uds_data[256] = ""; /* data */ diff --git a/xorg/X11R7.6/rdp/rdpmisc.c b/xorg/X11R7.6/rdp/rdpmisc.c index 5c43654a..d3defe27 100644 --- a/xorg/X11R7.6/rdp/rdpmisc.c +++ b/xorg/X11R7.6/rdp/rdpmisc.c @@ -530,3 +530,43 @@ void FontCacheExtensionInit(INITARGS) { } + +/******************************************************************************/ +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++; + } +} diff --git a/xorg/X11R7.6/rdp/rdprandr.c b/xorg/X11R7.6/rdp/rdprandr.c index 978e48aa..ec011e8f 100644 --- a/xorg/X11R7.6/rdp/rdprandr.c +++ b/xorg/X11R7.6/rdp/rdprandr.c @@ -34,6 +34,7 @@ extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */ extern DeviceIntPtr g_pointer; /* in rdpmain.c */ extern DeviceIntPtr g_keyboard; /* in rdpmain.c */ extern ScreenPtr g_pScreen; /* in rdpmain.c */ +extern WindowPtr g_invalidate_window; /* in rdpmain.c */ static XID g_wid = 0; @@ -108,8 +109,10 @@ rdpInvalidateArea(ScreenPtr pScreen, int x, int y, int cx, int cy) wVisual(pScreen->root), &result); if (result == 0) { + g_invalidate_window = pWin; MapWindow(pWin, serverClient); DeleteWindow(pWin, None); + g_invalidate_window = pWin; } return 0; } diff --git a/xorg/X11R7.6/rdp/rdpup.c b/xorg/X11R7.6/rdp/rdpup.c index 22ebc95e..81165a3a 100644 --- a/xorg/X11R7.6/rdp/rdpup.c +++ b/xorg/X11R7.6/rdp/rdpup.c @@ -20,12 +20,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "rdp.h" - -#if 1 -#define DEBUG_OUT_UP(arg) -#else -#define DEBUG_OUT_UP(arg) ErrorF arg -#endif +#include "xrdp_rail.h" #define LOG_LEVEL 1 #define LLOG(_level, _args) \ @@ -59,6 +54,7 @@ extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp_mask; /* from rdpmain.c */ extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */ +extern int g_use_rail; /* from rdpmain.c */ /* true is to use unix domain socket */ extern int g_use_uds; /* in rdpmain.c */ @@ -147,6 +143,7 @@ rdpup_disconnect(void) g_max_os_bitmaps = 0; g_free(g_os_bitmaps); g_os_bitmaps = 0; + g_use_rail = 0; return 0; } @@ -199,7 +196,7 @@ rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv) } index++; } - LLOGLN(0, ("rdpup_add_os_bitmap: evicting old, oldest_index %d", oldest_index)); + LLOGLN(10, ("rdpup_add_os_bitmap: evicting old, oldest_index %d", oldest_index)); /* evict old */ g_os_bitmaps[oldest_index].priv->status = 0; /* set new */ @@ -209,8 +206,8 @@ rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv) g_os_bitmap_stamp++; rv = oldest_index; } - LLOGLN(0, ("rdpup_add_os_bitmap: new bitmap index %d", rv)); - LLOGLN(0, (" g_pixmap_num_used %d", g_pixmap_num_used)); + LLOGLN(10, ("rdpup_add_os_bitmap: new bitmap index %d", rv)); + LLOGLN(10, (" g_pixmap_num_used %d", g_pixmap_num_used)); return rv; } @@ -218,7 +215,8 @@ rdpup_add_os_bitmap(PixmapPtr pixmap, rdpPixmapPtr priv) int rdpup_remove_os_bitmap(int rdpindex) { - LLOGLN(0, ("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; @@ -234,7 +232,7 @@ rdpup_remove_os_bitmap(int rdpindex) g_os_bitmaps[rdpindex].priv = 0; g_pixmap_num_used--; } - LLOGLN(0, (" g_pixmap_num_used %d", g_pixmap_num_used)); + LLOGLN(10, (" g_pixmap_num_used %d", g_pixmap_num_used)); return 0; } @@ -245,7 +243,7 @@ rdpup_send(char* data, int len) { int sent; - DEBUG_OUT_UP(("rdpup_send - sending %d bytes\n", len)); + LLOGLN(10, ("rdpup_send - sending %d bytes", len)); if (g_sck_closed) { return 1; @@ -313,7 +311,7 @@ rdpup_send_pending(void) { if (g_connected && g_begin) { - DEBUG_OUT_UP(("end %d\n", g_count)); + LLOGLN(10, ("end %d", g_count)); out_uint16_le(g_out_s, 2); out_uint16_le(g_out_s, 4); g_count++; @@ -428,8 +426,8 @@ process_screen_size_msg(int width, int height, int bpp) int mmheight; Bool ok; - ErrorF("process_screen_size_msg: set width %d height %d bpp %d\n", - width, height, bpp); + LLOGLN(0, ("process_screen_size_msg: set width %d height %d bpp %d", + width, height, bpp)); g_rdpScreen.rdp_width = width; g_rdpScreen.rdp_height = height; g_rdpScreen.rdp_bpp = bpp; @@ -460,9 +458,9 @@ process_screen_size_msg(int width, int height, int bpp) RRSetCurrentConfig(g_pScreen, RR_Rotate_0, 0, pSize); if ((g_rdpScreen.width != width) || (g_rdpScreen.height != height)) { - ErrorF(" calling RRScreenSizeSet\n"); + LLOGLN(0, (" calling RRScreenSizeSet")); ok = RRScreenSizeSet(g_pScreen, width, height, mmwidth, mmheight); - ErrorF(" RRScreenSizeSet ok=[%d]\n", ok); + LLOGLN(0, (" RRScreenSizeSet ok=[%d]", ok)); } return 0; } @@ -521,7 +519,7 @@ rdpup_send_caps(void) rv = rdpup_send(ls->data, len); if (rv != 0) { - ErrorF("rdpup_send_caps: rdpup_send failed\n"); + LLOGLN(0, ("rdpup_send_caps: rdpup_send failed")); } free_stream(ls); return rv; @@ -531,8 +529,8 @@ rdpup_send_caps(void) static int process_version_msg(int param1, int param2, int param3, int param4) { - ErrorF("process_version_msg: version %d %d %d %d\n", param1, param2, - param3, param4); + LLOGLN(0, ("process_version_msg: version %d %d %d %d", param1, param2, + param3, param4)); if ((param1 > 0) || (param2 > 0) || (param3 > 0) || (param4 > 0)) { rdpup_send_caps(); @@ -551,6 +549,7 @@ rdpup_process_msg(struct stream* s) int param3; int param4; int bytes; + int i1; in_uint16_le(s, msg_type); if (msg_type == 103) @@ -560,8 +559,8 @@ rdpup_process_msg(struct stream* s) in_uint32_le(s, param2); in_uint32_le(s, param3); in_uint32_le(s, param4); - DEBUG_OUT_UP(("rdpup_process_msg - msg %d param1 %d param2 %d param3 %d \ -param4 %d\n", msg, param1, param2, param3, param4)); + LLOGLN(10, ("rdpup_process_msg - msg %d param1 %d param2 %d param3 %d " + "param4 %d", msg, param1, param2, param3, param4)); switch (msg) { case 15: /* key down */ @@ -641,15 +640,14 @@ param4 %d\n", msg, param1, param2, param3, param4)); } memcpy(&(g_rdpScreen.client_info), s->p - 4, bytes); g_rdpScreen.client_info.size = bytes; - ErrorF("rdpup_process_msg: got client info bytes %d\n", bytes); - ErrorF(" jpeg support %d\n", - g_rdpScreen.client_info.jpeg); - ErrorF(" offscreen support %d\n", - g_rdpScreen.client_info.offscreen_support_level); - ErrorF(" offscreen size %d\n", - g_rdpScreen.client_info.offscreen_cache_size); - ErrorF(" offscreen entries %d\n", - g_rdpScreen.client_info.offscreen_cache_entries); + LLOGLN(0, ("rdpup_process_msg: got client info bytes %d", bytes)); + LLOGLN(0, (" jpeg support %d", g_rdpScreen.client_info.jpeg)); + i1 = g_rdpScreen.client_info.offscreen_support_level; + LLOGLN(0, (" offscreen support %d", i1)); + i1 = g_rdpScreen.client_info.offscreen_cache_size; + LLOGLN(0, (" offscreen size %d", i1)); + i1 = g_rdpScreen.client_info.offscreen_cache_entries; + LLOGLN(0, (" offscreen entries %d", i1)); if (g_rdpScreen.client_info.offscreen_support_level > 0) { if (g_rdpScreen.client_info.offscreen_cache_entries > 0) @@ -660,6 +658,10 @@ param4 %d\n", msg, param1, param2, param3, param4)); g_malloc(sizeof(struct rdpup_os_bitmap) * g_max_os_bitmaps, 1); } } + if (g_rdpScreen.client_info.rail_support_level > 0) + { + g_use_rail = 1; + } } else { @@ -703,7 +705,7 @@ rdpup_init(void) { if (!g_create_dir("/tmp/.xrdp")) { - ErrorF("rdpup_init: g_create_dir failed\n"); + LLOGLN(0, ("rdpup_init: g_create_dir failed")); return 0; } g_chmod_hex("/tmp/.xrdp", 0x1777); @@ -731,7 +733,7 @@ rdpup_init(void) g_listen_sck = g_tcp_local_socket_stream(); if (g_tcp_local_bind(g_listen_sck, g_uds_data) != 0) { - ErrorF("rdpup_init: g_tcp_local_bind failed\n"); + LLOGLN(0, ("rdpup_init: g_tcp_local_bind failed")); return 0; } g_tcp_listen(g_listen_sck); @@ -837,7 +839,7 @@ rdpup_begin_update(void) s_push_layer(g_out_s, iso_hdr, 8); out_uint16_le(g_out_s, 1); /* begin update */ out_uint16_le(g_out_s, 4); /* size */ - DEBUG_OUT_UP(("begin %d\n", g_count)); + LLOGLN(10, ("begin %d", g_count)); g_begin = 1; g_count = 1; } @@ -880,7 +882,7 @@ rdpup_fill_rect(short x, short y, int cx, int cy) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_fill_rect\n")); + LLOGLN(10, (" rdpup_fill_rect")); rdpup_pre_check(12); out_uint16_le(g_out_s, 3); /* fill rect */ out_uint16_le(g_out_s, 12); /* size */ @@ -899,7 +901,7 @@ rdpup_screen_blt(short x, short y, int cx, int cy, short srcx, short srcy) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_screen_blt\n")); + LLOGLN(10, (" rdpup_screen_blt")); rdpup_pre_check(16); out_uint16_le(g_out_s, 4); /* screen blt */ out_uint16_le(g_out_s, 16); /* size */ @@ -920,7 +922,7 @@ rdpup_set_clip(short x, short y, int cx, int cy) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_set_clip\n")); + LLOGLN(10, (" rdpup_set_clip")); rdpup_pre_check(12); out_uint16_le(g_out_s, 10); /* set clip */ out_uint16_le(g_out_s, 12); /* size */ @@ -939,7 +941,7 @@ rdpup_reset_clip(void) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_reset_clip\n")); + LLOGLN(10, (" rdpup_reset_clip")); rdpup_pre_check(4); out_uint16_le(g_out_s, 11); /* reset clip */ out_uint16_le(g_out_s, 4); /* size */ @@ -1087,7 +1089,7 @@ rdpup_set_fgcolor(int fgcolor) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_set_fgcolor\n")); + LLOGLN(10, (" rdpup_set_fgcolor")); rdpup_pre_check(8); out_uint16_le(g_out_s, 12); /* set fgcolor */ out_uint16_le(g_out_s, 8); /* size */ @@ -1105,7 +1107,7 @@ rdpup_set_bgcolor(int bgcolor) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_set_bgcolor\n")); + LLOGLN(10, (" rdpup_set_bgcolor")); rdpup_pre_check(8); out_uint16_le(g_out_s, 13); /* set bg color */ out_uint16_le(g_out_s, 8); /* size */ @@ -1123,7 +1125,7 @@ rdpup_set_opcode(int opcode) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_set_opcode\n")); + LLOGLN(10, (" rdpup_set_opcode")); rdpup_pre_check(6); out_uint16_le(g_out_s, 14); /* set opcode */ out_uint16_le(g_out_s, 6); /* size */ @@ -1139,7 +1141,7 @@ rdpup_set_pen(int style, int width) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_set_pen\n")); + LLOGLN(10, (" rdpup_set_pen")); rdpup_pre_check(8); out_uint16_le(g_out_s, 17); /* set pen */ out_uint16_le(g_out_s, 8); /* size */ @@ -1156,7 +1158,7 @@ rdpup_draw_line(short x1, short y1, short x2, short y2) { if (g_connected) { - DEBUG_OUT_UP((" rdpup_draw_line\n")); + LLOGLN(10, (" rdpup_draw_line")); rdpup_pre_check(12); out_uint16_le(g_out_s, 18); /* draw line */ out_uint16_le(g_out_s, 12); /* size */ @@ -1177,7 +1179,7 @@ rdpup_set_cursor(short x, short y, char* cur_data, char* cur_mask) if (g_connected) { - DEBUG_OUT_UP((" rdpup_set_cursor\n")); + LLOGLN(10, (" rdpup_set_cursor")); size = 8 + 32 * (32 * 3) + 32 * (32 / 8); rdpup_pre_check(size); out_uint16_le(g_out_s, 19); /* set cursor */ @@ -1202,7 +1204,7 @@ rdpup_create_os_surface(int rdpindex, int width, int height) LLOGLN(10, ("rdpup_create_os_surface:")); if (g_connected) { - DEBUG_OUT_UP((" rdpup_create_os_surface\n")); + 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); @@ -1387,10 +1389,10 @@ rdpup_send_area(struct image_data* id, int x, int y, int w, int h) { h = id->height - y; } - DEBUG_OUT_UP(("%d\n", w * h)); + LLOGLN(10, ("%d", w * h)); if (g_connected && g_begin) { - DEBUG_OUT_UP((" rdpup_send_area\n")); + LLOGLN(10, (" rdpup_send_area")); ly = y; while (ly < y + h) { @@ -1402,7 +1404,7 @@ rdpup_send_area(struct image_data* id, int x, int y, int w, int h) single_color = get_single_color(id, lx, ly, lw, lh); if (single_color != -1) { - DEBUG_OUT_UP(("%d sending single color\n", g_count)); + LLOGLN(10, ("%d sending single color", g_count)); rdpup_set_fgcolor(single_color); rdpup_fill_rect(lx, ly, lw, lh); } @@ -1472,3 +1474,232 @@ rdpup_set_hints(int hints, int mask) out_uint32_le(g_out_s, mask); } } + +/******************************************************************************/ +void +rdpup_create_window(WindowPtr pWindow, rdpWindowRec* priv) +{ + int bytes; + int index; + int flags; + int num_window_rects; + int num_visibility_rects; + int title_bytes; + int style; + int ext_style; + int root_id; + char title[256]; + + LLOGLN(10, ("rdpup_create_window: id 0x%8.8x", pWindow->drawable.id)); + if (g_connected) + { + root_id = pWindow->drawable.pScreen->root->drawable.id; + + if (pWindow->overrideRedirect) + { + style = XR_STYLE_TOOLTIP; + ext_style = XR_EXT_STYLE_TOOLTIP; + } + else + { + style = XR_STYLE_NORMAL; + ext_style = XR_EXT_STYLE_NORMAL; + } + + flags = WINDOW_ORDER_TYPE_WINDOW | WINDOW_ORDER_STATE_NEW; + strcpy(title, "title"); + title_bytes = strlen(title); + + num_window_rects = 1; + num_visibility_rects = 1; + + /* calculate bytes */ + bytes = (2 + 2) + (5 * 4) + (2 + title_bytes) + (12 * 4) + + (2 + num_window_rects * 8) + (4 + 4) + + (2 + num_visibility_rects * 8) + 4; + + rdpup_pre_check(bytes); + out_uint16_le(g_out_s, 25); + out_uint16_le(g_out_s, bytes); + g_count++; + out_uint32_le(g_out_s, pWindow->drawable.id); /* window_id */ + out_uint32_le(g_out_s, pWindow->parent->drawable.id); /* owner_window_id */ + flags |= WINDOW_ORDER_FIELD_OWNER; + out_uint32_le(g_out_s, style); /* style */ + out_uint32_le(g_out_s, ext_style); /* extended_style */ + flags |= WINDOW_ORDER_FIELD_STYLE; + out_uint32_le(g_out_s, 0); /* show_state */ + flags |= WINDOW_ORDER_FIELD_SHOW; + out_uint16_le(g_out_s, title_bytes); /* title_info */ + out_uint8a(g_out_s, title, title_bytes); + flags |= WINDOW_ORDER_FIELD_TITLE; + out_uint32_le(g_out_s, 0); /* client_offset_x */ + out_uint32_le(g_out_s, 0); /* client_offset_y */ + flags |= WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET; + out_uint32_le(g_out_s, pWindow->drawable.width); /* client_area_width */ + out_uint32_le(g_out_s, pWindow->drawable.height); /* client_area_height */ + flags |= WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE; + out_uint32_le(g_out_s, 0); /* rp_content */ + out_uint32_le(g_out_s, root_id); /* root_parent_handle */ + flags |= WINDOW_ORDER_FIELD_ROOT_PARENT; + out_uint32_le(g_out_s, pWindow->drawable.x); /* window_offset_x */ + out_uint32_le(g_out_s, pWindow->drawable.y); /* window_offset_y */ + flags |= WINDOW_ORDER_FIELD_WND_OFFSET; + out_uint32_le(g_out_s, 0); /* window_client_delta_x */ + out_uint32_le(g_out_s, 0); /* window_client_delta_y */ + flags |= WINDOW_ORDER_FIELD_WND_CLIENT_DELTA; + out_uint32_le(g_out_s, pWindow->drawable.width); /* window_width */ + out_uint32_le(g_out_s, pWindow->drawable.height); /* window_height */ + flags |= WINDOW_ORDER_FIELD_WND_SIZE; + out_uint16_le(g_out_s, num_window_rects); /* num_window_rects */ + for (index = 0; index < num_window_rects; index++) + { + out_uint16_le(g_out_s, 0); /* left */ + out_uint16_le(g_out_s, 0); /* top */ + out_uint16_le(g_out_s, pWindow->drawable.width); /* right */ + out_uint16_le(g_out_s, pWindow->drawable.height); /* bottom */ + } + flags |= WINDOW_ORDER_FIELD_WND_RECTS; + out_uint32_le(g_out_s, 0); /* visible_offset_x */ + out_uint32_le(g_out_s, 0); /* visible_offset_y */ + flags |= WINDOW_ORDER_FIELD_VIS_OFFSET; + out_uint16_le(g_out_s, num_visibility_rects); /* num_visibility_rects */ + for (index = 0; index < num_visibility_rects; index++) + { + out_uint16_le(g_out_s, 0); /* left */ + out_uint16_le(g_out_s, 0); /* top */ + out_uint16_le(g_out_s, pWindow->drawable.width); /* right */ + out_uint16_le(g_out_s, pWindow->drawable.height); /* bottom */ + } + flags |= WINDOW_ORDER_FIELD_VISIBILITY; + + out_uint32_le(g_out_s, flags); /* flags */ + } +} + +/******************************************************************************/ +void +rdpup_delete_window(WindowPtr pWindow, rdpWindowRec* priv) +{ + LLOGLN(10, ("rdpup_delete_window: id 0x%8.8x", pWindow->drawable.id)); + if (g_connected) + { + rdpup_pre_check(8); + out_uint16_le(g_out_s, 26); + out_uint16_le(g_out_s, 8); + g_count++; + out_uint32_le(g_out_s, pWindow->drawable.id); /* window_id */ + } +} + +/******************************************************************************/ +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; + + if (pDirtyPriv == 0) + { + return 0; + } + if (pDirtyPriv->is_dirty == 0) + { + return 0; + } + + /* update use 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->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)); + 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); + } + 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); + } + 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; + } + draw_item_remove_all(pDirtyPriv); + rdpup_end_update(); + pDirtyPriv->is_dirty = 0; + rdpup_switch_os_surface(-1); + return 0; +} |