int
rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC,
              int x, int y, int count, unsigned short *chars)
{
    int rv;
    rdpPtr dev;
    RegionRec clip_reg;
    RegionRec reg;
    int cd;
    BoxRec box;

    LLOGLN(10, ("rdpPolyText16:"));
    dev = rdpGetDevFromScreen(pGC->pScreen);
    dev->counts.rdpPolyText16CallCount++;
    GetTextBoundingBox(pDrawable, pGC->font, x, y, count, &box);
    rdpRegionInit(&reg, &box, 0);
    rdpRegionInit(&clip_reg, NullBox, 0);
    cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
    LLOGLN(10, ("rdpPolyText16: cd %d", cd));
    if (cd == XRDP_CD_CLIP)
    {
        rdpRegionIntersect(&reg, &clip_reg, &reg);
    }
    /* do original call */
    rv = rdpPolyText16Org(pDrawable, pGC, x, y, count, chars);
    if (cd != XRDP_CD_NODRAW)
    {
        rdpClientConAddAllReg(dev, &reg, pDrawable);
    }
    rdpRegionUninit(&clip_reg);
    rdpRegionUninit(&reg);
    return rv;
}
void
rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill,
                xRectangle *prectInit)
{
    rdpPtr dev;
    RegionRec clip_reg;
    RegionPtr reg;
    int cd;

    LLOGLN(10, ("rdpPolyFillRect:"));
    dev = rdpGetDevFromScreen(pGC->pScreen);
    dev->counts.rdpPolyFillRectCallCount++;
    /* make a copy of rects */
    reg = rdpRegionFromRects(nrectFill, prectInit, CT_NONE);
    rdpRegionTranslate(reg, pDrawable->x, pDrawable->y);
    rdpRegionInit(&clip_reg, NullBox, 0);
    cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
    LLOGLN(10, ("rdpPolyFillRect: cd %d", cd));
    if (cd == XRDP_CD_CLIP)
    {
        rdpRegionIntersect(reg, &clip_reg, reg);
    }
    /* do original call */
    rdpPolyFillRectOrg(pDrawable, pGC, nrectFill, prectInit);
    if (cd != XRDP_CD_NODRAW)
    {
        rdpClientConAddAllReg(dev, reg, pDrawable);
    }
    rdpRegionUninit(&clip_reg);
    rdpRegionDestroy(reg);
}
void
rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC,
                int x, int y, unsigned int nglyph,
                CharInfoPtr *ppci, pointer pglyphBase)
{
    rdpPtr dev;
    RegionRec clip_reg;
    RegionRec reg;
    int cd;
    BoxRec box;

    LLOGLN(0, ("rdpPolyGlyphBlt:"));
    dev = rdpGetDevFromScreen(pGC->pScreen);
    dev->counts.rdpPolyGlyphBltCallCount++;
    GetTextBoundingBox(pDrawable, pGC->font, x, y, nglyph, &box);
    rdpRegionInit(&reg, &box, 0);
    rdpRegionInit(&clip_reg, NullBox, 0);
    cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
    LLOGLN(10, ("rdpPolyGlyphBlt: cd %d", cd));
    if (cd == XRDP_CD_CLIP)
    {
        rdpRegionIntersect(&reg, &clip_reg, &reg);
    }
    /* do original call */
    rdpPolyGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
    if (cd != XRDP_CD_NODRAW)
    {
        rdpClientConAddAllReg(dev, &reg, pDrawable);
    }
    rdpRegionUninit(&clip_reg);
    rdpRegionUninit(&reg);
}
Exemple #4
0
void
rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y,
            int w, int h, int leftPad, int format, char *pBits)
{
    rdpPtr dev;
    RegionRec clip_reg;
    RegionRec reg;
    int cd;
    BoxRec box;

    LLOGLN(10, ("rdpPutImage:"));
    dev = rdpGetDevFromScreen(pGC->pScreen);
    dev->counts.rdpPutImageCallCount++;
    box.x1 = x + pDst->x;
    box.y1 = y + pDst->y;
    box.x2 = box.x1 + w;
    box.y2 = box.y1 + h;
    rdpRegionInit(&reg, &box, 0);
    rdpRegionInit(&clip_reg, NullBox, 0);
    cd = rdpDrawGetClip(dev, &clip_reg, pDst, pGC);
    LLOGLN(10, ("rdpPutImage: cd %d", cd));
    if (cd == XRDP_CD_CLIP)
    {
        rdpRegionIntersect(&reg, &clip_reg, &reg);
    }
    /* do original call */
    rdpPutImageOrg(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits);
    if (cd != XRDP_CD_NODRAW)
    {
        rdpClientConAddAllReg(dev, &reg, pDst);
    }
    rdpRegionUninit(&clip_reg);
    rdpRegionUninit(&reg);
}
Exemple #5
0
void
rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
             INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst,
             INT16 yDst, CARD16 width, CARD16 height)
{
    ScreenPtr pScreen;
    rdpPtr dev;
    PictureScreenPtr ps;
    BoxRec box;
    RegionRec reg;

    LLOGLN(10, ("rdpComposite:"));
    pScreen = pDst->pDrawable->pScreen;
    dev = rdpGetDevFromScreen(pScreen);
    dev->counts.rdpCompositeCallCount++;
    box.x1 = xDst + pDst->pDrawable->x;
    box.y1 = yDst + pDst->pDrawable->y;
    box.x2 = box.x1 + width;
    box.y2 = box.y1 + height;
    rdpRegionInit(&reg, &box, 0);
    if (pDst->pCompositeClip != NULL)
    {
        rdpRegionIntersect(&reg, pDst->pCompositeClip, &reg);
    }
    ps = GetPictureScreen(pScreen);
    /* do original call */
    rdpCompositeOrg(ps, dev, op, pSrc, pMask, pDst, xSrc, ySrc,
                    xMask, yMask, xDst, yDst, width, height);
    rdpClientConAddAllReg(dev, &reg, pDst->pDrawable);
    rdpRegionUninit(&reg);
}
Exemple #6
0
void
rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion)
{
    ScreenPtr pScreen;
    rdpPtr dev;
    RegionRec reg;
    RegionRec clip;
    int dx;
    int dy;
    int num_clip_rects;
    int num_reg_rects;
    BoxPtr box;
    BoxRec box1;

    LLOGLN(10, ("rdpCopyWindow:"));
    pScreen = pWin->drawable.pScreen;
    dev = rdpGetDevFromScreen(pScreen);
    dev->counts.rdpCopyWindowCallCount++;

    rdpRegionInit(&reg, NullBox, 0);
    rdpRegionCopy(&reg, pOldRegion);
    rdpRegionInit(&clip, NullBox, 0);
    rdpRegionCopy(&clip, &pWin->borderClip);
    dx = pWin->drawable.x - ptOldOrg.x;
    dy = pWin->drawable.y - ptOldOrg.y;

    dev->pScreen->CopyWindow = dev->CopyWindow;
    dev->pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion);
    dev->pScreen->CopyWindow = rdpCopyWindow;

    num_clip_rects = REGION_NUM_RECTS(&clip);
    num_reg_rects = REGION_NUM_RECTS(&reg);

    if ((num_clip_rects == 0) || (num_reg_rects == 0))
    {
    }
    else
    {
        if ((num_clip_rects > 16) || (num_reg_rects > 16))
        {
            LLOGLN(10, ("rdpCopyWindow: big list"));
            box = rdpRegionExtents(&reg);
            box1 = *box;
            box1.x1 += dx;
            box1.y1 += dy;
            box1.x2 += dx;
            box1.y2 += dy;
            rdpClientConAddAllBox(dev, &box1, &(pWin->drawable));
        }
        else
        {
            rdpRegionTranslate(&reg, dx, dy);
            rdpRegionIntersect(&reg, &reg, &clip);
            rdpClientConAddAllReg(dev, &reg, &(pWin->drawable));
        }
    }
    rdpRegionUninit(&reg);
    rdpRegionUninit(&clip);
}
void
rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
{
    rdpPtr dev;
    RegionRec clip_reg;
    RegionRec reg;
    int cd;
    int index;
    int x1;
    int y1;
    int x2;
    int y2;
    BoxRec box;

    LLOGLN(10, ("rdpPolySegment:"));
    dev = rdpGetDevFromScreen(pGC->pScreen);
    dev->counts.rdpPolySegmentCallCount++;
    rdpRegionInit(&reg, NullBox, 0);
    for (index = 0; index < nseg; index++)
    {
        x1 = pSegs[index].x1 + pDrawable->x;
        y1 = pSegs[index].y1 + pDrawable->y;
        x2 = pSegs[index].x2 + pDrawable->x;
        y2 = pSegs[index].y2 + pDrawable->y;
        box.x1 = RDPMIN(x1, x2);
        box.y1 = RDPMIN(y1, y2);
        box.x2 = RDPMAX(x1, x2) + 1;
        box.y2 = RDPMAX(y1, y2) + 1;
        rdpRegionUnionRect(&reg, &box);
    }
    rdpRegionInit(&clip_reg, NullBox, 0);
    cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
    LLOGLN(10, ("rdpPolySegment: cd %d", cd));
    if (cd == XRDP_CD_CLIP)
    {
        rdpRegionIntersect(&reg, &clip_reg, &reg);
    }
    /* do original call */
    rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs);
    if (cd != XRDP_CD_NODRAW)
    {
        rdpClientConAddAllReg(dev, &reg, pDrawable);
    }
    rdpRegionUninit(&clip_reg);
    rdpRegionUninit(&reg);
}
Exemple #8
0
void
rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
             int npt, DDXPointPtr in_pts)
{
    rdpPtr dev;
    RegionRec clip_reg;
    RegionRec reg;
    int cd;
    int index;
    BoxRec box;

    LLOGLN(10, ("rdpPolyPoint:"));
    dev = rdpGetDevFromScreen(pGC->pScreen);
    dev->counts.rdpPolyPointCallCount++;
    rdpRegionInit(&reg, NullBox, 0);
    for (index = 0; index < npt; index++)
    {
        box.x1 = in_pts[index].x + pDrawable->x;
        box.y1 = in_pts[index].y + pDrawable->y;
        box.x2 = box.x1 + 1;
        box.y2 = box.y1 + 1;
        rdpRegionUnionRect(&reg, &box);
    }
    rdpRegionInit(&clip_reg, NullBox, 0);
    cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
    LLOGLN(10, ("rdpPolyPoint: cd %d", cd));
    if (cd == XRDP_CD_CLIP)
    {
        rdpRegionIntersect(&reg, &clip_reg, &reg);
    }
    /* do original call */
    rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts);
    if (cd != XRDP_CD_NODRAW)
    {
        rdpClientConAddAllReg(dev, &reg, pDrawable);
    }
    rdpRegionUninit(&clip_reg);
    rdpRegionUninit(&reg);
}
Exemple #9
0
RegionPtr
rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
             GCPtr pGC, int srcx, int srcy, int w, int h,
             int dstx, int dsty, unsigned long bitPlane)
{
    RegionPtr rv;
    rdpPtr dev;
    RegionRec clip_reg;
    RegionRec reg;
    int cd;
    BoxRec box;

    LLOGLN(10, ("rdpCopyPlane:"));
    dev = rdpGetDevFromScreen(pGC->pScreen);
    dev->counts.rdpCopyPlaneCallCount++;
    box.x1 = pDst->x + dstx;
    box.y1 = pDst->y + dsty;
    box.x2 = box.x1 + w;
    box.y2 = box.x1 + h;
    rdpRegionInit(&reg, &box, 0);
    rdpRegionInit(&clip_reg, NullBox, 0);
    cd = rdpDrawGetClip(dev, &clip_reg, pDst, pGC);
    LLOGLN(10, ("rdpCopyPlane: cd %d", cd));
    if (cd == XRDP_CD_CLIP)
    {
        rdpRegionIntersect(&reg, &clip_reg, &reg);
    }
    /* do original call */
    rv = rdpCopyPlaneOrg(pSrc, pDst, pGC, srcx, srcy, w, h,
                         dstx, dsty, bitPlane);
    if (cd != XRDP_CD_NODRAW)
    {
        rdpClientConAddAllReg(dev, &reg, pDst);
    }
    rdpRegionUninit(&clip_reg);
    rdpRegionUninit(&reg);
    return rv;
}
Exemple #10
0
/* return 2, draw using clip */
int
rdpDrawGetClip(rdpPtr dev, RegionPtr pRegion, DrawablePtr pDrawable, GCPtr pGC)
{
    WindowPtr pWindow;
    RegionPtr temp;
    BoxRec box;
    int rv;

    rv = 0;

    if (pDrawable->type == DRAWABLE_PIXMAP)
    {
        if (is_clientClip_region(pGC))
        {
            miComputeCompositeClip(pGC, pDrawable);
            RegionCopy(pRegion, pGC->pCompositeClip);
            rv = 2;
        }
        else
        {
            rv = 1;
        }

        if (rv == 2) /* check if the clip is the entire pixmap */
        {
            box.x1 = 0;
            box.y1 = 0;
            box.x2 = pDrawable->width;
            box.y2 = pDrawable->height;

            if (rdpRegionContainsRect(pRegion, &box) == rgnIN)
            {
                rv = 1;
            }
        }
    }
    else if (pDrawable->type == DRAWABLE_WINDOW)
    {
        pWindow = (WindowPtr)pDrawable;

        if (pWindow->viewable)
        {
            if (pGC->subWindowMode == IncludeInferiors)
            {
                temp = &pWindow->borderClip;
            }
            else
            {
                temp = &pWindow->clipList;
            }

            if (rdpRegionNotEmpty(temp))
            {
                if (is_clientClip_region(pGC))
                {
                    rdpRegionCopy(pRegion, pGC->clientClip);
                    rdpRegionTranslate(pRegion,
                                       pDrawable->x + pGC->clipOrg.x,
                                       pDrawable->y + pGC->clipOrg.y);
                    rdpRegionIntersect(pRegion, pRegion, temp);
                    rv = 2;
                }
                else
                {
                    rdpRegionCopy(pRegion, temp);
                    rv = 2;
                }

                if (rv == 2) /* check if the clip is the entire screen */
                {
                    box.x1 = 0;
                    box.y1 = 0;
                    box.x2 = dev->width;
                    box.y2 = dev->height;

                    if (rdpRegionContainsRect(pRegion, &box) == rgnIN)
                    {
                        rv = 1;
                    }
                }
            }
        }
    }

    return rv;
}
Exemple #11
0
/* return 2, draw using clip */
int
rdpDrawGetClip(rdpPtr dev, RegionPtr pRegion, DrawablePtr pDrawable, GCPtr pGC)
{
    WindowPtr pWindow;
    RegionPtr temp;
    BoxRec box;
    int rv;

    rv = 0;

    if (pDrawable->type == DRAWABLE_PIXMAP)
    {
        switch (pGC->clientClipType)
        {
            case CT_NONE:
                rv = 1;
                break;
            case CT_REGION:
                rv = 2;
                rdpRegionCopy(pRegion, pGC->clientClip);
                break;
            default:
                LLOGLN(0, ("rdpDrawGetClip: unimp clip type %d",
                       pGC->clientClipType));
                break;
        }

        if (rv == 2) /* check if the clip is the entire pixmap */
        {
            box.x1 = 0;
            box.y1 = 0;
            box.x2 = pDrawable->width;
            box.y2 = pDrawable->height;

            if (rdpRegionContainsRect(pRegion, &box) == rgnIN)
            {
                rv = 1;
            }
        }
    }
    else if (pDrawable->type == DRAWABLE_WINDOW)
    {
        pWindow = (WindowPtr)pDrawable;

        if (pWindow->viewable)
        {
            if (pGC->subWindowMode == IncludeInferiors)
            {
                temp = &pWindow->borderClip;
            }
            else
            {
                temp = &pWindow->clipList;
            }

            if (rdpRegionNotEmpty(temp))
            {
                switch (pGC->clientClipType)
                {
                    case CT_NONE:
                        rv = 2;
                        rdpRegionCopy(pRegion, temp);
                        break;
                    case CT_REGION:
                        rv = 2;
                        rdpRegionCopy(pRegion, pGC->clientClip);
                        rdpRegionTranslate(pRegion,
                                           pDrawable->x + pGC->clipOrg.x,
                                           pDrawable->y + pGC->clipOrg.y);
                        rdpRegionIntersect(pRegion, pRegion, temp);
                        break;
                    default:
                        LLOGLN(0, ("rdpDrawGetClip: unimp clip type %d",
                               pGC->clientClipType));
                        break;
                }

                if (rv == 2) /* check if the clip is the entire screen */
                {
                    box.x1 = 0;
                    box.y1 = 0;
                    box.x2 = dev->width;
                    box.y2 = dev->height;

                    if (rdpRegionContainsRect(pRegion, &box) == rgnIN)
                    {
                        rv = 1;
                    }
                }
            }
        }
    }

    return rv;
}
Exemple #12
0
void
rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects,
                 xRectangle *rects)
{
    rdpPtr dev;
    BoxRec box;
    int index;
    int up;
    int down;
    int lw;
    int cd;
    int x1;
    int y1;
    int x2;
    int y2;
    RegionRec clip_reg;
    RegionRec reg;

    LLOGLN(10, ("rdpPolyRectangle:"));
    dev = rdpGetDevFromScreen(pGC->pScreen);
    dev->counts.rdpPolyRectangleCallCount++;
    rdpRegionInit(&reg, NullBox, 0);
    lw = pGC->lineWidth;
    if (lw < 1)
    {
        lw = 1;
    }
    up = lw / 2;
    down = 1 + (lw - 1) / 2;
    index = 0;
    while (index < nrects)
    {
        x1 = rects[index].x + pDrawable->x;
        y1 = rects[index].y + pDrawable->y;
        x2 = x1 + rects[index].width;
        y2 = y1 + rects[index].height;
        /* top */
        box.x1 = x1 - up;
        box.y1 = y1 - up;
        box.x2 = x2 + down;
        box.y2 = y1 + down;
        rdpRegionUnionRect(&reg, &box);
        /* left */
        box.x1 = x1 - up;
        box.y1 = y1 - up;
        box.x2 = x1 + down;
        box.y2 = y2 + down;
        rdpRegionUnionRect(&reg, &box);
        /* right */
        box.x1 = x2 - up;
        box.y1 = y1 - up;
        box.x2 = x2 + down;
        box.y2 = y2 + down;
        rdpRegionUnionRect(&reg, &box);
        /* bottom */
        box.x1 = x1 - up;
        box.y1 = y2 - up;
        box.x2 = x2 + down;
        box.y2 = y2 + down;
        rdpRegionUnionRect(&reg, &box);
        index++;
    }
    rdpRegionInit(&clip_reg, NullBox, 0);
    cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
    LLOGLN(10, ("rdpPolyRectangle: cd %d", cd));
    if (cd == XRDP_CD_CLIP)
    {
        rdpRegionIntersect(&reg, &clip_reg, &reg);
    }
    /* do original call */
    rdpPolyRectangleOrg(pDrawable, pGC, nrects, rects);
    if (cd != XRDP_CD_NODRAW)
    {
        rdpClientConAddAllReg(dev, &reg, pDrawable);
    }
    rdpRegionUninit(&clip_reg);
    rdpRegionUninit(&reg);
}