xorg: offscreen bitmaps, don't remote until used

master
Jay Sorg 12 years ago
parent 7539d7271e
commit da9d55f180

@ -193,12 +193,31 @@ typedef rdpWindowRec* rdpWindowPtr;
#define XR_STYLE_DIALOG (0x80000000) #define XR_STYLE_DIALOG (0x80000000)
#define XR_EXT_STYLE_DIALOG (0x00040000) #define XR_EXT_STYLE_DIALOG (0x00040000)
#define RDI_FILL 1
#define RDI_IMGLL 2
#define RDI_IMGLY 3
struct rdp_draw_item
{
int type;
int fg_color;
int bg_color;
int opcode;
RegionPtr reg;
struct rdp_draw_item* prev;
struct rdp_draw_item* next;
};
struct _rdpPixmapRec struct _rdpPixmapRec
{ {
int status; int status;
int rdpindex; int rdpindex;
int allocBytes; int allocBytes;
int con_number; int con_number;
int is_dirty;
int pad;
struct rdp_draw_item* draw_item_head;
struct rdp_draw_item* draw_item_tail;
}; };
typedef struct _rdpPixmapRec rdpPixmapRec; typedef struct _rdpPixmapRec rdpPixmapRec;
typedef rdpPixmapRec* rdpPixmapPtr; typedef rdpPixmapRec* rdpPixmapPtr;
@ -265,6 +284,22 @@ hexdump(unsigned char *p, unsigned int len);
Bool Bool
rdpCloseScreen(int i, ScreenPtr pScreen); rdpCloseScreen(int i, ScreenPtr pScreen);
int
draw_item_add(rdpPixmapRec* priv, struct rdp_draw_item* di);
int
draw_item_remove(rdpPixmapRec* priv, struct rdp_draw_item* di);
int
draw_item_remove_all(rdpPixmapRec* priv);
int
draw_item_pack(rdpPixmapRec* priv);
int
draw_item_add_img_region(rdpPixmapRec* priv, RegionPtr reg, int type);
int
draw_item_add_fill_region(rdpPixmapRec* priv, RegionPtr reg, int color,
int opcode);
PixmapPtr PixmapPtr
rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
unsigned usage_hint); unsigned usage_hint);
@ -426,6 +461,8 @@ void
rdpup_create_window(WindowPtr pWindow, rdpWindowRec* priv); rdpup_create_window(WindowPtr pWindow, rdpWindowRec* priv);
void void
rdpup_delete_window(WindowPtr pWindow, rdpWindowRec* priv); rdpup_delete_window(WindowPtr pWindow, rdpWindowRec* priv);
int
rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec* pDirtyPriv);
#if defined(X_BYTE_ORDER) #if defined(X_BYTE_ORDER)
# if X_BYTE_ORDER == X_LITTLE_ENDIAN # if X_BYTE_ORDER == X_LITTLE_ENDIAN

@ -367,6 +367,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
can_do_screen_blt = pGC->alu == GXcopy; can_do_screen_blt = pGC->alu == GXcopy;
if (can_do_screen_blt) if (can_do_screen_blt)
{ {
rdpup_check_dirty(pDstPixmap, pDstPriv);
return rdpCopyAreaWndToPixmap(pSrcWnd, pDstPixmap, pDstPriv, pGC, return rdpCopyAreaWndToPixmap(pSrcWnd, pDstPixmap, pDstPriv, pGC,
srcx, srcy, w, h, dstx, dsty); srcx, srcy, w, h, dstx, dsty);
} }
@ -380,6 +381,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
pSrcPriv = GETPIXPRIV(pSrcPixmap); pSrcPriv = GETPIXPRIV(pSrcPixmap);
if (XRDP_IS_OS(pSrcPriv)) if (XRDP_IS_OS(pSrcPriv))
{ {
rdpup_check_dirty(pSrcPixmap, pSrcPriv);
if (pDst->type == DRAWABLE_WINDOW) if (pDst->type == DRAWABLE_WINDOW)
{ {
pDstWnd = (WindowPtr)pDst; pDstWnd = (WindowPtr)pDst;
@ -395,6 +397,7 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_check_dirty(pDstPixmap, pDstPriv);
return rdpCopyAreaPixmapToPixmap(pSrcPixmap, pSrcPriv, return rdpCopyAreaPixmapToPixmap(pSrcPixmap, pSrcPriv,
pDstPixmap, pDstPriv, pDstPixmap, pDstPriv,
pGC, srcx, srcy, w, h, pGC, srcx, srcy, w, h,

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -68,22 +69,32 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
RegionPtr rv; RegionPtr rv;
RegionRec clip_reg; RegionRec clip_reg;
RegionRec box_reg; RegionRec box_reg;
RegionRec reg1;
RegionRec reg2;
int cd; int cd;
int num_clips; int num_clips;
int j; int j;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
BoxRec box; BoxRec box;
BoxPtr pbox; BoxPtr pbox;
struct image_data id; struct image_data id;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpCopyPlane:")); LLOGLN(10, ("rdpCopyPlane:"));
/* do original call */ /* do original call */
rv = rdpCopyPlaneOrg(pSrc, pDst, pGC, srcx, srcy, w, h, rv = rdpCopyPlaneOrg(pSrc, pDst, pGC, srcx, srcy, w, h,
dstx, dsty, bitPlane); dstx, dsty, bitPlane);
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (pDst->type == DRAWABLE_PIXMAP) if (pDst->type == DRAWABLE_PIXMAP)
{ {
@ -91,9 +102,21 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
LLOGLN(10, ("rdpCopyPlane: gettig dirty"));
pDstPriv->is_dirty = 1;
pDirtyPriv = pDstPriv;
dirty_type = RDI_IMGLY;
}
else
{
rdpup_switch_os_surface(pDstPriv->rdpindex);
reset_surface = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
got_id = 1;
}
} }
} }
else else
@ -103,12 +126,13 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
pDstWnd = (WindowPtr)pDst; pDstWnd = (WindowPtr)pDst;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
return rv; return rv;
} }
@ -117,41 +141,75 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
cd = rdp_get_clip(&clip_reg, pDst, pGC); cd = rdp_get_clip(&clip_reg, pDst, pGC);
if (cd == 1) if (cd == 1)
{ {
rdpup_begin_update(); if (dirty_type != 0)
rdpup_send_area(&id, pDst->x + dstx, pDst->y + dsty, w, h); {
rdpup_end_update(); box.x1 = pDst->x + dstx;
box.y1 = pDst->y + dsty;
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
RegionUninit(&reg1);
}
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) else if (cd == 2)
{ {
num_clips = REGION_NUM_RECTS(&clip_reg); num_clips = REGION_NUM_RECTS(&clip_reg);
if (num_clips > 0) if (num_clips > 0)
{ {
rdpup_begin_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(&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.x1 = pDst->x + dstx;
{ box.y1 = pDst->y + dsty;
box = REGION_RECTS(&clip_reg)[j]; box.x2 = box.x1 + w;
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); box.y2 = box.y1 + h;
} RegionInit(&reg1, &box, 0);
RegionInit(&reg2, NullBox, 0);
RegionCopy(&reg2, &clip_reg);
RegionIntersect(&reg1, &reg1, &reg2);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
RegionUninit(&reg1);
RegionUninit(&reg2);
} }
else else
{ {
pbox = RegionExtents(&clip_reg); rdpup_begin_update();
rdpup_send_area(&id, pbox->x1, pbox->y1, pbox->x2 - pbox->x1, box.x1 = pDst->x + dstx;
pbox->y2 - pbox->y1); 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); RegionUninit(&clip_reg);
if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
return rv; return rv;
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -64,6 +65,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
{ {
RegionRec clip_reg; RegionRec clip_reg;
RegionRec box_reg; RegionRec box_reg;
RegionRec reg1;
int num_clips; int num_clips;
int cd; int cd;
int maxx; int maxx;
@ -73,17 +75,25 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
int i; int i;
int j; int j;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
BoxRec box; BoxRec box;
struct image_data id; struct image_data id;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpFillPolygon:")); LLOGLN(10, ("rdpFillPolygon:"));
/* do original call */ /* do original call */
rdpFillPolygonOrg(pDrawable, pGC, shape, mode, count, pPts); rdpFillPolygonOrg(pDrawable, pGC, shape, mode, count, pPts);
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (pDrawable->type == DRAWABLE_PIXMAP) if (pDrawable->type == DRAWABLE_PIXMAP)
{ {
@ -91,9 +101,21 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
LLOGLN(10, ("rdpFillPolygon: gettig dirty"));
pDstPriv->is_dirty = 1;
pDirtyPriv = pDstPriv;
dirty_type = RDI_IMGLY;
}
else
{
rdpup_switch_os_surface(pDstPriv->rdpindex);
reset_surface = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
got_id = 1;
}
} }
} }
else else
@ -103,12 +125,13 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
pDstWnd = (WindowPtr)pDrawable; pDstWnd = (WindowPtr)pDrawable;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
return; return;
} }
@ -154,9 +177,18 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
} }
if (cd == 1) if (cd == 1)
{ {
rdpup_begin_update(); if (dirty_type != 0)
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); {
rdpup_end_update(); RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
RegionUninit(&reg1);
}
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) else if (cd == 2)
{ {
@ -165,16 +197,26 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
num_clips = REGION_NUM_RECTS(&clip_reg); num_clips = REGION_NUM_RECTS(&clip_reg);
if (num_clips > 0) if (num_clips > 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
for (j = num_clips - 1; j >= 0; j--)
{ {
box = REGION_RECTS(&clip_reg)[j]; draw_item_add_img_region(pDirtyPriv, &clip_reg, dirty_type);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); }
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(&box_reg);
} }
RegionUninit(&clip_reg); RegionUninit(&clip_reg);
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -68,11 +69,15 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
int cd; int cd;
int j; int j;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
BoxRec box; BoxRec box;
struct image_data id; struct image_data id;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpImageGlyphBlt:")); LLOGLN(10, ("rdpImageGlyphBlt:"));
@ -84,6 +89,10 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
/* do original call */ /* do original call */
rdpImageGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); rdpImageGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (pDrawable->type == DRAWABLE_PIXMAP) if (pDrawable->type == DRAWABLE_PIXMAP)
{ {
@ -91,9 +100,21 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
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 else
@ -103,12 +124,13 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
pDstWnd = (WindowPtr)pDrawable; pDstWnd = (WindowPtr)pDrawable;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
return; return;
} }
@ -124,9 +146,18 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
} }
if (cd == 1) if (cd == 1)
{ {
rdpup_begin_update(); if (dirty_type != 0)
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); {
rdpup_end_update(); RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
RegionUninit(&reg1);
}
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) else if (cd == 2)
{ {
@ -135,17 +166,27 @@ rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
num_clips = REGION_NUM_RECTS(&reg); num_clips = REGION_NUM_RECTS(&reg);
if (num_clips > 0) if (num_clips > 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
for (j = num_clips - 1; j >= 0; j--)
{ {
box = REGION_RECTS(&reg)[j]; draw_item_add_img_region(pDirtyPriv, &reg, dirty_type);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); }
else if (got_id)
{
rdpup_begin_update();
for (j = num_clips - 1; j >= 0; j--)
{
box = REGION_RECTS(&reg)[j];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
}
rdpup_end_update();
} }
rdpup_end_update();
} }
RegionUninit(&reg1); RegionUninit(&reg1);
} }
RegionUninit(&reg); RegionUninit(&reg);
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
return; return;
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -66,11 +67,15 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
int cd; int cd;
int j; int j;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
BoxRec box; BoxRec box;
struct image_data id; struct image_data id;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpImageText16:")); LLOGLN(10, ("rdpImageText16:"));
@ -82,6 +87,10 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
/* do original call */ /* do original call */
rdpImageText16Org(pDrawable, pGC, x, y, count, chars); rdpImageText16Org(pDrawable, pGC, x, y, count, chars);
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (pDrawable->type == DRAWABLE_PIXMAP) if (pDrawable->type == DRAWABLE_PIXMAP)
{ {
@ -89,9 +98,21 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
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 else
@ -101,12 +122,13 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
pDstWnd = (WindowPtr)pDrawable; pDstWnd = (WindowPtr)pDrawable;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
return; return;
} }
@ -122,9 +144,18 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
} }
if (cd == 1) if (cd == 1)
{ {
rdpup_begin_update(); if (dirty_type != 0)
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); {
rdpup_end_update(); RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
RegionUninit(&reg1);
}
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) else if (cd == 2)
{ {
@ -133,17 +164,27 @@ rdpImageText16(DrawablePtr pDrawable, GCPtr pGC,
num_clips = REGION_NUM_RECTS(&reg); num_clips = REGION_NUM_RECTS(&reg);
if (num_clips > 0) if (num_clips > 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
for (j = num_clips - 1; j >= 0; j--)
{ {
box = REGION_RECTS(&reg)[j]; draw_item_add_img_region(pDirtyPriv, &reg, dirty_type);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); }
else if (got_id)
{
rdpup_begin_update();
for (j = num_clips - 1; j >= 0; j--)
{
box = REGION_RECTS(&reg)[j];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
}
rdpup_end_update();
} }
rdpup_end_update();
} }
RegionUninit(&reg1); RegionUninit(&reg1);
} }
RegionUninit(&reg); RegionUninit(&reg);
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
return; return;
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -66,11 +67,15 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
int cd; int cd;
int j; int j;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
BoxRec box; BoxRec box;
struct image_data id; struct image_data id;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpImageText8:")); LLOGLN(10, ("rdpImageText8:"));
@ -82,6 +87,10 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
/* do original call */ /* do original call */
rdpImageText8Org(pDrawable, pGC, x, y, count, chars); rdpImageText8Org(pDrawable, pGC, x, y, count, chars);
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (pDrawable->type == DRAWABLE_PIXMAP) if (pDrawable->type == DRAWABLE_PIXMAP)
{ {
@ -89,9 +98,21 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
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 else
@ -101,12 +122,13 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
pDstWnd = (WindowPtr)pDrawable; pDstWnd = (WindowPtr)pDrawable;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
return; return;
} }
@ -122,9 +144,18 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
} }
if (cd == 1) if (cd == 1)
{ {
rdpup_begin_update(); if (dirty_type != 0)
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); {
rdpup_end_update(); RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
RegionUninit(&reg1);
}
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) else if (cd == 2)
{ {
@ -133,17 +164,27 @@ rdpImageText8(DrawablePtr pDrawable, GCPtr pGC,
num_clips = REGION_NUM_RECTS(&reg); num_clips = REGION_NUM_RECTS(&reg);
if (num_clips > 0) if (num_clips > 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
for (j = num_clips - 1; j >= 0; j--)
{ {
box = REGION_RECTS(&reg)[j]; draw_item_add_img_region(pDirtyPriv, &reg, dirty_type);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); }
else if (got_id)
{
rdpup_begin_update();
for (j = num_clips - 1; j >= 0; j--)
{
box = REGION_RECTS(&reg)[j];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
}
rdpup_end_update();
} }
rdpup_end_update();
} }
RegionUninit(&reg1); RegionUninit(&reg1);
} }
RegionUninit(&reg); RegionUninit(&reg);
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
return; return;
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -66,12 +67,16 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
int i; int i;
int num_clips; int num_clips;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
xRectangle* rects; xRectangle* rects;
BoxRec box; BoxRec box;
struct image_data id; struct image_data id;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpPolyArc:")); LLOGLN(10, ("rdpPolyArc:"));
@ -97,6 +102,10 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
/* do original call */ /* do original call */
rdpPolyArcOrg(pDrawable, pGC, narcs, parcs); rdpPolyArcOrg(pDrawable, pGC, narcs, parcs);
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (pDrawable->type == DRAWABLE_PIXMAP) if (pDrawable->type == DRAWABLE_PIXMAP)
{ {
@ -104,9 +113,21 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
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 else
@ -116,12 +137,13 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
pDstWnd = (WindowPtr)pDrawable; pDstWnd = (WindowPtr)pDrawable;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
g_free(rects); g_free(rects);
return; return;
@ -137,13 +159,20 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
num_clips = REGION_NUM_RECTS(tmpRegion); num_clips = REGION_NUM_RECTS(tmpRegion);
if (num_clips > 0) if (num_clips > 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
for (i = num_clips - 1; i >= 0; i--)
{ {
box = REGION_RECTS(tmpRegion)[i]; draw_item_add_img_region(pDirtyPriv, tmpRegion, dirty_type);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); }
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); RegionDestroy(tmpRegion);
} }
@ -157,18 +186,28 @@ rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
num_clips = REGION_NUM_RECTS(tmpRegion); num_clips = REGION_NUM_RECTS(tmpRegion);
if (num_clips > 0) if (num_clips > 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
for (i = num_clips - 1; i >= 0; i--) {
draw_item_add_img_region(pDirtyPriv, tmpRegion, dirty_type);
}
else if (got_id)
{ {
box = REGION_RECTS(tmpRegion)[i]; rdpup_begin_update();
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); 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); RegionDestroy(tmpRegion);
} }
} }
RegionUninit(&clip_reg); RegionUninit(&clip_reg);
g_free(rects); g_free(rects);
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -66,12 +67,16 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
int i; int i;
int num_clips; int num_clips;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
xRectangle* rects; xRectangle* rects;
BoxRec box; BoxRec box;
struct image_data id; struct image_data id;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpPolyFillArc:")); LLOGLN(10, ("rdpPolyFillArc:"));
@ -97,6 +102,10 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
/* do original call */ /* do original call */
rdpPolyFillArcOrg(pDrawable, pGC, narcs, parcs); rdpPolyFillArcOrg(pDrawable, pGC, narcs, parcs);
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (pDrawable->type == DRAWABLE_PIXMAP) if (pDrawable->type == DRAWABLE_PIXMAP)
{ {
@ -104,9 +113,21 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
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 else
@ -116,12 +137,13 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
pDstWnd = (WindowPtr)pDrawable; pDstWnd = (WindowPtr)pDrawable;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
g_free(rects); g_free(rects);
return; return;
@ -137,13 +159,20 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
num_clips = REGION_NUM_RECTS(tmpRegion); num_clips = REGION_NUM_RECTS(tmpRegion);
if (num_clips > 0) if (num_clips > 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
for (i = num_clips - 1; i >= 0; i--)
{ {
box = REGION_RECTS(tmpRegion)[i]; draw_item_add_img_region(pDirtyPriv, tmpRegion, dirty_type);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); }
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); RegionDestroy(tmpRegion);
} }
@ -157,18 +186,28 @@ rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs)
num_clips = REGION_NUM_RECTS(tmpRegion); num_clips = REGION_NUM_RECTS(tmpRegion);
if (num_clips > 0) if (num_clips > 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
for (i = num_clips - 1; i >= 0; i--) {
draw_item_add_img_region(pDirtyPriv, tmpRegion, dirty_type);
}
else if (got_id)
{ {
box = REGION_RECTS(tmpRegion)[i]; rdpup_begin_update();
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); 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); RegionDestroy(tmpRegion);
} }
} }
RegionUninit(&clip_reg); RegionUninit(&clip_reg);
g_free(rects); g_free(rects);
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -68,10 +69,15 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
BoxRec box; BoxRec box;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
struct image_data id; struct image_data id;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpPolyFillRect:")); LLOGLN(10, ("rdpPolyFillRect:"));
@ -81,16 +87,30 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
/* do original call */ /* do original call */
rdpPolyFillRectOrg(pDrawable, pGC, nrectFill, prectInit); rdpPolyFillRectOrg(pDrawable, pGC, nrectFill, prectInit);
got_id = 0; dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
if (pDrawable->type == DRAWABLE_PIXMAP) if (pDrawable->type == DRAWABLE_PIXMAP)
{ {
pDstPixmap = (PixmapPtr)pDrawable; pDstPixmap = (PixmapPtr)pDrawable;
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
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 else
@ -100,12 +120,13 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
pDstWnd = (WindowPtr)pDrawable; pDstWnd = (WindowPtr)pDrawable;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
RegionDestroy(fill_reg); RegionDestroy(fill_reg);
return; return;
@ -115,40 +136,26 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
cd = rdp_get_clip(&clip_reg, pDrawable, pGC); cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
if (cd == 1) /* no clip */ if (cd == 1) /* no clip */
{ {
rdpup_begin_update(); 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? */
{ {
rdpup_set_fgcolor(pGC->fgPixel); if (pGC->fillStyle == 0 && /* solid fill */
rdpup_set_opcode(pGC->alu); (pGC->alu == GXclear ||
for (j = REGION_NUM_RECTS(fill_reg) - 1; j >= 0; j--) 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]; draw_item_add_fill_region(pDirtyPriv, fill_reg, pGC->fgPixel,
rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); pGC->alu);
} }
rdpup_set_opcode(GXcopy); else
}
else /* non solid fill */
{
for (j = REGION_NUM_RECTS(fill_reg) - 1; j >= 0; j--)
{ {
box = REGION_RECTS(fill_reg)[j]; draw_item_add_img_region(pDirtyPriv, fill_reg, RDI_IMGLL);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
} }
} }
rdpup_end_update(); else if (got_id)
}
else if (cd == 2) /* clip */
{
RegionIntersect(&clip_reg, &clip_reg, fill_reg);
num_clips = REGION_NUM_RECTS(&clip_reg);
if (num_clips > 0)
{ {
rdpup_begin_update(); rdpup_begin_update();
if (pGC->fillStyle == 0 && /* solid fill */ if (pGC->fillStyle == 0 && /* solid fill */
@ -162,25 +169,87 @@ rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
{ {
rdpup_set_fgcolor(pGC->fgPixel); rdpup_set_fgcolor(pGC->fgPixel);
rdpup_set_opcode(pGC->alu); 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_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
} }
rdpup_set_opcode(GXcopy); rdpup_set_opcode(GXcopy);
} }
else /* non solid fill */ 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]; box = REGION_RECTS(fill_reg)[j];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1,
box.y2 - box.y1);
} }
} }
rdpup_end_update(); rdpup_end_update();
} }
} }
else if (cd == 2) /* clip */
{
RegionIntersect(&clip_reg, &clip_reg, fill_reg);
num_clips = REGION_NUM_RECTS(&clip_reg);
if (num_clips > 0)
{
if (dirty_type != 0)
{
if (pGC->fillStyle == 0 && /* solid fill */
(pGC->alu == GXclear ||
pGC->alu == GXset ||
pGC->alu == GXinvert ||
pGC->alu == GXnoop ||
pGC->alu == GXand ||
pGC->alu == GXcopy /*||
pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
{
draw_item_add_fill_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
pGC->alu);
}
else
{
draw_item_add_img_region(pDirtyPriv, &clip_reg, RDI_IMGLL);
}
}
else if (got_id)
{
rdpup_begin_update();
if (pGC->fillStyle == 0 && /* solid fill */
(pGC->alu == GXclear ||
pGC->alu == GXset ||
pGC->alu == GXinvert ||
pGC->alu == GXnoop ||
pGC->alu == GXand ||
pGC->alu == GXcopy /*||
pGC->alu == GXxor*/)) /* todo, why dosen't xor work? */
{
rdpup_set_fgcolor(pGC->fgPixel);
rdpup_set_opcode(pGC->alu);
for (j = num_clips - 1; j >= 0; j--)
{
box = REGION_RECTS(&clip_reg)[j];
rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
}
rdpup_set_opcode(GXcopy);
}
else /* non solid fill */
{
for (j = num_clips - 1; j >= 0; j--)
{
box = REGION_RECTS(&clip_reg)[j];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
}
}
rdpup_end_update();
}
}
}
RegionUninit(&clip_reg); RegionUninit(&clip_reg);
RegionDestroy(fill_reg); RegionDestroy(fill_reg);
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -68,11 +69,15 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
int cd; int cd;
int j; int j;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
BoxRec box; BoxRec box;
struct image_data id; struct image_data id;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpPolyGlyphBlt:")); LLOGLN(10, ("rdpPolyGlyphBlt:"));
@ -84,6 +89,10 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
/* do original call */ /* do original call */
rdpPolyGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); rdpPolyGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (pDrawable->type == DRAWABLE_PIXMAP) if (pDrawable->type == DRAWABLE_PIXMAP)
{ {
@ -91,9 +100,21 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
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 else
@ -103,12 +124,13 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
pDstWnd = (WindowPtr)pDrawable; pDstWnd = (WindowPtr)pDrawable;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
return; return;
} }
@ -124,9 +146,18 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
} }
if (cd == 1) if (cd == 1)
{ {
rdpup_begin_update(); if (dirty_type != 0)
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); {
rdpup_end_update(); RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
RegionUninit(&reg1);
}
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) else if (cd == 2)
{ {
@ -135,17 +166,27 @@ rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
num_clips = REGION_NUM_RECTS(&reg); num_clips = REGION_NUM_RECTS(&reg);
if (num_clips > 0) if (num_clips > 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
for (j = num_clips - 1; j >= 0; j--)
{ {
box = REGION_RECTS(&reg)[j]; draw_item_add_img_region(pDirtyPriv, &reg, dirty_type);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); }
else if (got_id)
{
rdpup_begin_update();
for (j = num_clips - 1; j >= 0; j--)
{
box = REGION_RECTS(&reg)[j];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
}
rdpup_end_update();
} }
rdpup_end_update();
} }
RegionUninit(&reg1); RegionUninit(&reg1);
} }
RegionUninit(&reg); RegionUninit(&reg);
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
return; return;
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -68,6 +69,9 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
int i; int i;
int j; int j;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
BoxRec box; BoxRec box;
BoxRec total_box; BoxRec total_box;
DDXPointPtr pts; DDXPointPtr pts;
@ -76,6 +80,7 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpPolyPoint:")); LLOGLN(10, ("rdpPolyPoint:"));
@ -123,6 +128,10 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
/* do original call */ /* do original call */
rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts); rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts);
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (pDrawable->type == DRAWABLE_PIXMAP) if (pDrawable->type == DRAWABLE_PIXMAP)
{ {
@ -130,9 +139,21 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
LLOGLN(10, ("rdpPolyPoint: gettig dirty"));
pDstPriv->is_dirty = 1;
pDirtyPriv = pDstPriv;
dirty_type = RDI_IMGLY;
}
else
{
rdpup_switch_os_surface(pDstPriv->rdpindex);
reset_surface = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
got_id = 1;
}
} }
} }
else else
@ -142,12 +163,13 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
pDstWnd = (WindowPtr)pDrawable; pDstWnd = (WindowPtr)pDrawable;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
return; return;
} }
@ -158,15 +180,22 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
{ {
if (npt > 0) if (npt > 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
rdpup_set_fgcolor(pGC->fgPixel);
for (i = 0; i < npt; i++)
{ {
x = pts[i].x; /* TODO */
y = pts[i].y; }
rdpup_fill_rect(x, y, 1, 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) else if (cd == 2)
@ -174,21 +203,28 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
num_clips = REGION_NUM_RECTS(&clip_reg); num_clips = REGION_NUM_RECTS(&clip_reg);
if (npt > 0 && num_clips > 0) if (npt > 0 && num_clips > 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
rdpup_set_fgcolor(pGC->fgPixel);
for (j = num_clips - 1; j >= 0; j--)
{ {
box = REGION_RECTS(&clip_reg)[j]; /* TODO */
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); }
for (i = 0; i < npt; i++) else if (got_id)
{
rdpup_begin_update();
rdpup_set_fgcolor(pGC->fgPixel);
for (j = num_clips - 1; j >= 0; j--)
{ {
x = pts[i].x; box = REGION_RECTS(&clip_reg)[j];
y = pts[i].y; rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
rdpup_fill_rect(x, y, 1, 1); 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); RegionUninit(&clip_reg);
@ -196,5 +232,8 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
{ {
g_free(pts); g_free(pts);
} }
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -71,6 +72,9 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
int up; int up;
int down; int down;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
xRectangle* regRects; xRectangle* regRects;
xRectangle* r; xRectangle* r;
xRectangle* rect1; xRectangle* rect1;
@ -80,6 +84,7 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpPolyRectangle:")); LLOGLN(10, ("rdpPolyRectangle:"));
@ -93,6 +98,10 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
/* do original call */ /* do original call */
rdpPolyRectangleOrg(pDrawable, pGC, nrects, rects); rdpPolyRectangleOrg(pDrawable, pGC, nrects, rects);
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (pDrawable->type == DRAWABLE_PIXMAP) if (pDrawable->type == DRAWABLE_PIXMAP)
{ {
@ -100,9 +109,21 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
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 else
@ -112,12 +133,13 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
pDstWnd = (WindowPtr)pDrawable; pDstWnd = (WindowPtr)pDrawable;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
g_free(rect1); g_free(rect1);
return; return;
@ -164,27 +186,34 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
{ {
if (regRects != 0) if (regRects != 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
if (pGC->lineStyle == LineSolid)
{ {
rdpup_set_fgcolor(pGC->fgPixel); /* TODO */
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 else if (got_id)
{ {
for (i = 0; i < nrects * 4; i++) rdpup_begin_update();
if (pGC->lineStyle == LineSolid)
{ {
r = regRects + i; rdpup_set_fgcolor(pGC->fgPixel);
rdpup_send_area(&id, r->x, r->y, r->width, r->height); 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) else if (cd == 2)
@ -196,27 +225,34 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
num_clips = REGION_NUM_RECTS(&clip_reg); num_clips = REGION_NUM_RECTS(&clip_reg);
if (num_clips > 0) if (num_clips > 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
if (pGC->lineStyle == LineSolid)
{ {
rdpup_set_fgcolor(pGC->fgPixel); /* TODO */
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 else if (got_id)
{ {
for (j = num_clips - 1; j >= 0; j--) rdpup_begin_update();
if (pGC->lineStyle == LineSolid)
{
rdpup_set_fgcolor(pGC->fgPixel);
rdpup_set_opcode(pGC->alu);
for (j = num_clips - 1; j >= 0; j--)
{
box = REGION_RECTS(&clip_reg)[j];
rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
}
rdpup_set_opcode(GXcopy);
}
else
{ {
box = REGION_RECTS(&clip_reg)[j]; for (j = num_clips - 1; j >= 0; j--)
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); {
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); RegionDestroy(fill_reg);
} }
@ -224,5 +260,8 @@ rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
RegionUninit(&clip_reg); RegionUninit(&clip_reg);
g_free(regRects); g_free(regRects);
g_free(rect1); g_free(rect1);
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -63,12 +64,16 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
int i; int i;
int j; int j;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
xSegment* segs; xSegment* segs;
BoxRec box; BoxRec box;
struct image_data id; struct image_data id;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpPolySegment:")); LLOGLN(10, ("rdpPolySegment:"));
@ -88,6 +93,10 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
/* do original call */ /* do original call */
rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs); rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs);
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (pDrawable->type == DRAWABLE_PIXMAP) if (pDrawable->type == DRAWABLE_PIXMAP)
{ {
@ -95,9 +104,21 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
LLOGLN(10, ("rdpPolySegment: gettig dirty"));
pDstPriv->is_dirty = 1;
pDirtyPriv = pDstPriv;
dirty_type = RDI_IMGLY;
}
else
{
rdpup_switch_os_surface(pDstPriv->rdpindex);
reset_surface = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id);
got_id = 1;
}
} }
} }
else else
@ -107,12 +128,13 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
pDstWnd = (WindowPtr)pDrawable; pDstWnd = (WindowPtr)pDrawable;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
g_free(segs); g_free(segs);
return; return;
@ -124,41 +146,58 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
{ {
if (segs != 0) if (segs != 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
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); /* TODO */
}
else if (got_id)
{
rdpup_begin_update();
rdpup_set_fgcolor(pGC->fgPixel);
rdpup_set_opcode(pGC->alu);
rdpup_set_pen(0, pGC->lineWidth);
for (i = 0; i < nseg; i++)
{
rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
}
rdpup_set_opcode(GXcopy);
rdpup_end_update();
} }
rdpup_set_opcode(GXcopy);
rdpup_end_update();
} }
} }
else if (cd == 2) /* clip */ else if (cd == 2) /* clip */
{ {
if (segs != 0) if (segs != 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
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--)
{ {
box = REGION_RECTS(&clip_reg)[j]; /* TODO */
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); }
for (i = 0; i < nseg; i++) else if (got_id)
{
rdpup_begin_update();
rdpup_set_fgcolor(pGC->fgPixel);
rdpup_set_opcode(pGC->alu);
rdpup_set_pen(0, pGC->lineWidth);
for (j = REGION_NUM_RECTS(&clip_reg) - 1; j >= 0; j--)
{ {
rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2); box = REGION_RECTS(&clip_reg)[j];
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
for (i = 0; i < nseg; i++)
{
rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
}
} }
rdpup_reset_clip();
rdpup_set_opcode(GXcopy);
rdpup_end_update();
} }
rdpup_reset_clip();
rdpup_set_opcode(GXcopy);
rdpup_end_update();
} }
} }
g_free(segs); g_free(segs);
RegionUninit(&clip_reg); RegionUninit(&clip_reg);
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -69,11 +70,15 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
int j; int j;
int rv; int rv;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
BoxRec box; BoxRec box;
struct image_data id; struct image_data id;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpPolyText16:")); LLOGLN(10, ("rdpPolyText16:"));
@ -85,6 +90,10 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
/* do original call */ /* do original call */
rv = rdpPolyText16Org(pDrawable, pGC, x, y, count, chars); rv = rdpPolyText16Org(pDrawable, pGC, x, y, count, chars);
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (pDrawable->type == DRAWABLE_PIXMAP) if (pDrawable->type == DRAWABLE_PIXMAP)
{ {
@ -92,9 +101,21 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
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 else
@ -104,12 +125,13 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
pDstWnd = (WindowPtr)pDrawable; pDstWnd = (WindowPtr)pDrawable;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
return rv; return rv;
} }
@ -125,9 +147,18 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
} }
if (cd == 1) if (cd == 1)
{ {
rdpup_begin_update(); if (dirty_type != 0)
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); {
rdpup_end_update(); RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
RegionUninit(&reg1);
}
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) else if (cd == 2)
{ {
@ -136,17 +167,27 @@ rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
num_clips = REGION_NUM_RECTS(&reg); num_clips = REGION_NUM_RECTS(&reg);
if (num_clips > 0) if (num_clips > 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
for (j = num_clips - 1; j >= 0; j--)
{ {
box = REGION_RECTS(&reg)[j]; draw_item_add_img_region(pDirtyPriv, &reg, dirty_type);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); }
else if (got_id)
{
rdpup_begin_update();
for (j = num_clips - 1; j >= 0; j--)
{
box = REGION_RECTS(&reg)[j];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
}
rdpup_end_update();
} }
rdpup_end_update();
} }
RegionUninit(&reg1); RegionUninit(&reg1);
} }
RegionUninit(&reg); RegionUninit(&reg);
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
return rv; return rv;
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -69,11 +70,15 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
int j; int j;
int rv; int rv;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
BoxRec box; BoxRec box;
struct image_data id; struct image_data id;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpPolyText8:")); LLOGLN(10, ("rdpPolyText8:"));
@ -85,6 +90,10 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
/* do original call */ /* do original call */
rv = rdpPolyText8Org(pDrawable, pGC, x, y, count, chars); rv = rdpPolyText8Org(pDrawable, pGC, x, y, count, chars);
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (pDrawable->type == DRAWABLE_PIXMAP) if (pDrawable->type == DRAWABLE_PIXMAP)
{ {
@ -92,9 +101,21 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
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 else
@ -104,12 +125,13 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
pDstWnd = (WindowPtr)pDrawable; pDstWnd = (WindowPtr)pDrawable;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
return rv; return rv;
} }
@ -125,9 +147,18 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
} }
if (cd == 1) if (cd == 1)
{ {
rdpup_begin_update(); if (dirty_type != 0)
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); {
rdpup_end_update(); RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
RegionUninit(&reg1);
}
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) else if (cd == 2)
{ {
@ -136,17 +167,27 @@ rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC,
num_clips = REGION_NUM_RECTS(&reg); num_clips = REGION_NUM_RECTS(&reg);
if (num_clips > 0) if (num_clips > 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
for (j = num_clips - 1; j >= 0; j--)
{ {
box = REGION_RECTS(&reg)[j]; draw_item_add_img_region(pDirtyPriv, &reg, dirty_type);
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); }
else if (got_id)
{
rdpup_begin_update();
for (j = num_clips - 1; j >= 0; j--)
{
box = REGION_RECTS(&reg)[j];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
}
rdpup_end_update();
} }
rdpup_end_update();
} }
RegionUninit(&reg1); RegionUninit(&reg1);
} }
RegionUninit(&reg); RegionUninit(&reg);
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
return rv; return rv;
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -70,12 +71,16 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
int x2; int x2;
int y2; int y2;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
BoxRec box; BoxRec box;
DDXPointPtr ppts; DDXPointPtr ppts;
struct image_data id; struct image_data id;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpPolylines:")); LLOGLN(10, ("rdpPolylines:"));
@ -92,6 +97,10 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
/* do original call */ /* do original call */
rdpPolylinesOrg(pDrawable, pGC, mode, npt, pptInit); rdpPolylinesOrg(pDrawable, pGC, mode, npt, pptInit);
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (pDrawable->type == DRAWABLE_PIXMAP) if (pDrawable->type == DRAWABLE_PIXMAP)
{ {
@ -99,9 +108,21 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
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 else
@ -111,12 +132,13 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
pDstWnd = (WindowPtr)pDrawable; pDstWnd = (WindowPtr)pDrawable;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
g_free(ppts); g_free(ppts);
return; return;
@ -128,45 +150,16 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
{ {
if (ppts != 0) if (ppts != 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
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 (mode == CoordModeOrigin) /* TODO */
{
x2 = pDrawable->x + ppts[i].x;
y2 = pDrawable->y + ppts[i].y;
}
else
{
x2 = x1 + ppts[i].x;
y2 = y1 + ppts[i].y;
}
rdpup_draw_line(x1, y1, x2, y2);
x1 = x2;
y1 = y2;
} }
rdpup_set_opcode(GXcopy); else if (got_id)
rdpup_end_update();
}
}
else if (cd == 2)
{
num_clips = REGION_NUM_RECTS(&clip_reg);
if (ppts != 0 && num_clips > 0)
{
rdpup_begin_update();
rdpup_set_fgcolor(pGC->fgPixel);
rdpup_set_opcode(pGC->alu);
rdpup_set_pen(0, pGC->lineWidth);
for (j = num_clips - 1; j >= 0; j--)
{ {
box = REGION_RECTS(&clip_reg)[j]; rdpup_begin_update();
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); rdpup_set_fgcolor(pGC->fgPixel);
rdpup_set_opcode(pGC->alu);
rdpup_set_pen(0, pGC->lineWidth);
x1 = ppts[0].x + pDrawable->x; x1 = ppts[0].x + pDrawable->x;
y1 = ppts[0].y + pDrawable->y; y1 = ppts[0].y + pDrawable->y;
for (i = 1; i < npt; i++) for (i = 1; i < npt; i++)
@ -185,13 +178,59 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
x1 = x2; x1 = x2;
y1 = y2; y1 = y2;
} }
rdpup_set_opcode(GXcopy);
rdpup_end_update();
}
}
}
else if (cd == 2)
{
num_clips = REGION_NUM_RECTS(&clip_reg);
if (ppts != 0 && num_clips > 0)
{
if (dirty_type != 0)
{
/* TODO */
}
else if (got_id)
{
rdpup_begin_update();
rdpup_set_fgcolor(pGC->fgPixel);
rdpup_set_opcode(pGC->alu);
rdpup_set_pen(0, pGC->lineWidth);
for (j = num_clips - 1; j >= 0; j--)
{
box = REGION_RECTS(&clip_reg)[j];
rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
x1 = ppts[0].x + pDrawable->x;
y1 = ppts[0].y + pDrawable->y;
for (i = 1; i < npt; i++)
{
if (mode == CoordModeOrigin)
{
x2 = pDrawable->x + ppts[i].x;
y2 = pDrawable->y + ppts[i].y;
}
else
{
x2 = x1 + ppts[i].x;
y2 = y1 + ppts[i].y;
}
rdpup_draw_line(x1, y1, x2, y2);
x1 = x2;
y1 = y2;
}
}
rdpup_reset_clip();
rdpup_set_opcode(GXcopy);
rdpup_end_update();
} }
rdpup_reset_clip();
rdpup_set_opcode(GXcopy);
rdpup_end_update();
} }
} }
RegionUninit(&clip_reg); RegionUninit(&clip_reg);
g_free(ppts); g_free(ppts);
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -62,21 +63,32 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
{ {
RegionRec clip_reg; RegionRec clip_reg;
RegionRec box_reg; RegionRec box_reg;
RegionRec reg1;
int num_clips; int num_clips;
int cd; int cd;
int j; int j;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
BoxRec box; BoxRec box;
struct image_data id; struct image_data id;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpPushPixels:")); LLOGLN(0, ("rdpPushPixels:"));
/* do original call */ /* do original call */
rdpPushPixelsOrg(pGC, pBitMap, pDst, w, h, x, y); rdpPushPixelsOrg(pGC, pBitMap, pDst, w, h, x, y);
//return;
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (pDst->type == DRAWABLE_PIXMAP) if (pDst->type == DRAWABLE_PIXMAP)
{ {
@ -84,9 +96,21 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
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 else
@ -96,12 +120,13 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
pDstWnd = (WindowPtr)pDst; pDstWnd = (WindowPtr)pDst;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
return; return;
} }
@ -111,27 +136,56 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
cd = rdp_get_clip(&clip_reg, pDst, pGC); cd = rdp_get_clip(&clip_reg, pDst, pGC);
if (cd == 1) if (cd == 1)
{ {
rdpup_begin_update(); if (dirty_type != 0)
rdpup_send_area(0, x, y, w, h); {
rdpup_end_update(); box.x1 = pDst->x + x;
box.y1 = pDst->y + y;
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
RegionUninit(&reg1);
}
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) 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); RegionInit(&box_reg, &box, 0);
RegionIntersect(&clip_reg, &clip_reg, &box_reg); RegionIntersect(&clip_reg, &clip_reg, &box_reg);
num_clips = REGION_NUM_RECTS(&clip_reg); num_clips = REGION_NUM_RECTS(&clip_reg);
if (num_clips > 0) if (num_clips > 0)
{ {
rdpup_begin_update(); if (dirty_type != 0)
for (j = num_clips - 1; j >= 0; j--)
{ {
box = REGION_RECTS(&clip_reg)[j]; RegionInit(&reg1, &box, 0);
rdpup_send_area(0, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); draw_item_add_img_region(pDirtyPriv, &clip_reg, dirty_type);
RegionUninit(&reg1);
}
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(&box_reg);
} }
RegionUninit(&clip_reg); RegionUninit(&clip_reg);
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ 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; RegionRec clip_reg;
int cd; int cd;
int j; int j;
int reset_surface;
int post_process;
int got_id; int got_id;
int dirty_type;
BoxRec box; BoxRec box;
struct image_data id; struct image_data id;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
RegionRec reg1;
RegionRec reg2;
LLOGLN(10, ("rdpPutImage:")); LLOGLN(10, ("rdpPutImage:"));
LLOGLN(10, ("rdpPutImage: drawable id 0x%x", (int)(pDst->id))); LLOGLN(10, ("rdpPutImage: drawable id 0x%x", (int)(pDst->id)));
/* do original call */ /* do original call */
rdpPutImageOrg(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits); 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; got_id = 0;
if (pDst->type == DRAWABLE_PIXMAP) if (pDst->type == DRAWABLE_PIXMAP)
{ {
@ -84,9 +96,21 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
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 else
@ -96,12 +120,13 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
pDstWnd = (WindowPtr)pDst; pDstWnd = (WindowPtr)pDst;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
return; return;
} }
@ -109,22 +134,55 @@ rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
cd = rdp_get_clip(&clip_reg, pDst, pGC); cd = rdp_get_clip(&clip_reg, pDst, pGC);
if (cd == 1) if (cd == 1)
{ {
rdpup_begin_update(); if (dirty_type != 0)
rdpup_send_area(&id, pDst->x + x, pDst->y + y, w, h); {
rdpup_end_update(); box.x1 = pDst->x + x;
box.y1 = pDst->y + y;
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
RegionUninit(&reg1);
}
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) else if (cd == 2)
{ {
rdpup_begin_update(); if (dirty_type != 0)
for (j = REGION_NUM_RECTS(&clip_reg) - 1; j >= 0; j--)
{ {
box = REGION_RECTS(&clip_reg)[j]; box.x1 = pDst->x + x;
rdpup_set_clip(box.x1, box.y1, (box.x2 - box.x1), (box.y2 - box.y1)); box.y1 = pDst->y + y;
rdpup_send_area(&id, pDst->x + x, pDst->y + y, w, h); box.x2 = box.x1 + w;
box.y2 = box.y1 + h;
RegionInit(&reg1, &box, 0);
RegionInit(&reg2, NullBox, 0);
RegionCopy(&reg2, &clip_reg);
RegionIntersect(&reg1, &reg1, &reg2);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
RegionUninit(&reg1);
RegionUninit(&reg2);
}
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); RegionUninit(&clip_reg);
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
} }

@ -37,6 +37,7 @@ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* 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 */ extern GCOps g_rdpGCOps; /* from rdpdraw.c */
@ -63,17 +64,24 @@ rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc,
RegionRec clip_reg; RegionRec clip_reg;
int cd; int cd;
int got_id; int got_id;
int dirty_type;
int post_process;
int reset_surface;
struct image_data id; struct image_data id;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
LLOGLN(0, ("rdpSetSpans: todo")); LLOGLN(0, ("rdpSetSpans: todo"));
/* do original call */ /* do original call */
rdpSetSpansOrg(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); rdpSetSpansOrg(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (pDrawable->type == DRAWABLE_PIXMAP) if (pDrawable->type == DRAWABLE_PIXMAP)
{ {
@ -81,9 +89,21 @@ rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
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 else
@ -93,12 +113,13 @@ rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc,
pDstWnd = (WindowPtr)pDrawable; pDstWnd = (WindowPtr)pDrawable;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
} }
} }
} }
if (!got_id) if (!post_process)
{ {
return; return;
} }
@ -106,10 +127,25 @@ rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc,
cd = rdp_get_clip(&clip_reg, pDrawable, pGC); cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
if (cd == 1) if (cd == 1)
{ {
if (dirty_type != 0)
{
}
else if (got_id)
{
}
} }
else if (cd == 2) else if (cd == 2)
{ {
if (dirty_type != 0)
{
}
else if (got_id)
{
}
} }
RegionUninit(&clip_reg); RegionUninit(&clip_reg);
rdpup_switch_os_surface(-1); if (reset_surface)
{
rdpup_switch_os_surface(-1);
}
} }

@ -61,9 +61,12 @@ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* from rdpmain.c */ extern Bool g_wrapPixmap; /* from rdpmain.c */
extern WindowPtr g_invalidate_window; /* in rdpmain.c */ extern WindowPtr g_invalidate_window; /* in rdpmain.c */
extern int g_use_rail; /* in rdpmain.c */ extern int g_use_rail; /* in rdpmain.c */
extern int g_do_dirty_os; /* in rdpmain.c */
ColormapPtr g_rdpInstalledColormap; ColormapPtr g_rdpInstalledColormap;
static int g_doing_font = 0;
GCFuncs g_rdpGCFuncs = GCFuncs g_rdpGCFuncs =
{ {
rdpValidateGC, rdpChangeGC, rdpCopyGC, rdpDestroyGC, rdpChangeClip, rdpValidateGC, rdpChangeGC, rdpCopyGC, rdpDestroyGC, rdpChangeClip,
@ -317,7 +320,7 @@ rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects)
{ {
rdpGCRec* priv; rdpGCRec* priv;
LLOGLN(0, ("in rdpChangeClip")); LLOGLN(10, ("in rdpChangeClip"));
GC_FUNC_PROLOGUE(pGC); GC_FUNC_PROLOGUE(pGC);
pGC->funcs->ChangeClip(pGC, type, pValue, nrects); pGC->funcs->ChangeClip(pGC, type, pValue, nrects);
GC_FUNC_EPILOGUE(pGC); GC_FUNC_EPILOGUE(pGC);
@ -379,6 +382,180 @@ rdpCloseScreen(int i, ScreenPtr pScreen)
return 1; return 1;
} }
/******************************************************************************/
int
draw_item_add(rdpPixmapRec* priv, struct rdp_draw_item* di)
{
if (priv->draw_item_tail == 0)
{
priv->draw_item_tail = di;
priv->draw_item_head = di;
}
else
{
di->prev = priv->draw_item_tail;
priv->draw_item_tail->next = di;
priv->draw_item_tail = di;
}
return 0;
}
/******************************************************************************/
int
draw_item_remove(rdpPixmapRec* priv, struct rdp_draw_item* di)
{
if (di->prev != 0)
{
di->prev->next = di->next;
}
if (di->next != 0)
{
di->next->prev = di->prev;
}
if (priv->draw_item_head == di)
{
priv->draw_item_head = di->next;
}
if (priv->draw_item_tail == di)
{
priv->draw_item_tail = di->prev;
}
RegionDestroy(di->reg);
free(di);
return 0;
}
/******************************************************************************/
int
draw_item_remove_all(rdpPixmapRec* priv)
{
struct rdp_draw_item* di;
di = priv->draw_item_head;
while (di != 0)
{
draw_item_remove(priv, di);
di = priv->draw_item_head;
}
return 0;
}
/******************************************************************************/
int
draw_item_pack(rdpPixmapRec* priv)
{
struct rdp_draw_item* di;
struct rdp_draw_item* di_prev;
#if 1
/* look for repeating draw types */
if (priv->draw_item_head != 0)
{
if (priv->draw_item_head->next != 0)
{
di_prev = priv->draw_item_head;
di = priv->draw_item_head->next;
while (di != 0)
{
if ((di_prev->type == RDI_IMGLL) && (di->type == RDI_IMGLL))
{
LLOGLN(10, ("draw_item_pack: packing RDI_IMGLL"));
RegionUnion(di_prev->reg, di_prev->reg, di->reg);
draw_item_remove(priv, di);
di = di_prev->next;
}
else if ((di_prev->type == RDI_IMGLY) && (di->type == RDI_IMGLY))
{
LLOGLN(10, ("draw_item_pack: packing RDI_IMGLY"));
RegionUnion(di_prev->reg, di_prev->reg, di->reg);
draw_item_remove(priv, di);
di = di_prev->next;
}
else
{
di_prev = di;
di = di_prev->next;
}
}
}
}
#endif
#if 1
/* subtract regions */
if (priv->draw_item_tail != 0)
{
if (priv->draw_item_tail->prev != 0)
{
di = priv->draw_item_tail;
while (di->prev != 0)
{
di_prev = di->prev;
while (di_prev != 0)
{
/* D = M - S */
RegionSubtract(di_prev->reg, di_prev->reg, di->reg);
di_prev = di_prev->prev;
}
di = di->prev;
}
}
}
#endif
#if 1
/* remove draw items with empty regions */
di = priv->draw_item_head;
di_prev = 0;
while (di != 0)
{
if (!RegionNotEmpty(di->reg))
{
LLOGLN(10, ("draw_item_pack: removing empty item type %d", di->type));
draw_item_remove(priv, di);
di = di_prev == 0 ? priv->draw_item_head : di_prev->next;
}
else
{
di_prev = di;
di = di->next;
}
}
#endif
return 0;
}
/******************************************************************************/
int
draw_item_add_img_region(rdpPixmapRec* priv, RegionPtr reg, int type)
{
struct rdp_draw_item* di;
di = (struct rdp_draw_item*)malloc(sizeof(struct rdp_draw_item));
memset(di, 0, sizeof(struct rdp_draw_item));
di->type = type;
di->reg = RegionCreate(NullBox, 0);
RegionCopy(di->reg, reg);
draw_item_add(priv, di);
return 0;
}
/******************************************************************************/
int
draw_item_add_fill_region(rdpPixmapRec* priv, RegionPtr reg, int color,
int opcode)
{
struct rdp_draw_item* di;
di = (struct rdp_draw_item*)malloc(sizeof(struct rdp_draw_item));
memset(di, 0, sizeof(struct rdp_draw_item));
di->type = RDI_FILL;
di->fg_color = color;
di->opcode = opcode;
di->reg = RegionCreate(NullBox, 0);
RegionCopy(di->reg, reg);
draw_item_add(priv, di);
return 0;
}
/******************************************************************************/ /******************************************************************************/
PixmapPtr PixmapPtr
rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
@ -391,12 +568,13 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
org_width = width; org_width = width;
/* width must be a multiple of 4 in rdp */ /* width must be a multiple of 4 in rdp */
width = (width + 3) & ~3; 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; pScreen->CreatePixmap = g_rdpScreen.CreatePixmap;
rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint); rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint);
priv = GETPIXPRIV(rv); priv = GETPIXPRIV(rv);
priv->rdpindex = -1; priv->rdpindex = -1;
if ((rv->drawable.depth == g_rdpScreen.depth) && if ((rv->drawable.depth >= g_rdpScreen.depth) &&
(org_width > 1) && (height > 1)) (org_width > 1) && (height > 1))
{ {
priv->allocBytes = width * height * g_Bpp; priv->allocBytes = width * height * g_Bpp;
@ -406,6 +584,8 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
priv->status = 1; priv->status = 1;
rdpup_create_os_surface(priv->rdpindex, width, height); rdpup_create_os_surface(priv->rdpindex, width, height);
} }
//priv->reg_lossy = RegionCreate(NullBox, 0);
//priv->reg_lossless = RegionCreate(NullBox, 0);
} }
pScreen->ModifyPixmapHeader(rv, org_width, 0, 0, 0, 0, 0); pScreen->ModifyPixmapHeader(rv, org_width, 0, 0, 0, 0, 0);
pScreen->CreatePixmap = rdpCreatePixmap; pScreen->CreatePixmap = rdpCreatePixmap;
@ -429,6 +609,9 @@ rdpDestroyPixmap(PixmapPtr pPixmap)
{ {
rdpup_remove_os_bitmap(priv->rdpindex); rdpup_remove_os_bitmap(priv->rdpindex);
rdpup_delete_os_surface(priv->rdpindex); rdpup_delete_os_surface(priv->rdpindex);
//RegionDestroy(priv->reg_lossy);
//RegionDestroy(priv->reg_lossless);
draw_item_remove_all(priv);
} }
} }
pScreen = pPixmap->drawable.pScreen; pScreen = pPixmap->drawable.pScreen;
@ -833,12 +1016,18 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
RegionRec reg1; RegionRec reg1;
RegionRec reg2; RegionRec reg2;
DrawablePtr p; DrawablePtr p;
int dirty_type;
int j; int j;
int num_clips; int num_clips;
int post_process;
int reset_surface;
int got_id; int got_id;
int lx;
int ly;
WindowPtr pDstWnd; WindowPtr pDstWnd;
PixmapPtr pDstPixmap; PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv; rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
struct image_data id; struct image_data id;
LLOGLN(10, ("rdpComposite:")); LLOGLN(10, ("rdpComposite:"));
@ -850,6 +1039,10 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
p = pDst->pDrawable; p = pDst->pDrawable;
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
reset_surface = 0;
got_id = 0; got_id = 0;
if (p->type == DRAWABLE_PIXMAP) if (p->type == DRAWABLE_PIXMAP)
{ {
@ -857,9 +1050,23 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
pDstPriv = GETPIXPRIV(pDstPixmap); pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv)) if (XRDP_IS_OS(pDstPriv))
{ {
rdpup_switch_os_surface(pDstPriv->rdpindex); post_process = 1;
rdpup_get_pixmap_image_rect(pDstPixmap, &id); if (g_do_dirty_os)
got_id = 1; {
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 else
@ -869,12 +1076,14 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
pDstWnd = (WindowPtr)p; pDstWnd = (WindowPtr)p;
if (pDstWnd->viewable) if (pDstWnd->viewable)
{ {
post_process = 1;
rdpup_get_screen_image_rect(&id); rdpup_get_screen_image_rect(&id);
got_id = 1; got_id = 1;
LLOGLN(10, ("rdpComposite: screen"));
} }
} }
} }
if (!got_id) if (!post_process)
{ {
return; return;
} }
@ -888,19 +1097,27 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
RegionInit(&reg1, &box, 0); RegionInit(&reg1, &box, 0);
RegionInit(&reg2, NullBox, 0); RegionInit(&reg2, NullBox, 0);
RegionCopy(&reg2, pDst->clientClip); RegionCopy(&reg2, pDst->clientClip);
RegionTranslate(&reg2, p->x + pDst->clipOrigin.x, lx = p->x + pDst->clipOrigin.x;
p->y + pDst->clipOrigin.y); ly = p->y + pDst->clipOrigin.y;
RegionTranslate(&reg2, lx, ly);
RegionIntersect(&reg1, &reg1, &reg2); RegionIntersect(&reg1, &reg1, &reg2);
num_clips = REGION_NUM_RECTS(&reg1); if (dirty_type != 0)
if (num_clips > 0)
{ {
rdpup_begin_update(); draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
for (j = num_clips - 1; j >= 0; j--) }
else if (got_id)
{
num_clips = REGION_NUM_RECTS(&reg1);
if (num_clips > 0)
{ {
box = REGION_RECTS(&reg1)[j]; rdpup_begin_update();
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); for (j = num_clips - 1; j >= 0; j--)
{
box = REGION_RECTS(&reg1)[j];
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
}
rdpup_end_update();
} }
rdpup_end_update();
} }
RegionUninit(&reg1); RegionUninit(&reg1);
RegionUninit(&reg2); RegionUninit(&reg2);
@ -911,11 +1128,23 @@ rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
box.y1 = p->y + yDst; box.y1 = p->y + yDst;
box.x2 = box.x1 + width; box.x2 = box.x1 + width;
box.y2 = box.y1 + height; box.y2 = box.y1 + height;
rdpup_begin_update(); if (dirty_type != 0)
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); {
rdpup_end_update(); RegionInit(&reg1, &box, 0);
draw_item_add_img_region(pDirtyPriv, &reg1, dirty_type);
RegionUninit(&reg1);
}
else if (got_id)
{
rdpup_begin_update();
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
rdpup_end_update();
}
}
if (reset_surface)
{
rdpup_switch_os_surface(-1);
} }
rdpup_switch_os_surface(-1);
} }
/******************************************************************************/ /******************************************************************************/
@ -931,6 +1160,7 @@ rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
LLOGLN(10, ("rdpGlyphs:")); LLOGLN(10, ("rdpGlyphs:"));
LLOGLN(10, ("rdpGlyphs: nlists %d len %d", nlists, lists->len)); LLOGLN(10, ("rdpGlyphs: nlists %d len %d", nlists, lists->len));
rdpup_set_hints(1, 1); rdpup_set_hints(1, 1);
g_doing_font = 1;
for (index = 0; index < lists->len; index++) for (index = 0; index < lists->len; index++)
{ {
LLOGLN(10, (" index %d size %d refcnt %d width %d height %d", LLOGLN(10, (" index %d size %d refcnt %d width %d height %d",
@ -943,5 +1173,6 @@ rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
nlists, lists, glyphs); nlists, lists, glyphs);
ps->Glyphs = rdpGlyphs; ps->Glyphs = rdpGlyphs;
rdpup_set_hints(0, 1); rdpup_set_hints(0, 1);
g_doing_font = 0;
LLOGLN(10, ("rdpGlyphs: out")); LLOGLN(10, ("rdpGlyphs: out"));
} }

@ -42,6 +42,7 @@ DevPrivateKeyRec g_rdpPixmapIndex;
DeviceIntPtr g_pointer = 0; DeviceIntPtr g_pointer = 0;
DeviceIntPtr g_keyboard = 0; DeviceIntPtr g_keyboard = 0;
int g_do_dirty_os = 1; /* delay remoting off screen bitmaps */
Bool g_wrapWindow = 1; Bool g_wrapWindow = 1;
Bool g_wrapPixmap = 1; Bool g_wrapPixmap = 1;

@ -1590,3 +1590,79 @@ rdpup_delete_window(WindowPtr pWindow, rdpWindowRec* priv)
out_uint32_le(g_out_s, pWindow->drawable.id); /* window_id */ out_uint32_le(g_out_s, pWindow->drawable.id); /* window_id */
} }
} }
/******************************************************************************/
int
rdpup_check_dirty(PixmapPtr pDirtyPixmap, rdpPixmapRec* pDirtyPriv)
{
int index;
int count;
BoxRec box;
struct image_data id;
struct rdp_draw_item* di;
if (pDirtyPriv == 0)
{
return 0;
}
if (pDirtyPriv->is_dirty == 0)
{
return 0;
}
/* update uses time / count */
g_os_bitmaps[pDirtyPriv->rdpindex].stamp = g_os_bitmap_stamp;
g_os_bitmap_stamp++;
LLOGLN(10, ("-----------------got dirty"));
rdpup_switch_os_surface(pDirtyPriv->rdpindex);
rdpup_get_pixmap_image_rect(pDirtyPixmap, &id);
rdpup_begin_update();
draw_item_pack(pDirtyPriv);
di = pDirtyPriv->draw_item_head;
while (di != 0)
{
LLOGLN(10, ("rdpup_check_dirty: type %d", di->type));
switch (di->type)
{
case RDI_FILL:
rdpup_set_fgcolor(di->fg_color);
rdpup_set_opcode(di->opcode);
count = REGION_NUM_RECTS(di->reg);
for (index = 0; index < count; index++)
{
box = REGION_RECTS(di->reg)[index];
LLOGLN(10, (" RDI_FILL %d %d %d %d", box.x1, box.y1, box.x2, box.y2));
rdpup_fill_rect(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
}
rdpup_set_opcode(GXcopy);
break;
case RDI_IMGLL:
rdpup_set_hints(1, 1);
count = REGION_NUM_RECTS(di->reg);
for (index = 0; index < count; index++)
{
box = REGION_RECTS(di->reg)[index];
LLOGLN(10, (" RDI_IMGLL %d %d %d %d", box.x1, box.y1, box.x2, box.y2));
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
}
rdpup_set_hints(0, 1);
break;
case RDI_IMGLY:
count = REGION_NUM_RECTS(di->reg);
for (index = 0; index < count; index++)
{
box = REGION_RECTS(di->reg)[index];
LLOGLN(10, (" RDI_IMGLY %d %d %d %d", box.x1, box.y1, box.x2, box.y2));
rdpup_send_area(&id, box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
}
break;
}
di = di->next;
}
draw_item_remove_all(pDirtyPriv);
rdpup_end_update();
pDirtyPriv->is_dirty = 0;
rdpup_switch_os_surface(-1);
return 0;
}

Loading…
Cancel
Save