summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTilman Sauerbeck <tilman@code-monkey.de>2007-04-15 12:47:27 +0200
committerTilman Sauerbeck <tilman@code-monkey.de>2007-04-15 12:47:27 +0200
commit7b080d993ceda7b181e0611ed0c997c8aecc9ad7 (patch)
treee9663571fa0a617c27424b1913f429cd809a7e70
parent43b79af51b600e98ecac9d57aeb0d686dbc6a50e (diff)
Added memcpy-based DownloadFromScreen implementation.
-rw-r--r--src/mga_exa.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mga_exa.c b/src/mga_exa.c
index 066215f..c39af50 100644
--- a/src/mga_exa.c
+++ b/src/mga_exa.c
@@ -728,6 +728,31 @@ mgaUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
return TRUE;
}
+static Bool
+mgaDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h,
+ char *dst, int dst_pitch)
+{
+ PMGA(pSrc);
+
+ char *src = pSrc->devPrivate.ptr;
+ int src_pitch = exaGetPixmapPitch(pSrc);
+
+ int cpp = (pSrc->drawable.bitsPerPixel + 7) / 8;
+ int bytes = w * cpp;
+
+ src += y * src_pitch + x * cpp;
+
+ QUIESCE_DMA(pSrc);
+
+ while (h--) {
+ memcpy (dst, src, bytes);
+ src += src_pitch;
+ dst += dst_pitch;
+ }
+
+ return TRUE;
+}
+
static void
mgaWaitMarker(ScreenPtr pScreen, int marker)
{
@@ -873,6 +898,7 @@ mgaExaInit(ScreenPtr pScreen)
}
pExa->UploadToScreen = mgaUploadToScreen;
+ pExa->DownloadFromScreen = mgaDownloadFromScreen;
if (pMga->directRenderingEnabled)
init_dri(pScrn);