summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xorg/X11R7.6/rdp/rdp.h2
-rw-r--r--xorg/X11R7.6/rdp/rdpCopyArea.c22
-rw-r--r--xorg/X11R7.6/rdp/rdpCopyPlane.c25
-rw-r--r--xorg/X11R7.6/rdp/rdpFillPolygon.c74
-rw-r--r--xorg/X11R7.6/rdp/rdpFillSpans.c2
-rw-r--r--xorg/X11R7.6/rdp/rdpPolyPoint.c36
-rw-r--r--xorg/X11R7.6/rdp/rdpPolySegment.c9
-rw-r--r--xorg/X11R7.6/rdp/rdpPolylines.c91
-rw-r--r--xorg/X11R7.6/rdp/rdpPushPixels.c4
-rw-r--r--xorg/X11R7.6/rdp/rdpSetSpans.c2
-rw-r--r--xorg/X11R7.6/rdp/rdpdraw.c6
-rw-r--r--xorg/X11R7.6/rdp/rdpmisc.c40
12 files changed, 196 insertions, 117 deletions
diff --git a/xorg/X11R7.6/rdp/rdp.h b/xorg/X11R7.6/rdp/rdp.h
index 00f121ac..695a2bde 100644
--- a/xorg/X11R7.6/rdp/rdp.h
+++ b/xorg/X11R7.6/rdp/rdp.h
@@ -311,6 +311,8 @@ int
g_chmod_hex(const char* filename, int flags);
void
hexdump(unsigned char *p, unsigned int len);
+void
+RegionAroundSegs(RegionPtr reg, xSegment* segs, int nseg);
/* rdpdraw.c */
Bool
diff --git a/xorg/X11R7.6/rdp/rdpCopyArea.c b/xorg/X11R7.6/rdp/rdpCopyArea.c
index 6e799a7c..d9958e92 100644
--- a/xorg/X11R7.6/rdp/rdpCopyArea.c
+++ b/xorg/X11R7.6/rdp/rdpCopyArea.c
@@ -346,6 +346,25 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
LLOGLN(10, ("rdpCopyArea:"));
+ if (pSrc->type == DRAWABLE_PIXMAP)
+ {
+ pSrcPixmap = (PixmapPtr)pSrc;
+ pSrcPriv = GETPIXPRIV(pSrcPixmap);
+ if (XRDP_IS_OS(pSrcPriv))
+ {
+ rdpup_check_dirty(pSrcPixmap, pSrcPriv);
+ }
+ }
+ if (pDst->type == DRAWABLE_PIXMAP)
+ {
+ pDstPixmap = (PixmapPtr)pDst;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+ if (XRDP_IS_OS(pDstPriv))
+ {
+ rdpup_check_dirty(pDstPixmap, pDstPriv);
+ }
+ }
+
if (pSrc->type == DRAWABLE_WINDOW)
{
pSrcWnd = (WindowPtr)pSrc;
@@ -373,7 +392,6 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
can_do_screen_blt = pGC->alu == GXcopy;
if (can_do_screen_blt)
{
- rdpup_check_dirty(pDstPixmap, pDstPriv);
return rdpCopyAreaWndToPixmap(pSrcWnd, pDstPixmap, pDstPriv, pGC,
srcx, srcy, w, h, dstx, dsty);
}
@@ -387,7 +405,6 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
pSrcPriv = GETPIXPRIV(pSrcPixmap);
if (XRDP_IS_OS(pSrcPriv))
{
- rdpup_check_dirty(pSrcPixmap, pSrcPriv);
if (pDst->type == DRAWABLE_WINDOW)
{
pDstWnd = (WindowPtr)pDst;
@@ -403,7 +420,6 @@ rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
pDstPriv = GETPIXPRIV(pDstPixmap);
if (XRDP_IS_OS(pDstPriv))
{
- rdpup_check_dirty(pDstPixmap, pDstPriv);
return rdpCopyAreaPixmapToPixmap(pSrcPixmap, pSrcPriv,
pDstPixmap, pDstPriv,
pGC, srcx, srcy, w, h,
diff --git a/xorg/X11R7.6/rdp/rdpCopyPlane.c b/xorg/X11R7.6/rdp/rdpCopyPlane.c
index 78b1c338..73f337cc 100644
--- a/xorg/X11R7.6/rdp/rdpCopyPlane.c
+++ b/xorg/X11R7.6/rdp/rdpCopyPlane.c
@@ -86,11 +86,34 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
+ PixmapPtr pSrcPixmap;
+ rdpPixmapRec* pSrcPriv;
+
LLOGLN(10, ("rdpCopyPlane:"));
+ if (pSrc->type == DRAWABLE_PIXMAP)
+ {
+ pSrcPixmap = (PixmapPtr)pSrc;
+ pSrcPriv = GETPIXPRIV(pSrcPixmap);
+ if (XRDP_IS_OS(pSrcPriv))
+ {
+ rdpup_check_dirty(pSrcPixmap, pSrcPriv);
+ }
+ }
+ if (pDst->type == DRAWABLE_PIXMAP)
+ {
+ pDstPixmap = (PixmapPtr)pDst;
+ pDstPriv = GETPIXPRIV(pDstPixmap);
+ if (XRDP_IS_OS(pDstPriv))
+ {
+ rdpup_check_dirty(pDstPixmap, pDstPriv);
+ }
+ }
+
/* do original call */
rv = rdpCopyPlaneOrg(pSrc, pDst, pGC, srcx, srcy, w, h,
dstx, dsty, bitPlane);
+
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
@@ -108,7 +131,7 @@ rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
LLOGLN(10, ("rdpCopyPlane: gettig dirty"));
pDstPriv->is_dirty = 1;
pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLY;
+ dirty_type = RDI_IMGLL;
}
else
{
diff --git a/xorg/X11R7.6/rdp/rdpFillPolygon.c b/xorg/X11R7.6/rdp/rdpFillPolygon.c
index 38216019..bf71c094 100644
--- a/xorg/X11R7.6/rdp/rdpFillPolygon.c
+++ b/xorg/X11R7.6/rdp/rdpFillPolygon.c
@@ -87,6 +87,41 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
LLOGLN(10, ("rdpFillPolygon:"));
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = 0;
+ box.y2 = 0;
+ if (count > 0)
+ {
+ maxx = pPts[0].x;
+ maxy = pPts[0].y;
+ minx = maxx;
+ miny = maxy;
+ for (i = 1; i < count; i++)
+ {
+ if (pPts[i].x > maxx)
+ {
+ maxx = pPts[i].x;
+ }
+ if (pPts[i].x < minx)
+ {
+ minx = pPts[i].x;
+ }
+ if (pPts[i].y > maxy)
+ {
+ maxy = pPts[i].y;
+ }
+ if (pPts[i].y < miny)
+ {
+ miny = pPts[i].y;
+ }
+ }
+ box.x1 = pDrawable->x + minx;
+ box.y1 = pDrawable->y + miny;
+ box.x2 = pDrawable->x + maxx + 1;
+ box.y2 = pDrawable->y + maxy + 1;
+ }
+
/* do original call */
rdpFillPolygonOrg(pDrawable, pGC, shape, mode, count, pPts);
@@ -107,7 +142,7 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
LLOGLN(10, ("rdpFillPolygon: gettig dirty"));
pDstPriv->is_dirty = 1;
pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLY;
+ dirty_type = RDI_IMGLL;
}
else
{
@@ -138,43 +173,6 @@ rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC,
RegionInit(&clip_reg, NullBox, 0);
cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
- if (cd != 0)
- {
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = 0;
- box.y2 = 0;
- if (count > 0)
- {
- maxx = pPts[0].x;
- maxy = pPts[0].y;
- minx = maxx;
- miny = maxy;
- for (i = 1; i < count; i++)
- {
- if (pPts[i].x > maxx)
- {
- maxx = pPts[i].x;
- }
- if (pPts[i].x < minx)
- {
- minx = pPts[i].x;
- }
- if (pPts[i].y > maxy)
- {
- maxy = pPts[i].y;
- }
- if (pPts[i].y < miny)
- {
- miny = pPts[i].y;
- }
- box.x1 = pDrawable->x + minx;
- box.y1 = pDrawable->y + miny;
- box.x2 = pDrawable->x + maxx + 1;
- box.y2 = pDrawable->y + maxy + 1;
- }
- }
- }
if (cd == 1)
{
if (dirty_type != 0)
diff --git a/xorg/X11R7.6/rdp/rdpFillSpans.c b/xorg/X11R7.6/rdp/rdpFillSpans.c
index 1f655d01..5c3dcc67 100644
--- a/xorg/X11R7.6/rdp/rdpFillSpans.c
+++ b/xorg/X11R7.6/rdp/rdpFillSpans.c
@@ -68,7 +68,7 @@ rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit,
PixmapPtr pDstPixmap;
rdpPixmapRec* pDstPriv;
- LLOGLN(0, ("rdpFillSpans: todo"));
+ LLOGLN(10, ("rdpFillSpans: todo"));
/* do original call */
rdpFillSpansOrg(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
diff --git a/xorg/X11R7.6/rdp/rdpPolyPoint.c b/xorg/X11R7.6/rdp/rdpPolyPoint.c
index 9e0a43de..cbbc4a98 100644
--- a/xorg/X11R7.6/rdp/rdpPolyPoint.c
+++ b/xorg/X11R7.6/rdp/rdpPolyPoint.c
@@ -62,6 +62,8 @@ 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;
@@ -83,6 +85,7 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
rdpPixmapRec* pDirtyPriv;
LLOGLN(10, ("rdpPolyPoint:"));
+ LLOGLN(10, ("rdpPolyPoint: npt %d", npt));
if (npt > 32)
{
@@ -145,7 +148,7 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
LLOGLN(10, ("rdpPolyPoint: gettig dirty"));
pDstPriv->is_dirty = 1;
pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLY;
+ dirty_type = RDI_IMGLL;
}
else
{
@@ -182,7 +185,20 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
{
if (dirty_type != 0)
{
- /* TODO */
+ RegionInit(&reg1, 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(&reg2, &box, 0);
+ RegionUnion(&reg1, &reg1, &reg2);
+ RegionUninit(&reg2);
+ }
+ draw_item_add_fill_region(pDirtyPriv, &reg1, pGC->fgPixel,
+ pGC->alu);
+ RegionUninit(&reg1);
}
else if (got_id)
{
@@ -205,7 +221,21 @@ rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
{
if (dirty_type != 0)
{
- /* TODO */
+ RegionInit(&reg1, 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(&reg2, &box, 0);
+ RegionUnion(&reg1, &reg1, &reg2);
+ RegionUninit(&reg2);
+ }
+ RegionIntersect(&reg1, &reg1, &clip_reg);
+ draw_item_add_fill_region(pDirtyPriv, &reg1, pGC->fgPixel,
+ pGC->alu);
+ RegionUninit(&reg1);
}
else if (got_id)
{
diff --git a/xorg/X11R7.6/rdp/rdpPolySegment.c b/xorg/X11R7.6/rdp/rdpPolySegment.c
index 466c6b8c..efab3cc0 100644
--- a/xorg/X11R7.6/rdp/rdpPolySegment.c
+++ b/xorg/X11R7.6/rdp/rdpPolySegment.c
@@ -55,10 +55,6 @@ rdpPolySegmentOrg(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
GC_OP_EPILOGUE(pGC);
}
-/* in rdpPolylines.c */
-void
-RegionAroundSegs(RegionPtr reg, xSegment* segs, int nsegs);
-
/******************************************************************************/
void
rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
@@ -79,7 +75,8 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
- LLOGLN(10, ("rdpPolySegment: %d", nseg));
+ LLOGLN(10, ("rdpPolySegment:"));
+ LLOGLN(10, (" nseg %d", nseg));
segs = 0;
if (nseg) /* get the rects */
@@ -114,7 +111,7 @@ rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
LLOGLN(10, ("rdpPolySegment: gettig dirty"));
pDstPriv->is_dirty = 1;
pDirtyPriv = pDstPriv;
- dirty_type = RDI_IMGLY;
+ dirty_type = RDI_IMGLL;
}
else
{
diff --git a/xorg/X11R7.6/rdp/rdpPolylines.c b/xorg/X11R7.6/rdp/rdpPolylines.c
index 60c29e0c..cbaf9c3e 100644
--- a/xorg/X11R7.6/rdp/rdpPolylines.c
+++ b/xorg/X11R7.6/rdp/rdpPolylines.c
@@ -58,46 +58,6 @@ rdpPolylinesOrg(DrawablePtr pDrawable, GCPtr pGC, int mode,
/******************************************************************************/
void
-RegionAroundSegs(RegionPtr reg, xSegment* segs, int nseg)
-{
- int index;
- BoxRec box;
- RegionRec treg;
-
- index = 0;
- while (index < nseg)
- {
- if (segs[index].x1 < segs[index].x2)
- {
- box.x1 = segs[index].x1;
- box.x2 = segs[index].x2;
- }
- else
- {
- box.x1 = segs[index].x2;
- box.x2 = segs[index].x1;
- }
- box.x2++;
- if (segs[index].y1 < segs[index].y2)
- {
- box.y1 = segs[index].y1;
- box.y2 = segs[index].y2;
- }
- else
- {
- box.y1 = segs[index].y2;
- box.y2 = segs[index].y1;
- }
- box.y2++;
- RegionInit(&treg, &box, 0);
- RegionUnion(reg, reg, &treg);
- RegionUninit(&treg);
- index++;
- }
-}
-
-/******************************************************************************/
-void
rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
int npt, DDXPointPtr pptInit)
{
@@ -119,46 +79,61 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
- LLOGLN(0, ("rdpPolylines:"));
-
+ LLOGLN(10, ("rdpPolylines:"));
+ LLOGLN(10, (" npt %d mode %d x %d y %d", npt, mode,
+ pDrawable->x, pDrawable->y));
+#if 0
+ LLOGLN(0, (" points"));
+ for (i = 0; i < npt; i++)
+ {
+ LLOGLN(0, (" %d %d", pptInit[i].x, pptInit[i].y));
+ }
+#endif
/* convert lines to line segments */
nseg = npt - 1;
segs = 0;
if (npt > 1)
{
- segs = (xSegment*)g_malloc(sizeof(xSegment) * npt - 1, 0);
+ segs = (xSegment*)g_malloc(sizeof(xSegment) * nseg, 0);
segs[0].x1 = pptInit[0].x + pDrawable->x;
segs[0].y1 = pptInit[0].y + pDrawable->y;
if (mode == CoordModeOrigin)
{
segs[0].x2 = pptInit[1].x + pDrawable->x;
segs[0].y2 = pptInit[1].y + pDrawable->y;
+ for (i = 2; i < npt; i++)
+ {
+ segs[i - 1].x1 = segs[i - 2].x2;
+ segs[i - 1].y1 = segs[i - 2].y2;
+ segs[i - 1].x2 = pptInit[i].x + pDrawable->x;
+ segs[i - 1].y2 = pptInit[i].y + pDrawable->y;
+ }
}
else
{
segs[0].x2 = segs[0].x1 + pptInit[1].x;
segs[0].y2 = segs[0].y1 + pptInit[1].y;
- }
- for (i = 2; i < npt; i++)
- {
- segs[i - 1].x1 = segs[i - 2].x2;
- segs[i - 1].y1 = segs[i - 2].y2;
- if (mode == CoordModeOrigin)
- {
- segs[i - 1].x2 = pptInit[i].x + pDrawable->x;
- segs[i - 1].y2 = pptInit[i].x + pDrawable->x;
- }
- else
+ for (i = 2; i < npt; i++)
{
- segs[i - 1].x2 = segs[i - 2].x2 + pptInit[i].x;
- segs[i - 1].y2 = segs[i - 2].y2 + pptInit[i].y;
+ segs[i - 1].x1 = segs[i - 2].x2;
+ segs[i - 1].y1 = segs[i - 2].y2;
+ segs[i - 1].x2 = segs[i - 1].x1 + pptInit[i].x;
+ segs[i - 1].y2 = segs[i - 1].y1 + pptInit[i].y;
}
}
}
else
{
- LLOGLN(10, ("rdpPolylines: weird npt [%d]", npt));
+ LLOGLN(0, ("rdpPolylines: weird npt [%d]", npt));
+ }
+#if 0
+ LLOGLN(0, (" segments"));
+ for (i = 0; i < nseg; i++)
+ {
+ LLOGLN(0, (" %d %d %d %d", segs[i].x1, segs[i].y1,
+ segs[i].x2, segs[i].y2));
}
+#endif
/* do original call */
rdpPolylinesOrg(pDrawable, pGC, mode, npt, pptInit);
@@ -180,7 +155,7 @@ rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode,
LLOGLN(10, ("rdpPolylines: gettig dirty"));
pDstPriv->is_dirty = 1;
pDirtyPriv = pDstPriv;
- dirty_type = RDI_LINE;
+ dirty_type = RDI_IMGLL;
}
else
{
diff --git a/xorg/X11R7.6/rdp/rdpPushPixels.c b/xorg/X11R7.6/rdp/rdpPushPixels.c
index 02f15fea..06c5ba9f 100644
--- a/xorg/X11R7.6/rdp/rdpPushPixels.c
+++ b/xorg/X11R7.6/rdp/rdpPushPixels.c
@@ -78,13 +78,11 @@ rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
- LLOGLN(0, ("rdpPushPixels:"));
+ LLOGLN(10, ("rdpPushPixels:"));
/* do original call */
rdpPushPixelsOrg(pGC, pBitMap, pDst, w, h, x, y);
- //return;
-
dirty_type = 0;
pDirtyPriv = 0;
post_process = 0;
diff --git a/xorg/X11R7.6/rdp/rdpSetSpans.c b/xorg/X11R7.6/rdp/rdpSetSpans.c
index ed9bc404..aab36f88 100644
--- a/xorg/X11R7.6/rdp/rdpSetSpans.c
+++ b/xorg/X11R7.6/rdp/rdpSetSpans.c
@@ -73,7 +73,7 @@ rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc,
rdpPixmapRec* pDstPriv;
rdpPixmapRec* pDirtyPriv;
- LLOGLN(0, ("rdpSetSpans: todo"));
+ LLOGLN(10, ("rdpSetSpans: todo"));
/* do original call */
rdpSetSpansOrg(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted);
diff --git a/xorg/X11R7.6/rdp/rdpdraw.c b/xorg/X11R7.6/rdp/rdpdraw.c
index ac52daf3..78b2aa3d 100644
--- a/xorg/X11R7.6/rdp/rdpdraw.c
+++ b/xorg/X11R7.6/rdp/rdpdraw.c
@@ -424,7 +424,7 @@ draw_item_remove(rdpPixmapRec* priv, struct rdp_draw_item* di)
{
if (di->u.line.segs != 0)
{
- free(di->u.line.segs);
+ g_free(di->u.line.segs);
}
}
RegionDestroy(di->reg);
@@ -736,7 +736,7 @@ rdpRealizeWindow(WindowPtr pWindow)
rdpWindowRec* priv;
Bool rv;
- LLOGLN(0, ("rdpRealizeWindow:"));
+ LLOGLN(10, ("rdpRealizeWindow:"));
priv = GETWINPRIV(pWindow);
pScreen = pWindow->drawable.pScreen;
pScreen->RealizeWindow = g_rdpScreen.RealizeWindow;
@@ -771,7 +771,7 @@ rdpUnrealizeWindow(WindowPtr pWindow)
rdpWindowRec* priv;
Bool rv;
- LLOGLN(0, ("rdpUnrealizeWindow:"));
+ LLOGLN(10, ("rdpUnrealizeWindow:"));
priv = GETWINPRIV(pWindow);
pScreen = pWindow->drawable.pScreen;
pScreen->UnrealizeWindow = g_rdpScreen.UnrealizeWindow;
diff --git a/xorg/X11R7.6/rdp/rdpmisc.c b/xorg/X11R7.6/rdp/rdpmisc.c
index 5c43654a..d3defe27 100644
--- a/xorg/X11R7.6/rdp/rdpmisc.c
+++ b/xorg/X11R7.6/rdp/rdpmisc.c
@@ -530,3 +530,43 @@ void
FontCacheExtensionInit(INITARGS)
{
}
+
+/******************************************************************************/
+void
+RegionAroundSegs(RegionPtr reg, xSegment* segs, int nseg)
+{
+ int index;
+ BoxRec box;
+ RegionRec treg;
+
+ index = 0;
+ while (index < nseg)
+ {
+ if (segs[index].x1 < segs[index].x2)
+ {
+ box.x1 = segs[index].x1;
+ box.x2 = segs[index].x2;
+ }
+ else
+ {
+ box.x1 = segs[index].x2;
+ box.x2 = segs[index].x1;
+ }
+ box.x2++;
+ if (segs[index].y1 < segs[index].y2)
+ {
+ box.y1 = segs[index].y1;
+ box.y2 = segs[index].y2;
+ }
+ else
+ {
+ box.y1 = segs[index].y2;
+ box.y2 = segs[index].y1;
+ }
+ box.y2++;
+ RegionInit(&treg, &box, 0);
+ RegionUnion(reg, reg, &treg);
+ RegionUninit(&treg);
+ index++;
+ }
+}