libfreerdp-gdi: replace gdi_copy_mem by memmove
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Fri, 30 Sep 2011 03:19:13 +0000 (23:19 -0400)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Fri, 30 Sep 2011 03:19:13 +0000 (23:19 -0400)
include/freerdp/gdi/gdi.h
libfreerdp-gdi/16bpp.c
libfreerdp-gdi/32bpp.c
libfreerdp-gdi/8bpp.c
libfreerdp-gdi/gdi.c

index 19f10d5..e06fda8 100644 (file)
@@ -255,8 +255,6 @@ struct _GDI
 typedef struct _GDI GDI;
 
 FREERDP_API uint32 gdi_rop3_code(uint8 code);
-FREERDP_API void gdi_copy_mem(uint8 *d, uint8 *s, int n);
-FREERDP_API void gdi_copy_mem_backwards(uint8 *d, uint8 *s, int n);
 FREERDP_API uint8* gdi_get_bitmap_pointer(HGDI_DC hdcBmp, int x, int y);
 FREERDP_API uint8* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y);
 FREERDP_API int gdi_is_mono_pixel_set(uint8* data, int x, int y, int width);
index eb8b269..22d48fc 100644 (file)
@@ -147,9 +147,7 @@ static int BitBlt_SRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
                        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
                        if (srcp != 0 && dstp != 0)
-                       {
-                               gdi_copy_mem(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
-                       }
+                               memcpy(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
                }
 
                return 0;
@@ -164,9 +162,7 @@ static int BitBlt_SRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
                        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
                        if (srcp != 0 && dstp != 0)
-                       {
-                               gdi_copy_mem(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
-                       }
+                               memmove(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
                }
        }
        else if (nYSrc > nYDest || nXSrc > nXDest)
@@ -178,9 +174,7 @@ static int BitBlt_SRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
                        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
                        if (srcp != 0 && dstp != 0)
-                       {
-                               gdi_copy_mem(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
-                       }
+                               memmove(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
                }
        }
        else
@@ -192,9 +186,7 @@ static int BitBlt_SRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
                        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
                        if (srcp != 0 && dstp != 0)
-                       {
-                               gdi_copy_mem_backwards(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
-                       }
+                               memmove(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
                }
        }
        
index 6457257..6e50552 100644 (file)
@@ -164,9 +164,7 @@ static int BitBlt_SRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
                        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
                        if (srcp != 0 && dstp != 0)
-                       {
-                               gdi_copy_mem(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
-                       }
+                               memcpy(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
                }
 
                return 0;
@@ -181,9 +179,7 @@ static int BitBlt_SRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
                        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
                        if (srcp != 0 && dstp != 0)
-                       {
-                               gdi_copy_mem(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
-                       }
+                               memmove(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
                }
        }
        else if (nYSrc > nYDest || nXSrc > nXDest)
@@ -195,9 +191,7 @@ static int BitBlt_SRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
                        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
                        if (srcp != 0 && dstp != 0)
-                       {
-                               gdi_copy_mem(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
-                       }
+                               memmove(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
                }
        }
        else
@@ -209,12 +203,10 @@ static int BitBlt_SRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
                        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
                        if (srcp != 0 && dstp != 0)
-                       {
-                               gdi_copy_mem_backwards(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
-                       }
+                               memmove(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
                }
        }
-       
+
        return 0;
 }
 
index 9b751f6..27cc1d3 100644 (file)
@@ -86,9 +86,7 @@ static int BitBlt_SRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid
                        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
                        if (srcp != 0 && dstp != 0)
-                       {
-                               gdi_copy_mem(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
-                       }
+                               memcpy(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
                }
 
                return 0;
@@ -103,9 +101,7 @@ static int BitBlt_SRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid
                        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
                        if (srcp != 0 && dstp != 0)
-                       {
-                               gdi_copy_mem(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
-                       }
+                               memmove(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
                }
        }
        else if (nYSrc > nYDest || nXSrc > nXDest)
@@ -117,9 +113,7 @@ static int BitBlt_SRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid
                        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
                        if (srcp != 0 && dstp != 0)
-                       {
-                               gdi_copy_mem(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
-                       }
+                               memmove(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
                }
        }
        else
@@ -131,9 +125,7 @@ static int BitBlt_SRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid
                        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);
 
                        if (srcp != 0 && dstp != 0)
-                       {
-                               gdi_copy_mem_backwards(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
-                       }
+                               memmove(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
                }
        }
        
index 632652c..f70786c 100644 (file)
@@ -308,36 +308,6 @@ INLINE uint32 gdi_rop3_code(uint8 code)
        return rop3_code_table[code];
 }
 
-INLINE void gdi_copy_mem(uint8 * d, uint8 * s, int n)
-{
-       memmove(d, s, n);
-}
-
-INLINE void gdi_copy_mem_backwards(uint8 * d, uint8 * s, int n)
-{
-       d = (d + n) - 1;
-       s = (s + n) - 1;
-       
-       while (n & (~7))
-       {
-               *(d--) = *(s--);
-               *(d--) = *(s--);
-               *(d--) = *(s--);
-               *(d--) = *(s--);
-               *(d--) = *(s--);
-               *(d--) = *(s--);
-               *(d--) = *(s--);
-               *(d--) = *(s--);
-               n = n - 8;
-       }
-
-       while (n > 0)
-       {
-               *(d--) = *(s--);
-               n--;
-       }
-}
-
 INLINE uint8* gdi_get_bitmap_pointer(HGDI_DC hdcBmp, int x, int y)
 {
        uint8 * p;