Alexandre Julliard : gdi32: Remove support for private color maps.

Alexandre Julliard julliard at winehq.org
Tue Dec 13 13:01:23 CST 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Dec 12 15:58:05 2011 +0100

gdi32: Remove support for private color maps.

---

 dlls/gdi32/dibdrv/dc.c         |   33 +++++----------------------------
 dlls/gdi32/dibdrv/dibdrv.h     |    7 ++-----
 dlls/gdi32/dibdrv/primitives.c |    2 +-
 3 files changed, 8 insertions(+), 34 deletions(-)

diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c
index ed7b0f7..c4921a3 100644
--- a/dlls/gdi32/dibdrv/dc.c
+++ b/dlls/gdi32/dibdrv/dc.c
@@ -68,7 +68,7 @@ static void init_bit_fields(dib_info *dib, const DWORD *bit_fields)
 }
 
 static BOOL init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD *bit_fields,
-                          RGBQUAD *color_table, void *bits, enum dib_info_flags flags)
+                          const RGBQUAD *color_table, void *bits, enum dib_info_flags flags)
 {
     dib->bit_count    = bi->biBitCount;
     dib->width        = bi->biWidth;
@@ -79,7 +79,6 @@ static BOOL init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD
     dib->bits.is_copy = FALSE;
     dib->bits.free    = NULL;
     dib->bits.param   = NULL;
-    dib->flags        = flags;
 
     if(dib->height < 0) /* top-down */
     {
@@ -143,19 +142,12 @@ static BOOL init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD
 
     if (color_table && bi->biClrUsed)
     {
-        if (flags & private_color_table)
-        {
-            dib->color_table = HeapAlloc(GetProcessHeap(), 0, bi->biClrUsed * sizeof(dib->color_table[0]));
-            if(!dib->color_table) return FALSE;
-            memcpy(dib->color_table, color_table, bi->biClrUsed * sizeof(color_table[0]));
-        }
-        else
-            dib->color_table = color_table;
+        dib->color_table = color_table;
         dib->color_table_size = bi->biClrUsed;
     }
     else if (flags & default_color_table)
     {
-        dib->color_table = (RGBQUAD *)get_default_color_table( dib->bit_count );
+        dib->color_table = get_default_color_table( dib->bit_count );
         dib->color_table_size = dib->color_table ? (1 << dib->bit_count) : 0;
     }
     else
@@ -170,7 +162,7 @@ static BOOL init_dib_info(dib_info *dib, const BITMAPINFOHEADER *bi, const DWORD
 BOOL init_dib_info_from_bitmapinfo(dib_info *dib, const BITMAPINFO *info, void *bits, enum dib_info_flags flags)
 {
     return init_dib_info( dib, &info->bmiHeader, (const DWORD *)info->bmiColors,
-                          (RGBQUAD *)info->bmiColors, bits, flags );
+                          info->bmiColors, bits, flags );
 }
 
 BOOL init_dib_info_from_bitmapobj(dib_info *dib, BITMAPOBJ *bmp, enum dib_info_flags flags)
@@ -208,9 +200,6 @@ static void clear_dib_info(dib_info *dib)
  */
 void free_dib_info(dib_info *dib)
 {
-    if (dib->flags & private_color_table)
-        HeapFree(GetProcessHeap(), 0, dib->color_table);
-
     if (dib->bits.free) dib->bits.free( &dib->bits );
     clear_dib_info( dib );
 }
@@ -229,19 +218,7 @@ void copy_dib_color_info(dib_info *dst, const dib_info *src)
     dst->blue_shift       = src->blue_shift;
     dst->funcs            = src->funcs;
     dst->color_table_size = src->color_table_size;
-    dst->color_table      = NULL;
-    dst->flags            = src->flags;
-    if(dst->color_table_size)
-    {
-        int size = dst->color_table_size * sizeof(dst->color_table[0]);
-        if (dst->flags & private_color_table)
-        {
-            dst->color_table = HeapAlloc(GetProcessHeap(), 0, size);
-            memcpy(dst->color_table, src->color_table, size);
-        }
-        else
-            dst->color_table = src->color_table;
-    }
+    dst->color_table      = src->color_table;
 }
 
 DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bitblt_coords *src,
diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h
index d388f91..524032a 100644
--- a/dlls/gdi32/dibdrv/dibdrv.h
+++ b/dlls/gdi32/dibdrv/dibdrv.h
@@ -20,8 +20,7 @@
 
 enum dib_info_flags
 {
-    private_color_table = 1,
-    default_color_table = 2
+    default_color_table = 1
 };
 
 typedef struct
@@ -35,11 +34,9 @@ typedef struct
     int red_shift, green_shift, blue_shift;
     int red_len, green_len, blue_len;
 
-    RGBQUAD *color_table;
+    const RGBQUAD *color_table;
     DWORD color_table_size;
 
-    enum dib_info_flags flags;
-
     const struct primitive_funcs *funcs;
 } dib_info;
 
diff --git a/dlls/gdi32/dibdrv/primitives.c b/dlls/gdi32/dibdrv/primitives.c
index d0d838b..07911b2 100644
--- a/dlls/gdi32/dibdrv/primitives.c
+++ b/dlls/gdi32/dibdrv/primitives.c
@@ -1391,7 +1391,7 @@ static DWORD rgb_to_pixel_colortable(const dib_info *dib, BYTE r, BYTE g, BYTE b
 
     for(i = 0; i < dib->color_table_size; i++)
     {
-        RGBQUAD *cur = dib->color_table + i;
+        const RGBQUAD *cur = dib->color_table + i;
         diff = (r - cur->rgbRed)   * (r - cur->rgbRed)
             +  (g - cur->rgbGreen) * (g - cur->rgbGreen)
             +  (b - cur->rgbBlue)  * (b - cur->rgbBlue);




More information about the wine-cvs mailing list