wined3d: Remove unneeded casts (3 of 4)

Andrew Talbot andrew.talbot at talbotville.com
Wed Jan 23 15:40:02 CST 2008


Changelog:
    wined3d: Remove unneeded casts.

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index f6aed08..cfb47ca 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -386,7 +386,7 @@ ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface) {
     ULONG ref = InterlockedDecrement(&This->resource.ref);
     TRACE("(%p) : Releasing from %d\n", This, ref + 1);
     if (ref == 0) {
-        IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->resource.wineD3DDevice;
+        IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
         renderbuffer_entry_t *entry, *entry2;
         TRACE("(%p) : cleaning up\n", This);
 
@@ -724,7 +724,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, CONST RECT *rect, v
         }
 
         top = mem + pitch * local_rect.top;
-        bottom = ((BYTE *) mem) + pitch * ( local_rect.bottom - local_rect.top - 1);
+        bottom = mem + pitch * ( local_rect.bottom - local_rect.top - 1);
         for(i = 0; i < (local_rect.bottom - local_rect.top) / 2; i++) {
             memcpy(row, top + off, len);
             memcpy(top + off, bottom + off, len);
@@ -759,7 +759,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, CONST RECT *rect, v
         for(y = local_rect.top; y < local_rect.bottom; y++) {
             for(x = local_rect.left; x < local_rect.right; x++) {
                 /*                      start              lines            pixels      */
-                BYTE *blue =  (BYTE *) ((BYTE *) mem) + y * pitch + x * (sizeof(BYTE) * 3);
+                BYTE *blue =  mem + y * pitch + x * (sizeof(BYTE) * 3);
                 BYTE *green = blue  + 1;
                 BYTE *red =   green + 1;
 
@@ -994,7 +994,7 @@ static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, GLenum fm
     GLint  prev_rasterpos[4];
     GLint skipBytes = 0;
     UINT pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *) This);    /* target is argb, 4 byte */
-    IWineD3DDeviceImpl *myDevice = (IWineD3DDeviceImpl *) This->resource.wineD3DDevice;
+    IWineD3DDeviceImpl *myDevice = This->resource.wineD3DDevice;
     IWineD3DSwapChainImpl *swapchain;
 
     /* Activate the correct context for the render target */
@@ -1655,7 +1655,7 @@ HRESULT d3dfmt_convert_surface(BYTE *src, BYTE *dst, UINT pitch, UINT width, UIN
             unsigned char *Dest;
             for(y = 0; y < height; y++) {
                 Source = (short *) (src + y * pitch);
-                Dest = (unsigned char *) (dst + y * outpitch);
+                Dest = dst + y * outpitch;
                 for (x = 0; x < width; x++ ) {
                     long color = (*Source++);
                     /* B */ Dest[0] = 0xff;
@@ -1693,7 +1693,7 @@ HRESULT d3dfmt_convert_surface(BYTE *src, BYTE *dst, UINT pitch, UINT width, UIN
             unsigned char *Dest;
             for(y = 0; y < height; y++) {
                 Source = (DWORD *) (src + y * pitch);
-                Dest = (unsigned char *) (dst + y * outpitch);
+                Dest = dst + y * outpitch;
                 for (x = 0; x < width; x++ ) {
                     long color = (*Source++);
                     /* B */ Dest[0] = ((color >> 16) & 0xff) + 128; /* W */
@@ -1719,7 +1719,7 @@ HRESULT d3dfmt_convert_surface(BYTE *src, BYTE *dst, UINT pitch, UINT width, UIN
                  */
                 for(y = 0; y < height; y++) {
                     Source = (WORD *) (src + y * pitch);
-                    Dest = (unsigned char *) (dst + y * outpitch);
+                    Dest = dst + y * outpitch;
                     for (x = 0; x < width; x++ ) {
                         short color = (*Source++);
                         unsigned char l = ((color >> 10) & 0xfc);
@@ -1772,7 +1772,7 @@ HRESULT d3dfmt_convert_surface(BYTE *src, BYTE *dst, UINT pitch, UINT width, UIN
                  */
                 for(y = 0; y < height; y++) {
                     Source = (DWORD *) (src + y * pitch);
-                    Dest = (unsigned char *) (dst + y * outpitch);
+                    Dest = dst + y * outpitch;
                     for (x = 0; x < width; x++ ) {
                         long color = (*Source++);
                         /* L */ Dest[2] = ((color >> 16) & 0xff);   /* L */
@@ -1789,7 +1789,7 @@ HRESULT d3dfmt_convert_surface(BYTE *src, BYTE *dst, UINT pitch, UINT width, UIN
                  */
                 for(y = 0; y < height; y++) {
                     Source = (DWORD *) (src + y * pitch);
-                    Dest = (unsigned char *) (dst + y * outpitch);
+                    Dest = dst + y * outpitch;
                     for (x = 0; x < width; x++ ) {
                         long color = (*Source++);
                         /* B */ Dest[0] = ((color >> 16) & 0xff);       /* L */
@@ -1808,8 +1808,8 @@ HRESULT d3dfmt_convert_surface(BYTE *src, BYTE *dst, UINT pitch, UINT width, UIN
             unsigned char *Source;
             unsigned char *Dest;
             for(y = 0; y < height; y++) {
-                Source = (unsigned char *) (src + y * pitch);
-                Dest = (unsigned char *) (dst + y * outpitch);
+                Source = src + y * pitch;
+                Dest = dst + y * outpitch;
                 for (x = 0; x < width; x++ ) {
                     unsigned char color = (*Source++);
                     /* A */ Dest[1] = (color & 0xf0) << 0;
diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c
index f57b9f4..8a6f546 100644
--- a/dlls/wined3d/surface_base.c
+++ b/dlls/wined3d/surface_base.c
@@ -651,7 +651,7 @@ static HRESULT
                 case 2: COLORFILL_ROW(WORD)
         case 3:
         {
-            BYTE *d = (BYTE *) buf;
+            BYTE *d = buf;
             for (x = 0; x < width; x++,d+=3)
             {
                 d[0] = (color    ) & 0xFF;
@@ -1427,8 +1427,8 @@ IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface,
 
         /* Since slock was originally copied from this surface's description, we can just reuse it */
         assert(This->resource.allocatedMemory != NULL);
-        sbuf = (BYTE *)This->resource.allocatedMemory + lock_src.top * pitch + lock_src.left * bpp;
-        dbuf = (BYTE *)This->resource.allocatedMemory + lock_dst.top * pitch + lock_dst.left * bpp;
+        sbuf = This->resource.allocatedMemory + lock_src.top * pitch + lock_src.left * bpp;
+        dbuf = This->resource.allocatedMemory + lock_dst.top * pitch + lock_dst.left * bpp;
         sEntry = getFormatDescEntry(Src->resource.format, NULL, NULL);
         dEntry = sEntry;
     }
@@ -1514,8 +1514,8 @@ IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface,
             {
                 BYTE *d, *s;
                 DWORD tmp;
-                s = (BYTE *) sbuf;
-                d = (BYTE *) dbuf;
+                s = sbuf;
+                d = dbuf;
                 for (y = 0; y < h; y++)
                 {
                     for (x = 0; x < w * 3; x += 3)
diff --git a/dlls/wined3d/surface_gdi.c b/dlls/wined3d/surface_gdi.c
index 92adcc6..30c922a 100644
--- a/dlls/wined3d/surface_gdi.c
+++ b/dlls/wined3d/surface_gdi.c
@@ -140,7 +140,7 @@ ULONG WINAPI IWineGDISurfaceImpl_Release(IWineD3DSurface *iface) {
     ULONG ref = InterlockedDecrement(&This->resource.ref);
     TRACE("(%p) : Releasing from %d\n", This, ref + 1);
     if (ref == 0) {
-        IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->resource.wineD3DDevice;
+        IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
         TRACE("(%p) : cleaning up\n", This);
 
         if(This->Flags & SFLAG_DIBSECTION) {
@@ -254,7 +254,7 @@ static HRESULT WINAPI
 IWineGDISurfaceImpl_UnlockRect(IWineD3DSurface *iface)
 {
     IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
-    IWineD3DDeviceImpl *dev = (IWineD3DDeviceImpl *) This->resource.wineD3DDevice;
+    IWineD3DDeviceImpl *dev = This->resource.wineD3DDevice;
     TRACE("(%p)\n", This);
 
     if (!(This->Flags & SFLAG_LOCKED))
@@ -492,7 +492,7 @@ const char* filename)
             table[i][2] = This->palette->palents[i].peBlue;
         }
         for (y = 0; y < This->pow2Height; y++) {
-            unsigned char *src = (unsigned char *) This->resource.allocatedMemory + (y * 1 * IWineD3DSurface_GetPitch(iface));
+            unsigned char *src = This->resource.allocatedMemory + (y * 1 * IWineD3DSurface_GetPitch(iface));
             for (x = 0; x < This->pow2Width; x++) {
                 unsigned char color = *src;
                 src += 1;
@@ -514,7 +514,7 @@ const char* filename)
         alpha_shift = get_shift(formatEntry->alphaMask);
 
         for (y = 0; y < This->pow2Height; y++) {
-            unsigned char *src = (unsigned char *) This->resource.allocatedMemory + (y * 1 * IWineD3DSurface_GetPitch(iface));
+            unsigned char *src = This->resource.allocatedMemory + (y * 1 * IWineD3DSurface_GetPitch(iface));
             for (x = 0; x < This->pow2Width; x++) {	    
                 unsigned int color;
                 unsigned int comp;



More information about the wine-patches mailing list