From bdeac904e0195ea68cb227028cba620e76fd0124 Mon Sep 17 00:00:00 2001 From: Dmitry Chapyshev Date: Sat, 11 Apr 2009 08:58:56 +0000 Subject: [PATCH] - Sync gdiplus, iccvid, imaadp32.acm, inetcomm with Wine 1.1.19 - Remove unneeded gdiplus_ros.diff svn path=/trunk/; revision=40456 --- reactos/dll/win32/gdiplus/gdiplus.c | 2 +- reactos/dll/win32/gdiplus/gdiplus.spec | 2 +- reactos/dll/win32/gdiplus/gdiplus_private.h | 2 +- reactos/dll/win32/gdiplus/gdiplus_ros.diff | 58 ------------ reactos/dll/win32/iccvid/iccvid.c | 3 +- reactos/dll/win32/imaadp32.acm/imaadp32.c | 90 +++++++++++++++---- .../dll/win32/inetcomm/internettransport.c | 12 +-- 7 files changed, 83 insertions(+), 86 deletions(-) delete mode 100644 reactos/dll/win32/gdiplus/gdiplus_ros.diff diff --git a/reactos/dll/win32/gdiplus/gdiplus.c b/reactos/dll/win32/gdiplus/gdiplus.c index a11ad5833bc..35caad8d830 100644 --- a/reactos/dll/win32/gdiplus/gdiplus.c +++ b/reactos/dll/win32/gdiplus/gdiplus.c @@ -214,7 +214,7 @@ INT arc2polybezier(GpPointF * points, REAL x1, REAL y1, REAL x2, REAL y2, unstretch_angle(&startAngle, x2 / 2.0, y2 / 2.0); unstretch_angle(&endAngle, x2 / 2.0, y2 / 2.0); - count = ceil(fabs(endAngle - startAngle) / M_PI_2) * 3 + 1; + count = ceilf(fabs(endAngle - startAngle) / M_PI_2) * 3 + 1; /* don't make more than a full circle */ count = min(MAX_ARC_PTS, count); diff --git a/reactos/dll/win32/gdiplus/gdiplus.spec b/reactos/dll/win32/gdiplus/gdiplus.spec index 0037a74182f..17f4951c9fd 100644 --- a/reactos/dll/win32/gdiplus/gdiplus.spec +++ b/reactos/dll/win32/gdiplus/gdiplus.spec @@ -47,7 +47,7 @@ @ stdcall GdipBitmapUnlockBits(ptr ptr) @ stdcall GdipClearPathMarkers(ptr) @ stub GdipCloneBitmapArea -@ stub GdipCloneBitmapAreaI +@ stdcall GdipCloneBitmapAreaI(long long long long long ptr ptr) @ stdcall GdipCloneBrush(ptr ptr) @ stdcall GdipCloneCustomLineCap(ptr ptr) @ stdcall GdipCloneFont(ptr ptr) diff --git a/reactos/dll/win32/gdiplus/gdiplus_private.h b/reactos/dll/win32/gdiplus/gdiplus_private.h index 658f15e488e..dbeebe3380e 100644 --- a/reactos/dll/win32/gdiplus/gdiplus_private.h +++ b/reactos/dll/win32/gdiplus/gdiplus_private.h @@ -61,7 +61,7 @@ extern inline void delete_element(region_element *element); static inline INT roundr(REAL x) { - return (INT) floor(x + 0.5); + return (INT) floorf(x + 0.5); } static inline REAL deg2rad(REAL degrees) diff --git a/reactos/dll/win32/gdiplus/gdiplus_ros.diff b/reactos/dll/win32/gdiplus/gdiplus_ros.diff deleted file mode 100644 index 904a12a273f..00000000000 --- a/reactos/dll/win32/gdiplus/gdiplus_ros.diff +++ /dev/null @@ -1,58 +0,0 @@ -Index: gdiplus.c -=================================================================== -RCS file: /home/wine/wine/dlls/gdiplus/gdiplus.c,v -retrieving revision 1.15 -diff -u -r1.15 gdiplus.c ---- gdiplus.c 8 Jan 2008 16:22:52 -0000 1.15 -+++ gdiplus.c 23 Mar 2008 21:21:23 -0000 -@@ -200,7 +200,7 @@ - unstretch_angle(&startAngle, x2 / 2.0, y2 / 2.0); - unstretch_angle(&endAngle, x2 / 2.0, y2 / 2.0); - -- count = ceilf(fabs(endAngle - startAngle) / M_PI_2) * 3 + 1; -+ count = ceil(fabs(endAngle - startAngle) / M_PI_2) * 3 + 1; - /* don't make more than a full circle */ - count = min(MAX_ARC_PTS, count); - -Index: gdiplus_private.h -=================================================================== -RCS file: /home/wine/wine/dlls/gdiplus/gdiplus_private.h,v -retrieving revision 1.58 -diff -u -r1.58 gdiplus_private.h ---- gdiplus_private.h 15 Aug 2007 09:36:31 -0000 1.58 -+++ gdiplus_private.h 23 Mar 2008 09:25:54 -0000 -@@ -46,7 +46,7 @@ - - static inline INT roundr(REAL x) - { -- return (INT) floorf(x + 0.5); -+ return (INT) floor(x + 0.5); - } - - static inline REAL deg2rad(REAL degrees) -Index: graphics.c -=================================================================== -RCS file: /home/wine/wine/dlls/gdiplus/graphics.c,v -retrieving revision 1.102 -diff -u -r1.102 graphics.c ---- graphics.c 1 Mar 2008 12:15:48 -0000 1.102 -+++ graphics.c 23 Mar 2008 21:21:23 -0000 -@@ -1464,7 +1464,7 @@ - DeleteObject(SelectObject(graphics->hdc, CreateFontIndirectW(&lfw))); - - for(i = 0, j = 0; i < length; i++){ -- if(!isprintW(string[i]) && (string[i] != '\n')) -+ if(!isprint(string[i]) && (string[i] != '\n')) - continue; - - stringdup[j] = string[i]; -@@ -1873,7 +1873,7 @@ - nwidth = nheight = INT_MAX; - - for(i = 0, j = 0; i < length; i++){ -- if(!isprintW(string[i]) && (string[i] != '\n')) -+ if(!isprint(string[i]) && (string[i] != '\n')) - continue; - - stringdup[j] = string[i]; - diff --git a/reactos/dll/win32/iccvid/iccvid.c b/reactos/dll/win32/iccvid/iccvid.c index 77328eabcda..1a1b33e2ae9 100644 --- a/reactos/dll/win32/iccvid/iccvid.c +++ b/reactos/dll/win32/iccvid/iccvid.c @@ -57,6 +57,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(iccvid); static HINSTANCE ICCVID_hModule; #define ICCVID_MAGIC mmioFOURCC('c', 'v', 'i', 'd') +#define compare_fourcc(fcc1, fcc2) (((fcc1)^(fcc2))&~0x20202020) #define DBUG 0 #define MAX_STRIPS 32 @@ -975,7 +976,7 @@ LRESULT WINAPI ICCVID_DriverProc( DWORD_PTR dwDriverId, HDRVR hdrvr, UINT msg, TRACE("Opened\n"); - if (icinfo && icinfo->fccType != ICTYPE_VIDEO) return 0; + if (icinfo && compare_fourcc(icinfo->fccType, ICTYPE_VIDEO)) return 0; info = heap_alloc( sizeof (ICCVID_Info) ); if( info ) diff --git a/reactos/dll/win32/imaadp32.acm/imaadp32.c b/reactos/dll/win32/imaadp32.acm/imaadp32.c index dd3cc5d108e..9a2fb537c90 100644 --- a/reactos/dll/win32/imaadp32.acm/imaadp32.c +++ b/reactos/dll/win32/imaadp32.acm/imaadp32.c @@ -120,9 +120,52 @@ static DWORD ADPCM_GetFormatIndex(const WAVEFORMATEX *wfx) return i; } + switch (wfx->wFormatTag) + { + case WAVE_FORMAT_PCM: + if(3 > wfx->nChannels && + wfx->nChannels > 0 && + wfx->nAvgBytesPerSec == 2 * wfx->nSamplesPerSec * wfx->nChannels && + wfx->nBlockAlign == 2 * wfx->nChannels && + wfx->wBitsPerSample == 16) + return hi; + break; + case WAVE_FORMAT_IMA_ADPCM: + if(3 > wfx->nChannels && + wfx->nChannels > 0 && + wfx->wBitsPerSample == 4 && + wfx->cbSize == 2) + return hi; + break; + } + return 0xFFFFFFFF; } +static void init_wfx_ima_adpcm(IMAADPCMWAVEFORMAT* awfx/*, DWORD nba*/) +{ + register WAVEFORMATEX* pwfx = &awfx->wfx; + + /* we assume wFormatTag, nChannels, nSamplesPerSec and wBitsPerSample + * have been initialized... */ + + if (pwfx->wFormatTag != WAVE_FORMAT_IMA_ADPCM) {FIXME("wrong FT\n"); return;} + if (ADPCM_GetFormatIndex(pwfx) == 0xFFFFFFFF) {FIXME("wrong fmt\n"); return;} + + switch (pwfx->nSamplesPerSec) + { + case 8000: pwfx->nBlockAlign = 256 * pwfx->nChannels; break; + case 11025: pwfx->nBlockAlign = 256 * pwfx->nChannels; break; + case 22050: pwfx->nBlockAlign = 512 * pwfx->nChannels; break; + case 44100: pwfx->nBlockAlign = 1024 * pwfx->nChannels; break; + default: /*pwfx->nBlockAlign = nba;*/ break; + } + pwfx->cbSize = sizeof(WORD); + + awfx->wSamplesPerBlock = (pwfx->nBlockAlign - (4 * pwfx->nChannels) * 2) / pwfx->nChannels + 1; + pwfx->nAvgBytesPerSec = (pwfx->nSamplesPerSec * pwfx->nBlockAlign) / awfx->wSamplesPerBlock; +} + /*********************************************************************** * R16 * @@ -612,6 +655,7 @@ static LRESULT ADPCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs) /* some tests ... */ if (adfs->cbwfxSrc < sizeof(PCMWAVEFORMAT) || adfs->cbwfxDst < sizeof(PCMWAVEFORMAT) || + adfs->pwfxSrc->wFormatTag == adfs->pwfxDst->wFormatTag || ADPCM_GetFormatIndex(adfs->pwfxSrc) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE; /* FIXME: should do those tests against the real size (according to format tag */ @@ -636,26 +680,24 @@ static LRESULT ADPCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs) adfs->pwfxDst->wFormatTag = WAVE_FORMAT_PCM; } - /* check if result is ok */ - if (ADPCM_GetFormatIndex(adfs->pwfxDst) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE; - /* recompute other values */ switch (adfs->pwfxDst->wFormatTag) { case WAVE_FORMAT_PCM: adfs->pwfxDst->nBlockAlign = (adfs->pwfxDst->nChannels * adfs->pwfxDst->wBitsPerSample) / 8; adfs->pwfxDst->nAvgBytesPerSec = adfs->pwfxDst->nSamplesPerSec * adfs->pwfxDst->nBlockAlign; + /* check if result is ok */ + if (ADPCM_GetFormatIndex(adfs->pwfxDst) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE; break; case WAVE_FORMAT_IMA_ADPCM: - adfs->pwfxDst->nBlockAlign = 1024; + init_wfx_ima_adpcm((IMAADPCMWAVEFORMAT*)adfs->pwfxDst); /* FIXME: not handling header overhead */ - adfs->pwfxDst->nAvgBytesPerSec = ((adfs->pwfxDst->nSamplesPerSec * 4) / 8) * adfs->pwfxSrc->nChannels; - ((IMAADPCMWAVEFORMAT*)adfs->pwfxDst)->wSamplesPerBlock = (1024 - 4 * adfs->pwfxSrc->nChannels) * (2 / adfs->pwfxSrc->nChannels) + 1; TRACE("setting spb=%u\n", ((IMAADPCMWAVEFORMAT*)adfs->pwfxDst)->wSamplesPerBlock); + /* check if result is ok */ + if (ADPCM_GetFormatIndex(adfs->pwfxDst) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE; break; default: - FIXME("\n"); - break; + return ACMERR_NOTPOSSIBLE; } return MMSYSERR_NOERROR; @@ -775,6 +817,8 @@ static LRESULT ADPCM_StreamClose(PACMDRVSTREAMINSTANCE adsi) */ static LRESULT ADPCM_StreamSize(const ACMDRVSTREAMINSTANCE *adsi, PACMDRVSTREAMSIZE adss) { + DWORD nblocks; + switch (adss->fdwSize) { case ACM_STREAMSIZEF_DESTINATION: @@ -782,14 +826,18 @@ static LRESULT ADPCM_StreamSize(const ACMDRVSTREAMINSTANCE *adsi, PACMDRVSTREAMS if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM && adsi->pwfxDst->wFormatTag == WAVE_FORMAT_IMA_ADPCM) { - /* don't take block overhead into account, doesn't matter too much */ - adss->cbSrcLength = adss->cbDstLength * 4; + nblocks = adss->cbDstLength / adsi->pwfxDst->nBlockAlign; + if (nblocks == 0) + return ACMERR_NOTPOSSIBLE; + adss->cbSrcLength = nblocks * adsi->pwfxSrc->nBlockAlign * ((IMAADPCMWAVEFORMAT*)adsi->pwfxDst)->wSamplesPerBlock; } else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_IMA_ADPCM && adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM) { - FIXME("misses the block header overhead\n"); - adss->cbSrcLength = 256 + adss->cbDstLength / 4; + nblocks = adss->cbDstLength / (adsi->pwfxDst->nBlockAlign * ((IMAADPCMWAVEFORMAT*)adsi->pwfxSrc)->wSamplesPerBlock); + if (nblocks == 0) + return ACMERR_NOTPOSSIBLE; + adss->cbSrcLength = nblocks * adsi->pwfxSrc->nBlockAlign; } else { @@ -801,14 +849,24 @@ static LRESULT ADPCM_StreamSize(const ACMDRVSTREAMINSTANCE *adsi, PACMDRVSTREAMS if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM && adsi->pwfxDst->wFormatTag == WAVE_FORMAT_IMA_ADPCM) { - FIXME("misses the block header overhead\n"); - adss->cbDstLength = 256 + adss->cbSrcLength / 4; + nblocks = adss->cbSrcLength / (adsi->pwfxSrc->nBlockAlign * ((IMAADPCMWAVEFORMAT*)adsi->pwfxDst)->wSamplesPerBlock); + if (nblocks == 0) + return ACMERR_NOTPOSSIBLE; + if (adss->cbSrcLength % (adsi->pwfxSrc->nBlockAlign * ((IMAADPCMWAVEFORMAT*)adsi->pwfxDst)->wSamplesPerBlock)) + /* Round block count up. */ + nblocks++; + adss->cbDstLength = nblocks * adsi->pwfxDst->nBlockAlign; } else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_IMA_ADPCM && adsi->pwfxDst->wFormatTag == WAVE_FORMAT_PCM) { - /* don't take block overhead into account, doesn't matter too much */ - adss->cbDstLength = adss->cbSrcLength * 4; + nblocks = adss->cbSrcLength / adsi->pwfxSrc->nBlockAlign; + if (nblocks == 0) + return ACMERR_NOTPOSSIBLE; + if (adss->cbSrcLength % adsi->pwfxSrc->nBlockAlign) + /* Round block count up. */ + nblocks++; + adss->cbDstLength = nblocks * adsi->pwfxDst->nBlockAlign * ((IMAADPCMWAVEFORMAT*)adsi->pwfxSrc)->wSamplesPerBlock; } else { diff --git a/reactos/dll/win32/inetcomm/internettransport.c b/reactos/dll/win32/inetcomm/internettransport.c index f0499bc19a1..af4772c2f88 100644 --- a/reactos/dll/win32/inetcomm/internettransport.c +++ b/reactos/dll/win32/inetcomm/internettransport.c @@ -20,19 +20,15 @@ #define COBJMACROS -#include -#include - -#include "windef.h" -#include "winbase.h" -#include "winnt.h" -#include "winuser.h" -#include "winsock2.h" #include "ws2tcpip.h" +#include "windef.h" +#include "winnt.h" #include "objbase.h" #include "ole2.h" #include "mimeole.h" +#include + #include "wine/debug.h" #include "inetcomm_private.h"