gdi32: Don't use gdi_private.h and ntgdi_private.h at the same time.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-09-07 14:11:38 +02:00 committed by Alexandre Julliard
parent 691cb12e5b
commit 3361a2f2ba
8 changed files with 46 additions and 7 deletions

View File

@ -30,7 +30,7 @@
#include "winternl.h"
#include "winerror.h"
#include "ntgdi_private.h"
#include "gdi_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dc);

View File

@ -93,7 +93,7 @@ static const struct gdi_obj_funcs dib_funcs =
*
* Return the size of the bitmap info structure including color table.
*/
int bitmap_info_size( const BITMAPINFO * info, WORD coloruse )
static int bitmap_info_size( const BITMAPINFO *info, WORD coloruse )
{
unsigned int colors, size, masks = 0;

View File

@ -21,9 +21,9 @@
*/
#include <assert.h>
#include <stdlib.h>
#include "gdi_private.h"
#include "ntgdi_private.h"
#include "winnls.h"
#include "wine/debug.h"

View File

@ -35,13 +35,15 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winnls.h"
#include "winerror.h"
#include "ntgdi_private.h"
#include "gdi_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(enhmetafile);

View File

@ -23,6 +23,7 @@
#define __WINE_GDI_PRIVATE_H
#include <stdarg.h>
#include <limits.h>
#include "windef.h"
#include "winbase.h"
@ -273,4 +274,19 @@ extern HENHMETAFILE EMF_Create_HENHMETAFILE( ENHMETAHEADER *emh, DWORD filesize,
extern BOOL get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void *bits,
UINT *usage ) DECLSPEC_HIDDEN;
static inline int get_dib_stride( int width, int bpp )
{
return ((width * bpp + 31) >> 3) & ~3;
}
/* only for use on sanitized BITMAPINFO structures */
static inline int get_dib_info_size( const BITMAPINFO *info, UINT coloruse )
{
if (info->bmiHeader.biCompression == BI_BITFIELDS)
return sizeof(BITMAPINFOHEADER) + 3 * sizeof(DWORD);
if (coloruse == DIB_PAL_COLORS)
return sizeof(BITMAPINFOHEADER) + info->bmiHeader.biClrUsed * sizeof(WORD);
return FIELD_OFFSET( BITMAPINFO, bmiColors[info->bmiHeader.biClrUsed] );
}
#endif /* __WINE_GDI_PRIVATE_H */

View File

@ -22,7 +22,6 @@
#include <stdarg.h>
#include "ntgdi_private.h"
#include "gdi_private.h"
#include "winnls.h"
#include "wine/wingdi16.h"

View File

@ -56,7 +56,7 @@
#include "winnls.h"
#include "winternl.h"
#include "gdi_private.h"
#include "ntgdi_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(metafile);
@ -110,6 +110,27 @@ HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh)
return handle;
}
static int bitmap_info_size( const BITMAPINFO *info, WORD coloruse )
{
unsigned int colors, size, masks = 0;
if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
{
const BITMAPCOREHEADER *core = (const BITMAPCOREHEADER *)info;
colors = (core->bcBitCount <= 8) ? 1 << core->bcBitCount : 0;
return sizeof(BITMAPCOREHEADER) + colors *
((coloruse == DIB_RGB_COLORS) ? sizeof(RGBTRIPLE) : sizeof(WORD));
}
else /* assume BITMAPINFOHEADER */
{
if (info->bmiHeader.biClrUsed) colors = min( info->bmiHeader.biClrUsed, 256 );
else colors = info->bmiHeader.biBitCount > 8 ? 0 : 1 << info->bmiHeader.biBitCount;
if (info->bmiHeader.biCompression == BI_BITFIELDS) masks = 3;
size = max( info->bmiHeader.biSize, sizeof(BITMAPINFOHEADER) + masks * sizeof(DWORD) );
return size + colors * ((coloruse == DIB_RGB_COLORS) ? sizeof(RGBQUAD) : sizeof(WORD));
}
}
/******************************************************************
* convert_points
*

View File

@ -180,7 +180,6 @@ extern void DC_InitDC( DC * dc ) DECLSPEC_HIDDEN;
extern void DC_UpdateXforms( DC * dc ) DECLSPEC_HIDDEN;
/* dib.c */
extern int bitmap_info_size( const BITMAPINFO * info, WORD coloruse ) DECLSPEC_HIDDEN;
extern BOOL fill_color_table_from_pal_colors( BITMAPINFO *info, HDC hdc ) DECLSPEC_HIDDEN;
extern const RGBQUAD *get_default_color_table( int bpp ) DECLSPEC_HIDDEN;
extern void fill_default_color_table( BITMAPINFO *info ) DECLSPEC_HIDDEN;
@ -645,6 +644,8 @@ static inline void copy_bitmapinfo( BITMAPINFO *dst, const BITMAPINFO *src )
extern void CDECL free_heap_bits( struct gdi_image_bits *bits ) DECLSPEC_HIDDEN;
void set_gdi_client_ptr( HGDIOBJ handle, void *ptr ) DECLSPEC_HIDDEN;
extern HMODULE gdi32_module DECLSPEC_HIDDEN;
#endif /* __WINE_NTGDI_PRIVATE_H */