Henri Verbeet : d3d9/tests: Use GetRenderTargetData() for reading back pixels.

Alexandre Julliard julliard at winehq.org
Tue Nov 23 09:38:21 CST 2010


Module: wine
Branch: master
Commit: 27b72fa84761fe738f693e1beb5bba50879afbea
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=27b72fa84761fe738f693e1beb5bba50879afbea

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Nov 18 20:50:38 2010 +0100

d3d9/tests: Use GetRenderTargetData() for reading back pixels.

This is the recommended way to read back render targets. It's also much faster
on current wined3d, but that's mostly a side effect of imperfections in our
resource location management.

---

 dlls/d3d9/tests/visual.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index f2eb4b4..d2c5df5 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -110,8 +110,9 @@ static DWORD getPixelColor(IDirect3DDevice9 *device, UINT x, UINT y)
     D3DLOCKED_RECT lockedRect;
     RECT rectToLock = {x, y, x+1, y+1};
 
-    hr = IDirect3DDevice9_CreateRenderTarget(device, 640, 480, D3DFMT_A8R8G8B8, 0, 0, TRUE, &surf, NULL);
-    if(FAILED(hr) || !surf )  /* This is not a test */
+    hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 640, 480,
+            D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &surf, NULL);
+    if (FAILED(hr) || !surf)
     {
         trace("Can't create an offscreen plain surface to read the render target data, hr=%08x\n", hr);
         return 0xdeadbeef;
@@ -125,8 +126,8 @@ static DWORD getPixelColor(IDirect3DDevice9 *device, UINT x, UINT y)
         goto out;
     }
 
-    hr = IDirect3DDevice9_StretchRect(device, target, NULL, surf, NULL, D3DTEXF_POINT);
-    if(FAILED(hr))
+    hr = IDirect3DDevice9_GetRenderTargetData(device, target, surf);
+    if (FAILED(hr))
     {
         trace("Can't read the render target data, hr=%08x\n", hr);
         ret = 0xdeadbeec;




More information about the wine-cvs mailing list