wined3d: Fix the handling of the blue channel inIWineGDISurfaceImpl_SaveSnapshot. (take 2)

Gerald Pfeifer gerald at pfeifer.com
Wed May 5 17:10:18 CDT 2010


On Wed, 5 May 2010, Alexandre Julliard wrote:
> It's very unlikely that we'd want to use red and green but not blue...

You do have a point here, Alexandre. :-)  Now, I am absolutely not
an expert of this code at all, but is it possible a patch like the
one below is the real fix here?

Gerald
---
 dlls/wined3d/surface_gdi.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/surface_gdi.c b/dlls/wined3d/surface_gdi.c
index eec9b84..580c88a 100644
--- a/dlls/wined3d/surface_gdi.c
+++ b/dlls/wined3d/surface_gdi.c
@@ -341,14 +341,13 @@ const char* filename)
             fwrite(output, 3 * This->pow2Width, 1, f);
         }
     } else {
-        int red_shift, green_shift, blue_shift, pix_width, alpha_shift;
+        int red_shift, green_shift, blue_shift, pix_width;
 
         pix_width = format_desc->byte_count;
 
         red_shift = get_shift(format_desc->red_mask);
         green_shift = get_shift(format_desc->green_mask);
         blue_shift = get_shift(format_desc->blue_mask);
-        alpha_shift = get_shift(format_desc->alpha_mask);
 
         for (y = 0; y < This->pow2Height; y++) {
             const unsigned char *src = This->resource.allocatedMemory + (y * 1 * IWineD3DSurface_GetPitch(iface));
@@ -367,8 +366,8 @@ const char* filename)
                 output[3 * x + 0] = red_shift > 0 ? comp >> red_shift : comp << -red_shift;
                 comp = color & format_desc->green_mask;
                 output[3 * x + 1] = green_shift > 0 ? comp >> green_shift : comp << -green_shift;
-                comp = color & format_desc->alpha_mask;
-                output[3 * x + 2] = alpha_shift > 0 ? comp >> alpha_shift : comp << -alpha_shift;
+                comp = color & format_desc->blue_mask;
+                output[3 * x + 2] = blue_shift > 0 ? comp >> blue_shift : comp << -blue_shift;
             }
             fwrite(output, 3 * This->pow2Width, 1, f);
         }
-- 
1.6.6.2



More information about the wine-patches mailing list