From ccce11d2c390dc7c4cead537ea753bff8a3dc27a Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Wed, 18 Feb 2009 20:34:00 +0000 Subject: [PATCH] gdi32: Move 16-bit functions not exported in gdi32.dll into files compiled only when 16-bit functionality is enabled. --- dlls/gdi32/bitmap.c | 1 - dlls/gdi32/brush.c | 32 +--- dlls/gdi32/clipping.c | 143 --------------- dlls/gdi32/dc.c | 77 +------- dlls/gdi32/dib.c | 52 +----- dlls/gdi32/gdi16.c | 380 +++++++++++++++++++++++++++++++++++++++ dlls/gdi32/gdi_main.c | 10 -- dlls/gdi32/gdi_private.h | 8 + dlls/gdi32/gdiobj.c | 13 -- dlls/gdi32/mapping.c | 38 ---- dlls/gdi32/palette.c | 51 +----- 11 files changed, 407 insertions(+), 398 deletions(-) diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c index 5ca76a2e928..f4c48c6e7b2 100644 --- a/dlls/gdi32/bitmap.c +++ b/dlls/gdi32/bitmap.c @@ -26,7 +26,6 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" -#include "wine/winbase16.h" #include "gdi_private.h" #include "wine/debug.h" diff --git a/dlls/gdi32/brush.c b/dlls/gdi32/brush.c index 885fe88b13a..a9f3ae14913 100644 --- a/dlls/gdi32/brush.c +++ b/dlls/gdi32/brush.c @@ -26,8 +26,6 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" -#include "wine/wingdi16.h" -#include "wownt32.h" #include "gdi_private.h" #include "wine/debug.h" @@ -450,39 +448,23 @@ static INT BRUSH_GetObject( HGDIOBJ handle, INT count, LPVOID buffer ) return count; } - /*********************************************************************** - * SetSolidBrush (GDI.604) - * - * Change the color of a solid brush. - * - * PARAMS - * hBrush [I] Brush to change the color of - * newColor [I] New color for hBrush - * - * RETURNS - * Success: TRUE. The color of hBrush is set to newColor. - * Failure: FALSE. - * - * FIXME - * This function is undocumented and untested. The implementation may - * not be correct. + * BRUSH_SetSolid */ -BOOL16 WINAPI SetSolidBrush16(HBRUSH16 hBrush, COLORREF newColor ) +BOOL BRUSH_SetSolid( HGDIOBJ handle, COLORREF new_color ) { BRUSHOBJ * brushPtr; - BOOL16 res = FALSE; + BOOL res = FALSE; - TRACE("(hBrush %04x, newColor %08x)\n", hBrush, newColor); - if (!(brushPtr = GDI_GetObjPtr( HBRUSH_32(hBrush), OBJ_BRUSH ))) + if (!(brushPtr = GDI_GetObjPtr( handle, OBJ_BRUSH ))) return FALSE; if (brushPtr->logbrush.lbStyle == BS_SOLID) { - brushPtr->logbrush.lbColor = newColor; + brushPtr->logbrush.lbColor = new_color; res = TRUE; } - GDI_ReleaseObj( HBRUSH_32(hBrush) ); - return res; + GDI_ReleaseObj( handle ); + return res; } diff --git a/dlls/gdi32/clipping.c b/dlls/gdi32/clipping.c index 22fec790cda..8e80207f0e9 100644 --- a/dlls/gdi32/clipping.c +++ b/dlls/gdi32/clipping.c @@ -23,7 +23,6 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" -#include "wownt32.h" #include "gdi_private.h" #include "wine/debug.h" @@ -213,25 +212,6 @@ INT WINAPI OffsetClipRgn( HDC hdc, INT x, INT y ) } -/*********************************************************************** - * OffsetVisRgn (GDI.102) - */ -INT16 WINAPI OffsetVisRgn16( HDC16 hdc16, INT16 x, INT16 y ) -{ - INT16 retval; - HDC hdc = HDC_32( hdc16 ); - DC * dc = get_dc_ptr( hdc ); - - if (!dc) return ERROR; - TRACE("%p %d,%d\n", hdc, x, y ); - update_dc( dc ); - retval = OffsetRgn( dc->hVisRgn, x, y ); - CLIPPING_UpdateGCRegion( dc ); - release_dc_ptr( dc ); - return retval; -} - - /*********************************************************************** * ExcludeClipRect (GDI32.@) */ @@ -326,74 +306,6 @@ INT WINAPI IntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bottom } -/*********************************************************************** - * ExcludeVisRect (GDI.73) - */ -INT16 WINAPI ExcludeVisRect16( HDC16 hdc16, INT16 left, INT16 top, INT16 right, INT16 bottom ) -{ - HRGN tempRgn; - INT16 ret; - POINT pt[2]; - HDC hdc = HDC_32( hdc16 ); - DC * dc = get_dc_ptr( hdc ); - if (!dc) return ERROR; - - pt[0].x = left; - pt[0].y = top; - pt[1].x = right; - pt[1].y = bottom; - - LPtoDP( hdc, pt, 2 ); - - TRACE("%p %d,%d - %d,%d\n", hdc, pt[0].x, pt[0].y, pt[1].x, pt[1].y); - - if (!(tempRgn = CreateRectRgn( pt[0].x, pt[0].y, pt[1].x, pt[1].y ))) ret = ERROR; - else - { - update_dc( dc ); - ret = CombineRgn( dc->hVisRgn, dc->hVisRgn, tempRgn, RGN_DIFF ); - DeleteObject( tempRgn ); - } - if (ret != ERROR) CLIPPING_UpdateGCRegion( dc ); - release_dc_ptr( dc ); - return ret; -} - - -/*********************************************************************** - * IntersectVisRect (GDI.98) - */ -INT16 WINAPI IntersectVisRect16( HDC16 hdc16, INT16 left, INT16 top, INT16 right, INT16 bottom ) -{ - HRGN tempRgn; - INT16 ret; - POINT pt[2]; - HDC hdc = HDC_32( hdc16 ); - DC * dc = get_dc_ptr( hdc ); - if (!dc) return ERROR; - - pt[0].x = left; - pt[0].y = top; - pt[1].x = right; - pt[1].y = bottom; - - LPtoDP( hdc, pt, 2 ); - - TRACE("%p %d,%d - %d,%d\n", hdc, pt[0].x, pt[0].y, pt[1].x, pt[1].y); - - if (!(tempRgn = CreateRectRgn( pt[0].x, pt[0].y, pt[1].x, pt[1].y ))) ret = ERROR; - else - { - update_dc( dc ); - ret = CombineRgn( dc->hVisRgn, dc->hVisRgn, tempRgn, RGN_AND ); - DeleteObject( tempRgn ); - } - if (ret != ERROR) CLIPPING_UpdateGCRegion( dc ); - release_dc_ptr( dc ); - return ret; -} - - /*********************************************************************** * PtVisible (GDI32.@) */ @@ -510,61 +422,6 @@ INT WINAPI GetMetaRgn( HDC hdc, HRGN hRgn ) } -/*********************************************************************** - * SaveVisRgn (GDI.129) - */ -HRGN16 WINAPI SaveVisRgn16( HDC16 hdc16 ) -{ - struct saved_visrgn *saved; - HDC hdc = HDC_32( hdc16 ); - DC *dc = get_dc_ptr( hdc ); - - if (!dc) return 0; - TRACE("%p\n", hdc ); - - update_dc( dc ); - if (!(saved = HeapAlloc( GetProcessHeap(), 0, sizeof(*saved) ))) goto error; - if (!(saved->hrgn = CreateRectRgn( 0, 0, 0, 0 ))) goto error; - CombineRgn( saved->hrgn, dc->hVisRgn, 0, RGN_COPY ); - saved->next = dc->saved_visrgn; - dc->saved_visrgn = saved; - release_dc_ptr( dc ); - return HRGN_16(saved->hrgn); - -error: - release_dc_ptr( dc ); - HeapFree( GetProcessHeap(), 0, saved ); - return 0; -} - - -/*********************************************************************** - * RestoreVisRgn (GDI.130) - */ -INT16 WINAPI RestoreVisRgn16( HDC16 hdc16 ) -{ - struct saved_visrgn *saved; - HDC hdc = HDC_32( hdc16 ); - DC *dc = get_dc_ptr( hdc ); - INT16 ret = ERROR; - - if (!dc) return ERROR; - - TRACE("%p\n", hdc ); - - if (!(saved = dc->saved_visrgn)) goto done; - - ret = CombineRgn( dc->hVisRgn, saved->hrgn, 0, RGN_COPY ); - dc->saved_visrgn = saved->next; - DeleteObject( saved->hrgn ); - HeapFree( GetProcessHeap(), 0, saved ); - CLIPPING_UpdateGCRegion( dc ); - done: - release_dc_ptr( dc ); - return ret; -} - - /*********************************************************************** * GetRandomRgn [GDI32.@] * diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index 2032dfaf15a..4d10f2205ad 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -326,9 +326,9 @@ void DC_UpdateXforms( DC *dc ) /*********************************************************************** - * GetDCState (Not a Windows API) + * get_dc_state (Not a Windows API) */ -static HDC GetDCState( HDC hdc ) +HDC get_dc_state( HDC hdc ) { DC * newdc, * dc; HGDIOBJ handle; @@ -429,9 +429,9 @@ static HDC GetDCState( HDC hdc ) /*********************************************************************** - * SetDCState (Not a Windows API) + * set_dc_state (Not a Windows API) */ -static void SetDCState( HDC hdc, HDC hdcs ) +void set_dc_state( HDC hdc, HDC hdcs ) { DC *dc, *dcs; @@ -522,24 +522,6 @@ static void SetDCState( HDC hdc, HDC hdcs ) } -/*********************************************************************** - * GetDCState (GDI.179) - */ -HDC16 WINAPI GetDCState16( HDC16 hdc ) -{ - return HDC_16( GetDCState( HDC_32(hdc) )); -} - - -/*********************************************************************** - * SetDCState (GDI.180) - */ -void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs ) -{ - SetDCState( HDC_32(hdc), HDC_32(hdcs) ); -} - - /*********************************************************************** * SaveDC (GDI32.@) */ @@ -561,7 +543,7 @@ INT WINAPI SaveDC( HDC hdc ) return ret; } - if (!(hdcs = GetDCState( hdc ))) + if (!(hdcs = get_dc_state( hdc ))) { release_dc_ptr( dc ); return 0; @@ -635,7 +617,7 @@ BOOL WINAPI RestoreDC( HDC hdc, INT level ) dcs->saved_dc = 0; if (--dc->saveLevel < level) { - SetDCState( hdc, hdcs ); + set_dc_state( hdc, hdcs ); if (!PATH_AssignGdiPath( &dc->path, &dcs->path )) /* FIXME: This might not be quite right, since we're * returning FALSE but still destroying the saved DC state */ @@ -1103,21 +1085,6 @@ BOOL WINAPI GetDCOrgEx( HDC hDC, LPPOINT lpp ) } -/*********************************************************************** - * SetDCOrg (GDI.117) - */ -DWORD WINAPI SetDCOrg16( HDC16 hdc16, INT16 x, INT16 y ) -{ - DWORD prevOrg = 0; - HDC hdc = HDC_32( hdc16 ); - DC *dc = get_dc_ptr( hdc ); - if (!dc) return 0; - if (dc->funcs->pSetDCOrg) prevOrg = dc->funcs->pSetDCOrg( dc->physDev, x, y ); - release_dc_ptr( dc ); - return prevOrg; -} - - /*********************************************************************** * GetGraphicsMode (GDI32.@) */ @@ -1974,38 +1941,6 @@ BOOL WINAPI GetWindowOrgEx( HDC hdc, LPPOINT pt ) } -/*********************************************************************** - * InquireVisRgn (GDI.131) - */ -HRGN16 WINAPI InquireVisRgn16( HDC16 hdc ) -{ - HRGN16 ret = 0; - DC * dc = get_dc_ptr( HDC_32(hdc) ); - if (dc) - { - ret = HRGN_16(dc->hVisRgn); - release_dc_ptr( dc ); - } - return ret; -} - - -/*********************************************************************** - * GetClipRgn (GDI.173) - */ -HRGN16 WINAPI GetClipRgn16( HDC16 hdc ) -{ - HRGN16 ret = 0; - DC * dc = get_dc_ptr( HDC_32(hdc) ); - if (dc) - { - ret = HRGN_16(dc->hClipRgn); - release_dc_ptr( dc ); - } - return ret; -} - - /*********************************************************************** * GetLayout (GDI32.@) * diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c index 9fcb7c58e9a..0dceaa80949 100644 --- a/dlls/gdi32/dib.c +++ b/dlls/gdi32/dib.c @@ -151,8 +151,8 @@ int bitmap_info_size( const BITMAPINFO * info, WORD coloruse ) * Get the info from a bitmap header. * Return 0 for COREHEADER, 1 for INFOHEADER, -1 for error. */ -static int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width, - LONG *height, WORD *planes, WORD *bpp, DWORD *compr, DWORD *size ) +int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width, + LONG *height, WORD *planes, WORD *bpp, DWORD *compr, DWORD *size ) { if (header->biSize == sizeof(BITMAPCOREHEADER)) { @@ -1141,54 +1141,6 @@ HBITMAP WINAPI CreateDIBitmap( HDC hdc, const BITMAPINFOHEADER *header, return handle; } -/*********************************************************************** - * CreateDIBSection (GDI.489) - */ -HBITMAP16 WINAPI CreateDIBSection16 (HDC16 hdc, const BITMAPINFO *bmi, UINT16 usage, - SEGPTR *bits16, HANDLE section, DWORD offset) -{ - LPVOID bits32; - HBITMAP hbitmap; - - hbitmap = CreateDIBSection( HDC_32(hdc), bmi, usage, &bits32, section, offset ); - if (hbitmap) - { - BITMAPOBJ *bmp = GDI_GetObjPtr(hbitmap, OBJ_BITMAP); - if (bmp && bmp->dib && bits32) - { - const BITMAPINFOHEADER *bi = &bmi->bmiHeader; - LONG width, height; - WORD planes, bpp; - DWORD compr, size; - INT width_bytes; - WORD count, sel; - int i; - - DIB_GetBitmapInfo(bi, &width, &height, &planes, &bpp, &compr, &size); - - height = height >= 0 ? height : -height; - width_bytes = DIB_GetDIBWidthBytes(width, bpp); - - if (!size || (compr != BI_RLE4 && compr != BI_RLE8)) size = width_bytes * height; - - /* 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; - } - bmp->segptr_bits = MAKESEGPTR( sel, 0 ); - if (bits16) *bits16 = bmp->segptr_bits; - } - if (bmp) GDI_ReleaseObj( hbitmap ); - } - return HBITMAP_16(hbitmap); -} - /* Copy/synthesize RGB palette from BITMAPINFO. Ripped from dlls/winex11.drv/dib.c */ static void DIB_CopyColorTable( DC *dc, BITMAPOBJ *bmp, WORD coloruse, const BITMAPINFO *info ) { diff --git a/dlls/gdi32/gdi16.c b/dlls/gdi32/gdi16.c index 1d0344bbd92..643f682c467 100644 --- a/dlls/gdi32/gdi16.c +++ b/dlls/gdi32/gdi16.c @@ -3268,3 +3268,383 @@ BOOL16 WINAPI SetLayout16( HDC16 hdc, DWORD layout ) { return SetLayout( HDC_32(hdc), layout ); } + + +/*********************************************************************** + * SetSolidBrush (GDI.604) + * + * Change the color of a solid brush. + * + * PARAMS + * hBrush [I] Brush to change the color of + * newColor [I] New color for hBrush + * + * RETURNS + * Success: TRUE. The color of hBrush is set to newColor. + * Failure: FALSE. + * + * FIXME + * This function is undocumented and untested. The implementation may + * not be correct. + */ +BOOL16 WINAPI SetSolidBrush16(HBRUSH16 hBrush, COLORREF newColor ) +{ + TRACE("(hBrush %04x, newColor %08x)\n", hBrush, newColor); + + return BRUSH_SetSolid( HBRUSH_32(hBrush), newColor ); +} + + +/*********************************************************************** + * Copy (GDI.250) + */ +void WINAPI Copy16( LPVOID src, LPVOID dst, WORD size ) +{ + memcpy( dst, src, size ); +} + +/*********************************************************************** + * RealizeDefaultPalette (GDI.365) + */ +UINT16 WINAPI RealizeDefaultPalette16( HDC16 hdc ) +{ + UINT16 ret = 0; + DC *dc; + + TRACE("%04x\n", hdc ); + + if (!(dc = get_dc_ptr( HDC_32(hdc) ))) return 0; + + if (dc->funcs->pRealizeDefaultPalette) ret = dc->funcs->pRealizeDefaultPalette( dc->physDev ); + release_dc_ptr( dc ); + return ret; +} + +/*********************************************************************** + * IsDCCurrentPalette (GDI.412) + */ +BOOL16 WINAPI IsDCCurrentPalette16(HDC16 hDC) +{ + DC *dc = get_dc_ptr( HDC_32(hDC) ); + if (dc) + { + BOOL bRet = dc->hPalette == hPrimaryPalette; + release_dc_ptr( dc ); + return bRet; + } + return FALSE; +} + +/********************************************************************* + * SetMagicColors (GDI.606) + */ +VOID WINAPI SetMagicColors16(HDC16 hDC, COLORREF color, UINT16 index) +{ + FIXME("(hDC %04x, color %04x, index %04x): stub\n", hDC, (int)color, index); + +} + + +/*********************************************************************** + * DPtoLP (GDI.67) + */ +BOOL16 WINAPI DPtoLP16( HDC16 hdc, LPPOINT16 points, INT16 count ) +{ + DC * dc = get_dc_ptr( HDC_32(hdc) ); + if (!dc) return FALSE; + + while (count--) + { + points->x = MulDiv( points->x - dc->vportOrgX, dc->wndExtX, dc->vportExtX ) + dc->wndOrgX; + points->y = MulDiv( points->y - dc->vportOrgY, dc->wndExtY, dc->vportExtY ) + dc->wndOrgY; + points++; + } + release_dc_ptr( dc ); + return TRUE; +} + + +/*********************************************************************** + * LPtoDP (GDI.99) + */ +BOOL16 WINAPI LPtoDP16( HDC16 hdc, LPPOINT16 points, INT16 count ) +{ + DC * dc = get_dc_ptr( HDC_32(hdc) ); + if (!dc) return FALSE; + + while (count--) + { + points->x = MulDiv( points->x - dc->wndOrgX, dc->vportExtX, dc->wndExtX ) + dc->vportOrgX; + points->y = MulDiv( points->y - dc->wndOrgY, dc->vportExtY, dc->wndExtY ) + dc->vportOrgY; + points++; + } + release_dc_ptr( dc ); + return TRUE; +} + + +/*********************************************************************** + * GetDCState (GDI.179) + */ +HDC16 WINAPI GetDCState16( HDC16 hdc ) +{ + return HDC_16( get_dc_state( HDC_32(hdc) )); +} + + +/*********************************************************************** + * SetDCState (GDI.180) + */ +void WINAPI SetDCState16( HDC16 hdc, HDC16 hdcs ) +{ + set_dc_state( HDC_32(hdc), HDC_32(hdcs) ); +} + +/*********************************************************************** + * SetDCOrg (GDI.117) + */ +DWORD WINAPI SetDCOrg16( HDC16 hdc16, INT16 x, INT16 y ) +{ + DWORD prevOrg = 0; + HDC hdc = HDC_32( hdc16 ); + DC *dc = get_dc_ptr( hdc ); + if (!dc) return 0; + if (dc->funcs->pSetDCOrg) prevOrg = dc->funcs->pSetDCOrg( dc->physDev, x, y ); + release_dc_ptr( dc ); + return prevOrg; +} + + +/*********************************************************************** + * InquireVisRgn (GDI.131) + */ +HRGN16 WINAPI InquireVisRgn16( HDC16 hdc ) +{ + HRGN16 ret = 0; + DC * dc = get_dc_ptr( HDC_32(hdc) ); + if (dc) + { + ret = HRGN_16(dc->hVisRgn); + release_dc_ptr( dc ); + } + return ret; +} + + +/*********************************************************************** + * OffsetVisRgn (GDI.102) + */ +INT16 WINAPI OffsetVisRgn16( HDC16 hdc16, INT16 x, INT16 y ) +{ + INT16 retval; + HDC hdc = HDC_32( hdc16 ); + DC * dc = get_dc_ptr( hdc ); + + if (!dc) return ERROR; + TRACE("%p %d,%d\n", hdc, x, y ); + update_dc( dc ); + retval = OffsetRgn( dc->hVisRgn, x, y ); + CLIPPING_UpdateGCRegion( dc ); + release_dc_ptr( dc ); + return retval; +} + + +/*********************************************************************** + * ExcludeVisRect (GDI.73) + */ +INT16 WINAPI ExcludeVisRect16( HDC16 hdc16, INT16 left, INT16 top, INT16 right, INT16 bottom ) +{ + HRGN tempRgn; + INT16 ret; + POINT pt[2]; + HDC hdc = HDC_32( hdc16 ); + DC * dc = get_dc_ptr( hdc ); + if (!dc) return ERROR; + + pt[0].x = left; + pt[0].y = top; + pt[1].x = right; + pt[1].y = bottom; + + LPtoDP( hdc, pt, 2 ); + + TRACE("%p %d,%d - %d,%d\n", hdc, pt[0].x, pt[0].y, pt[1].x, pt[1].y); + + if (!(tempRgn = CreateRectRgn( pt[0].x, pt[0].y, pt[1].x, pt[1].y ))) ret = ERROR; + else + { + update_dc( dc ); + ret = CombineRgn( dc->hVisRgn, dc->hVisRgn, tempRgn, RGN_DIFF ); + DeleteObject( tempRgn ); + } + if (ret != ERROR) CLIPPING_UpdateGCRegion( dc ); + release_dc_ptr( dc ); + return ret; +} + + +/*********************************************************************** + * IntersectVisRect (GDI.98) + */ +INT16 WINAPI IntersectVisRect16( HDC16 hdc16, INT16 left, INT16 top, INT16 right, INT16 bottom ) +{ + HRGN tempRgn; + INT16 ret; + POINT pt[2]; + HDC hdc = HDC_32( hdc16 ); + DC * dc = get_dc_ptr( hdc ); + if (!dc) return ERROR; + + pt[0].x = left; + pt[0].y = top; + pt[1].x = right; + pt[1].y = bottom; + + LPtoDP( hdc, pt, 2 ); + + TRACE("%p %d,%d - %d,%d\n", hdc, pt[0].x, pt[0].y, pt[1].x, pt[1].y); + + if (!(tempRgn = CreateRectRgn( pt[0].x, pt[0].y, pt[1].x, pt[1].y ))) ret = ERROR; + else + { + update_dc( dc ); + ret = CombineRgn( dc->hVisRgn, dc->hVisRgn, tempRgn, RGN_AND ); + DeleteObject( tempRgn ); + } + if (ret != ERROR) CLIPPING_UpdateGCRegion( dc ); + release_dc_ptr( dc ); + return ret; +} + + +/*********************************************************************** + * SaveVisRgn (GDI.129) + */ +HRGN16 WINAPI SaveVisRgn16( HDC16 hdc16 ) +{ + struct saved_visrgn *saved; + HDC hdc = HDC_32( hdc16 ); + DC *dc = get_dc_ptr( hdc ); + + if (!dc) return 0; + TRACE("%p\n", hdc ); + + update_dc( dc ); + if (!(saved = HeapAlloc( GetProcessHeap(), 0, sizeof(*saved) ))) goto error; + if (!(saved->hrgn = CreateRectRgn( 0, 0, 0, 0 ))) goto error; + CombineRgn( saved->hrgn, dc->hVisRgn, 0, RGN_COPY ); + saved->next = dc->saved_visrgn; + dc->saved_visrgn = saved; + release_dc_ptr( dc ); + return HRGN_16(saved->hrgn); + +error: + release_dc_ptr( dc ); + HeapFree( GetProcessHeap(), 0, saved ); + return 0; +} + + +/*********************************************************************** + * RestoreVisRgn (GDI.130) + */ +INT16 WINAPI RestoreVisRgn16( HDC16 hdc16 ) +{ + struct saved_visrgn *saved; + HDC hdc = HDC_32( hdc16 ); + DC *dc = get_dc_ptr( hdc ); + INT16 ret = ERROR; + + if (!dc) return ERROR; + + TRACE("%p\n", hdc ); + + if (!(saved = dc->saved_visrgn)) goto done; + + ret = CombineRgn( dc->hVisRgn, saved->hrgn, 0, RGN_COPY ); + dc->saved_visrgn = saved->next; + DeleteObject( saved->hrgn ); + HeapFree( GetProcessHeap(), 0, saved ); + CLIPPING_UpdateGCRegion( dc ); + done: + release_dc_ptr( dc ); + return ret; +} + + +/*********************************************************************** + * GetClipRgn (GDI.173) + */ +HRGN16 WINAPI GetClipRgn16( HDC16 hdc ) +{ + HRGN16 ret = 0; + DC * dc = get_dc_ptr( HDC_32(hdc) ); + if (dc) + { + ret = HRGN_16(dc->hClipRgn); + release_dc_ptr( dc ); + } + return ret; +} + + +/*********************************************************************** + * MakeObjectPrivate (GDI.463) + * + * What does that mean ? + * Some little docu can be found in "Undocumented Windows", + * but this is basically useless. + */ +void WINAPI MakeObjectPrivate16( HGDIOBJ16 handle16, BOOL16 private ) +{ + FIXME( "stub: %x %u\n", handle16, private ); +} + +/*********************************************************************** + * CreateDIBSection (GDI.489) + */ +HBITMAP16 WINAPI CreateDIBSection16 (HDC16 hdc, const BITMAPINFO *bmi, UINT16 usage, + SEGPTR *bits16, HANDLE section, DWORD offset) +{ + LPVOID bits32; + HBITMAP hbitmap; + + hbitmap = CreateDIBSection( HDC_32(hdc), bmi, usage, &bits32, section, offset ); + if (hbitmap) + { + BITMAPOBJ *bmp = GDI_GetObjPtr(hbitmap, OBJ_BITMAP); + if (bmp && bmp->dib && bits32) + { + const BITMAPINFOHEADER *bi = &bmi->bmiHeader; + LONG width, height; + WORD planes, bpp; + DWORD compr, size; + INT width_bytes; + WORD count, sel; + int i; + + DIB_GetBitmapInfo(bi, &width, &height, &planes, &bpp, &compr, &size); + + height = height >= 0 ? height : -height; + width_bytes = DIB_GetDIBWidthBytes(width, bpp); + + if (!size || (compr != BI_RLE4 && compr != BI_RLE8)) size = width_bytes * height; + + /* 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; + } + bmp->segptr_bits = MAKESEGPTR( sel, 0 ); + if (bits16) *bits16 = bmp->segptr_bits; + } + if (bmp) GDI_ReleaseObj( hbitmap ); + } + return HBITMAP_16(hbitmap); +} diff --git a/dlls/gdi32/gdi_main.c b/dlls/gdi32/gdi_main.c index 4d834aa28c3..6734ed5df50 100644 --- a/dlls/gdi32/gdi_main.c +++ b/dlls/gdi32/gdi_main.c @@ -23,7 +23,6 @@ #include "windef.h" #include "winbase.h" #include "wingdi.h" -#include "wine/winbase16.h" #include "gdi_private.h" /*********************************************************************** @@ -36,12 +35,3 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID lpvReserved) LoadLibrary16( "gdi.exe" ); return GDI_Init(); } - - -/*********************************************************************** - * Copy (GDI.250) - */ -void WINAPI Copy16( LPVOID src, LPVOID dst, WORD size ) -{ - memcpy( dst, src, size ); -} diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index e01f1d0f320..bc22741ad58 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -368,6 +368,9 @@ extern HBITMAP BITMAP_CopyBitmap( HBITMAP hbitmap ) DECLSPEC_HIDDEN; extern BOOL BITMAP_SetOwnerDC( HBITMAP hbitmap, DC *dc ) DECLSPEC_HIDDEN; extern INT BITMAP_GetWidthBytes( INT bmWidth, INT bpp ) DECLSPEC_HIDDEN; +/* brush.c */ +extern BOOL BRUSH_SetSolid( HGDIOBJ handle, COLORREF new_color ) DECLSPEC_HIDDEN; + /* clipping.c */ extern void CLIPPING_UpdateGCRegion( DC * dc ) DECLSPEC_HIDDEN; @@ -379,11 +382,15 @@ extern void release_dc_ptr( DC *dc ) DECLSPEC_HIDDEN; extern void update_dc( DC *dc ) DECLSPEC_HIDDEN; extern void DC_InitDC( DC * dc ) DECLSPEC_HIDDEN; extern void DC_UpdateXforms( DC * dc ) DECLSPEC_HIDDEN; +extern HDC get_dc_state( HDC hdc ) DECLSPEC_HIDDEN; +extern void set_dc_state( HDC hdc, HDC hdcs ) DECLSPEC_HIDDEN; /* dib.c */ extern int DIB_GetDIBWidthBytes( int width, int depth ) DECLSPEC_HIDDEN; extern int DIB_GetDIBImageBytes( int width, int height, int depth ) DECLSPEC_HIDDEN; extern int bitmap_info_size( const BITMAPINFO * info, WORD coloruse ) DECLSPEC_HIDDEN; +extern int DIB_GetBitmapInfo( const BITMAPINFOHEADER *header, LONG *width, + LONG *height, WORD *planes, WORD *bpp, DWORD *compr, DWORD *size ) DECLSPEC_HIDDEN; /* driver.c */ extern const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name ) DECLSPEC_HIDDEN; @@ -493,6 +500,7 @@ extern POINT *GDI_Bezier( const POINT *Points, INT count, INT *nPtsOut ) DECLSPE extern HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg); extern UINT WINAPI GDIRealizePalette( HDC hdc ); extern HPALETTE PALETTE_Init(void) DECLSPEC_HIDDEN; +extern HPALETTE hPrimaryPalette DECLSPEC_HIDDEN; /* region.c */ extern BOOL REGION_FrameRgn( HRGN dest, HRGN src, INT x, INT y ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c index a67ceb32d5d..6ba4a4c8cdb 100644 --- a/dlls/gdi32/gdiobj.c +++ b/dlls/gdi32/gdiobj.c @@ -1155,19 +1155,6 @@ void WINAPI SetObjectOwner( HGDIOBJ handle, HANDLE owner ) } -/*********************************************************************** - * MakeObjectPrivate (GDI.463) - * - * What does that mean ? - * Some little docu can be found in "Undocumented Windows", - * but this is basically useless. - */ -void WINAPI MakeObjectPrivate16( HGDIOBJ16 handle16, BOOL16 private ) -{ - FIXME( "stub: %x %u\n", handle16, private ); -} - - /*********************************************************************** * GdiFlush (GDI32.@) */ diff --git a/dlls/gdi32/mapping.c b/dlls/gdi32/mapping.c index cc82fc2c880..c802a102f98 100644 --- a/dlls/gdi32/mapping.c +++ b/dlls/gdi32/mapping.c @@ -57,25 +57,6 @@ static void MAPPING_FixIsotropic( DC * dc ) } -/*********************************************************************** - * DPtoLP (GDI.67) - */ -BOOL16 WINAPI DPtoLP16( HDC16 hdc, LPPOINT16 points, INT16 count ) -{ - DC * dc = get_dc_ptr( HDC_32(hdc) ); - if (!dc) return FALSE; - - while (count--) - { - points->x = MulDiv( points->x - dc->vportOrgX, dc->wndExtX, dc->vportExtX ) + dc->wndOrgX; - points->y = MulDiv( points->y - dc->vportOrgY, dc->wndExtY, dc->vportExtY ) + dc->wndOrgY; - points++; - } - release_dc_ptr( dc ); - return TRUE; -} - - /*********************************************************************** * DPtoLP (GDI32.@) */ @@ -104,25 +85,6 @@ BOOL WINAPI DPtoLP( HDC hdc, LPPOINT points, INT count ) } -/*********************************************************************** - * LPtoDP (GDI.99) - */ -BOOL16 WINAPI LPtoDP16( HDC16 hdc, LPPOINT16 points, INT16 count ) -{ - DC * dc = get_dc_ptr( HDC_32(hdc) ); - if (!dc) return FALSE; - - while (count--) - { - points->x = MulDiv( points->x - dc->wndOrgX, dc->vportExtX, dc->wndExtX ) + dc->vportOrgX; - points->y = MulDiv( points->y - dc->wndOrgY, dc->vportExtY, dc->wndExtY ) + dc->vportOrgY; - points++; - } - release_dc_ptr( dc ); - return TRUE; -} - - /*********************************************************************** * LPtoDP (GDI32.@) */ diff --git a/dlls/gdi32/palette.c b/dlls/gdi32/palette.c index 58ff4b531cf..b4bbc9508d1 100644 --- a/dlls/gdi32/palette.c +++ b/dlls/gdi32/palette.c @@ -29,12 +29,12 @@ #include "windef.h" #include "winbase.h" +#include "winerror.h" #include "wingdi.h" -#include "wownt32.h" -#include "wine/winuser16.h" +#include "winuser.h" + #include "gdi_private.h" #include "wine/debug.h" -#include "winerror.h" WINE_DEFAULT_DEBUG_CHANNEL(palette); @@ -67,7 +67,7 @@ UINT (WINAPI *pfnRealizePalette)(HDC hdc) = GDIRealizePalette; static UINT SystemPaletteUse = SYSPAL_STATIC; /* currently not considered */ -static HPALETTE hPrimaryPalette = 0; /* used for WM_PALETTECHANGED */ +HPALETTE hPrimaryPalette = 0; /* used for WM_PALETTECHANGED */ static HPALETTE hLastRealizedPalette = 0; /* UnrealizeObject() needs it */ #define NB_RESERVED_COLORS 20 /* number of fixed colors in system palette */ @@ -752,39 +752,6 @@ UINT WINAPI GDIRealizePalette( HDC hdc ) } -/*********************************************************************** - * RealizeDefaultPalette (GDI.365) - */ -UINT16 WINAPI RealizeDefaultPalette16( HDC16 hdc ) -{ - UINT16 ret = 0; - DC *dc; - - TRACE("%04x\n", hdc ); - - if (!(dc = get_dc_ptr( HDC_32(hdc) ))) return 0; - - if (dc->funcs->pRealizeDefaultPalette) ret = dc->funcs->pRealizeDefaultPalette( dc->physDev ); - release_dc_ptr( dc ); - return ret; -} - -/*********************************************************************** - * IsDCCurrentPalette (GDI.412) - */ -BOOL16 WINAPI IsDCCurrentPalette16(HDC16 hDC) -{ - DC *dc = get_dc_ptr( HDC_32(hDC) ); - if (dc) - { - BOOL bRet = dc->hPalette == hPrimaryPalette; - release_dc_ptr( dc ); - return bRet; - } - return FALSE; -} - - /*********************************************************************** * SelectPalette [GDI32.@] * @@ -860,16 +827,6 @@ BOOL WINAPI UpdateColors( return 0x666; } - -/********************************************************************* - * SetMagicColors (GDI.606) - */ -VOID WINAPI SetMagicColors16(HDC16 hDC, COLORREF color, UINT16 index) -{ - FIXME("(hDC %04x, color %04x, index %04x): stub\n", hDC, (int)color, index); - -} - /********************************************************************* * SetMagicColors (GDI32.@) */