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(®, &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(®, &clip_reg, ®); } /* do original call */ rdpPolyGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); if (cd != XRDP_CD_NODRAW) { rdpClientConAddAllReg(dev, ®, pDrawable); } rdpRegionUninit(&clip_reg); rdpRegionUninit(®); }
Bool rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight) { WindowPtr root; PixmapPtr screenPixmap; BoxRec box; rdpPtr dev; LLOGLN(0, ("rdpRRScreenSetSize: width %d height %d mmWidth %d mmHeight %d", width, height, (int)mmWidth, (int)mmHeight)); dev = rdpGetDevFromScreen(pScreen); root = rdpGetRootWindowPtr(pScreen); if ((width < 1) || (height < 1)) { LLOGLN(10, (" error width %d height %d", width, height)); return FALSE; } dev->width = width; dev->height = height; dev->paddedWidthInBytes = PixmapBytePad(dev->width, dev->depth); dev->sizeInBytes = dev->paddedWidthInBytes * dev->height; pScreen->width = width; pScreen->height = height; pScreen->mmWidth = mmWidth; pScreen->mmHeight = mmHeight; screenPixmap = pScreen->GetScreenPixmap(pScreen); g_free(dev->pfbMemory_alloc); dev->pfbMemory_alloc = (char *) g_malloc(dev->sizeInBytes + 16, 1); dev->pfbMemory = (char *) RDPALIGN(dev->pfbMemory_alloc, 16); if (screenPixmap != 0) { pScreen->ModifyPixmapHeader(screenPixmap, width, height, -1, -1, dev->paddedWidthInBytes, dev->pfbMemory); } box.x1 = 0; box.y1 = 0; box.x2 = width; box.y2 = height; rdpRegionInit(&root->winSize, &box, 1); rdpRegionInit(&root->borderSize, &box, 1); rdpRegionReset(&root->borderClip, &box); rdpRegionBreak(&root->clipList); root->drawable.width = width; root->drawable.height = height; ResizeChildrenWinSize(root, 0, 0, 0, 0); RRGetInfo(pScreen, 1); LLOGLN(0, (" screen resized to %dx%d", pScreen->width, pScreen->height)); RRScreenSizeNotify(pScreen); #if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1, 13, 0, 0, 0) xf86EnableDisableFBAccess(pScreen->myNum, FALSE); xf86EnableDisableFBAccess(pScreen->myNum, TRUE); #else xf86EnableDisableFBAccess(xf86Screens[pScreen->myNum], FALSE); xf86EnableDisableFBAccess(xf86Screens[pScreen->myNum], TRUE); #endif return TRUE; }
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(®, &box, 0); if (pDst->pCompositeClip != NULL) { rdpRegionIntersect(®, pDst->pCompositeClip, ®); } ps = GetPictureScreen(pScreen); /* do original call */ rdpCompositeOrg(ps, dev, op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); rdpClientConAddAllReg(dev, ®, pDst->pDrawable); rdpRegionUninit(®); }
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(®, &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(®, &clip_reg, ®); } /* do original call */ rdpPutImageOrg(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits); if (cd != XRDP_CD_NODRAW) { rdpClientConAddAllReg(dev, ®, pDst); } rdpRegionUninit(&clip_reg); rdpRegionUninit(®); }
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(®, &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(®, &clip_reg, ®); } /* do original call */ rv = rdpPolyText16Org(pDrawable, pGC, x, y, count, chars); if (cd != XRDP_CD_NODRAW) { rdpClientConAddAllReg(dev, ®, pDrawable); } rdpRegionUninit(&clip_reg); rdpRegionUninit(®); return rv; }
Bool rdpRRGetPanning(ScreenPtr pScreen, RRCrtcPtr crtc, BoxPtr totalArea, BoxPtr trackingArea, INT16 *border) { rdpPtr dev; LLOGLN(0, ("rdpRRGetPanning: %p", crtc)); dev = rdpGetDevFromScreen(pScreen); if (totalArea != 0) { totalArea->x1 = 0; totalArea->y1 = 0; totalArea->x2 = dev->width; totalArea->y2 = dev->height; } if (trackingArea != 0) { trackingArea->x1 = 0; trackingArea->y1 = 0; trackingArea->x2 = dev->width; trackingArea->y2 = dev->height; } if (border != 0) { border[0] = 0; border[1] = 0; border[2] = 0; border[3] = 0; } return TRUE; }
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(®, NullBox, 0); rdpRegionCopy(®, 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(®); 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(®); box1 = *box; box1.x1 += dx; box1.y1 += dy; box1.x2 += dx; box1.y2 += dy; rdpClientConAddAllBox(dev, &box1, &(pWin->drawable)); } else { rdpRegionTranslate(®, dx, dy); rdpRegionIntersect(®, ®, &clip); rdpClientConAddAllReg(dev, ®, &(pWin->drawable)); } } rdpRegionUninit(®); rdpRegionUninit(&clip); }
Bool rdpCloseScreen(ScreenPtr pScreen) { rdpPtr dev; Bool rv; LLOGLN(0, ("rdpCloseScreen:")); dev = rdpGetDevFromScreen(pScreen); dev->pScreen->CloseScreen = dev->CloseScreen; rv = dev->pScreen->CloseScreen(pScreen); dev->pScreen->CloseScreen = rdpCloseScreen; return rv; }
PixmapPtr rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth) { rdpPtr dev; PixmapPtr rv; LLOGLN(10, ("rdpCreatePixmap: width %d height %d depth %d", width, height, depth)); dev = rdpGetDevFromScreen(pScreen); pScreen->CreatePixmap = dev->CreatePixmap; rv = pScreen->CreatePixmap(pScreen, width, height, depth); pScreen->CreatePixmap = rdpCreatePixmap; return rv; }
Bool rdpRRGetInfo(ScreenPtr pScreen, Rotation *pRotations) { int width; int height; rdpPtr dev; LLOGLN(0, ("rdpRRGetInfo:")); dev = rdpGetDevFromScreen(pScreen); *pRotations = RR_Rotate_0; width = dev->width; height = dev->height; rdpRRRegisterSize(pScreen, width, height); return TRUE; }
Bool rdpDestroyPixmap(PixmapPtr pPixmap) { Bool rv; ScreenPtr pScreen; rdpPtr dev; LLOGLN(10, ("rdpDestroyPixmap: refcnt %d", pPixmap->refcnt)); pScreen = pPixmap->drawable.pScreen; dev = rdpGetDevFromScreen(pScreen); pScreen->DestroyPixmap = dev->DestroyPixmap; rv = pScreen->DestroyPixmap(pPixmap); pScreen->DestroyPixmap = rdpDestroyPixmap; return rv; }
Bool rdpRRGetPanning(ScreenPtr pScreen, RRCrtcPtr crtc, BoxPtr totalArea, BoxPtr trackingArea, INT16 *border) { rdpPtr dev; BoxRec totalAreaRect; BoxRec trackingAreaRect; LLOGLN(0, ("rdpRRGetPanning: %p", crtc)); if (!g_panning) { return FALSE; } dev = rdpGetDevFromScreen(pScreen); totalAreaRect.x1 = 0; totalAreaRect.y1 = 0; totalAreaRect.x2 = dev->width; totalAreaRect.y2 = dev->height; trackingAreaRect.x1 = 0; trackingAreaRect.y1 = 0; trackingAreaRect.x2 = dev->width; trackingAreaRect.y2 = dev->height; if (totalArea != 0) { *totalArea = totalAreaRect; } if (trackingArea != 0) { *trackingArea = trackingAreaRect; } if (border != 0) { border[0] = 0; border[1] = 0; border[2] = 0; border[3] = 0; } return TRUE; }
Bool rdpModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, pointer pPixData) { Bool rv; ScreenPtr pScreen; rdpPtr dev; LLOGLN(10, ("rdpModifyPixmapHeader:")); pScreen = pPixmap->drawable.pScreen; dev = rdpGetDevFromScreen(pScreen); pScreen->ModifyPixmapHeader = dev->ModifyPixmapHeader; rv = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, devKind, pPixData); pScreen->ModifyPixmapHeader = rdpModifyPixmapHeader; return rv; }
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(®, 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(®, &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(®, &clip_reg, ®); } /* do original call */ rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs); if (cd != XRDP_CD_NODRAW) { rdpClientConAddAllReg(dev, ®, pDrawable); } rdpRegionUninit(&clip_reg); rdpRegionUninit(®); }
void rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists, GlyphPtr *glyphs) { ScreenPtr pScreen; rdpPtr dev; PictureScreenPtr ps; LLOGLN(10, ("rdpGlyphs:")); pScreen = pDst->pDrawable->pScreen; dev = rdpGetDevFromScreen(pScreen); ps = GetPictureScreen(pScreen); rdpGlyphsOrg(ps, dev, op, pSrc, pDst, maskFormat, xSrc, ySrc, nlists, lists, glyphs); }
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(®, 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(®, &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(®, &clip_reg, ®); } /* do original call */ rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts); if (cd != XRDP_CD_NODRAW) { rdpClientConAddAllReg(dev, ®, pDrawable); } rdpRegionUninit(&clip_reg); rdpRegionUninit(®); }
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(®, &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(®, &clip_reg, ®); } /* do original call */ rv = rdpCopyPlaneOrg(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, bitPlane); if (cd != XRDP_CD_NODRAW) { rdpClientConAddAllReg(dev, ®, pDst); } rdpRegionUninit(&clip_reg); rdpRegionUninit(®); return rv; }
Bool rdpCreateGC(GCPtr pGC) { Bool rv; rdpPtr dev; ScreenPtr pScreen; rdpGCPtr priv; LLOGLN(10, ("rdpCreateGC:")); pScreen = pGC->pScreen; dev = rdpGetDevFromScreen(pScreen); priv = (rdpGCPtr)rdpGetGCPrivate(pGC, dev->privateKeyRecGC); pScreen->CreateGC = dev->CreateGC; rv = pScreen->CreateGC(pGC); if (rv) { priv->funcs = pGC->funcs; priv->ops = 0; pGC->funcs = &g_rdpGCFuncs; } pScreen->CreateGC = rdpCreateGC; return rv; }
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(®, 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(®, &box); /* left */ box.x1 = x1 - up; box.y1 = y1 - up; box.x2 = x1 + down; box.y2 = y2 + down; rdpRegionUnionRect(®, &box); /* right */ box.x1 = x2 - up; box.y1 = y1 - up; box.x2 = x2 + down; box.y2 = y2 + down; rdpRegionUnionRect(®, &box); /* bottom */ box.x1 = x1 - up; box.y1 = y2 - up; box.x2 = x2 + down; box.y2 = y2 + down; rdpRegionUnionRect(®, &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(®, &clip_reg, ®); } /* do original call */ rdpPolyRectangleOrg(pDrawable, pGC, nrects, rects); if (cd != XRDP_CD_NODRAW) { rdpClientConAddAllReg(dev, ®, pDrawable); } rdpRegionUninit(&clip_reg); rdpRegionUninit(®); }