diff options
Diffstat (limited to 'xorg/X11R7.6/rdp/rdpPolyPoint.c')
-rw-r--r-- | xorg/X11R7.6/rdp/rdpPolyPoint.c | 422 |
1 files changed, 224 insertions, 198 deletions
diff --git a/xorg/X11R7.6/rdp/rdpPolyPoint.c b/xorg/X11R7.6/rdp/rdpPolyPoint.c index 48a993a0..7c65b602 100644 --- a/xorg/X11R7.6/rdp/rdpPolyPoint.c +++ b/xorg/X11R7.6/rdp/rdpPolyPoint.c @@ -26,9 +26,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define LOG_LEVEL 1 #define LLOG(_level, _args) \ - do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0) + do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0) #define LLOGLN(_level, _args) \ - do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */ extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */ @@ -50,12 +50,12 @@ void rdpPolyPointOrg(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr in_pts) { - rdpGCPtr priv; - GCFuncs* oldFuncs; + rdpGCPtr priv; + GCFuncs *oldFuncs; - GC_OP_PROLOGUE(pGC); - pGC->ops->PolyPoint(pDrawable, pGC, mode, npt, in_pts); - GC_OP_EPILOGUE(pGC); + GC_OP_PROLOGUE(pGC); + pGC->ops->PolyPoint(pDrawable, pGC, mode, npt, in_pts); + GC_OP_EPILOGUE(pGC); } /******************************************************************************/ @@ -63,219 +63,245 @@ void rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr in_pts) { - RegionRec clip_reg; - RegionRec reg1; - RegionRec reg2; - int num_clips; - int cd; - int x; - int y; - int i; - int j; - int got_id; - int dirty_type; - int post_process; - int reset_surface; - BoxRec box; - BoxRec total_box; - DDXPointPtr pts; - DDXPointRec stack_pts[32]; - struct image_data id; - WindowPtr pDstWnd; - PixmapPtr pDstPixmap; - rdpPixmapRec* pDstPriv; - rdpPixmapRec* pDirtyPriv; - - LLOGLN(10, ("rdpPolyPoint:")); - LLOGLN(10, ("rdpPolyPoint: npt %d", npt)); - - if (npt > 32) - { - pts = (DDXPointPtr)g_malloc(sizeof(DDXPointRec) * npt, 0); - } - else - { - pts = stack_pts; - } - for (i = 0; i < npt; i++) - { - pts[i].x = pDrawable->x + in_pts[i].x; - pts[i].y = pDrawable->y + in_pts[i].y; - if (i == 0) + RegionRec clip_reg; + RegionRec reg1; + RegionRec reg2; + int num_clips; + int cd; + int x; + int y; + int i; + int j; + int got_id; + int dirty_type; + int post_process; + int reset_surface; + BoxRec box; + BoxRec total_box; + DDXPointPtr pts; + DDXPointRec stack_pts[32]; + struct image_data id; + WindowPtr pDstWnd; + PixmapPtr pDstPixmap; + rdpPixmapRec *pDstPriv; + rdpPixmapRec *pDirtyPriv; + + LLOGLN(10, ("rdpPolyPoint:")); + LLOGLN(10, ("rdpPolyPoint: npt %d", npt)); + + if (npt > 32) { - total_box.x1 = pts[0].x; - total_box.y1 = pts[0].y; - total_box.x2 = pts[0].x; - total_box.y2 = pts[0].y; + pts = (DDXPointPtr)g_malloc(sizeof(DDXPointRec) * npt, 0); } else { - if (pts[i].x < total_box.x1) - { - total_box.x1 = pts[i].x; - } - if (pts[i].y < total_box.y1) - { - total_box.y1 = pts[i].y; - } - if (pts[i].x > total_box.x2) - { - total_box.x2 = pts[i].x; - } - if (pts[i].y > total_box.y2) - { - total_box.y2 = pts[i].y; - } - } - /* todo, use this total_box */ - } - - /* do original call */ - rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts); - - dirty_type = 0; - pDirtyPriv = 0; - post_process = 0; - reset_surface = 0; - got_id = 0; - if (pDrawable->type == DRAWABLE_PIXMAP) - { - pDstPixmap = (PixmapPtr)pDrawable; - pDstPriv = GETPIXPRIV(pDstPixmap); - if (XRDP_IS_OS(pDstPriv)) - { - post_process = 1; - if (g_do_dirty_os) - { - LLOGLN(10, ("rdpPolyPoint: gettig dirty")); - pDstPriv->is_dirty = 1; - pDirtyPriv = pDstPriv; - dirty_type = RDI_IMGLL; - } - else - { - rdpup_switch_os_surface(pDstPriv->rdpindex); - reset_surface = 1; - rdpup_get_pixmap_image_rect(pDstPixmap, &id); - got_id = 1; - } + pts = stack_pts; } - } - else - { - if (pDrawable->type == DRAWABLE_WINDOW) + + for (i = 0; i < npt; i++) { - pDstWnd = (WindowPtr)pDrawable; - if (pDstWnd->viewable) - { - post_process = 1; - if (g_do_dirty_ons) + pts[i].x = pDrawable->x + in_pts[i].x; + pts[i].y = pDrawable->y + in_pts[i].y; + + if (i == 0) { - LLOGLN(0, ("rdpPolyPoint: gettig dirty")); - g_screenPriv.is_dirty = 1; - pDirtyPriv = &g_screenPriv; - dirty_type = RDI_IMGLL; + total_box.x1 = pts[0].x; + total_box.y1 = pts[0].y; + total_box.x2 = pts[0].x; + total_box.y2 = pts[0].y; } else { - rdpup_get_screen_image_rect(&id); - got_id = 1; + if (pts[i].x < total_box.x1) + { + total_box.x1 = pts[i].x; + } + + if (pts[i].y < total_box.y1) + { + total_box.y1 = pts[i].y; + } + + if (pts[i].x > total_box.x2) + { + total_box.x2 = pts[i].x; + } + + if (pts[i].y > total_box.y2) + { + total_box.y2 = pts[i].y; + } } - } + + /* todo, use this total_box */ } - } - if (!post_process) - { - return; - } - - RegionInit(&clip_reg, NullBox, 0); - cd = rdp_get_clip(&clip_reg, pDrawable, pGC); - if (cd == 1) - { - if (npt > 0) + + /* do original call */ + rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts); + + dirty_type = 0; + pDirtyPriv = 0; + post_process = 0; + reset_surface = 0; + got_id = 0; + + if (pDrawable->type == DRAWABLE_PIXMAP) { - if (dirty_type != 0) - { - RegionInit(®1, NullBox, 0); - for (i = 0; i < npt; i++) + pDstPixmap = (PixmapPtr)pDrawable; + pDstPriv = GETPIXPRIV(pDstPixmap); + + if (XRDP_IS_OS(pDstPriv)) { - box.x1 = pts[i].x; - box.y1 = pts[i].y; - box.x2 = box.x1 + 1; - box.y2 = box.y1 + 1; - RegionInit(®2, &box, 0); - RegionUnion(®1, ®1, ®2); - RegionUninit(®2); + post_process = 1; + + if (g_do_dirty_os) + { + LLOGLN(10, ("rdpPolyPoint: gettig dirty")); + pDstPriv->is_dirty = 1; + pDirtyPriv = pDstPriv; + dirty_type = RDI_IMGLL; + } + else + { + rdpup_switch_os_surface(pDstPriv->rdpindex); + reset_surface = 1; + rdpup_get_pixmap_image_rect(pDstPixmap, &id); + got_id = 1; + } } - draw_item_add_fill_region(pDirtyPriv, ®1, pGC->fgPixel, - pGC->alu); - RegionUninit(®1); - } - else if (got_id) - { - rdpup_begin_update(); - rdpup_set_fgcolor(pGC->fgPixel); - for (i = 0; i < npt; i++) + } + else + { + if (pDrawable->type == DRAWABLE_WINDOW) { - x = pts[i].x; - y = pts[i].y; - rdpup_fill_rect(x, y, 1, 1); + pDstWnd = (WindowPtr)pDrawable; + + if (pDstWnd->viewable) + { + post_process = 1; + + if (g_do_dirty_ons) + { + LLOGLN(0, ("rdpPolyPoint: gettig dirty")); + g_screenPriv.is_dirty = 1; + pDirtyPriv = &g_screenPriv; + dirty_type = RDI_IMGLL; + } + else + { + rdpup_get_screen_image_rect(&id); + got_id = 1; + } + } } - rdpup_end_update(); - } } - } - else if (cd == 2) - { - num_clips = REGION_NUM_RECTS(&clip_reg); - if (npt > 0 && num_clips > 0) + + if (!post_process) + { + return; + } + + RegionInit(&clip_reg, NullBox, 0); + cd = rdp_get_clip(&clip_reg, pDrawable, pGC); + + if (cd == 1) { - if (dirty_type != 0) - { - RegionInit(®1, NullBox, 0); - for (i = 0; i < npt; i++) + if (npt > 0) { - box.x1 = pts[i].x; - box.y1 = pts[i].y; - box.x2 = box.x1 + 1; - box.y2 = box.y1 + 1; - RegionInit(®2, &box, 0); - RegionUnion(®1, ®1, ®2); - RegionUninit(®2); + if (dirty_type != 0) + { + RegionInit(®1, NullBox, 0); + + for (i = 0; i < npt; i++) + { + box.x1 = pts[i].x; + box.y1 = pts[i].y; + box.x2 = box.x1 + 1; + box.y2 = box.y1 + 1; + RegionInit(®2, &box, 0); + RegionUnion(®1, ®1, ®2); + RegionUninit(®2); + } + + draw_item_add_fill_region(pDirtyPriv, ®1, pGC->fgPixel, + pGC->alu); + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_set_fgcolor(pGC->fgPixel); + + for (i = 0; i < npt; i++) + { + x = pts[i].x; + y = pts[i].y; + rdpup_fill_rect(x, y, 1, 1); + } + + rdpup_end_update(); + } } - RegionIntersect(®1, ®1, &clip_reg); - draw_item_add_fill_region(pDirtyPriv, ®1, pGC->fgPixel, - pGC->alu); - RegionUninit(®1); - } - else if (got_id) - { - rdpup_begin_update(); - rdpup_set_fgcolor(pGC->fgPixel); - for (j = num_clips - 1; j >= 0; j--) + } + else if (cd == 2) + { + num_clips = REGION_NUM_RECTS(&clip_reg); + + if (npt > 0 && num_clips > 0) { - box = REGION_RECTS(&clip_reg)[j]; - rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); - for (i = 0; i < npt; i++) - { - x = pts[i].x; - y = pts[i].y; - rdpup_fill_rect(x, y, 1, 1); - } + if (dirty_type != 0) + { + RegionInit(®1, NullBox, 0); + + for (i = 0; i < npt; i++) + { + box.x1 = pts[i].x; + box.y1 = pts[i].y; + box.x2 = box.x1 + 1; + box.y2 = box.y1 + 1; + RegionInit(®2, &box, 0); + RegionUnion(®1, ®1, ®2); + RegionUninit(®2); + } + + RegionIntersect(®1, ®1, &clip_reg); + draw_item_add_fill_region(pDirtyPriv, ®1, pGC->fgPixel, + pGC->alu); + RegionUninit(®1); + } + else if (got_id) + { + rdpup_begin_update(); + rdpup_set_fgcolor(pGC->fgPixel); + + for (j = num_clips - 1; j >= 0; j--) + { + box = REGION_RECTS(&clip_reg)[j]; + rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); + + for (i = 0; i < npt; i++) + { + x = pts[i].x; + y = pts[i].y; + rdpup_fill_rect(x, y, 1, 1); + } + } + + rdpup_reset_clip(); + rdpup_end_update(); + } } - rdpup_reset_clip(); - rdpup_end_update(); - } } - } - RegionUninit(&clip_reg); - if (pts != stack_pts) - { - g_free(pts); - } - if (reset_surface) - { - rdpup_switch_os_surface(-1); - } + + RegionUninit(&clip_reg); + + if (pts != stack_pts) + { + g_free(pts); + } + + if (reset_surface) + { + rdpup_switch_os_surface(-1); + } } |