camerauis/cameraapp/generic/src/CamSyncRotatorAo.cpp
branchRCL_3
changeset 24 bac7acad7cb3
parent 0 1ddebce53859
equal deleted inserted replaced
23:61bc0f252b2b 24:bac7acad7cb3
       
     1 /*
       
     2 * Copyright (c)  Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "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 *
       
    14 * Description:  Utility class to rotate bitmaps*
       
    15 */
       
    16 
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <e32base.h>
       
    21 #include <e32std.h>
       
    22 #include "CamSyncRotatorAo.h"
       
    23 #include "camlogging.h"
       
    24 
       
    25 // CONSTANTS
       
    26 
       
    27 // MACROS
       
    28 
       
    29 // LOCAL CONSTANTS AND MACROS
       
    30 
       
    31 // MODULE DATA STRUCTURES
       
    32 
       
    33 // LOCAL FUNCTION PROTOTYPES
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 
       
    37 // ============================= LOCAL FUNCTIONS ===============================
       
    38 
       
    39 // ============================ MEMBER FUNCTIONS ===============================
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CCamSyncRotatorAo::CCamSyncRotatorAo
       
    43 // C++ constructor
       
    44 // -----------------------------------------------------------------------------
       
    45 //
       
    46 CCamSyncRotatorAo::CCamSyncRotatorAo(MBitmapRotationObserver& aObserver) : 
       
    47                          CActive( EPriorityHigh ),
       
    48                          iObserver( aObserver )
       
    49                             
       
    50     {    
       
    51     }
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // CCamSyncRotatorAo::ConstructL
       
    55 // Second phase constructor.
       
    56 // -----------------------------------------------------------------------------
       
    57 //
       
    58 void CCamSyncRotatorAo::ConstructL()
       
    59     {    
       
    60     iRotator = CBitmapRotator::NewL();
       
    61     CActiveScheduler::Add( this );
       
    62     }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CCamSyncRotatorAo::NewL
       
    66 // Two-phased constructor.
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 CCamSyncRotatorAo* CCamSyncRotatorAo::NewL(MBitmapRotationObserver& aObserver)
       
    70     {
       
    71     CCamSyncRotatorAo* self = new( ELeave ) CCamSyncRotatorAo(aObserver);
       
    72     CleanupStack::PushL( self );
       
    73     self->ConstructL();
       
    74     CleanupStack::Pop( self );
       
    75     return self;
       
    76     }
       
    77 
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CCamSyncRotatorAo::~CCamSyncRotatorAo()
       
    81 // Destructor
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 CCamSyncRotatorAo::~CCamSyncRotatorAo()
       
    85   {
       
    86   PRINT( _L("Camera => ~CCamSyncRotatorAo" ))  
       
    87   Cancel();
       
    88   delete iRotator;
       
    89   PRINT( _L("Camera <= ~CCamSyncRotatorAo" ))  
       
    90   }
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // CCamSyncRotatorAo::RotateL()
       
    94 // Rotate the provided bitmap
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 void CCamSyncRotatorAo::RotateL( CFbsBitmap* aBitmap, CBitmapRotator::TRotationAngle aRotation )
       
    98     {
       
    99     iRotator->Rotate( &iStatus, *aBitmap, aRotation );
       
   100     SetActive();    
       
   101     }
       
   102    
       
   103 // -----------------------------------------------------------------------------
       
   104 // CCamSyncRotatorAo::RunL
       
   105 // Called when a rotation operation is completed (or cancelled)
       
   106 // -----------------------------------------------------------------------------
       
   107 //
       
   108 void CCamSyncRotatorAo::RunL()
       
   109     {            
       
   110     iObserver.RotationCompleteL(iStatus.Int());
       
   111     }
       
   112         
       
   113 // -----------------------------------------------------------------------------
       
   114 // CCamSyncRotatorAo::DoCancel
       
   115 // Called to cancel an outstanding rotation operation
       
   116 // -----------------------------------------------------------------------------
       
   117 //
       
   118 void CCamSyncRotatorAo::DoCancel()
       
   119     {
       
   120     iRotator->Cancel();
       
   121     }
       
   122     
       
   123 //  End of File