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

@@ -486,7 +486,7 @@ static void vncHooksCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
screen_box.x2 = pScreen->width;
screen_box.y2 = pScreen->height;

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

dx = pWin->drawable.x - ptOldOrg.x;
dy = pWin->drawable.y - ptOldOrg.y;
@@ -526,7 +526,7 @@ static void vncHooksClearToBackground(WindowPtr pWin, int x, int y, int w,
box.x2 = w ? (box.x1 + w) : (pWin->drawable.x + pWin->drawable.width);
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);

(*pScreen->ClearToBackground) (pWin, x, y, w, h, generateExposures);
@@ -690,13 +690,13 @@ static void vncHooksComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
box.y1 = max(pDst->pDrawable->y + yDst, 0);
box.x2 = box.x1 + width;
box.y2 = box.y1 + height;
RegionInit(&changed, &box, 0);
RegionInitBoxes(&changed, &box, 1);

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

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

@@ -800,7 +800,7 @@ static void vncHooksGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
fbbox.y1 = 0;
fbbox.x2 = pScreen->width;
fbbox.y2 = pScreen->height;
RegionInit(&fbreg, &fbbox, 0);
RegionInitBoxes(&fbreg, &fbbox, 1);

RegionIntersect(changed, changed, &fbreg);

@@ -883,13 +883,13 @@ static void vncHooksTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
box.y1 += pDst->pDrawable->y;
box.x2 += pDst->pDrawable->x;
box.y2 += pDst->pDrawable->y;
RegionInit(&changed, &box, 0);
RegionInitBoxes(&changed, &box, 1);

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

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

@@ -948,13 +948,13 @@ static void vncHooksTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
box.y1 += pDst->pDrawable->y;
box.x2 += pDst->pDrawable->x;
box.y2 += pDst->pDrawable->y;
RegionInit(&changed, &box, 0);
RegionInitBoxes(&changed, &box, 1);

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

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

@@ -1006,13 +1006,13 @@ static void vncHooksTriStrip(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
box.y1 += pDst->pDrawable->y;
box.x2 += pDst->pDrawable->x;
box.y2 += pDst->pDrawable->y;
RegionInit(&changed, &box, 0);
RegionInitBoxes(&changed, &box, 1);

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

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

@@ -1064,13 +1064,13 @@ static void vncHooksTriFan(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
box.y1 += pDst->pDrawable->y;
box.x2 += pDst->pDrawable->x;
box.y2 += pDst->pDrawable->y;
RegionInit(&changed, &box, 0);
RegionInitBoxes(&changed, &box, 1);

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

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

@@ -1318,7 +1318,7 @@ static void vncHooksPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;

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

(*pGC->ops->PutImage) (pDrawable, pGC, depth, x, y, w, h, leftPad, format,
@@ -1356,7 +1356,7 @@ static RegionPtr vncHooksCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;

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

RegionIntersect(&dst, &dst, pGC->pCompositeClip);
@@ -1370,7 +1370,7 @@ static RegionPtr vncHooksCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;

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

if ((pSrc->type == DRAWABLE_WINDOW) &&
RegionNotEmpty(&((WindowPtr)pSrc)->clipList)) {
@@ -1426,7 +1426,7 @@ static RegionPtr vncHooksCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;

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

ret = (*pGC->ops->CopyPlane) (pSrc, pDst, pGC, srcx, srcy, w, h,
@@ -1490,7 +1490,7 @@ static void vncHooksPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
box.x2 = maxX + 1 + pDrawable->x;
box.y2 = maxY + 1 + pDrawable->y;

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

(*pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, pts);
@@ -1929,7 +1929,7 @@ static void vncHooksFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape,
box.x2 = maxX + 1 + pDrawable->x;
box.y2 = maxY + 1 + pDrawable->y;

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

(*pGC->ops->FillPolygon) (pDrawable, pGC, shape, mode, count, pts);
@@ -2121,7 +2121,7 @@ static int vncHooksPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y,

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

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

ret = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars);
@@ -2155,7 +2155,7 @@ static int vncHooksPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y,

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

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

ret = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars);
@@ -2188,7 +2188,7 @@ static void vncHooksImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y,

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

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

(*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars);
@@ -2219,7 +2219,7 @@ static void vncHooksImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y,

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

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

(*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars);
@@ -2251,7 +2251,7 @@ static void vncHooksImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x,

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

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

(*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
@@ -2283,7 +2283,7 @@ static void vncHooksPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x,

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

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

(*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
@@ -2313,7 +2313,7 @@ static void vncHooksPushPixels(GCPtr pGC, PixmapPtr pBitMap,
box.x2 = box.x1 + w;
box.y2 = box.y1 + h;

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

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

Loading…
Cancel
Save