mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-22 23:26:15 +00:00
Merge with develop
--HG-- branch : compatibility-develop
This commit is contained in:
commit
fd3b681203
1 changed files with 54 additions and 2 deletions
|
@ -1792,7 +1792,7 @@ void CBitmap::releaseMipMaps()
|
|||
\*-------------------------------------------------------------------*/
|
||||
void CBitmap::resample(sint32 nNewWidth, sint32 nNewHeight)
|
||||
{
|
||||
nlassert(PixelFormat == RGBA || PixelFormat == Luminance);
|
||||
nlassert(PixelFormat == RGBA || PixelFormat == Luminance || PixelFormat == AlphaLuminance);
|
||||
bool needRebuild = false;
|
||||
|
||||
// Deleting mipmaps
|
||||
|
@ -1832,6 +1832,58 @@ void CBitmap::resample(sint32 nNewWidth, sint32 nNewHeight)
|
|||
resamplePicture8 (&_Data[0][0], pDestGray, _Width, _Height, nNewWidth, nNewHeight);
|
||||
//logResample("Resample: 60");
|
||||
}
|
||||
else if (PixelFormat == AlphaLuminance)
|
||||
{
|
||||
pDestui.resize(nNewWidth*nNewHeight*2);
|
||||
|
||||
uint16 *pSrc = (uint16*)&_Data[0][0];
|
||||
uint16 *pDest = (uint16*)&pDestui[0];
|
||||
|
||||
size_t srcSize = _Width*_Width;
|
||||
uint8 *pSrcGray = new uint8[srcSize];
|
||||
uint8 *pSrcAlpha = new uint8[srcSize];
|
||||
|
||||
// set iterators
|
||||
uint16 *i = (uint16*)pSrc;
|
||||
uint16 *iEnd = (uint16*)i + srcSize;
|
||||
uint8 *iGray = pSrcGray;
|
||||
uint8 *iAlpha = pSrcAlpha;
|
||||
|
||||
// copy alpha and gray in distinct arrays
|
||||
while (i < iEnd)
|
||||
{
|
||||
*(iGray++) = (*i) & 0xff;
|
||||
*(iAlpha++) = ((*i) >> 8) & 0xff;
|
||||
++i;
|
||||
}
|
||||
|
||||
size_t destSize = nNewWidth*nNewHeight;
|
||||
|
||||
// resample gray values array
|
||||
uint8 *pDestGray = new uint8[destSize];
|
||||
resamplePicture8(pSrcGray, pDestGray, _Width, _Height, nNewWidth, nNewHeight);
|
||||
delete[] pSrcGray;
|
||||
|
||||
// resample alpha values array
|
||||
uint8 *pDestAlpha = new uint8[destSize];
|
||||
resamplePicture8(pSrcAlpha, pDestAlpha, _Width, _Height, nNewWidth, nNewHeight);
|
||||
delete[] pSrcAlpha;
|
||||
|
||||
// set iterators
|
||||
i = (uint16*)pDest;
|
||||
iEnd = (uint16*)i + destSize;
|
||||
iGray = pDestGray;
|
||||
iAlpha = pDestAlpha;
|
||||
|
||||
// merge alpha and gray in destination array
|
||||
while (i < iEnd)
|
||||
{
|
||||
*(i++) = *(iGray++) | (*(iAlpha++) << 8);
|
||||
}
|
||||
|
||||
delete[] pDestGray;
|
||||
delete[] pDestAlpha;
|
||||
}
|
||||
|
||||
NLMISC::contReset(_Data[0]); // free memory
|
||||
//logResample("Resample: 70");
|
||||
|
@ -2148,7 +2200,7 @@ void CBitmap::resamplePicture32Fast (const NLMISC::CRGBA *pSrc, NLMISC::CRGBA *p
|
|||
|
||||
|
||||
/*-------------------------------------------------------------------*\
|
||||
resamplePicture32
|
||||
resamplePicture8
|
||||
\*-------------------------------------------------------------------*/
|
||||
void CBitmap::resamplePicture8 (const uint8 *pSrc, uint8 *pDest,
|
||||
sint32 nSrcWidth, sint32 nSrcHeight,
|
||||
|
|
Loading…
Reference in a new issue