htiui/HtiServicePlugins/HtiScreenshotServicePlugin/src/HtiScreenshotServicePlugin.cpp
changeset 17 4f2773374eff
parent 11 4df3a095718c
equal deleted inserted replaced
15:e11368ed4880 17:4f2773374eff
    26 
    26 
    27 #include <imageconversion.h>
    27 #include <imageconversion.h>
    28 #include <ezcompressor.h>
    28 #include <ezcompressor.h>
    29 #include <hal.h>
    29 #include <hal.h>
    30 
    30 
    31 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
       
    32 
       
    33 #include <AknLayoutConfig.h>
    31 #include <AknLayoutConfig.h>
    34 #include <apgtask.h> 
    32 #include <apgtask.h> 
    35 #include <AknCapServerDefs.h>
    33 #include <AknCapServerDefs.h>
    36 
    34 
       
    35 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
       
    36 #include <alf/alfdrawer.h>
    37 #endif
    37 #endif
    38 
    38 
    39 // CONSTANTS
    39 // CONSTANTS
    40 const static TUid KScreenshotServiceUid = {0x1020DEC3};
    40 const static TUid KScreenshotServiceUid = {0x1020DEC3};
    41 
    41 
  1715 
  1715 
  1716 // ----------------------------------------------------------------------------
  1716 // ----------------------------------------------------------------------------
  1717 void CHtiScreenshotServicePlugin::HandleRotateScreen(const TDesC8& aData)
  1717 void CHtiScreenshotServicePlugin::HandleRotateScreen(const TDesC8& aData)
  1718     {
  1718     {
  1719     HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::HandleRotateScreen" );
  1719     HTI_LOG_FUNC_IN( "CHtiScreenshotServicePlugin::HandleRotateScreen" );
  1720 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )               
  1720              
  1721     TInt orientation = aData[0];
  1721     TInt orientation = aData[0];
  1722     if (orientation > 1 || orientation < 0)
  1722     if (orientation > 1 || orientation < 0)
  1723         {
  1723         {
  1724         iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
  1724         iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
  1725                 KErrDescrInvalid, KScreenshotServiceUid);
  1725                 KErrDescrInvalid, KScreenshotServiceUid);
  1808             KScreenshotServiceUid);
  1808             KScreenshotServiceUid);
  1809 
  1809 
  1810     CleanupStack::PopAndDestroy(layoutConfigPtr);
  1810     CleanupStack::PopAndDestroy(layoutConfigPtr);
  1811     CleanupStack::PopAndDestroy(screenDevice);
  1811     CleanupStack::PopAndDestroy(screenDevice);
  1812     ws.Close();
  1812     ws.Close();
  1813 #else
  1813              
  1814     iDispatcher->DispatchOutgoingErrorMessage(KErrArgument,
       
  1815             KErrDescrScreenNotSupported, KScreenshotServiceUid);
       
  1816 #endif               
       
  1817     HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::HandleRotateScreen" );
  1814     HTI_LOG_FUNC_OUT( "CHtiScreenshotServicePlugin::HandleRotateScreen" );
  1818     }
  1815     }
  1819 // ----------------------------------------------------------------------------
  1816 // ----------------------------------------------------------------------------
  1820 void CHtiScreenshotServicePlugin::CreateBitmapL( TRect& aRegion,
  1817 void CHtiScreenshotServicePlugin::CreateBitmapL( TRect& aRegion,
  1821                                                  TDisplayMode aMode )
  1818                                                  TDisplayMode aMode )
  1831     delete iScreen;//in case ICLComplete was not called
  1828     delete iScreen;//in case ICLComplete was not called
  1832     iScreen = NULL;
  1829     iScreen = NULL;
  1833     iScreen = new( ELeave ) CFbsBitmap;
  1830     iScreen = new( ELeave ) CFbsBitmap;
  1834     User::LeaveIfError( iScreen->Create( imageSize, displayMode ) );
  1831     User::LeaveIfError( iScreen->Create( imageSize, displayMode ) );
  1835 
  1832 
       
  1833 	TInt err = KErrNone;
       
  1834 	TRect region;
  1836     if ( aRegion.IsEmpty() )
  1835     if ( aRegion.IsEmpty() )
  1837         {
  1836         {
  1838         iScreenDevice->CopyScreenToBitmap( iScreen );
  1837         err = iScreenDevice->CopyScreenToBitmap( iScreen );
       
  1838 		region = imageSize;
  1839         }
  1839         }
  1840     else
  1840     else
  1841         {
  1841         {
  1842         iScreenDevice->CopyScreenToBitmap( iScreen, aRegion );
  1842         err = iScreenDevice->CopyScreenToBitmap( iScreen, aRegion );
  1843         }
  1843 		region = aRegion;
  1844 
  1844         }
       
  1845     if (err == KErrNoMemory)
       
  1846 	    {
       
  1847 		HTI_LOG_TEXT( "screenshot in camera mode" );
       
  1848 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
       
  1849 		err = CAlfDrawer::FallbackCopyScreenToBitmap(*iScreenDevice, iScreen, region);
       
  1850 #endif
       
  1851 		}
  1845 
  1852 
  1846     if ( iDeltaCapture )
  1853     if ( iDeltaCapture )
  1847         {
  1854         {
  1848         HTI_LOG_TEXT( "DeltaCapture enabled" );
  1855         HTI_LOG_TEXT( "DeltaCapture enabled" );
  1849 
  1856