[PATCH 4/4] wined3d: Use the r5g5l6 helper struct in convert_r5g5_snorm_l6_unorm.

Stefan Dösinger stefan at codeweavers.com
Mon Mar 2 15:29:12 CST 2015


---
 dlls/wined3d/utils.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index e6cd4da..6b41ac0 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -303,25 +303,23 @@ static void convert_r5g5_snorm_l6_unorm(const BYTE *src, BYTE *dst, UINT src_row
         UINT dst_row_pitch, UINT dst_slice_pitch, UINT width, UINT height, UINT depth)
 {
     unsigned int x, y, z;
-    const WORD *Source;
+    const struct r5g5l6 *texel_in;
+    unsigned short *texel_out;
 
     for (z = 0; z < depth; z++)
     {
         for (y = 0; y < height; y++)
         {
-            unsigned short *Dest_s = (unsigned short *) (dst + z * dst_slice_pitch + y * dst_row_pitch);
-            Source = (const WORD *)(src + z * src_slice_pitch + y * src_row_pitch);
+            texel_out = (unsigned short *) (dst + z * dst_slice_pitch + y * dst_row_pitch);
+            texel_in = (const struct r5g5l6 *)(src + z * src_slice_pitch + y * src_row_pitch);
             for (x = 0; x < width; x++ )
             {
-                short color = (*Source++);
-                unsigned char l = ((color >> 10) & 0xfc);
-                        short v = ((color >>  5) & 0x3e);
-                        short u = ((color      ) & 0x1f);
-                short v_conv = v + 16;
-                short u_conv = u + 16;
-
-                *Dest_s = ((u_conv << 11) & 0xf800) | ((l << 5) & 0x7e0) | (v_conv & 0x1f);
-                Dest_s += 1;
+                unsigned char r_conv = texel_in->r + 16;
+                unsigned char g_conv = texel_in->g + 16;
+
+                *texel_out = ((r_conv << 11) & 0xf800) | ((texel_in->l << 5) & 0x7e0) | (g_conv & 0x1f);
+                texel_out++;
+                texel_in++;
             }
         }
     }
-- 
2.3.0




More information about the wine-patches mailing list