summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2014-04-09 11:25:32 -0700
committerEric Anholt <eric@anholt.net>2014-04-09 11:27:19 -0700
commitcbd28c9892087deb2017042f8b24615c1f19dc30 (patch)
treeca17a10a397afbc1c4883d3ddff0ae7b89de829c
parent0a0fbba28e467700a5ecc564b451093c9484c4dd (diff)
glx: Refactor DRI2CopyRegion calls.
I needed to add some code to each one, so it's a good time to make a helper func.
-rw-r--r--glx/glxdri2.c48
1 files changed, 21 insertions, 27 deletions
diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index 5d1a45bff..94476ddc4 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -115,55 +115,49 @@ __glXDRIdrawableDestroy(__GLXdrawable * drawable)
}
static void
-__glXDRIdrawableCopySubBuffer(__GLXdrawable * drawable,
- int x, int y, int w, int h)
+copy_box(__GLXdrawable * drawable,
+ int dst, int src,
+ int x, int y, int w, int h)
{
- __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
BoxRec box;
RegionRec region;
box.x1 = x;
- box.y1 = private->height - y - h;
+ box.y1 = y;
box.x2 = x + w;
- box.y2 = private->height - y;
+ box.y2 = y + h;
RegionInit(&region, &box, 0);
- DRI2CopyRegion(drawable->pDraw, &region,
- DRI2BufferFrontLeft, DRI2BufferBackLeft);
+ DRI2CopyRegion(drawable->pDraw, &region, dst, src);
}
static void
-__glXDRIdrawableWaitX(__GLXdrawable * drawable)
+__glXDRIdrawableCopySubBuffer(__GLXdrawable * drawable,
+ int x, int y, int w, int h)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
- BoxRec box;
- RegionRec region;
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = private->width;
- box.y2 = private->height;
- RegionInit(&region, &box, 0);
+ copy_box(drawable, x, private->height - y - h,
+ w, h,
+ DRI2BufferFrontLeft, DRI2BufferBackLeft);
+}
- DRI2CopyRegion(drawable->pDraw, &region,
- DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft);
+static void
+__glXDRIdrawableWaitX(__GLXdrawable * drawable)
+{
+ __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
+
+ copy_box(drawable, DRI2BufferFakeFrontLeft, DRI2BufferFrontLeft,
+ 0, 0, private->width, private->height);
}
static void
__glXDRIdrawableWaitGL(__GLXdrawable * drawable)
{
__GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
- BoxRec box;
- RegionRec region;
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = private->width;
- box.y2 = private->height;
- RegionInit(&region, &box, 0);
- DRI2CopyRegion(drawable->pDraw, &region,
- DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft);
+ copy_box(drawable, DRI2BufferFrontLeft, DRI2BufferFakeFrontLeft,
+ 0, 0, private->width, private->height);
}
static void