Alexander Dorofeyev : wined3d: Don' t use device palettes in read_from_framebuffer.

Alexandre Julliard julliard at winehq.org
Tue Mar 25 06:58:19 CDT 2008


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

Author: Alexander Dorofeyev <alexd4 at inbox.lv>
Date:   Tue Mar 25 02:03:38 2008 +0200

wined3d: Don't use device palettes in read_from_framebuffer.

---

 dlls/wined3d/surface.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 131de47..2c78f09 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -789,19 +789,24 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, CONST RECT *rect, v
         }
     }
 
+    LEAVE_GL();
+
     /* For P8 textures we need to perform an inverse palette lookup. This is done by searching for a palette
      * index which matches the RGB value. Note this isn't guaranteed to work when there are multiple entries for
      * the same color but we have no choice.
      * In case of P8 render targets, the index is stored in the alpha component so no conversion is needed.
      */
     if((This->resource.format == WINED3DFMT_P8) && !primary_render_target_is_p8(myDevice)) {
-        PALETTEENTRY *pal;
+        PALETTEENTRY *pal = NULL;
         DWORD width = pitch / 3;
         int x, y, c;
+
         if(This->palette) {
             pal = This->palette->palents;
         } else {
-            pal = This->resource.wineD3DDevice->palettes[This->resource.wineD3DDevice->currentPalette];
+            ERR("Palette is missing, cannot perform inverse palette lookup\n");
+            HeapFree(GetProcessHeap(), 0, mem);
+            return ;
         }
 
         for(y = local_rect.top; y < local_rect.bottom; y++) {
@@ -824,7 +829,6 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, CONST RECT *rect, v
         }
         HeapFree(GetProcessHeap(), 0, mem);
     }
-    LEAVE_GL();
 }
 
 /* Read the framebuffer contents into a texture */




More information about the wine-cvs mailing list