Alexandre Julliard : gdi32: Get rid of the return value in DIB conversion functions, they never fail now.

Alexandre Julliard julliard at winehq.org
Thu Oct 13 14:10:10 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Oct 13 00:15:29 2011 +0200

gdi32: Get rid of the return value in DIB conversion functions, they never fail now.

---

 dlls/gdi32/dibdrv/dc.c         |    3 +-
 dlls/gdi32/dibdrv/dibdrv.h     |    2 +-
 dlls/gdi32/dibdrv/objects.c    |   10 ++----
 dlls/gdi32/dibdrv/primitives.c |   68 +++++----------------------------------
 4 files changed, 15 insertions(+), 68 deletions(-)

diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c
index 883a60a..29528f5 100644
--- a/dlls/gdi32/dibdrv/dc.c
+++ b/dlls/gdi32/dibdrv/dc.c
@@ -290,7 +290,8 @@ DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bit
 
     __TRY
     {
-        ret = dst_dib.funcs->convert_to( &dst_dib, &src_dib, &src->visrect );
+        dst_dib.funcs->convert_to( &dst_dib, &src_dib, &src->visrect );
+        ret = TRUE;
     }
     __EXCEPT_PAGE_FAULT
     {
diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h
index 0be8ffa..7eae7cb 100644
--- a/dlls/gdi32/dibdrv/dibdrv.h
+++ b/dlls/gdi32/dibdrv/dibdrv.h
@@ -141,7 +141,7 @@ typedef struct primitive_funcs
     void              (* copy_rect)(const dib_info *dst, const RECT *rc, const dib_info *src,
                                     const POINT *origin, int rop2, int overlap);
     DWORD     (* colorref_to_pixel)(const dib_info *dib, COLORREF color);
-    BOOL             (* convert_to)(dib_info *dst, const dib_info *src, const RECT *src_rect);
+    void             (* convert_to)(dib_info *dst, const dib_info *src, const RECT *src_rect);
     BOOL       (* create_rop_masks)(const dib_info *dib, const dib_info *hatch,
                                     const rop_mask *fg, const rop_mask *bg, rop_mask_bits *bits);
     void            (* stretch_row)(const dib_info *dst_dib, const POINT *dst_start,
diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c
index 2dcd33a..67eda57 100644
--- a/dlls/gdi32/dibdrv/objects.c
+++ b/dlls/gdi32/dibdrv/objects.c
@@ -1349,13 +1349,9 @@ HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush )
             rect.right = orig_dib.width;
             rect.bottom = orig_dib.height;
 
-            if(pdev->brush_dib.funcs->convert_to(&pdev->brush_dib, &orig_dib, &rect))
-            {
-                pdev->brush_rects = pattern_brush;
-                pdev->defer &= ~DEFER_BRUSH;
-            }
-            else
-                free_dib_info(&pdev->brush_dib);
+            pdev->brush_dib.funcs->convert_to(&pdev->brush_dib, &orig_dib, &rect);
+            pdev->brush_rects = pattern_brush;
+            pdev->defer &= ~DEFER_BRUSH;
             free_dib_info(&orig_dib);
         }
         GlobalUnlock((HGLOBAL)logbrush.lbHatch);
diff --git a/dlls/gdi32/dibdrv/primitives.c b/dlls/gdi32/dibdrv/primitives.c
index 051177d..47e5f77 100644
--- a/dlls/gdi32/dibdrv/primitives.c
+++ b/dlls/gdi32/dibdrv/primitives.c
@@ -1141,7 +1141,7 @@ static inline BOOL bit_fields_match(const dib_info *d1, const dib_info *d2)
            d1->blue_mask  == d2->blue_mask;
 }
 
-static BOOL convert_to_8888(dib_info *dst, const dib_info *src, const RECT *src_rect)
+static void convert_to_8888(dib_info *dst, const dib_info *src, const RECT *src_rect)
 {
     DWORD *dst_start = get_pixel_ptr_32(dst, 0, 0), *dst_pixel, src_val;
     int x, y, pad_size = (dst->width - (src_rect->right - src_rect->left)) * 4;
@@ -1376,16 +1376,10 @@ static BOOL convert_to_8888(dib_info *dst, const dib_info *src, const RECT *src_
         }
         break;
     }
-
-    default:
-        FIXME("Unsupported conversion: %d -> 8888\n", src->bit_count);
-        return FALSE;
     }
-
-    return TRUE;
 }
 
-static BOOL convert_to_32(dib_info *dst, const dib_info *src, const RECT *src_rect)
+static void convert_to_32(dib_info *dst, const dib_info *src, const RECT *src_rect)
 {
     DWORD *dst_start = get_pixel_ptr_32(dst, 0, 0), *dst_pixel, src_val;
     int x, y, pad_size = (dst->width - (src_rect->right - src_rect->left)) * 4;
@@ -1648,16 +1642,10 @@ static BOOL convert_to_32(dib_info *dst, const dib_info *src, const RECT *src_re
         }
         break;
     }
-
-    default:
-        FIXME("Unsupported conversion: %d -> 32\n", src->bit_count);
-        return FALSE;
     }
-
-    return TRUE;
 }
 
-static BOOL convert_to_24(dib_info *dst, const dib_info *src, const RECT *src_rect)
+static void convert_to_24(dib_info *dst, const dib_info *src, const RECT *src_rect)
 {
     BYTE *dst_start = get_pixel_ptr_24(dst, 0, 0), *dst_pixel;
     DWORD src_val;
@@ -1897,16 +1885,10 @@ static BOOL convert_to_24(dib_info *dst, const dib_info *src, const RECT *src_re
         }
         break;
     }
-
-    default:
-        FIXME("Unsupported conversion: %d -> 24\n", src->bit_count);
-        return FALSE;
     }
-
-    return TRUE;
 }
 
-static BOOL convert_to_555(dib_info *dst, const dib_info *src, const RECT *src_rect)
+static void convert_to_555(dib_info *dst, const dib_info *src, const RECT *src_rect)
 {
     WORD *dst_start = get_pixel_ptr_16(dst, 0, 0), *dst_pixel;
     INT x, y, pad_size = ((dst->width + 1) & ~1) * 2 - (src_rect->right - src_rect->left) * 2;
@@ -2145,16 +2127,10 @@ static BOOL convert_to_555(dib_info *dst, const dib_info *src, const RECT *src_r
         }
         break;
     }
-
-    default:
-        FIXME("Unsupported conversion: %d -> 555\n", src->bit_count);
-        return FALSE;
-
     }
-    return TRUE;
 }
 
-static BOOL convert_to_16(dib_info *dst, const dib_info *src, const RECT *src_rect)
+static void convert_to_16(dib_info *dst, const dib_info *src, const RECT *src_rect)
 {
     WORD *dst_start = get_pixel_ptr_16(dst, 0, 0), *dst_pixel;
     INT x, y, pad_size = ((dst->width + 1) & ~1) * 2 - (src_rect->right - src_rect->left) * 2;
@@ -2417,13 +2393,7 @@ static BOOL convert_to_16(dib_info *dst, const dib_info *src, const RECT *src_re
         }
         break;
     }
-
-    default:
-        FIXME("Unsupported conversion: %d -> 16\n", src->bit_count);
-        return FALSE;
-
     }
-    return TRUE;
 }
 
 static inline BOOL color_tables_match(const dib_info *d1, const dib_info *d2)
@@ -2434,7 +2404,7 @@ static inline BOOL color_tables_match(const dib_info *d1, const dib_info *d2)
     return !memcmp(d1->color_table, d2->color_table, d1->color_table_size * sizeof(d1->color_table[0]));
 }
 
-static BOOL convert_to_8(dib_info *dst, const dib_info *src, const RECT *src_rect)
+static void convert_to_8(dib_info *dst, const dib_info *src, const RECT *src_rect)
 {
     BYTE *dst_start = get_pixel_ptr_8(dst, 0, 0), *dst_pixel;
     INT x, y, pad_size = ((dst->width + 3) & ~3) - (src_rect->right - src_rect->left);
@@ -2695,16 +2665,10 @@ static BOOL convert_to_8(dib_info *dst, const dib_info *src, const RECT *src_rec
         }
         break;
     }
-
-    default:
-        FIXME("Unsupported conversion: %d -> 8\n", src->bit_count);
-        return FALSE;
-
     }
-    return TRUE;
 }
 
-static BOOL convert_to_4(dib_info *dst, const dib_info *src, const RECT *src_rect)
+static void convert_to_4(dib_info *dst, const dib_info *src, const RECT *src_rect)
 {
     BYTE *dst_start = get_pixel_ptr_4(dst, 0, 0), *dst_pixel, dst_val;
     INT x, y, pad_size = ((dst->width + 7) & ~7) / 2 - (src_rect->right - src_rect->left + 1) / 2;
@@ -3088,17 +3052,10 @@ static BOOL convert_to_4(dib_info *dst, const dib_info *src, const RECT *src_rec
         }
         break;
     }
-
-    default:
-        FIXME("Unsupported conversion: %d -> 4\n", src->bit_count);
-        return FALSE;
-
     }
-
-    return TRUE;
 }
 
-static BOOL convert_to_1(dib_info *dst, const dib_info *src, const RECT *src_rect)
+static void convert_to_1(dib_info *dst, const dib_info *src, const RECT *src_rect)
 {
     BYTE *dst_start = get_pixel_ptr_1(dst, 0, 0), *dst_pixel, dst_val;
     INT x, y, pad_size = ((dst->width + 31) & ~31) / 8 - (src_rect->right - src_rect->left + 7) / 8;
@@ -3490,18 +3447,11 @@ static BOOL convert_to_1(dib_info *dst, const dib_info *src, const RECT *src_rec
         }
         break;
     }
-
-    default:
-        FIXME("Unsupported conversion: %d -> 1\n", src->bit_count);
-        return FALSE;
-
     }
-    return TRUE;
 }
 
-static BOOL convert_to_null(dib_info *dst, const dib_info *src, const RECT *src_rect)
+static void convert_to_null(dib_info *dst, const dib_info *src, const RECT *src_rect)
 {
-    return FALSE;
 }
 
 static BOOL create_rop_masks_32(const dib_info *dib, const dib_info *hatch, const rop_mask *fg, const rop_mask *bg, rop_mask_bits *bits)




More information about the wine-cvs mailing list