Archived:Scaling a bitmap without preserving the aspect ratio may lead to application panic on S60 2nd Edition FP3 (Known Issue)
Using the CBitmapScaler::Scale() method with the aMaintainAspectRatio parameter set to EFalse may lead to application panic.
An application may terminate with USER 21 panic when a bitmap image (e.g., of size 132x176) is scaled (e.g., to 176x144) using the Scale method from CBitmapScaler with the aMaintainAspectRatio parameter set to EFalse.
How to reproduce
If all that is needed is for the scaled image to be rendered on the screen, you can use the CGraphicContext::DrawBitmap method.
If the scaled bitmap is to be retained for further processing, the same method can be used to render the image on a CBitmapContext object and then keep the bitmap on which this was constructed. The following is a sample code for testing that can be integrated into the S60 Developer Platform 2.0: Image Converter Example application.
void CImageConverterEngine::ScaleL(TSize aSize)
CWsBitmap *newBitmap = new (ELeave)
CFbsBitmapDevice* bitDev =
CBitmapContext* bgc = NULL;
bgc->DrawBitmap(TRect(TPoint(0,0), aSize), iBitmap);
CleanupStack::PopAndDestroy(2); // bitDev, newBitmap
iBitmap = newBitmap;