imageeditorengine/JpegScaler/src/JpegScalerImpl.cpp
changeset 1 edfc90759b9f
equal deleted inserted replaced
0:57d4cdd99204 1:edfc90759b9f
       
     1 /*
       
     2 * Copyright (c) 2010 Ixonos Plc.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - Initial contribution
       
    11 *
       
    12 * Contributors:
       
    13 * Ixonos Plc
       
    14 *
       
    15 * Description:  
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include "JpegScalerImpl.h"
       
    21 #include "CJpegScale.h"
       
    22 
       
    23 CJpegScalerImpl* CJpegScalerImpl::NewL(RFs & aFsSession)
       
    24 {
       
    25     CJpegScalerImpl* impl = new(ELeave) CJpegScalerImpl(aFsSession);
       
    26     CleanupStack::PushL(impl);
       
    27     impl->ConstructL();
       
    28     CleanupStack::Pop();
       
    29     return impl;
       
    30 }
       
    31 
       
    32 CJpegScalerImpl::~CJpegScalerImpl()
       
    33 {
       
    34     Cancel();
       
    35     delete iScale;
       
    36 }
       
    37 	
       
    38 void CJpegScalerImpl::Scale(TRequestStatus* aRequestStatus, const TFileName& aSrcFileName, const TFileName& aTrgFileName, const TSize& aDestinationSize)
       
    39 {
       
    40     iScale->iSourceName = aSrcFileName;
       
    41     iScale->iTargetName = aTrgFileName;
       
    42     iScale->iTargetSize = aDestinationSize;
       
    43     iCallerReqStatus = aRequestStatus;
       
    44     *iCallerReqStatus = KRequestPending;
       
    45     Call();
       
    46 }
       
    47 
       
    48 CJpegScalerImpl::CJpegScalerImpl(RFs& aFsSession)
       
    49 : CAsyncOneShot(EPriorityStandard), iFsSession(aFsSession)
       
    50 {
       
    51     
       
    52 }
       
    53 
       
    54 void CJpegScalerImpl::ConstructL()
       
    55 {
       
    56     iScale = new(ELeave) CJpegScale();
       
    57 }
       
    58 
       
    59 void CJpegScalerImpl::RunL()
       
    60 {
       
    61     TInt err = KErrNone;
       
    62     if (iStatus == KErrNone)
       
    63     {
       
    64         TRAP(err,iScale->ScaleL());    
       
    65     }
       
    66     else
       
    67     {
       
    68         err = iStatus.Int();
       
    69     }
       
    70     User::RequestComplete(iCallerReqStatus,err);
       
    71 }
       
    72 
       
    73 
       
    74 
       
    75 // End of File