diff --git a/.gitignore b/.gitignore index 418244e96b0..f439b356d3d 100644 --- a/.gitignore +++ b/.gitignore @@ -124,7 +124,6 @@ dlls/toolhelp.dll16 dlls/user.exe16 dlls/ver.dll16 dlls/wineps16.drv16 -dlls/wing.dll16 dlls/winsock.dll16 dlls/wprocs.dll16 include/activaut.h diff --git a/configure b/configure index 6a76027b869..5372518cf20 100755 --- a/configure +++ b/configure @@ -17081,6 +17081,14 @@ ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS dlls/winex11.drv/Makefile: dlls/winex11.drv/Makefile.in dlls/Makedll.rules" ac_config_files="$ac_config_files dlls/winex11.drv/Makefile" +ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/wing.dll16/Makefile" +test "x$enable_win16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ + wing.dll16" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/wing.dll16/Makefile: dlls/wing.dll16/Makefile.in dlls/Makedll.rules" +ac_config_files="$ac_config_files dlls/wing.dll16/Makefile" + ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/wing32/Makefile" test "x$enable_wing32" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ @@ -19082,6 +19090,7 @@ do "dlls/wineps.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wineps.drv/Makefile" ;; "dlls/winequartz.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winequartz.drv/Makefile" ;; "dlls/winex11.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winex11.drv/Makefile" ;; + "dlls/wing.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wing.dll16/Makefile" ;; "dlls/wing32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wing32/Makefile" ;; "dlls/winhttp/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winhttp/Makefile" ;; "dlls/winhttp/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winhttp/tests/Makefile" ;; diff --git a/configure.ac b/configure.ac index 175b051bad7..faf891df33b 100644 --- a/configure.ac +++ b/configure.ac @@ -2496,6 +2496,7 @@ WINE_CONFIG_MAKEFILE([dlls/wineoss.drv/Makefile],[dlls/Makedll.rules],[dlls],[AL WINE_CONFIG_MAKEFILE([dlls/wineps.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/winequartz.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/winex11.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) +WINE_CONFIG_MAKEFILE([dlls/wing.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) WINE_CONFIG_MAKEFILE([dlls/wing32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/winhttp/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/winhttp/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) diff --git a/dlls/Makefile.in b/dlls/Makefile.in index 3ff953cf2db..de007a7ef9b 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -28,7 +28,6 @@ WIN16_FILES = \ user.exe16 \ ver.dll16 \ wineps16.drv16 \ - wing.dll16 \ winsock.dll16 \ wprocs.dll16 @@ -43,7 +42,7 @@ all: $(BUILDSUBDIRS) @WIN16_FILES@ commdlg.dll16: echo "comdlg32.dll" >$@ -gdi.exe16 wing.dll16: +gdi.exe16: echo "gdi32.dll" >$@ krnl386.exe16 system.drv16 toolhelp.dll16: diff --git a/dlls/gdi32/Makefile.in b/dlls/gdi32/Makefile.in index fbd2d476f7e..45bdad58b24 100644 --- a/dlls/gdi32/Makefile.in +++ b/dlls/gdi32/Makefile.in @@ -9,9 +9,7 @@ IMPORTS = advapi32 kernel32 ntdll EXTRAINCL = @FREETYPEINCL@ @FONTCONFIGINCL@ EXTRALIBS = @CARBONLIB@ -SPEC_SRCS16 = \ - gdi.exe.spec \ - wing.spec +SPEC_SRCS16 = gdi.exe.spec C_SRCS = \ bidi.c \ @@ -56,8 +54,7 @@ C_SRCS16 = \ bidi16.c \ env.c \ gdi16.c \ - metafile16.c \ - wing.c + metafile16.c RC_SRCS = version.rc RC_SRCS16 = version16.rc diff --git a/dlls/wing.dll16/Makefile.in b/dlls/wing.dll16/Makefile.in new file mode 100644 index 00000000000..a3e42f26cfd --- /dev/null +++ b/dlls/wing.dll16/Makefile.in @@ -0,0 +1,13 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = wing.dll16 +IMPORTS = gdi32 kernel32 +EXTRADLLFLAGS = -Wb,--subsystem,win16 + +C_SRCS = wing.c + +@MAKE_DLL_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/gdi32/wing.c b/dlls/wing.dll16/wing.c similarity index 77% rename from dlls/gdi32/wing.c rename to dlls/wing.dll16/wing.c index f20cc4c9ecf..750c8daec04 100644 --- a/dlls/gdi32/wing.c +++ b/dlls/wing.dll16/wing.c @@ -26,7 +26,6 @@ #include "winbase.h" #include "wingdi.h" #include "wownt32.h" -#include "gdi_private.h" #include "wine/wingdi16.h" #include "wine/debug.h" @@ -51,19 +50,6 @@ typedef enum WING_DITHER_TYPE WING_DISPERSED_4x4, WING_DISPERSED_8x8, WING_CLUSTERED_4x4 } WING_DITHER_TYPE; -/* - * WinG DIB bitmaps can be selected into DC and then scribbled upon - * by GDI functions. They can also be changed directly. This gives us - * three choices - * - use original WinG 16-bit DLL - * requires working 16-bit driver interface - * - implement DIB graphics driver from scratch - * see wing.zip size - * - use shared pixmaps - * won't work with some videocards and/or videomodes - * 961208 - AK - */ - /*********************************************************************** * WinGCreateDC (WING.1001) * @@ -79,7 +65,7 @@ typedef enum WING_DITHER_TYPE HDC16 WINAPI WinGCreateDC16(void) { TRACE("(void)\n"); - return CreateCompatibleDC16(0); + return HDC_16( CreateCompatibleDC( 0 )); } /*********************************************************************** @@ -130,13 +116,38 @@ BOOL16 WINAPI WinGRecommendDIBFormat16(BITMAPINFO *bmpi) * Success: A handle to the created bitmap. * Failure: A NULL handle. */ -HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 hdc, BITMAPINFO *bmpi, - SEGPTR *bits) +HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 hdc, BITMAPINFO *bmpi, SEGPTR *bits) { - TRACE("(%d,%p,%p)\n", hdc, bmpi, bits); - TRACE(": create %dx%dx%d bitmap\n", bmpi->bmiHeader.biWidth, - bmpi->bmiHeader.biHeight, bmpi->bmiHeader.biPlanes); - return CreateDIBSection16(hdc, bmpi, 0, bits, 0, 0); + LPVOID bits32; + HBITMAP hbitmap; + + TRACE("(%d,%p,%p): create %dx%dx%d bitmap\n", hdc, bmpi, bits, + bmpi->bmiHeader.biWidth, bmpi->bmiHeader.biHeight, bmpi->bmiHeader.biPlanes); + + hbitmap = CreateDIBSection( HDC_32(hdc), bmpi, BI_RGB, &bits32, 0, 0 ); + if (hbitmap) + { + DIBSECTION dib; + DWORD size; + WORD count, sel; + int i; + + GetObjectW( hbitmap, sizeof(dib), &dib ); + size = dib.dsBm.bmHeight * dib.dsBm.bmWidthBytes; + + /* calculate number of sel's needed for size with 64K steps */ + count = (size + 0xffff) / 0x10000; + sel = AllocSelectorArray16(count); + + for (i = 0; i < count; i++) + { + SetSelectorBase(sel + (i << __AHSHIFT), (DWORD)bits32 + i * 0x10000); + SetSelectorLimit16(sel + (i << __AHSHIFT), size - 1); /* yep, limit is correct */ + size -= 0x10000; + } + if (bits) *bits = MAKESEGPTR( sel, 0 ); + } + return HBITMAP_16(hbitmap); } /*********************************************************************** @@ -144,17 +155,8 @@ HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 hdc, BITMAPINFO *bmpi, */ SEGPTR WINAPI WinGGetDIBPointer16(HBITMAP16 hWinGBitmap, BITMAPINFO* bmpi) { - BITMAPOBJ* bmp = GDI_GetObjPtr( HBITMAP_32(hWinGBitmap), OBJ_BITMAP ); - SEGPTR res = 0; - - TRACE("(%d,%p)\n", hWinGBitmap, bmpi); - if (!bmp) return 0; - - if (bmpi) FIXME(": Todo - implement setting BITMAPINFO\n"); - - res = bmp->segptr_bits; - GDI_ReleaseObj( HBITMAP_32(hWinGBitmap) ); - return res; + FIXME("%x, %p: not supported\n", hWinGBitmap, bmpi ); + return 0; } /*********************************************************************** @@ -171,11 +173,10 @@ SEGPTR WINAPI WinGGetDIBPointer16(HBITMAP16 hWinGBitmap, BITMAPINFO* bmpi) * RETURNS * The number of entries set. */ -UINT16 WINAPI WinGSetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num, - RGBQUAD *colors) +UINT16 WINAPI WinGSetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num, RGBQUAD *colors) { TRACE("(%d,%d,%d,%p)\n", hdc, start, num, colors); - return SetDIBColorTable16(hdc, start, num, colors); + return SetDIBColorTable( HDC_32(hdc), start, num, colors ); } /*********************************************************************** @@ -192,11 +193,10 @@ UINT16 WINAPI WinGSetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num, * RETURNS * The number of entries retrieved. */ -UINT16 WINAPI WinGGetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num, - RGBQUAD *colors) +UINT16 WINAPI WinGGetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num, RGBQUAD *colors) { TRACE("(%d,%d,%d,%p)\n", hdc, start, num, colors); - return GetDIBColorTable16(hdc, start, num, colors); + return GetDIBColorTable( HDC_32(hdc), start, num, colors ); } /*********************************************************************** @@ -213,10 +213,10 @@ UINT16 WINAPI WinGGetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num, */ HPALETTE16 WINAPI WinGCreateHalfTonePalette16(void) { - HDC16 hdc = CreateCompatibleDC16(0); - HPALETTE16 ret = CreateHalftonePalette16(hdc); + HDC hdc = CreateCompatibleDC(0); + HPALETTE16 ret = HPALETTE_16( CreateHalftonePalette( hdc )); TRACE("(void)\n"); - DeleteDC16(hdc); + DeleteDC( hdc ); return ret; } @@ -238,7 +238,7 @@ HBRUSH16 WINAPI WinGCreateHalfToneBrush16(HDC16 winDC, COLORREF col, WING_DITHER_TYPE type) { TRACE("(%d,%d,%d)\n", winDC, col, type); - return CreateSolidBrush16(col); + return HBRUSH_16( CreateSolidBrush( col )); } /*********************************************************************** @@ -251,12 +251,12 @@ BOOL16 WINAPI WinGStretchBlt16(HDC16 destDC, INT16 xDest, INT16 yDest, HDC16 srcDC, INT16 xSrc, INT16 ySrc, INT16 widSrc, INT16 heiSrc) { - BOOL16 retval; + BOOL retval; TRACE("(%d,%d,...)\n", destDC, srcDC); - SetStretchBltMode16 ( destDC, COLORONCOLOR ); - retval=StretchBlt16(destDC, xDest, yDest, widDest, heiDest, srcDC, - xSrc, ySrc, widSrc, heiSrc, SRCCOPY); - SetStretchBltMode16 ( destDC, BLACKONWHITE ); + SetStretchBltMode( HDC_32(destDC), COLORONCOLOR ); + retval = StretchBlt( HDC_32(destDC), xDest, yDest, widDest, heiDest, + HDC_32(srcDC), xSrc, ySrc, widSrc, heiSrc, SRCCOPY ); + SetStretchBltMode( HDC_32(destDC), BLACKONWHITE ); return retval; } @@ -270,6 +270,5 @@ BOOL16 WINAPI WinGBitBlt16(HDC16 destDC, INT16 xDest, INT16 yDest, INT16 xSrc, INT16 ySrc) { TRACE("(%d,%d,...)\n", destDC, srcDC); - return BitBlt16(destDC, xDest, yDest, widDest, heiDest, srcDC, - xSrc, ySrc, SRCCOPY); + return BitBlt( HDC_32(destDC), xDest, yDest, widDest, heiDest, HDC_32(srcDC), xSrc, ySrc, SRCCOPY ); } diff --git a/dlls/gdi32/wing.spec b/dlls/wing.dll16/wing.dll16.spec similarity index 100% rename from dlls/gdi32/wing.spec rename to dlls/wing.dll16/wing.dll16.spec