diff -r e5618cc85d74 -r 6c158198356e javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/imagescaler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javauis/eswt_akn/org.eclipse.ercp.swt.s60/native/src/imagescaler.cpp Thu Aug 19 09:48:13 2010 +0300 @@ -0,0 +1,65 @@ +/******************************************************************************* + * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nokia Corporation - S60 implementation + *******************************************************************************/ + + +#include +#include +#include "imagescaler.h" + + +CImageScaler::CImageScaler() + : CActive(EPriorityStandard) +{ + CActiveScheduler::Add(this); +} + +CImageScaler::~CImageScaler() +{ + Cancel(); + if (iBitmapScaler) + iBitmapScaler->Cancel(); + delete iBitmapScaler; + delete iWait; +} + +CImageScaler* CImageScaler::NewL() +{ + CImageScaler* self = new(ELeave) CImageScaler(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; +} + +void CImageScaler::ConstructL() +{ + iBitmapScaler = CBitmapScaler::NewL(); + iBitmapScaler->SetQualityAlgorithm(CBitmapScaler::EMaximumQuality); + iWait = new(ELeave) CActiveSchedulerWait; +} + +void CImageScaler::Scale(CFbsBitmap& aSrcBitmap, CFbsBitmap& aDestBitmap, TBool aKeepAspectRatio) +{ + iBitmapScaler->Scale(&iStatus, aSrcBitmap, aDestBitmap, aKeepAspectRatio); + SetActive(); + iWait->Start(); +} + +void CImageScaler::RunL() +{ + iWait->AsyncStop(); +} + +void CImageScaler::DoCancel() +{ +} + +// End of File