[MSRLE32] Sync with Wine Staging 1.7.55. CORE-10536

svn path=/trunk/; revision=69986
This commit is contained in:
Amine Khaldi 2015-11-21 09:59:56 +00:00
parent 659bed7ef9
commit 6140544f7a
2 changed files with 52 additions and 42 deletions

View file

@ -1596,7 +1596,7 @@ static LRESULT DecompressQuery(CodecInfo *pi, LPCBITMAPINFOHEADER lpbiIn,
/* check input format if given */
if (lpbiIn != NULL) {
if (!isSupportedMRLE(lpbiIn))
if (!isSupportedMRLE(lpbiIn) && !isSupportedDIB(lpbiIn))
return ICERR_BADFORMAT;
}
@ -1607,11 +1607,11 @@ static LRESULT DecompressQuery(CodecInfo *pi, LPCBITMAPINFOHEADER lpbiIn,
if (lpbiIn != NULL) {
if (lpbiIn->biWidth != lpbiOut->biWidth)
hr = ICERR_UNSUPPORTED;
hr = ICERR_UNSUPPORTED;
if (lpbiIn->biHeight != lpbiOut->biHeight)
hr = ICERR_UNSUPPORTED;
hr = ICERR_UNSUPPORTED;
if (lpbiIn->biBitCount > lpbiOut->biBitCount)
hr = ICERR_UNSUPPORTED;
hr = ICERR_UNSUPPORTED;
}
}
@ -1645,49 +1645,51 @@ static LRESULT DecompressBegin(CodecInfo *pi, LPCBITMAPINFOHEADER lpbiIn,
if (pi->bDecompress)
DecompressEnd(pi);
rgbIn = (const RGBQUAD*)((const BYTE*)lpbiIn + lpbiIn->biSize);
rgbOut = (const RGBQUAD*)((const BYTE*)lpbiOut + lpbiOut->biSize);
if (lpbiIn->biCompression != BI_RGB)
{
rgbIn = (const RGBQUAD*)((const BYTE*)lpbiIn + lpbiIn->biSize);
rgbOut = (const RGBQUAD*)((const BYTE*)lpbiOut + lpbiOut->biSize);
switch (lpbiOut->biBitCount) {
case 4:
case 8:
pi->palette_map = LocalAlloc(LPTR, lpbiIn->biClrUsed);
if (pi->palette_map == NULL)
return ICERR_MEMORY;
switch (lpbiOut->biBitCount) {
case 4:
case 8:
pi->palette_map = LocalAlloc(LPTR, lpbiIn->biClrUsed);
if (pi->palette_map == NULL)
return ICERR_MEMORY;
for (i = 0; i < lpbiIn->biClrUsed; i++) {
pi->palette_map[i] = MSRLE32_GetNearestPaletteIndex(lpbiOut->biClrUsed, rgbOut, rgbIn[i]);
}
break;
case 15:
case 16:
pi->palette_map = LocalAlloc(LPTR, lpbiIn->biClrUsed * 2);
if (pi->palette_map == NULL)
return ICERR_MEMORY;
for (i = 0; i < lpbiIn->biClrUsed; i++) {
pi->palette_map[i] = MSRLE32_GetNearestPaletteIndex(lpbiOut->biClrUsed, rgbOut, rgbIn[i]);
}
break;
case 15:
case 16:
pi->palette_map = LocalAlloc(LPTR, lpbiIn->biClrUsed * 2);
if (pi->palette_map == NULL)
return ICERR_MEMORY;
for (i = 0; i < lpbiIn->biClrUsed; i++) {
WORD color;
for (i = 0; i < lpbiIn->biClrUsed; i++) {
WORD color;
if (lpbiOut->biBitCount == 15)
color = ((rgbIn[i].rgbRed >> 3) << 10)
| ((rgbIn[i].rgbGreen >> 3) << 5) | (rgbIn[i].rgbBlue >> 3);
else
color = ((rgbIn[i].rgbRed >> 3) << 11)
| ((rgbIn[i].rgbGreen >> 3) << 5) | (rgbIn[i].rgbBlue >> 3);
if (lpbiOut->biBitCount == 15)
color = ((rgbIn[i].rgbRed >> 3) << 10)
| ((rgbIn[i].rgbGreen >> 3) << 5) | (rgbIn[i].rgbBlue >> 3);
else
color = ((rgbIn[i].rgbRed >> 3) << 11)
| ((rgbIn[i].rgbGreen >> 3) << 5) | (rgbIn[i].rgbBlue >> 3);
pi->palette_map[i * 2 + 1] = color >> 8;
pi->palette_map[i * 2 + 0] = color & 0xFF;
pi->palette_map[i * 2 + 1] = color >> 8;
pi->palette_map[i * 2 + 0] = color & 0xFF;
};
break;
case 24:
case 32:
pi->palette_map = LocalAlloc(LPTR, lpbiIn->biClrUsed * sizeof(RGBQUAD));
if (pi->palette_map == NULL)
return ICERR_MEMORY;
memcpy(pi->palette_map, rgbIn, lpbiIn->biClrUsed * sizeof(RGBQUAD));
break;
};
break;
case 24:
case 32:
pi->palette_map = LocalAlloc(LPTR, lpbiIn->biClrUsed * sizeof(RGBQUAD));
if (pi->palette_map == NULL)
return ICERR_MEMORY;
memcpy(pi->palette_map, rgbIn, lpbiIn->biClrUsed * sizeof(RGBQUAD));
break;
};
}
pi->bDecompress = TRUE;
return ICERR_OK;
@ -1718,6 +1720,14 @@ static LRESULT Decompress(CodecInfo *pi, ICDECOMPRESS *pic, DWORD dwSize)
assert(pic->lpbiInput->biWidth == pic->lpbiOutput->biWidth);
assert(pic->lpbiInput->biHeight == pic->lpbiOutput->biHeight);
/* Uncompressed frame? */
if (pic->lpbiInput->biCompression == BI_RGB)
{
pic->lpbiOutput->biSizeImage = pic->lpbiInput->biSizeImage;
memcpy(pic->lpOutput, pic->lpInput, pic->lpbiOutput->biSizeImage);
return ICERR_OK;
}
pic->lpbiOutput->biSizeImage = DIBWIDTHBYTES(*pic->lpbiOutput) * pic->lpbiOutput->biHeight;
if (pic->lpbiInput->biBitCount == 4)
return MSRLE32_DecompressRLE4(pi, pic->lpbiOutput, pic->lpInput, pic->lpOutput);

View file

@ -122,7 +122,7 @@ reactos/dll/win32/msisip # Synced to WineStaging-1.7.47
reactos/dll/win32/msisys.ocx # Synced to WineStaging-1.7.47
reactos/dll/win32/msnet32 # Synced to WineStaging-1.7.47
reactos/dll/win32/mspatcha # Synced to WineStaging-1.7.47
reactos/dll/win32/msrle32 # Synced to WineStaging-1.7.47
reactos/dll/win32/msrle32 # Synced to WineStaging-1.7.55
reactos/dll/win32/mssign32 # Synced to WineStaging-1.7.47
reactos/dll/win32/mssip32 # Synced to WineStaging-1.7.47
reactos/dll/win32/mstask # Synced to WineStaging-1.7.47