Fixed a number of dll separation issues.

This commit is contained in:
Alexandre Julliard 2002-08-28 22:35:23 +00:00
parent c895879e2a
commit aface53759
18 changed files with 261 additions and 565 deletions

View File

@ -23,13 +23,66 @@
#include "winnls.h"
#include "wine/winbase16.h"
#include "win16drv/win16drv.h"
#include "font.h"
#include "gdi.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(win16drv);
static void WIN16DRV_NewTextMetric16ToW(const NEWTEXTMETRIC16 *ptm16, LPNEWTEXTMETRICW ptmW )
{
ptmW->tmHeight = ptm16->tmHeight;
ptmW->tmAscent = ptm16->tmAscent;
ptmW->tmDescent = ptm16->tmDescent;
ptmW->tmInternalLeading = ptm16->tmInternalLeading;
ptmW->tmExternalLeading = ptm16->tmExternalLeading;
ptmW->tmAveCharWidth = ptm16->tmAveCharWidth;
ptmW->tmMaxCharWidth = ptm16->tmMaxCharWidth;
ptmW->tmWeight = ptm16->tmWeight;
ptmW->tmOverhang = ptm16->tmOverhang;
ptmW->tmDigitizedAspectX = ptm16->tmDigitizedAspectX;
ptmW->tmDigitizedAspectY = ptm16->tmDigitizedAspectY;
ptmW->tmFirstChar = ptm16->tmFirstChar;
ptmW->tmLastChar = ptm16->tmLastChar;
ptmW->tmDefaultChar = ptm16->tmDefaultChar;
ptmW->tmBreakChar = ptm16->tmBreakChar;
ptmW->tmItalic = ptm16->tmItalic;
ptmW->tmUnderlined = ptm16->tmUnderlined;
ptmW->tmStruckOut = ptm16->tmStruckOut;
ptmW->tmPitchAndFamily = ptm16->tmPitchAndFamily;
ptmW->tmCharSet = ptm16->tmCharSet;
ptmW->ntmFlags = ptm16->ntmFlags;
ptmW->ntmSizeEM = ptm16->ntmSizeEM;
ptmW->ntmCellHeight = ptm16->ntmCellHeight;
ptmW->ntmAvgWidth = ptm16->ntmAvgWidth;
}
static void WIN16DRV_EnumLogFont16ToW( const ENUMLOGFONT16 *font16, LPENUMLOGFONTW font32 )
{
font32->elfLogFont.lfHeight = font16->elfLogFont.lfHeight;
font32->elfLogFont.lfWidth = font16->elfLogFont.lfWidth;
font32->elfLogFont.lfEscapement = font16->elfLogFont.lfEscapement;
font32->elfLogFont.lfOrientation = font16->elfLogFont.lfOrientation;
font32->elfLogFont.lfWeight = font16->elfLogFont.lfWeight;
font32->elfLogFont.lfItalic = font16->elfLogFont.lfItalic;
font32->elfLogFont.lfUnderline = font16->elfLogFont.lfUnderline;
font32->elfLogFont.lfStrikeOut = font16->elfLogFont.lfStrikeOut;
font32->elfLogFont.lfCharSet = font16->elfLogFont.lfCharSet;
font32->elfLogFont.lfOutPrecision = font16->elfLogFont.lfOutPrecision;
font32->elfLogFont.lfClipPrecision = font16->elfLogFont.lfClipPrecision;
font32->elfLogFont.lfQuality = font16->elfLogFont.lfQuality;
font32->elfLogFont.lfPitchAndFamily = font16->elfLogFont.lfPitchAndFamily;
MultiByteToWideChar( CP_ACP, 0, font16->elfLogFont.lfFaceName, -1,
font32->elfLogFont.lfFaceName, LF_FACESIZE );
font32->elfLogFont.lfFaceName[LF_FACESIZE-1] = 0;
MultiByteToWideChar( CP_ACP, 0, font16->elfFullName, -1, font32->elfFullName, LF_FULLFACESIZE );
font32->elfFullName[LF_FULLFACESIZE-1] = 0;
MultiByteToWideChar( CP_ACP, 0, font16->elfStyle, -1, font32->elfStyle, LF_FACESIZE );
font32->elfStyle[LF_FACESIZE-1] = 0;
}
/***********************************************************************
* WIN16DRV_GetTextExtentPoint
*/
@ -69,7 +122,7 @@ BOOL WIN16DRV_GetTextMetrics( PHYSDEV dev, TEXTMETRICW *metrics )
TRACE("%04x \n", physDev->hdc);
FONT_TextMetric16ToW( &physDev->tm, metrics );
*metrics = physDev->tm;
TRACE(
"H %ld, A %ld, D %ld, Int %ld, Ext %ld, AW %ld, MW %ld, W %ld\n",
@ -130,8 +183,7 @@ HFONT WIN16DRV_SelectFont( PHYSDEV dev, HFONT hfont)
#define fi physDev->FontInfo
physDev->tm.tmHeight = YDSTOLS(dc, fi->dfPixHeight);
physDev->tm.tmAscent = YDSTOLS(dc, fi->dfAscent);
physDev->tm.tmDescent = physDev->tm.tmHeight -
physDev->tm.tmAscent;
physDev->tm.tmDescent = physDev->tm.tmHeight - physDev->tm.tmAscent;
physDev->tm.tmInternalLeading = YDSTOLS(dc, fi->dfInternalLeading);
physDev->tm.tmExternalLeading = YDSTOLS(dc, fi->dfExternalLeading);
physDev->tm.tmAveCharWidth = XDSTOLS(dc, fi->dfAvgWidth);
@ -151,7 +203,7 @@ HFONT WIN16DRV_SelectFont( PHYSDEV dev, HFONT hfont)
physDev->tm.tmCharSet = fi->dfCharSet;
#undef fi
TRACE("H %d, A %d, D %d, Int %d, Ext %d, AW %d, MW %d, W %d\n",
TRACE("H %ld, A %ld, D %ld, Int %ld, Ext %ld, AW %ld, MW %ld, W %ld\n",
physDev->tm.tmHeight,
physDev->tm.tmAscent,
physDev->tm.tmDescent,
@ -236,24 +288,15 @@ WORD WINAPI EnumCallback16(LPENUMLOGFONT16 lpLogFont,
WORD wFontType, LONG lpClientData)
{
ENUMLOGFONTEXW lfW;
ENUMLOGFONTEX16 lf16;
NEWTEXTMETRICEXW tmW;
NEWTEXTMETRICEX16 tm16;
TRACE("In EnumCallback16 plf=%p\n", lpLogFont);
/* we have a ENUMLOGFONT16 which is a subset of ENUMLOGFONTEX16,
so we copy it into one of these and then convert to ENUMLOGFONTEXW */
memset(&lfW, 0, sizeof(lfW));
WIN16DRV_EnumLogFont16ToW(lpLogFont, (ENUMLOGFONTW *)&lfW);
memset(&lf16, 0, sizeof(lf16));
memcpy(&lf16, lpLogFont, sizeof(*lpLogFont));
FONT_EnumLogFontEx16ToW(&lf16, &lfW);
/* and a similar idea for NEWTEXTMETRIC16 */
memset(&tm16, 0, sizeof(tm16));
memcpy(&tm16, lpTextMetrics, sizeof(*lpTextMetrics));
FONT_NewTextMetricEx16ToW(&tm16, &tmW);
memset(&tmW, 0, sizeof(tmW));
WIN16DRV_NewTextMetric16ToW(lpTextMetrics, (NEWTEXTMETRICW *)&tmW);
return (*(((WEPFC *)lpClientData)->proc))( &lfW, &tmW, wFontType,
((WEPFC *)lpClientData)->lp );

View File

@ -201,7 +201,7 @@ typedef struct
{
SEGPTR segptrPDEVICE; /* PDEVICE used by 16 bit printer drivers */
LOGFONT16 lf; /* Current font details */
TEXTMETRIC16 tm; /* Current font metrics */
TEXTMETRICW tm; /* Current font metrics */
LPFONTINFO16 FontInfo; /* Current font realized by printer driver */
LPLOGBRUSH16 BrushInfo; /* Current brush realized by printer driver */
LPLOGPEN16 PenInfo; /* Current pen realized by printer driver */

View File

@ -217,9 +217,6 @@ static BOOL process_attach(void)
if ((instance = LoadLibrary16( "USER.EXE" )) < 32) return FALSE;
USER_HeapSel = instance | 7;
/* Global atom table initialisation */
if (!ATOM_Init( USER_HeapSel )) return FALSE;
/* Load the graphics driver */
tweak_init();
if (!load_driver()) return FALSE;

View File

@ -432,7 +432,7 @@ static void X11DRV_TextExtents_normal( fontObject* pfo, XChar2b* pstr, int count
*pwidth = info.width;
}
static void X11DRV_GetTextMetricsA_normal( fontObject* pfo, LPTEXTMETRICA pTM )
static void X11DRV_GetTextMetricsW_normal( fontObject* pfo, LPTEXTMETRICW pTM )
{
LPIFONTINFO16 pdf = &pfo->fi->df;
@ -611,7 +611,7 @@ void X11DRV_TextExtents_dbcs_2fonts( fontObject* pfo, XChar2b* pstr, int count,
*pwidth = width;
}
static void X11DRV_GetTextMetricsA_cp932( fontObject* pfo, LPTEXTMETRICA pTM )
static void X11DRV_GetTextMetricsW_cp932( fontObject* pfo, LPTEXTMETRICW pTM )
{
fontObject* pfo_ansi = XFONT_GetFontObject( pfo->prefobjs[0] );
LPIFONTINFO16 pdf = &pfo->fi->df;
@ -691,7 +691,7 @@ const X11DRV_CP X11DRV_cptable[X11DRV_CPTABLE_COUNT] =
X11DRV_TextWidth_normal,
X11DRV_DrawText_normal,
X11DRV_TextExtents_normal,
X11DRV_GetTextMetricsA_normal,
X11DRV_GetTextMetricsW_normal,
},
{ /* UNICODE */
X11DRV_enum_subfont_charset_normal,
@ -700,7 +700,7 @@ const X11DRV_CP X11DRV_cptable[X11DRV_CPTABLE_COUNT] =
X11DRV_TextWidth_normal,
X11DRV_DrawText_normal,
X11DRV_TextExtents_normal,
X11DRV_GetTextMetricsA_normal,
X11DRV_GetTextMetricsW_normal,
},
{ /* CP932 */
X11DRV_enum_subfont_charset_cp932,
@ -709,7 +709,7 @@ const X11DRV_CP X11DRV_cptable[X11DRV_CPTABLE_COUNT] =
X11DRV_TextWidth_dbcs_2fonts,
X11DRV_DrawText_dbcs_2fonts,
X11DRV_TextExtents_dbcs_2fonts,
X11DRV_GetTextMetricsA_cp932,
X11DRV_GetTextMetricsW_cp932,
},
{ /* CP936 */
X11DRV_enum_subfont_charset_cp936,
@ -718,7 +718,7 @@ const X11DRV_CP X11DRV_cptable[X11DRV_CPTABLE_COUNT] =
X11DRV_TextWidth_dbcs_2fonts,
X11DRV_DrawText_dbcs_2fonts,
X11DRV_TextExtents_dbcs_2fonts,
X11DRV_GetTextMetricsA_normal, /* FIXME */
X11DRV_GetTextMetricsW_normal, /* FIXME */
},
{ /* CP949 */
X11DRV_enum_subfont_charset_cp949,
@ -727,7 +727,7 @@ const X11DRV_CP X11DRV_cptable[X11DRV_CPTABLE_COUNT] =
X11DRV_TextWidth_dbcs_2fonts,
X11DRV_DrawText_dbcs_2fonts,
X11DRV_TextExtents_dbcs_2fonts,
X11DRV_GetTextMetricsA_normal, /* FIXME */
X11DRV_GetTextMetricsW_normal, /* FIXME */
},
{ /* CP950 */
X11DRV_enum_subfont_charset_cp950,
@ -736,7 +736,7 @@ const X11DRV_CP X11DRV_cptable[X11DRV_CPTABLE_COUNT] =
X11DRV_TextWidth_dbcs_2fonts,
X11DRV_DrawText_dbcs_2fonts,
X11DRV_TextExtents_dbcs_2fonts,
X11DRV_GetTextMetricsA_cp932,
X11DRV_GetTextMetricsW_cp932,
},
{ /* SYMBOL */
X11DRV_enum_subfont_charset_normal,
@ -745,6 +745,6 @@ const X11DRV_CP X11DRV_cptable[X11DRV_CPTABLE_COUNT] =
X11DRV_TextWidth_normal,
X11DRV_DrawText_normal,
X11DRV_TextExtents_normal,
X11DRV_GetTextMetricsA_normal,
X11DRV_GetTextMetricsW_normal,
}
};

View File

@ -133,6 +133,37 @@ XImage *X11DRV_DIB_CreateXImage( int width, int height, int depth )
}
/***********************************************************************
* DIB_GetBitmapInfo
*
* Get the info from a bitmap header.
* Return 1 for INFOHEADER, 0 for COREHEADER, -1 for error.
*/
static int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, DWORD *width,
int *height, WORD *bpp, WORD *compr )
{
if (header->biSize == sizeof(BITMAPCOREHEADER))
{
BITMAPCOREHEADER *core = (BITMAPCOREHEADER *)header;
*width = core->bcWidth;
*height = core->bcHeight;
*bpp = core->bcBitCount;
*compr = 0;
return 0;
}
if (header->biSize >= sizeof(BITMAPINFOHEADER))
{
*width = header->biWidth;
*height = header->biHeight;
*bpp = header->biBitCount;
*compr = header->biCompression;
return 1;
}
ERR("(%ld): unknown/wrong size for header\n", header->biSize );
return -1;
}
/***********************************************************************
* X11DRV_DIB_GenColorMap
*

View File

@ -377,6 +377,27 @@ inline static BOOL is_stock_font( HFONT font )
}
static void FONT_LogFontWTo16( const LOGFONTW* font32, LPLOGFONT16 font16 )
{
font16->lfHeight = font32->lfHeight;
font16->lfWidth = font32->lfWidth;
font16->lfEscapement = font32->lfEscapement;
font16->lfOrientation = font32->lfOrientation;
font16->lfWeight = font32->lfWeight;
font16->lfItalic = font32->lfItalic;
font16->lfUnderline = font32->lfUnderline;
font16->lfStrikeOut = font32->lfStrikeOut;
font16->lfCharSet = font32->lfCharSet;
font16->lfOutPrecision = font32->lfOutPrecision;
font16->lfClipPrecision = font32->lfClipPrecision;
font16->lfQuality = font32->lfQuality;
font16->lfPitchAndFamily = font32->lfPitchAndFamily;
WideCharToMultiByte( CP_ACP, 0, font32->lfFaceName, -1,
font16->lfFaceName, LF_FACESIZE, NULL, NULL );
font16->lfFaceName[LF_FACESIZE-1] = 0;
}
/***********************************************************************
* Checksums
*/
@ -3326,17 +3347,17 @@ BOOL X11DRV_EnumDeviceFonts( X11DRV_PDEVICE *physDev, LPLOGFONTW plf,
NEWTEXTMETRICEXW tm;
fontResource* pfr = fontList;
BOOL b, bRet = 0;
LOGFONT16 lf16;
/* don't enumerate x11 fonts if we're using client side fonts */
if (physDev->dc->gdiFont) return FALSE;
FONT_LogFontWTo16(plf, &lf16);
if( lf16.lfFaceName[0] )
if( plf->lfFaceName[0] )
{
char facename[LF_FACESIZE+1];
WideCharToMultiByte( CP_ACP, 0, plf->lfFaceName, -1,
facename, sizeof(facename), NULL, NULL );
/* enum all entries in this resource */
pfr = XFONT_FindFIList( pfr, lf16.lfFaceName );
pfr = XFONT_FindFIList( pfr, facename );
if( pfr )
{
fontInfo* pfi;
@ -3346,8 +3367,8 @@ BOOL X11DRV_EnumDeviceFonts( X11DRV_PDEVICE *physDev, LPLOGFONTW plf,
release the crit section, font list will
have to be retraversed on return */
if(lf16.lfCharSet == DEFAULT_CHARSET ||
lf16.lfCharSet == pfi->df.dfCharSet) {
if(plf->lfCharSet == DEFAULT_CHARSET ||
plf->lfCharSet == pfi->df.dfCharSet) {
if( (b = (*proc)( &lf, &tm,
XFONT_GetFontMetric( pfi, &lf, &tm ), lp )) )
bRet = b;
@ -3376,13 +3397,10 @@ BOOL X11DRV_EnumDeviceFonts( X11DRV_PDEVICE *physDev, LPLOGFONTW plf,
*/
BOOL X11DRV_GetTextMetrics(X11DRV_PDEVICE *physDev, TEXTMETRICW *metrics)
{
TEXTMETRICA tmA;
if( CHECK_PFONT(physDev->font) )
{
fontObject* pfo = __PFONT(physDev->font);
X11DRV_cptable[pfo->fi->cptable].pGetTextMetricsA( pfo, &tmA );
FONT_TextMetricAToW(&tmA, metrics);
X11DRV_cptable[pfo->fi->cptable].pGetTextMetricsW( pfo, metrics );
return TRUE;
}
return FALSE;

View File

@ -40,7 +40,6 @@ typedef struct tagBITMAPOBJ
} BITMAPOBJ;
/* objects/bitmap.c */
extern INT BITMAP_GetWidthBytes( INT width, INT depth );
extern HBITMAP BITMAP_CopyBitmap( HBITMAP hbitmap );
extern BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, DC *dc );
@ -48,8 +47,6 @@ extern BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, DC *dc );
extern int DIB_GetDIBWidthBytes( int width, int depth );
extern int DIB_GetDIBImageBytes( int width, int height, int depth );
extern int DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse );
extern int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, DWORD *width,
int *height, WORD *bpp, WORD *compr );
extern HBITMAP DIB_CreateDIBSection( HDC hdc, BITMAPINFO *bmi, UINT usage, LPVOID *bits,
HANDLE section, DWORD offset, DWORD ovr_pitch );
extern void DIB_UpdateDIBSection( DC *dc, BOOL toDIB );

View File

@ -24,18 +24,6 @@
#include "gdi.h"
extern BOOL FONT_Init( UINT16* pTextCaps );
extern void FONT_LogFontATo16( const LOGFONTA* font32, LPLOGFONT16 font16 );
extern void FONT_LogFontWTo16( const LOGFONTW* font32, LPLOGFONT16 font16 );
extern void FONT_LogFont16ToA( const LOGFONT16* font16, LPLOGFONTA font32 );
extern void FONT_LogFont16ToW( const LOGFONT16* font16, LPLOGFONTW font32 );
extern void FONT_TextMetricATo16(const TEXTMETRICA *ptm32, LPTEXTMETRIC16 ptm16 );
extern void FONT_TextMetricWTo16(const TEXTMETRICW *ptm32, LPTEXTMETRIC16 ptm16 );
extern void FONT_TextMetric16ToA(const TEXTMETRIC16 *ptm16, LPTEXTMETRICA ptm32 );
extern void FONT_TextMetric16ToW(const TEXTMETRIC16 *ptm16, LPTEXTMETRICW ptm32 );
extern void FONT_TextMetricAToW(const TEXTMETRICA *ptm32A, LPTEXTMETRICW ptm32W );
extern void FONT_NewTextMetricEx16ToW(const NEWTEXTMETRICEX16*, LPNEWTEXTMETRICEXW);
extern void FONT_EnumLogFontEx16ToW(const ENUMLOGFONTEX16*, LPENUMLOGFONTEXW);
extern LPWSTR FONT_mbtowc(HDC, LPCSTR, INT, INT*, UINT*);
extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID);

View File

@ -453,7 +453,6 @@ extern HMETAFILE16 MF_Create_HMETAFILE16(METAHEADER *mh);
extern METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mr, LPCSTR filename);
/* region.c */
extern HRGN REGION_CropRgn( HRGN hDst, HRGN hSrc, const RECT *lpRect, const POINT *lpPt );
extern BOOL REGION_FrameRgn( HRGN dest, HRGN src, INT x, INT y );
#define WINE_GGO_GRAY16_BITMAP 0x7f

View File

@ -37,7 +37,4 @@ typedef BOOL (*HANDLERPROC)(LPVOID, LPCVOID);
extern BOOL VIRTUAL_SetFaultHandler(LPCVOID addr, HANDLERPROC proc, LPVOID arg);
extern DWORD VIRTUAL_HandleFault(LPCVOID addr);
/* memory/atom.c */
extern BOOL ATOM_Init( WORD globalTableSel );
#endif /* __WINE_GLOBAL_H */

View File

@ -264,7 +264,7 @@ typedef struct tagX11DRV_CP
void (*pTextExtents)( fontObject* pfo, XChar2b* pstr, int count,
int* pdir, int* pascent, int* pdescent,
int* pwidth );
void (*pGetTextMetricsA)( fontObject* pfo, LPTEXTMETRICA pTM );
void (*pGetTextMetricsW)( fontObject* pfo, LPTEXTMETRICW pTM );
} X11DRV_CP;
extern const X11DRV_CP X11DRV_cptable[X11DRV_CPTABLE_COUNT];

View File

@ -67,19 +67,6 @@ typedef struct
HANDLE16 entries[1];
} ATOMTABLE;
static WORD ATOM_UserDS = 0; /* USER data segment */
/***********************************************************************
* ATOM_Init
*
* Global table initialisation.
*/
BOOL ATOM_Init( WORD globalTableSel )
{
ATOM_UserDS = globalTableSel;
return TRUE;
}
/***********************************************************************
* ATOM_GetTable
@ -200,18 +187,6 @@ WORD WINAPI InitAtomTable16( WORD entries )
HANDLE16 handle;
ATOMTABLE *table;
/* We consider the first table to be initialized as the global table.
* This works, as USER (both built-in and native) is the first one to
* register ...
*/
if (!ATOM_UserDS)
{
ATOM_UserDS = CURRENT_DS;
/* return dummy local handle */
return LocalAlloc16( LMEM_FIXED, 1 );
}
/* Allocate the table */
if (!entries) entries = DEFAULT_ATOMTABLE_SIZE; /* sanity check */
@ -268,7 +243,6 @@ ATOM WINAPI AddAtom16( LPCSTR str )
len = strlen( buffer );
if (!(table = ATOM_GetTable( TRUE ))) return 0;
if (CURRENT_DS == ATOM_UserDS) return GlobalAddAtomA( str );
hash = ATOM_Hash( table->size, buffer, len );
entry = table->entries[hash];
@ -314,7 +288,6 @@ ATOM WINAPI DeleteAtom16( ATOM atom )
WORD hash;
if (atom < MAXINTATOM) return 0; /* Integer atom */
if (CURRENT_DS == ATOM_UserDS) return GlobalDeleteAtom( atom );
TRACE("0x%x\n",atom);
@ -352,8 +325,6 @@ ATOM WINAPI FindAtom16( LPCSTR str )
HANDLE16 entry;
int len;
if (CURRENT_DS == ATOM_UserDS) return GlobalFindAtomA( str );
TRACE("%s\n",debugstr_a(str));
if (ATOM_IsIntAtomA( str, &iatom )) return iatom;
@ -389,8 +360,6 @@ UINT16 WINAPI GetAtomName16( ATOM atom, LPSTR buffer, INT16 count )
UINT len;
char text[8];
if (CURRENT_DS == ATOM_UserDS) return GlobalGetAtomNameA( atom, buffer, count );
TRACE("%x\n",atom);
if (!count) return 0;

View File

@ -53,7 +53,7 @@ static const struct gdi_obj_funcs bitmap_funcs =
* Return number of bytes taken by a scanline of 16-bit aligned Windows DDB
* data.
*/
INT BITMAP_GetWidthBytes( INT bmWidth, INT bpp )
static INT BITMAP_GetWidthBytes( INT bmWidth, INT bpp )
{
switch(bpp)
{

View File

@ -103,7 +103,7 @@ int DIB_BitmapInfoSize( const BITMAPINFO * info, WORD coloruse )
* Return 1 for INFOHEADER, 0 for COREHEADER,
* 4 for V4HEADER, 5 for V5HEADER, -1 for error.
*/
int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, DWORD *width,
static int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, DWORD *width,
int *height, WORD *bpp, WORD *compr )
{
if (header->biSize == sizeof(BITMAPINFOHEADER))

View File

@ -135,25 +135,7 @@ extern WORD CALLBACK FONT_CallTo16_word_llwl(FONTENUMPROCEX16,LONG,LONG,WORD,LON
/***********************************************************************
* LOGFONT conversion functions.
*/
void FONT_LogFontATo16( const LOGFONTA* font32, LPLOGFONT16 font16 )
{
font16->lfHeight = font32->lfHeight;
font16->lfWidth = font32->lfWidth;
font16->lfEscapement = font32->lfEscapement;
font16->lfOrientation = font32->lfOrientation;
font16->lfWeight = font32->lfWeight;
font16->lfItalic = font32->lfItalic;
font16->lfUnderline = font32->lfUnderline;
font16->lfStrikeOut = font32->lfStrikeOut;
font16->lfCharSet = font32->lfCharSet;
font16->lfOutPrecision = font32->lfOutPrecision;
font16->lfClipPrecision = font32->lfClipPrecision;
font16->lfQuality = font32->lfQuality;
font16->lfPitchAndFamily = font32->lfPitchAndFamily;
lstrcpynA( font16->lfFaceName, font32->lfFaceName, LF_FACESIZE );
}
void FONT_LogFontWTo16( const LOGFONTW* font32, LPLOGFONT16 font16 )
static void FONT_LogFontWTo16( const LOGFONTW* font32, LPLOGFONT16 font16 )
{
font16->lfHeight = font32->lfHeight;
font16->lfWidth = font32->lfWidth;
@ -173,25 +155,7 @@ void FONT_LogFontWTo16( const LOGFONTW* font32, LPLOGFONT16 font16 )
font16->lfFaceName[LF_FACESIZE-1] = 0;
}
void FONT_LogFont16ToA( const LOGFONT16 *font16, LPLOGFONTA font32 )
{
font32->lfHeight = font16->lfHeight;
font32->lfWidth = font16->lfWidth;
font32->lfEscapement = font16->lfEscapement;
font32->lfOrientation = font16->lfOrientation;
font32->lfWeight = font16->lfWeight;
font32->lfItalic = font16->lfItalic;
font32->lfUnderline = font16->lfUnderline;
font32->lfStrikeOut = font16->lfStrikeOut;
font32->lfCharSet = font16->lfCharSet;
font32->lfOutPrecision = font16->lfOutPrecision;
font32->lfClipPrecision = font16->lfClipPrecision;
font32->lfQuality = font16->lfQuality;
font32->lfPitchAndFamily = font16->lfPitchAndFamily;
lstrcpynA( font32->lfFaceName, font16->lfFaceName, LF_FACESIZE );
}
void FONT_LogFont16ToW( const LOGFONT16 *font16, LPLOGFONTW font32 )
static void FONT_LogFont16ToW( const LOGFONT16 *font16, LPLOGFONTW font32 )
{
font32->lfHeight = font16->lfHeight;
font32->lfWidth = font16->lfWidth;
@ -210,41 +174,21 @@ void FONT_LogFont16ToW( const LOGFONT16 *font16, LPLOGFONTW font32 )
font32->lfFaceName[LF_FACESIZE-1] = 0;
}
void FONT_LogFontAToW( const LOGFONTA *fontA, LPLOGFONTW fontW )
static void FONT_LogFontAToW( const LOGFONTA *fontA, LPLOGFONTW fontW )
{
memcpy(fontW, fontA, sizeof(LOGFONTA) - LF_FACESIZE);
MultiByteToWideChar(CP_ACP, 0, fontA->lfFaceName, -1, fontW->lfFaceName,
LF_FACESIZE);
}
void FONT_LogFontWToA( const LOGFONTW *fontW, LPLOGFONTA fontA )
static void FONT_LogFontWToA( const LOGFONTW *fontW, LPLOGFONTA fontA )
{
memcpy(fontA, fontW, sizeof(LOGFONTA) - LF_FACESIZE);
WideCharToMultiByte(CP_ACP, 0, fontW->lfFaceName, -1, fontA->lfFaceName,
LF_FACESIZE, NULL, NULL);
}
void FONT_EnumLogFontEx16ToA( const ENUMLOGFONTEX16 *font16, LPENUMLOGFONTEXA font32 )
{
FONT_LogFont16ToA( (LPLOGFONT16)font16, (LPLOGFONTA)font32);
lstrcpynA( font32->elfFullName, font16->elfFullName, LF_FULLFACESIZE );
lstrcpynA( font32->elfStyle, font16->elfStyle, LF_FACESIZE );
lstrcpynA( font32->elfScript, font16->elfScript, LF_FACESIZE );
}
void FONT_EnumLogFontEx16ToW( const ENUMLOGFONTEX16 *font16, LPENUMLOGFONTEXW font32 )
{
FONT_LogFont16ToW( (LPLOGFONT16)font16, (LPLOGFONTW)font32);
MultiByteToWideChar( CP_ACP, 0, font16->elfFullName, -1, font32->elfFullName, LF_FULLFACESIZE );
font32->elfFullName[LF_FULLFACESIZE-1] = 0;
MultiByteToWideChar( CP_ACP, 0, font16->elfStyle, -1, font32->elfStyle, LF_FACESIZE );
font32->elfStyle[LF_FACESIZE-1] = 0;
MultiByteToWideChar( CP_ACP, 0, font16->elfScript, -1, font32->elfScript, LF_FACESIZE );
font32->elfScript[LF_FACESIZE-1] = 0;
}
void FONT_EnumLogFontExWTo16( const ENUMLOGFONTEXW *fontW, LPENUMLOGFONTEX16 font16 )
static void FONT_EnumLogFontExWTo16( const ENUMLOGFONTEXW *fontW, LPENUMLOGFONTEX16 font16 )
{
FONT_LogFontWTo16( (LPLOGFONTW)fontW, (LPLOGFONT16)font16);
@ -259,7 +203,7 @@ void FONT_EnumLogFontExWTo16( const ENUMLOGFONTEXW *fontW, LPENUMLOGFONTEX16 fon
font16->elfScript[LF_FACESIZE-1] = '\0';
}
void FONT_EnumLogFontExWToA( const ENUMLOGFONTEXW *fontW, LPENUMLOGFONTEXA fontA )
static void FONT_EnumLogFontExWToA( const ENUMLOGFONTEXW *fontW, LPENUMLOGFONTEXA fontA )
{
FONT_LogFontWToA( (LPLOGFONTW)fontW, (LPLOGFONTA)fontA);
@ -277,127 +221,7 @@ void FONT_EnumLogFontExWToA( const ENUMLOGFONTEXW *fontW, LPENUMLOGFONTEXA fontA
/***********************************************************************
* TEXTMETRIC conversion functions.
*/
void FONT_TextMetricATo16(const TEXTMETRICA *ptm32, LPTEXTMETRIC16 ptm16 )
{
ptm16->tmHeight = ptm32->tmHeight;
ptm16->tmAscent = ptm32->tmAscent;
ptm16->tmDescent = ptm32->tmDescent;
ptm16->tmInternalLeading = ptm32->tmInternalLeading;
ptm16->tmExternalLeading = ptm32->tmExternalLeading;
ptm16->tmAveCharWidth = ptm32->tmAveCharWidth;
ptm16->tmMaxCharWidth = ptm32->tmMaxCharWidth;
ptm16->tmWeight = ptm32->tmWeight;
ptm16->tmOverhang = ptm32->tmOverhang;
ptm16->tmDigitizedAspectX = ptm32->tmDigitizedAspectX;
ptm16->tmDigitizedAspectY = ptm32->tmDigitizedAspectY;
ptm16->tmFirstChar = ptm32->tmFirstChar;
ptm16->tmLastChar = ptm32->tmLastChar;
ptm16->tmDefaultChar = ptm32->tmDefaultChar;
ptm16->tmBreakChar = ptm32->tmBreakChar;
ptm16->tmItalic = ptm32->tmItalic;
ptm16->tmUnderlined = ptm32->tmUnderlined;
ptm16->tmStruckOut = ptm32->tmStruckOut;
ptm16->tmPitchAndFamily = ptm32->tmPitchAndFamily;
ptm16->tmCharSet = ptm32->tmCharSet;
}
void FONT_TextMetricWTo16(const TEXTMETRICW *ptm32, LPTEXTMETRIC16 ptm16 )
{
ptm16->tmHeight = ptm32->tmHeight;
ptm16->tmAscent = ptm32->tmAscent;
ptm16->tmDescent = ptm32->tmDescent;
ptm16->tmInternalLeading = ptm32->tmInternalLeading;
ptm16->tmExternalLeading = ptm32->tmExternalLeading;
ptm16->tmAveCharWidth = ptm32->tmAveCharWidth;
ptm16->tmMaxCharWidth = ptm32->tmMaxCharWidth;
ptm16->tmWeight = ptm32->tmWeight;
ptm16->tmOverhang = ptm32->tmOverhang;
ptm16->tmDigitizedAspectX = ptm32->tmDigitizedAspectX;
ptm16->tmDigitizedAspectY = ptm32->tmDigitizedAspectY;
ptm16->tmFirstChar = ptm32->tmFirstChar;
ptm16->tmLastChar = ptm32->tmLastChar;
ptm16->tmDefaultChar = ptm32->tmDefaultChar;
ptm16->tmBreakChar = ptm32->tmBreakChar;
ptm16->tmItalic = ptm32->tmItalic;
ptm16->tmUnderlined = ptm32->tmUnderlined;
ptm16->tmStruckOut = ptm32->tmStruckOut;
ptm16->tmPitchAndFamily = ptm32->tmPitchAndFamily;
ptm16->tmCharSet = ptm32->tmCharSet;
}
void FONT_TextMetric16ToA(const TEXTMETRIC16 *ptm16, LPTEXTMETRICA ptm32 )
{
ptm32->tmHeight = ptm16->tmHeight;
ptm32->tmAscent = ptm16->tmAscent;
ptm32->tmDescent = ptm16->tmDescent;
ptm32->tmInternalLeading = ptm16->tmInternalLeading;
ptm32->tmExternalLeading = ptm16->tmExternalLeading;
ptm32->tmAveCharWidth = ptm16->tmAveCharWidth;
ptm32->tmMaxCharWidth = ptm16->tmMaxCharWidth;
ptm32->tmWeight = ptm16->tmWeight;
ptm32->tmOverhang = ptm16->tmOverhang;
ptm32->tmDigitizedAspectX = ptm16->tmDigitizedAspectX;
ptm32->tmDigitizedAspectY = ptm16->tmDigitizedAspectY;
ptm32->tmFirstChar = ptm16->tmFirstChar;
ptm32->tmLastChar = ptm16->tmLastChar;
ptm32->tmDefaultChar = ptm16->tmDefaultChar;
ptm32->tmBreakChar = ptm16->tmBreakChar;
ptm32->tmItalic = ptm16->tmItalic;
ptm32->tmUnderlined = ptm16->tmUnderlined;
ptm32->tmStruckOut = ptm16->tmStruckOut;
ptm32->tmPitchAndFamily = ptm16->tmPitchAndFamily;
ptm32->tmCharSet = ptm16->tmCharSet;
}
void FONT_TextMetric16ToW(const TEXTMETRIC16 *ptm16, LPTEXTMETRICW ptm32 )
{
ptm32->tmHeight = ptm16->tmHeight;
ptm32->tmAscent = ptm16->tmAscent;
ptm32->tmDescent = ptm16->tmDescent;
ptm32->tmInternalLeading = ptm16->tmInternalLeading;
ptm32->tmExternalLeading = ptm16->tmExternalLeading;
ptm32->tmAveCharWidth = ptm16->tmAveCharWidth;
ptm32->tmMaxCharWidth = ptm16->tmMaxCharWidth;
ptm32->tmWeight = ptm16->tmWeight;
ptm32->tmOverhang = ptm16->tmOverhang;
ptm32->tmDigitizedAspectX = ptm16->tmDigitizedAspectX;
ptm32->tmDigitizedAspectY = ptm16->tmDigitizedAspectY;
ptm32->tmFirstChar = ptm16->tmFirstChar;
ptm32->tmLastChar = ptm16->tmLastChar;
ptm32->tmDefaultChar = ptm16->tmDefaultChar;
ptm32->tmBreakChar = ptm16->tmBreakChar;
ptm32->tmItalic = ptm16->tmItalic;
ptm32->tmUnderlined = ptm16->tmUnderlined;
ptm32->tmStruckOut = ptm16->tmStruckOut;
ptm32->tmPitchAndFamily = ptm16->tmPitchAndFamily;
ptm32->tmCharSet = ptm16->tmCharSet;
}
void FONT_TextMetricAToW(const TEXTMETRICA *ptm32A, LPTEXTMETRICW ptm32W )
{
ptm32W->tmHeight = ptm32A->tmHeight;
ptm32W->tmAscent = ptm32A->tmAscent;
ptm32W->tmDescent = ptm32A->tmDescent;
ptm32W->tmInternalLeading = ptm32A->tmInternalLeading;
ptm32W->tmExternalLeading = ptm32A->tmExternalLeading;
ptm32W->tmAveCharWidth = ptm32A->tmAveCharWidth;
ptm32W->tmMaxCharWidth = ptm32A->tmMaxCharWidth;
ptm32W->tmWeight = ptm32A->tmWeight;
ptm32W->tmOverhang = ptm32A->tmOverhang;
ptm32W->tmDigitizedAspectX = ptm32A->tmDigitizedAspectX;
ptm32W->tmDigitizedAspectY = ptm32A->tmDigitizedAspectY;
ptm32W->tmFirstChar = ptm32A->tmFirstChar;
ptm32W->tmLastChar = ptm32A->tmLastChar;
ptm32W->tmDefaultChar = ptm32A->tmDefaultChar;
ptm32W->tmBreakChar = ptm32A->tmBreakChar;
ptm32W->tmItalic = ptm32A->tmItalic;
ptm32W->tmUnderlined = ptm32A->tmUnderlined;
ptm32W->tmStruckOut = ptm32A->tmStruckOut;
ptm32W->tmPitchAndFamily = ptm32A->tmPitchAndFamily;
ptm32W->tmCharSet = ptm32A->tmCharSet;
}
void FONT_TextMetricWToA(const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA )
static void FONT_TextMetricWToA(const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA )
{
ptmA->tmHeight = ptmW->tmHeight;
ptmA->tmAscent = ptmW->tmAscent;
@ -422,9 +246,28 @@ void FONT_TextMetricWToA(const TEXTMETRICW *ptmW, LPTEXTMETRICA ptmA )
}
void FONT_NewTextMetricExWTo16(const NEWTEXTMETRICEXW *ptmW, LPNEWTEXTMETRICEX16 ptm16 )
static void FONT_NewTextMetricExWTo16(const NEWTEXTMETRICEXW *ptmW, LPNEWTEXTMETRICEX16 ptm16 )
{
FONT_TextMetricWTo16((LPTEXTMETRICW)ptmW, (LPTEXTMETRIC16)ptm16);
ptm16->ntmTm.tmHeight = ptmW->ntmTm.tmHeight;
ptm16->ntmTm.tmAscent = ptmW->ntmTm.tmAscent;
ptm16->ntmTm.tmDescent = ptmW->ntmTm.tmDescent;
ptm16->ntmTm.tmInternalLeading = ptmW->ntmTm.tmInternalLeading;
ptm16->ntmTm.tmExternalLeading = ptmW->ntmTm.tmExternalLeading;
ptm16->ntmTm.tmAveCharWidth = ptmW->ntmTm.tmAveCharWidth;
ptm16->ntmTm.tmMaxCharWidth = ptmW->ntmTm.tmMaxCharWidth;
ptm16->ntmTm.tmWeight = ptmW->ntmTm.tmWeight;
ptm16->ntmTm.tmOverhang = ptmW->ntmTm.tmOverhang;
ptm16->ntmTm.tmDigitizedAspectX = ptmW->ntmTm.tmDigitizedAspectX;
ptm16->ntmTm.tmDigitizedAspectY = ptmW->ntmTm.tmDigitizedAspectY;
ptm16->ntmTm.tmFirstChar = ptmW->ntmTm.tmFirstChar;
ptm16->ntmTm.tmLastChar = ptmW->ntmTm.tmLastChar;
ptm16->ntmTm.tmDefaultChar = ptmW->ntmTm.tmDefaultChar;
ptm16->ntmTm.tmBreakChar = ptmW->ntmTm.tmBreakChar;
ptm16->ntmTm.tmItalic = ptmW->ntmTm.tmItalic;
ptm16->ntmTm.tmUnderlined = ptmW->ntmTm.tmUnderlined;
ptm16->ntmTm.tmStruckOut = ptmW->ntmTm.tmStruckOut;
ptm16->ntmTm.tmPitchAndFamily = ptmW->ntmTm.tmPitchAndFamily;
ptm16->ntmTm.tmCharSet = ptmW->ntmTm.tmCharSet;
ptm16->ntmTm.ntmFlags = ptmW->ntmTm.ntmFlags;
ptm16->ntmTm.ntmSizeEM = ptmW->ntmTm.ntmSizeEM;
ptm16->ntmTm.ntmCellHeight = ptmW->ntmTm.ntmCellHeight;
@ -432,7 +275,7 @@ void FONT_NewTextMetricExWTo16(const NEWTEXTMETRICEXW *ptmW, LPNEWTEXTMETRICEX16
memcpy(&ptm16->ntmFontSig, &ptmW->ntmFontSig, sizeof(FONTSIGNATURE));
}
void FONT_NewTextMetricExWToA(const NEWTEXTMETRICEXW *ptmW, LPNEWTEXTMETRICEXA ptmA )
static void FONT_NewTextMetricExWToA(const NEWTEXTMETRICEXW *ptmW, LPNEWTEXTMETRICEXA ptmA )
{
FONT_TextMetricWToA((LPTEXTMETRICW)ptmW, (LPTEXTMETRICA)ptmA);
ptmA->ntmTm.ntmFlags = ptmW->ntmTm.ntmFlags;
@ -442,17 +285,6 @@ void FONT_NewTextMetricExWToA(const NEWTEXTMETRICEXW *ptmW, LPNEWTEXTMETRICEXA p
memcpy(&ptmA->ntmFontSig, &ptmW->ntmFontSig, sizeof(FONTSIGNATURE));
}
void FONT_NewTextMetricEx16ToW(const NEWTEXTMETRICEX16 *ptm16, LPNEWTEXTMETRICEXW ptmW )
{
FONT_TextMetric16ToW((LPTEXTMETRIC16)ptm16, (LPTEXTMETRICW)ptmW);
ptmW->ntmTm.ntmFlags = ptm16->ntmTm.ntmFlags;
ptmW->ntmTm.ntmSizeEM = ptm16->ntmTm.ntmSizeEM;
ptmW->ntmTm.ntmCellHeight = ptm16->ntmTm.ntmCellHeight;
ptmW->ntmTm.ntmAvgWidth = ptm16->ntmTm.ntmAvgWidth;
memcpy(&ptmW->ntmFontSig, &ptm16->ntmFontSig, sizeof(FONTSIGNATURE));
}
/***********************************************************************
* CreateFontIndirectA (GDI32.@)
*/
@ -1907,7 +1739,6 @@ DWORD WINAPI GetKerningPairsW( HDC hDC, DWORD cPairs,
/*************************************************************************
* TranslateCharsetInfo [GDI32.@]
* TranslateCharsetInfo [USER32.@]
*
* Fills a CHARSETINFO structure for a character set, code page, or
* font. This allows making the correspondance between different labelings

View File

@ -2754,261 +2754,6 @@ INT WINAPI GetRandomRgn(HDC hDC, HRGN hRgn, DWORD dwCode)
return -1;
}
/***********************************************************************
* REGION_CropAndOffsetRegion
*/
static BOOL REGION_CropAndOffsetRegion(const POINT* off, const RECT *rect, WINEREGION *rgnSrc, WINEREGION* rgnDst)
{
if( !rect ) /* just copy and offset */
{
RECT *xrect;
if( rgnDst == rgnSrc )
{
if( off->x || off->y )
xrect = rgnDst->rects;
else
return TRUE;
}
else
xrect = HeapReAlloc( GetProcessHeap(), 0, rgnDst->rects,
rgnSrc->size * sizeof( RECT ));
if( xrect )
{
INT i;
if( rgnDst != rgnSrc )
memcpy( rgnDst, rgnSrc, sizeof( WINEREGION ));
if( off->x || off->y )
{
for( i = 0; i < rgnDst->numRects; i++ )
{
xrect[i].left = rgnSrc->rects[i].left + off->x;
xrect[i].right = rgnSrc->rects[i].right + off->x;
xrect[i].top = rgnSrc->rects[i].top + off->y;
xrect[i].bottom = rgnSrc->rects[i].bottom + off->y;
}
rgnDst->extents.left += off->x;
rgnDst->extents.right += off->x;
rgnDst->extents.top += off->y;
rgnDst->extents.bottom += off->y;
}
else
memcpy( xrect, rgnSrc->rects, rgnDst->numRects * sizeof(RECT));
rgnDst->rects = xrect;
} else
return FALSE;
}
else if ((rect->left >= rect->right) ||
(rect->top >= rect->bottom) ||
!EXTENTCHECK(rect, &rgnSrc->extents))
{
empty:
if( !rgnDst->rects )
{
rgnDst->rects = HeapAlloc(GetProcessHeap(), 0, RGN_DEFAULT_RECTS * sizeof( RECT ));
if( rgnDst->rects )
rgnDst->size = RGN_DEFAULT_RECTS;
else
return FALSE;
}
TRACE("cropped to empty!\n");
EMPTY_REGION(rgnDst);
}
else /* region box and clipping rect appear to intersect */
{
RECT *lpr;
INT i, j, clipa, clipb;
INT left = rgnSrc->extents.right + off->x;
INT right = rgnSrc->extents.left + off->x;
for( clipa = 0; rgnSrc->rects[clipa].bottom <= rect->top; clipa++ )
; /* skip bands above the clipping rectangle */
for( clipb = clipa; clipb < rgnSrc->numRects; clipb++ )
if( rgnSrc->rects[clipb].top >= rect->bottom )
break; /* and below it */
/* clipa - index of the first rect in the first intersecting band
* clipb - index of the last rect in the last intersecting band
*/
if((rgnDst != rgnSrc) && (rgnDst->size < (i = (clipb - clipa))))
{
rgnDst->rects = HeapReAlloc( GetProcessHeap(), 0,
rgnDst->rects, i * sizeof(RECT));
if( !rgnDst->rects ) return FALSE;
rgnDst->size = i;
}
if( TRACE_ON(region) )
{
REGION_DumpRegion( rgnSrc );
TRACE("\tclipa = %i, clipb = %i\n", clipa, clipb );
}
for( i = clipa, j = 0; i < clipb ; i++ )
{
/* i - src index, j - dst index, j is always <= i for obvious reasons */
lpr = rgnSrc->rects + i;
if( lpr->left < rect->right && lpr->right > rect->left )
{
rgnDst->rects[j].top = lpr->top + off->y;
rgnDst->rects[j].bottom = lpr->bottom + off->y;
rgnDst->rects[j].left = ((lpr->left > rect->left) ? lpr->left : rect->left) + off->x;
rgnDst->rects[j].right = ((lpr->right < rect->right) ? lpr->right : rect->right) + off->x;
if( rgnDst->rects[j].left < left ) left = rgnDst->rects[j].left;
if( rgnDst->rects[j].right > right ) right = rgnDst->rects[j].right;
j++;
}
}
if( j == 0 ) goto empty;
rgnDst->extents.left = left;
rgnDst->extents.right = right;
left = rect->top + off->y;
right = rect->bottom + off->y;
rgnDst->numRects = j--;
for( i = 0; i <= j; i++ ) /* fixup top band */
if( rgnDst->rects[i].top < left )
rgnDst->rects[i].top = left;
else
break;
for( i = j; i >= 0; i-- ) /* fixup bottom band */
if( rgnDst->rects[i].bottom > right )
rgnDst->rects[i].bottom = right;
else
break;
rgnDst->extents.top = rgnDst->rects[0].top;
rgnDst->extents.bottom = rgnDst->rects[j].bottom;
if( TRACE_ON(region) )
{
TRACE("result:\n");
REGION_DumpRegion( rgnDst );
}
}
return TRUE;
}
/***********************************************************************
* REGION_CropRgn
*
*
* hSrc: Region to crop and offset.
* lpRect: Clipping rectangle. Can be NULL (no clipping).
* lpPt: Points to offset the cropped region. Can be NULL (no offset).
*
* hDst: Region to hold the result (a new region is created if it's 0).
* Allowed to be the same region as hSrc in which case everything
* will be done in place, with no memory reallocations.
*
* Returns: hDst if success, 0 otherwise.
*/
HRGN REGION_CropRgn( HRGN hDst, HRGN hSrc, const RECT *lpRect, const POINT *lpPt )
{
/* Optimization of the following generic code:
HRGN h;
if( lpRect )
h = CreateRectRgn( lpRect->left, lpRect->top, lpRect->right, lpRect->bottom );
else
h = CreateRectRgn( 0, 0, 0, 0 );
if( hDst == 0 ) hDst = h;
if( lpRect )
CombineRgn( hDst, hSrc, h, RGN_AND );
else
CombineRgn( hDst, hSrc, 0, RGN_COPY );
if( lpPt )
OffsetRgn( hDst, lpPt->x, lpPt->y );
if( hDst != h )
DeleteObject( h );
return hDst;
*/
RGNOBJ *objSrc = (RGNOBJ *) GDI_GetObjPtr( hSrc, REGION_MAGIC );
if(objSrc)
{
RGNOBJ *objDst;
WINEREGION *rgnDst;
if( hDst )
{
if (!(objDst = (RGNOBJ *) GDI_GetObjPtr( hDst, REGION_MAGIC )))
{
hDst = 0;
goto done;
}
rgnDst = objDst->rgn;
}
else
{
if ((rgnDst = HeapAlloc(GetProcessHeap(), 0, sizeof( WINEREGION ))))
{
rgnDst->size = rgnDst->numRects = 0;
rgnDst->rects = NULL; /* back end will allocate exact number */
}
}
if( rgnDst )
{
POINT pt = { 0, 0 };
if( !lpPt ) lpPt = &pt;
if( lpRect )
TRACE("src %p -> dst %p (%i,%i)-(%i,%i) by (%li,%li)\n", objSrc->rgn, rgnDst,
lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, lpPt->x, lpPt->y );
else
TRACE("src %p -> dst %p by (%li,%li)\n", objSrc->rgn, rgnDst, lpPt->x, lpPt->y );
if( REGION_CropAndOffsetRegion( lpPt, lpRect, objSrc->rgn, rgnDst ) == FALSE )
{
if( hDst ) /* existing rgn */
{
GDI_ReleaseObj(hDst);
hDst = 0;
goto done;
}
goto fail;
}
else if( hDst == 0 )
{
if (!(objDst = GDI_AllocObject( sizeof(RGNOBJ), REGION_MAGIC,
&hDst, &region_funcs )))
{
fail:
if( rgnDst->rects )
HeapFree( GetProcessHeap(), 0, rgnDst->rects );
HeapFree( GetProcessHeap(), 0, rgnDst );
goto done;
}
objDst->rgn = rgnDst;
}
GDI_ReleaseObj(hDst);
}
else hDst = 0;
done:
GDI_ReleaseObj(hSrc);
return hDst;
}
return 0;
}
/***********************************************************************
* GetMetaRgn (GDI32.@)

View File

@ -62,7 +62,7 @@
#include "winerror.h"
#include "msvcrt/excpt.h"
WINE_DECLARE_DEBUG_CHANNEL(cursor);
WINE_DEFAULT_DEBUG_CHANNEL(cursor);
WINE_DECLARE_DEBUG_CHANNEL(icon);
WINE_DECLARE_DEBUG_CHANNEL(resource);
@ -123,6 +123,37 @@ static void *map_fileW( LPCWSTR name )
}
/***********************************************************************
* get_bitmap_width_bytes
*
* Return number of bytes taken by a scanline of 16-bit aligned Windows DDB
* data.
*/
static int get_bitmap_width_bytes( int width, int bpp )
{
switch(bpp)
{
case 1:
return 2 * ((width+15) / 16);
case 4:
return 2 * ((width+3) / 4);
case 24:
width *= 3;
/* fall through */
case 8:
return width + (width & 1);
case 16:
case 15:
return width * 2;
case 32:
return width * 4;
default:
WARN("Unknown depth %d, please report.\n", bpp );
}
return -1;
}
/**********************************************************************
* CURSORICON_FindSharedIcon
*/
@ -1157,9 +1188,9 @@ HGLOBAL16 WINAPI CreateCursorIconIndirect16( HINSTANCE16 hInstance,
hInstance = GetExePtr( hInstance ); /* Make it a module handle */
if (!lpXORbits || !lpANDbits || info->bPlanes != 1) return 0;
info->nWidthBytes = BITMAP_GetWidthBytes(info->nWidth,info->bBitsPerPixel);
info->nWidthBytes = get_bitmap_width_bytes(info->nWidth,info->bBitsPerPixel);
sizeXor = info->nHeight * info->nWidthBytes;
sizeAnd = info->nHeight * BITMAP_GetWidthBytes( info->nWidth, 1 );
sizeAnd = info->nHeight * get_bitmap_width_bytes( info->nWidth, 1 );
if (!(handle = GlobalAlloc16( GMEM_MOVEABLE,
sizeof(CURSORICONINFO) + sizeXor + sizeAnd)))
return 0;
@ -1301,7 +1332,7 @@ BOOL WINAPI DrawIcon( HDC hdc, INT x, INT y, HICON hIcon )
(char *)(ptr+1) );
hXorBits = CreateBitmap( ptr->nWidth, ptr->nHeight, ptr->bPlanes,
ptr->bBitsPerPixel, (char *)(ptr + 1)
+ ptr->nHeight * BITMAP_GetWidthBytes(ptr->nWidth,1) );
+ ptr->nHeight * get_bitmap_width_bytes(ptr->nWidth,1) );
oldFg = SetTextColor( hdc, RGB(0,0,0) );
oldBg = SetBkColor( hdc, RGB(255,255,255) );
@ -1345,7 +1376,7 @@ DWORD WINAPI DumpIcon16( SEGPTR pInfo, WORD *lpLen,
if (!info) return 0;
sizeXor = info->nHeight * info->nWidthBytes;
sizeAnd = info->nHeight * BITMAP_GetWidthBytes( info->nWidth, 1 );
sizeAnd = info->nHeight * get_bitmap_width_bytes( info->nWidth, 1 );
if (lpAndBits) *lpAndBits = pInfo + sizeof(CURSORICONINFO);
if (lpXorBits) *lpXorBits = pInfo + sizeof(CURSORICONINFO) + sizeAnd;
if (lpLen) *lpLen = sizeof(CURSORICONINFO) + sizeAnd + sizeXor;
@ -1737,7 +1768,7 @@ BOOL WINAPI GetIconInfo(HICON hIcon,PICONINFO iconinfo) {
ciconinfo->bPlanes, ciconinfo->bBitsPerPixel,
(char *)(ciconinfo + 1)
+ ciconinfo->nHeight *
BITMAP_GetWidthBytes (ciconinfo->nWidth,1) );
get_bitmap_width_bytes (ciconinfo->nWidth,1) );
iconinfo->hbmMask = CreateBitmap ( ciconinfo->nWidth, ciconinfo->nHeight,
1, 1, (char *)(ciconinfo + 1));
@ -1900,7 +1931,7 @@ BOOL WINAPI DrawIconEx( HDC hdc, INT x0, INT y0, HICON hIcon,
ptr->bPlanes, ptr->bBitsPerPixel,
(char *)(ptr + 1)
+ ptr->nHeight *
BITMAP_GetWidthBytes(ptr->nWidth,1) );
get_bitmap_width_bytes(ptr->nWidth,1) );
hAndBits = CreateBitmap ( ptr->nWidth, ptr->nHeight,
1, 1, (char *)(ptr+1) );
oldFg = SetTextColor( hdc, RGB(0,0,0) );
@ -2224,7 +2255,21 @@ HICON WINAPI CopyImage( HANDLE hnd, UINT type, INT desiredx,
switch (type)
{
case IMAGE_BITMAP:
return BITMAP_CopyBitmap(hnd);
{
HBITMAP res;
BITMAP bm;
if (!GetObjectW( hnd, sizeof(bm), &bm )) return 0;
bm.bmBits = NULL;
if ((res = CreateBitmapIndirect(&bm)))
{
char *buf = HeapAlloc( GetProcessHeap(), 0, bm.bmWidthBytes * bm.bmHeight );
GetBitmapBits( hnd, bm.bmWidthBytes * bm.bmHeight, buf );
SetBitmapBits( res, bm.bmWidthBytes * bm.bmHeight, buf );
HeapFree( GetProcessHeap(), 0, buf );
}
return res;
}
case IMAGE_ICON:
return CURSORICON_ExtCopy(hnd,type, desiredx, desiredy, flags);
case IMAGE_CURSOR:

View File

@ -92,6 +92,28 @@ static void add_paint_count( HWND hwnd, int incr )
}
/***********************************************************************
* crop_rgn
*
* hSrc: Region to crop.
* lpRect: Clipping rectangle.
*
* hDst: Region to hold the result (a new region is created if it's 0).
* Allowed to be the same region as hSrc in which case everything
* will be done in place, with no memory reallocations.
*
* Returns: hDst if success, 0 otherwise.
*/
static HRGN crop_rgn( HRGN hDst, HRGN hSrc, const RECT *rect )
{
HRGN h = CreateRectRgnIndirect( rect );
if (hDst == 0) hDst = h;
CombineRgn( hDst, hSrc, h, RGN_AND );
if (hDst != h) DeleteObject( h );
return hDst;
}
/***********************************************************************
* WIN_HaveToDelayNCPAINT
*
@ -188,7 +210,10 @@ static HRGN WIN_UpdateNCRgn(WND* wnd, HRGN hRgn, UINT uncFlags )
{
wnd->flags &= ~WIN_NEEDS_NCPAINT;
if( wnd->hrgnUpdate > 1 )
hrgnRet = REGION_CropRgn( hRgn, wnd->hrgnUpdate, NULL, NULL );
{
CombineRgn( hRgn, wnd->hrgnUpdate, 0, RGN_COPY );
hrgnRet = hRgn;
}
else
{
hrgnRet = wnd->hrgnUpdate;
@ -229,7 +254,7 @@ static HRGN WIN_UpdateNCRgn(WND* wnd, HRGN hRgn, UINT uncFlags )
* case that places a valid region handle in hClip */
hClip = wnd->hrgnUpdate;
wnd->hrgnUpdate = REGION_CropRgn( hRgn, hClip, &r, NULL );
wnd->hrgnUpdate = crop_rgn( hRgn, hClip, &r );
if( uncFlags & UNC_REGION ) hrgnRet = hClip;
}
@ -266,7 +291,10 @@ static HRGN WIN_UpdateNCRgn(WND* wnd, HRGN hRgn, UINT uncFlags )
{
copyrgn:
if( uncFlags & UNC_REGION )
hrgnRet = REGION_CropRgn( hRgn, wnd->hrgnUpdate, NULL, NULL );
{
CombineRgn( hRgn, wnd->hrgnUpdate, 0, RGN_COPY );
hrgnRet = hRgn;
}
}
else
if( wnd->hrgnUpdate == 1 && (uncFlags & UNC_UPDATE) )
@ -406,9 +434,9 @@ static void RDW_UpdateRgns( WND* wndPtr, HRGN hRgn, UINT flags, BOOL firstRecurs
CombineRgn( wndPtr->hrgnUpdate, wndPtr->hrgnUpdate, hRgn, RGN_OR );
/* fall through */
case 0:
wndPtr->hrgnUpdate = REGION_CropRgn( wndPtr->hrgnUpdate,
wndPtr->hrgnUpdate ? wndPtr->hrgnUpdate : hRgn,
&r, NULL );
wndPtr->hrgnUpdate = crop_rgn( wndPtr->hrgnUpdate,
wndPtr->hrgnUpdate ? wndPtr->hrgnUpdate : hRgn,
&r );
if( !bHadOne )
{
GetRgnBox( wndPtr->hrgnUpdate, &r );
@ -735,9 +763,16 @@ BOOL WINAPI RedrawWindow( HWND hwnd, const RECT *rectUpdate,
if( hrgnUpdate )
{
if( wndPtr->hrgnUpdate )
hRgn = REGION_CropRgn( 0, hrgnUpdate, NULL, &pt );
{
hRgn = CreateRectRgn( 0, 0, 0, 0 );
CombineRgn( hRgn, hrgnUpdate, 0, RGN_COPY );
OffsetRgn( hRgn, pt.x, pt.y );
}
else
wndPtr->hrgnUpdate = REGION_CropRgn( 0, hrgnUpdate, &r, &pt );
{
wndPtr->hrgnUpdate = crop_rgn( 0, hrgnUpdate, &r );
OffsetRgn( wndPtr->hrgnUpdate, pt.x, pt.y );
}
}
else if( rectUpdate )
{
@ -770,7 +805,8 @@ BOOL WINAPI RedrawWindow( HWND hwnd, const RECT *rectUpdate,
/* In this we cannot leave with zero hRgn */
if( hrgnUpdate )
{
hRgn = REGION_CropRgn( hRgn, hrgnUpdate, &r, &pt );
hRgn = crop_rgn( hRgn, hrgnUpdate, &r );
OffsetRgn( hRgn, pt.x, pt.y );
GetRgnBox( hRgn, &r2 );
if( IsRectEmpty( &r2 ) ) goto END;
}