https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8767aada7563962a1e3015...
commit 8767aada7563962a1e3015a4dcbab22770c59850 Author: James Tabor james.tabor@reactos.org AuthorDate: Mon Sep 27 19:08:43 2021 -0500 Commit: James Tabor james.tabor@reactos.org CommitDate: Mon Sep 27 19:08:43 2021 -0500
[GDI32] Fix IV msvc build. --- win32ss/gdi/gdi32/objects/dc.c | 22 ++++++++++++++++++++-- win32ss/gdi/gdi32/wine/emfdc.c | 14 +++++++------- win32ss/gdi/gdi32/wine/metadc.c | 4 ++-- 3 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/win32ss/gdi/gdi32/objects/dc.c b/win32ss/gdi/gdi32/objects/dc.c index f929dfdd011..3f20b9f6392 100644 --- a/win32ss/gdi/gdi32/objects/dc.c +++ b/win32ss/gdi/gdi32/objects/dc.c @@ -1314,8 +1314,26 @@ SelectPalette( HPALETTE hpal, BOOL bForceBackground) { - HANDLE_METADC(HPALETTE, SelectPalette, NULL, hdc, hpal); - + if (GDI_HANDLE_GET_TYPE(hdc) != GDILoObjType_LO_DC_TYPE) + { + if (GDI_HANDLE_GET_TYPE(hdc) == GDILoObjType_LO_METADC16_TYPE) + { + return (HPALETTE)((ULONG_PTR)METADC_SelectPalette(hdc, hpal)); + } + else + { + PLDC pLDC = GdiGetLDC(hdc); + if ( !pLDC ) + { + SetLastError(ERROR_INVALID_HANDLE); + return NULL; + } + if ( pLDC->iType == LDC_EMFLDC && !(EMFDC_SelectPalette(pLDC, hpal)) ) + { + return NULL; + } + } + } return NtUserSelectPalette(hdc, hpal, bForceBackground); }
diff --git a/win32ss/gdi/gdi32/wine/emfdc.c b/win32ss/gdi/gdi32/wine/emfdc.c index 75abcf94837..c396f3df3a3 100644 --- a/win32ss/gdi/gdi32/wine/emfdc.c +++ b/win32ss/gdi/gdi32/wine/emfdc.c @@ -184,7 +184,7 @@ static UINT get_bitmap_info( HDC *hdc, HBITMAP *bitmap, BITMAPINFO *info )
bpp = info->bmiHeader.biBitCount; if (bpp <= 8) - return sizeof(BITMAPINFOHEADER) + (1 << bpp) * sizeof(RGBQUAD); + return sizeof(BITMAPINFOHEADER) + (1L << bpp) * sizeof(RGBQUAD); else if (bpp == 16 || bpp == 32) return sizeof(BITMAPINFOHEADER) + 3 * sizeof(RGBQUAD);
@@ -853,7 +853,7 @@ static BOOL emfdc_polylinegon( WINEDC *dc_attr, const POINT *points, INT count, DWORD size; BOOL ret, use_small_emr = can_use_short_points( points, count );
- size = use_small_emr ? offsetof( EMRPOLYLINE16, apts[count] ) : offsetof( EMRPOLYLINE, aptl[count] ); + size = use_small_emr ? (DWORD)offsetof( EMRPOLYLINE16, apts[count] ) : (DWORD)offsetof( EMRPOLYLINE, aptl[count] );
emr = HeapAlloc( GetProcessHeap(), 0, size ); emr->emr.iType = use_small_emr ? type + EMR_POLYLINE16 - EMR_POLYLINE : type; @@ -970,8 +970,8 @@ BOOL EMFDC_PolyDraw( WINEDC *dc_attr, const POINT *pts, const BYTE *types, DWORD BOOL use_small_emr = can_use_short_points( pts, count ); DWORD size;
- size = use_small_emr ? offsetof( EMRPOLYDRAW16, apts[count] ) - : offsetof( EMRPOLYDRAW, aptl[count] ); + size = use_small_emr ? (DWORD)offsetof( EMRPOLYDRAW16, apts[count] ) + : (DWORD)offsetof( EMRPOLYDRAW, aptl[count] ); size += (count + 3) & ~3;
if (!(emr = HeapAlloc( GetProcessHeap(), 0, size ))) return FALSE; @@ -2273,7 +2273,7 @@ BOOL EMFDC_WriteNamedEscape( WINEDC *dc_attr, PWCHAR pDriver, INT nEscape, INT c rounded_size = (cbInput+3) & ~3; total = offsetof(EMRNAMEDESCAPE,Data) + rounded_size;
- total += sizestr = (wcslen(pDriver) + 1 ) * sizeof(WCHAR); + total += sizestr = (UINT)((wcslen(pDriver) + 1 ) * sizeof(WCHAR));
pemr = RtlAllocateHeap( GetProcessHeap(), 0, total ); if ( !pemr ) @@ -2369,8 +2369,8 @@ HDC WINAPI CreateEnhMetaFileA( HDC hdc, const char *filename, const RECT *rect,
if(description) { - len1 = strlen(description); - len2 = strlen(description + len1 + 1); + len1 = (DWORD)strlen(description); + len2 = (DWORD)strlen(description + len1 + 1); total = MultiByteToWideChar( CP_ACP, 0, description, len1 + len2 + 3, NULL, 0 ); descriptionW = HeapAlloc( GetProcessHeap(), 0, total * sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, description, len1 + len2 + 3, descriptionW, total ); diff --git a/win32ss/gdi/gdi32/wine/metadc.c b/win32ss/gdi/gdi32/wine/metadc.c index 38ba8e6f641..c159880c93b 100644 --- a/win32ss/gdi/gdi32/wine/metadc.c +++ b/win32ss/gdi/gdi32/wine/metadc.c @@ -667,7 +667,7 @@ static INT16 metadc_create_region( struct metadc *metadc, HRGN hrgn ) mr->rdParm[1] = 6; mr->rdParm[2] = 0x2f6; mr->rdParm[3] = 0; - mr->rdParm[4] = (param - &mr->rdFunction) * sizeof(WORD); + mr->rdParm[4] = (WORD)((param - &mr->rdFunction) * sizeof(WORD)); mr->rdParm[5] = bands; mr->rdParm[6] = max_bounds; mr->rdParm[7] = rgndata->rdh.rcBound.left; @@ -757,7 +757,7 @@ static BOOL metadc_stretchblt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT
bpp = src_info.bmiHeader.biBitCount; if (bpp <= 8) - bmi_size = sizeof(BITMAPINFOHEADER) + (1 << bpp) * sizeof(RGBQUAD); + bmi_size = sizeof(BITMAPINFOHEADER) + (1L << bpp) * sizeof(RGBQUAD); else if (bpp == 16 || bpp == 32) bmi_size = sizeof(BITMAPINFOHEADER) + 3 * sizeof(RGBQUAD); else