Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 04:43, 24 August 2007.

KIS000303 - Scaling a bitmap without preserving the aspect ratio may lead to application panic

From Forum Nokia Wiki


Scaling a bitmap without preserving the aspect ratio may lead to application panic
KIS000303
Overview
Using the CBitmapScaler::Scale() method with the aMaintainAspectRatio parameter set to EFalse may lead to application panic.
Reported against
S60 2nd Edition, FP3, N70, N90
Date identified
November 24, 2005
Symptoms
-
Detailed description
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
(See above)
Solution
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 Series 60 Developer Platform 2.0: Image Converter Example application.
void CImageConverterEngine::ScaleL(TSize aSize)
    {
    CWsBitmap *newBitmap = new (ELeave)
        CWsBitmap(CEikonEnv::Static()->WsSession());
    CleanupStack::PushL(newBitmap);
    User::LeaveIfError(newBitmap->Create(
        aSize,CEikonEnv::Static()->DefaultDisplayMode()));

    CFbsBitmapDevice* bitDev =
        CFbsBitmapDevice::NewL(newBitmap);
    CleanupStack::PushL(bitDev);

    CBitmapContext* bgc = NULL;
    User::LeaveIfError(bitDev->CreateBitmapContext(bgc));

    bgc->DrawBitmap(TRect(TPoint(0,0), aSize), iBitmap);
    delete bgc;

    CleanupStack::PopAndDestroy(2); // bitDev, newBitmap

    delete iBitmap;
    iBitmap = newBitmap;

    iController->NotifyCompletion(KErrNone);
    }
Related Discussions
Thread Thread Starter Forum Replies Last Post
CCamera:NewL causes KERN-EXEC 0 alav Symbian Media (Graphics & Sounds) 3 2007-08-10 15:44
panic VIEWSERV 11 armel General Symbian C++ 1 2002-10-24 09:49
application crash on mmc card dinesh547 General Symbian C++ 14 2008-03-06 08:09
WAP Gateway problem Nokia_Archived WAP Servers 1 2002-05-20 12:51
About ImageReady and ViewFinderFrameReady mopa General Symbian C++ 1 2007-05-20 13:50
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZKnowledgeBaseContentQ
     qfnZtypeQUqfnTypeZKnownIssueQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX