Browse Source

Avoid using RegionInit() because of empty rects

It creates an invalid region if given an empty rect. Fortunately
RegionInitBoxes() handles that just fine, so use that instead.
tags/v1.10.90
Pierre Ossman 4 years ago
parent
commit
d4a1074ff7
1 changed files with 26 additions and 26 deletions
  1. 26
    26
      unix/xserver/hw/vnc/vncHooks.c

+ 26
- 26
unix/xserver/hw/vnc/vncHooks.c View File

screen_box.x2 = pScreen->width; screen_box.x2 = pScreen->width;
screen_box.y2 = pScreen->height; screen_box.y2 = pScreen->height;


RegionInit(&screen_rgn, &screen_box, 1);
RegionInitBoxes(&screen_rgn, &screen_box, 1);


dx = pWin->drawable.x - ptOldOrg.x; dx = pWin->drawable.x - ptOldOrg.x;
dy = pWin->drawable.y - ptOldOrg.y; dy = pWin->drawable.y - ptOldOrg.y;
box.x2 = w ? (box.x1 + w) : (pWin->drawable.x + pWin->drawable.width); box.x2 = w ? (box.x1 + w) : (pWin->drawable.x + pWin->drawable.width);
box.y2 = h ? (box.y1 + h) : (pWin->drawable.y + pWin->drawable.height); box.y2 = h ? (box.y1 + h) : (pWin->drawable.y + pWin->drawable.height);


RegionInit(&reg, &box, 0);
RegionInitBoxes(&reg, &box, 1);
RegionIntersect(&reg, &reg, &pWin->clipList); RegionIntersect(&reg, &reg, &pWin->clipList);


(*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures); (*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures);
box.y1 = max(pDst->pDrawable->y + yDst, 0); box.y1 = max(pDst->pDrawable->y + yDst, 0);
box.x2 = box.x1 + width; box.x2 = box.x1 + width;
box.y2 = box.y1 + height; box.y2 = box.y1 + height;
RegionInit(&changed, &box, 0);
RegionInitBoxes(&changed, &box, 1);


box.x1 = 0; box.x1 = 0;
box.y1 = 0; box.y1 = 0;
box.x2 = pScreen->width; box.x2 = pScreen->width;
box.y2 = pScreen->height; box.y2 = pScreen->height;
RegionInit(&fbreg, &box, 0);
RegionInitBoxes(&fbreg, &box, 1);


RegionIntersect(&changed, &changed, &fbreg); RegionIntersect(&changed, &changed, &fbreg);


fbbox.y1 = 0; fbbox.y1 = 0;
fbbox.x2 = pScreen->width; fbbox.x2 = pScreen->width;
fbbox.y2 = pScreen->height; fbbox.y2 = pScreen->height;
RegionInit(&fbreg, &fbbox, 0);
RegionInitBoxes(&fbreg, &fbbox, 1);


RegionIntersect(changed, changed, &fbreg); RegionIntersect(changed, changed, &fbreg);


box.y1 += pDst->pDrawable->y; box.y1 += pDst->pDrawable->y;
box.x2 += pDst->pDrawable->x; box.x2 += pDst->pDrawable->x;
box.y2 += pDst->pDrawable->y; box.y2 += pDst->pDrawable->y;
RegionInit(&changed, &box, 0);
RegionInitBoxes(&changed, &box, 1);


box.x1 = 0; box.x1 = 0;
box.y1 = 0; box.y1 = 0;
box.x2 = pScreen->width; box.x2 = pScreen->width;
box.y2 = pScreen->height; box.y2 = pScreen->height;
RegionInit(&fbreg, &box, 0);
RegionInitBoxes(&fbreg, &box, 1);


RegionIntersect(&changed, &changed, &fbreg); RegionIntersect(&changed, &changed, &fbreg);


box.y1 += pDst->pDrawable->y; box.y1 += pDst->pDrawable->y;
box.x2 += pDst->pDrawable->x; box.x2 += pDst->pDrawable->x;
box.y2 += pDst->pDrawable->y; box.y2 += pDst->pDrawable->y;
RegionInit(&changed, &box, 0);
RegionInitBoxes(&changed, &box, 1);


box.x1 = 0; box.x1 = 0;
box.y1 = 0; box.y1 = 0;
box.x2 = pScreen->width; box.x2 = pScreen->width;
box.y2 = pScreen->height; box.y2 = pScreen->height;
RegionInit(&fbreg, &box, 0);
RegionInitBoxes(&fbreg, &box, 1);


RegionIntersect(&changed, &changed, &fbreg); RegionIntersect(&changed, &changed, &fbreg);


box.y1 += pDst->pDrawable->y; box.y1 += pDst->pDrawable->y;
box.x2 += pDst->pDrawable->x; box.x2 += pDst->pDrawable->x;
box.y2 += pDst->pDrawable->y; box.y2 += pDst->pDrawable->y;
RegionInit(&changed, &box, 0);
RegionInitBoxes(&changed, &box, 1);


box.x1 = 0; box.x1 = 0;
box.y1 = 0; box.y1 = 0;
box.x2 = pScreen->width; box.x2 = pScreen->width;
box.y2 = pScreen->height; box.y2 = pScreen->height;
RegionInit(&fbreg, &box, 0);
RegionInitBoxes(&fbreg, &box, 1);


RegionIntersect(&changed, &changed, &fbreg); RegionIntersect(&changed, &changed, &fbreg);


box.y1 += pDst->pDrawable->y; box.y1 += pDst->pDrawable->y;
box.x2 += pDst->pDrawable->x; box.x2 += pDst->pDrawable->x;
box.y2 += pDst->pDrawable->y; box.y2 += pDst->pDrawable->y;
RegionInit(&changed, &box, 0);
RegionInitBoxes(&changed, &box, 1);


box.x1 = 0; box.x1 = 0;
box.y1 = 0; box.y1 = 0;
box.x2 = pScreen->width; box.x2 = pScreen->width;
box.y2 = pScreen->height; box.y2 = pScreen->height;
RegionInit(&fbreg, &box, 0);
RegionInitBoxes(&fbreg, &box, 1);


RegionIntersect(&changed, &changed, &fbreg); RegionIntersect(&changed, &changed, &fbreg);


box.x2 = box.x1 + w; box.x2 = box.x1 + w;
box.y2 = box.y1 + h; box.y2 = box.y1 + h;


RegionInit(&reg, &box, 0);
RegionInitBoxes(&reg, &box, 1);
RegionIntersect(&reg, &reg, pGC->pCompositeClip); RegionIntersect(&reg, &reg, pGC->pCompositeClip);


(*pGC->ops->PutImage) (pDrawable, pGC, depth, x, y, w, h, leftPad, format, (*pGC->ops->PutImage) (pDrawable, pGC, depth, x, y, w, h, leftPad, format,
box.x2 = box.x1 + w; box.x2 = box.x1 + w;
box.y2 = box.y1 + h; box.y2 = box.y1 + h;


RegionInit(&dst, &box, 0);
RegionInitBoxes(&dst, &box, 1);
} }


RegionIntersect(&dst, &dst, pGC->pCompositeClip); RegionIntersect(&dst, &dst, pGC->pCompositeClip);
box.x2 = box.x1 + w; box.x2 = box.x1 + w;
box.y2 = box.y1 + h; box.y2 = box.y1 + h;


RegionInit(&src, &box, 0);
RegionInitBoxes(&src, &box, 1);


if ((pSrc->type == DRAWABLE_WINDOW) && if ((pSrc->type == DRAWABLE_WINDOW) &&
RegionNotEmpty(&((WindowPtr)pSrc)->clipList)) { RegionNotEmpty(&((WindowPtr)pSrc)->clipList)) {
box.x2 = box.x1 + w; box.x2 = box.x1 + w;
box.y2 = box.y1 + h; box.y2 = box.y1 + h;


RegionInit(&reg, &box, 0);
RegionInitBoxes(&reg, &box, 1);
RegionIntersect(&reg, &reg, pGC->pCompositeClip); RegionIntersect(&reg, &reg, pGC->pCompositeClip);


ret = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC, srcx, srcy, w, h, ret = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC, srcx, srcy, w, h,
box.x2 = maxX + 1 + pDrawable->x; box.x2 = maxX + 1 + pDrawable->x;
box.y2 = maxY + 1 + pDrawable->y; box.y2 = maxY + 1 + pDrawable->y;


RegionInit(&reg, &box, 0);
RegionInitBoxes(&reg, &box, 1);
RegionIntersect(&reg, &reg, pGC->pCompositeClip); RegionIntersect(&reg, &reg, pGC->pCompositeClip);


(*pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, pts); (*pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, pts);
box.x2 = maxX + 1 + pDrawable->x; box.x2 = maxX + 1 + pDrawable->x;
box.y2 = maxY + 1 + pDrawable->y; box.y2 = maxY + 1 + pDrawable->y;


RegionInit(&reg, &box, 0);
RegionInitBoxes(&reg, &box, 1);
RegionIntersect(&reg, &reg, pGC->pCompositeClip); RegionIntersect(&reg, &reg, pGC->pCompositeClip);


(*pGC->ops->FillPolygon) (pDrawable, pGC, shape, mode, count, pts); (*pGC->ops->FillPolygon) (pDrawable, pGC, shape, mode, count, pts);


GetTextBoundingRect(pDrawable, pGC->font, x, y, count, &box); GetTextBoundingRect(pDrawable, pGC->font, x, y, count, &box);


RegionInit(&reg, &box, 0);
RegionInitBoxes(&reg, &box, 1);
RegionIntersect(&reg, &reg, pGC->pCompositeClip); RegionIntersect(&reg, &reg, pGC->pCompositeClip);


ret = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars); ret = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars);


GetTextBoundingRect(pDrawable, pGC->font, x, y, count, &box); GetTextBoundingRect(pDrawable, pGC->font, x, y, count, &box);


RegionInit(&reg, &box, 0);
RegionInitBoxes(&reg, &box, 1);
RegionIntersect(&reg, &reg, pGC->pCompositeClip); RegionIntersect(&reg, &reg, pGC->pCompositeClip);


ret = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars); ret = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars);


GetTextBoundingRect(pDrawable, pGC->font, x, y, count, &box); GetTextBoundingRect(pDrawable, pGC->font, x, y, count, &box);


RegionInit(&reg, &box, 0);
RegionInitBoxes(&reg, &box, 1);
RegionIntersect(&reg, &reg, pGC->pCompositeClip); RegionIntersect(&reg, &reg, pGC->pCompositeClip);


(*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars); (*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars);


GetTextBoundingRect(pDrawable, pGC->font, x, y, count, &box); GetTextBoundingRect(pDrawable, pGC->font, x, y, count, &box);


RegionInit(&reg, &box, 0);
RegionInitBoxes(&reg, &box, 1);
RegionIntersect(&reg, &reg, pGC->pCompositeClip); RegionIntersect(&reg, &reg, pGC->pCompositeClip);


(*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars); (*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars);


GetTextBoundingRect(pDrawable, pGC->font, x, y, nglyph, &box); GetTextBoundingRect(pDrawable, pGC->font, x, y, nglyph, &box);


RegionInit(&reg, &box, 0);
RegionInitBoxes(&reg, &box, 1);
RegionIntersect(&reg, &reg, pGC->pCompositeClip); RegionIntersect(&reg, &reg, pGC->pCompositeClip);


(*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);


GetTextBoundingRect(pDrawable, pGC->font, x, y, nglyph, &box); GetTextBoundingRect(pDrawable, pGC->font, x, y, nglyph, &box);


RegionInit(&reg, &box, 0);
RegionInitBoxes(&reg, &box, 1);
RegionIntersect(&reg, &reg, pGC->pCompositeClip); RegionIntersect(&reg, &reg, pGC->pCompositeClip);


(*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
box.x2 = box.x1 + w; box.x2 = box.x1 + w;
box.y2 = box.y1 + h; box.y2 = box.y1 + h;


RegionInit(&reg, &box, 0);
RegionInitBoxes(&reg, &box, 1);
RegionIntersect(&reg, &reg, pGC->pCompositeClip); RegionIntersect(&reg, &reg, pGC->pCompositeClip);


(*pGC->ops->PushPixels) (pGC, pBitMap, pDrawable, w, h, x, y); (*pGC->ops->PushPixels) (pGC, pBitMap, pDrawable, w, h, x, y);

Loading…
Cancel
Save