uifw/EikStd/dlgsrc/aknrecordinggc.cpp
branchRCL_3
changeset 4 8ca85d2f0db7
parent 0 2f259fa3e83a
child 23 3d340a0166ff
equal deleted inserted replaced
0:2f259fa3e83a 4:8ca85d2f0db7
    23 #include <graphics/gdi/gdistructs.h>
    23 #include <graphics/gdi/gdistructs.h>
    24 #endif // SYMBIAN_ENABLE_SPLIT_HEADERS
    24 #endif // SYMBIAN_ENABLE_SPLIT_HEADERS
    25 #include <e32err.h>
    25 #include <e32err.h>
    26 
    26 
    27 #include "aknrecordinggc.h"
    27 #include "aknrecordinggc.h"
       
    28 #include "akntrace.h"
    28 
    29 
    29 #ifdef _DEBUG
    30 #ifdef _DEBUG
    30 _LIT( KOverFlow, "Array overflow" );
    31 _LIT( KOverFlow, "Array overflow" );
    31 _LIT( KBadArgument, "Bad argument");
    32 _LIT( KBadArgument, "Bad argument");
    32 #endif // _DEBUG
    33 #endif // _DEBUG
    62 // CAknRecordingGc::~CAknRecordingGc
    63 // CAknRecordingGc::~CAknRecordingGc
    63 // -----------------------------------------------------------------------------
    64 // -----------------------------------------------------------------------------
    64 //
    65 //
    65 CAknRecordingGc::~CAknRecordingGc()
    66 CAknRecordingGc::~CAknRecordingGc()
    66     {
    67     {
       
    68     _AKNTRACE_FUNC_ENTER;
    67     iLines.ResetAndDestroy();
    69     iLines.ResetAndDestroy();
    68     delete iOffScreenBmp;
    70     delete iOffScreenBmp;
    69     delete iBitGc;
    71     delete iBitGc;
    70     delete iBitmapDevice;
    72     delete iBitmapDevice;
       
    73     _AKNTRACE_FUNC_EXIT;
    71     }
    74     }
    72     
    75     
    73 
    76 
    74 // -----------------------------------------------------------------------------
    77 // -----------------------------------------------------------------------------
    75 // CAknRecordingGc::FlushBuffer
    78 // CAknRecordingGc::FlushBuffer
    76 // -----------------------------------------------------------------------------
    79 // -----------------------------------------------------------------------------
    77 //
    80 //
    78 void CAknRecordingGc::FlushBuffer( const TRect& aRect, TInt aLineToSkip )
    81 void CAknRecordingGc::FlushBuffer( const TRect& aRect, TInt aLineToSkip )
    79     {
    82     {
       
    83     _AKNTRACE_FUNC_ENTER;
       
    84     _AKNTRACE( "The rect of FlushBuffer are ( %d, %d ) ( %d, %d )", 
       
    85     		aRect.iTl.iX, aRect.iTl.iY, 
       
    86     		aRect.iBr.iX, aRect.iBr.iY );
       
    87     _AKNTRACE( "[%s][%s]aLineToSkip: [%d]", "CAknRecordingGc", __FUNCTION__, aLineToSkip );
    80     if ( iLines.Count() == 0 )
    88     if ( iLines.Count() == 0 )
    81         {
    89         {
    82         return;
    90         return;
    83         }
    91         }
    84         
    92         
   165                         break;
   173                         break;
   166 
   174 
   167                     case CBufferItem::EDrawRect:
   175                     case CBufferItem::EDrawRect:
   168                         gc->DrawRect( item->iRect );
   176                         gc->DrawRect( item->iRect );
   169                         break;
   177                         break;
       
   178                         
   170                     case CBufferItem::EClear:
   179                     case CBufferItem::EClear:
   171                         gc->Clear( item->iRect );
   180                         gc->Clear( item->iRect );
       
   181                         break;
       
   182                         
       
   183                     case CBufferItem::EDrawLine:
       
   184                         // EDrawLine is used for separator line only and it
       
   185                         // should be skipped for the last visible item.
       
   186                         if ( i < iLines.Count() - 1 
       
   187                                 && realRect.iBr.iY < aRect.iBr.iY )
       
   188                             {
       
   189                             gc->DrawLine( item->iRect.iTl, item->iRect.iBr );
       
   190                             }
   172                         break;
   191                         break;
   173                     }
   192                     }
   174                 }
   193                 }
   175                 
   194                 
   176             gc->CancelClippingRect();
   195             gc->CancelClippingRect();
   190 
   209 
   191     if ( iUseBitGc )
   210     if ( iUseBitGc )
   192         {
   211         {
   193         iRealGc->BitBlt( TPoint( 0, 0 ), iOffScreenBmp, TRect( 0, 0, 360, 500 ) );
   212         iRealGc->BitBlt( TPoint( 0, 0 ), iOffScreenBmp, TRect( 0, 0, 360, 500 ) );
   194         }
   213         }
       
   214     _AKNTRACE_FUNC_EXIT;
   195     }
   215     }
   196 
   216 
   197 
   217 
   198 // -----------------------------------------------------------------------------
   218 // -----------------------------------------------------------------------------
   199 // CAknRecordingGc::PurgeBuffer
   219 // CAknRecordingGc::PurgeBuffer
   210 // CAknRecordingGc::PrepareForNewLineL
   230 // CAknRecordingGc::PrepareForNewLineL
   211 // -----------------------------------------------------------------------------
   231 // -----------------------------------------------------------------------------
   212 //
   232 //
   213 void CAknRecordingGc::PrepareForNewLineL( const TRect& aRect )
   233 void CAknRecordingGc::PrepareForNewLineL( const TRect& aRect )
   214     {
   234     {
       
   235     _AKNTRACE_FUNC_ENTER;
   215     CLineData* newLine = new ( ELeave ) CLineData;
   236     CLineData* newLine = new ( ELeave ) CLineData;
   216     newLine->iRect = aRect;
   237     newLine->iRect = aRect;
   217     iLines.AppendL( newLine );
   238     iLines.AppendL( newLine );
   218     iCurrentLine = iLines.Count() - 1;
   239     iCurrentLine = iLines.Count() - 1;
       
   240     _AKNTRACE_FUNC_EXIT;
   219     }
   241     }
   220 
   242 
   221 
   243 
   222 // -----------------------------------------------------------------------------
   244 // -----------------------------------------------------------------------------
   223 // CAknRecordingGc::ReplaceLineL
   245 // CAknRecordingGc::ReplaceLineL
   224 // -----------------------------------------------------------------------------
   246 // -----------------------------------------------------------------------------
   225 //
   247 //
   226 void CAknRecordingGc::ReplaceLineL( TInt aLine )
   248 void CAknRecordingGc::ReplaceLineL( TInt aLine )
   227     {
   249     {
       
   250     _AKNTRACE_FUNC_ENTER;
       
   251     _AKNTRACE( "[%s][%s]aLine: [%d].", "CAknRecordingGc", __FUNCTION__, aLine );
   228     if (  aLine < iLines.Count() )
   252     if (  aLine < iLines.Count() )
   229         {
   253         {
   230         TRect rect( iLines[aLine]->iRect );
   254         TRect rect( iLines[aLine]->iRect );
   231         
   255         
   232         delete iLines[aLine];
   256         delete iLines[aLine];
   234         iLines[aLine] = new ( ELeave ) CLineData;
   258         iLines[aLine] = new ( ELeave ) CLineData;
   235         iLines[aLine]->iRect = rect;
   259         iLines[aLine]->iRect = rect;
   236         }
   260         }
   237         
   261         
   238     iCurrentLine = aLine;
   262     iCurrentLine = aLine;
       
   263     _AKNTRACE_FUNC_EXIT;
   239     }
   264     }
   240 
   265 
   241 
   266 
   242 // -----------------------------------------------------------------------------
   267 // -----------------------------------------------------------------------------
   243 // CAknRecordingGc::UseBitGc
   268 // CAknRecordingGc::UseBitGc
   253 // CAknRecordingGc::InsertLineL
   278 // CAknRecordingGc::InsertLineL
   254 // -----------------------------------------------------------------------------
   279 // -----------------------------------------------------------------------------
   255 //
   280 //
   256 void CAknRecordingGc::InsertLineL( TInt aLine, const TRect& aRect )
   281 void CAknRecordingGc::InsertLineL( TInt aLine, const TRect& aRect )
   257     {
   282     {
       
   283     _AKNTRACE_FUNC_ENTER;
       
   284     _AKNTRACE( "[%s][%s]aLine: [%d].", "CAknRecordingGc", __FUNCTION__, aLine );
   258     CLineData* newLine = new ( ELeave ) CLineData;
   285     CLineData* newLine = new ( ELeave ) CLineData;
   259     newLine->iRect = aRect;
   286     newLine->iRect = aRect;
   260     
   287     
   261     iLines.Insert( newLine, aLine );
   288     iLines.Insert( newLine, aLine );
   262     iCurrentLine = aLine;
   289     iCurrentLine = aLine;
       
   290     _AKNTRACE_FUNC_EXIT;
   263     }
   291     }
   264 
   292 
   265 
   293 
   266 // -----------------------------------------------------------------------------
   294 // -----------------------------------------------------------------------------
   267 // CAknRecordingGc::InsertLineL
   295 // CAknRecordingGc::InsertLineL
   312 // CAknRecordingGc::DeleteLine
   340 // CAknRecordingGc::DeleteLine
   313 // -----------------------------------------------------------------------------
   341 // -----------------------------------------------------------------------------
   314 //
   342 //
   315 void CAknRecordingGc::DeleteLine( TInt aLine )
   343 void CAknRecordingGc::DeleteLine( TInt aLine )
   316     {
   344     {
       
   345     _AKNTRACE_FUNC_ENTER;
       
   346     _AKNTRACE( "[%s][%s]aLine: [%d].", "CAknRecordingGc", __FUNCTION__, aLine );
   317     if ( aLine != -1 && aLine < iLines.Count() )
   347     if ( aLine != -1 && aLine < iLines.Count() )
   318         {
   348         {
   319         delete iLines[aLine];
   349         delete iLines[aLine];
   320         iLines.Remove( aLine );
   350         iLines.Remove( aLine );
   321         }
   351         }
       
   352     _AKNTRACE_FUNC_EXIT;
   322     }
   353     }
   323 
   354 
   324 
   355 
   325 // -----------------------------------------------------------------------------
   356 // -----------------------------------------------------------------------------
   326 // CAknRecordingGc::CBufferItem::~CBufferItem()
   357 // CAknRecordingGc::CBufferItem::~CBufferItem()
   634     
   665     
   635 // ---------------------------------------------------------------------------
   666 // ---------------------------------------------------------------------------
   636 // From class CWindowGc
   667 // From class CWindowGc
   637 // ---------------------------------------------------------------------------
   668 // ---------------------------------------------------------------------------
   638 //
   669 //
   639 void CAknRecordingGc::DrawLine( const TPoint& /*aPoint1*/, 
   670 void CAknRecordingGc::DrawLine( const TPoint& aPoint1, 
   640     const TPoint& /*aPoint2*/ )
   671     const TPoint& aPoint2 )
   641     {
   672     {
       
   673     _AKNTRACE_FUNC_ENTER;
       
   674     CBufferItem* buffer = BufferItem();
       
   675     buffer->iType = CBufferItem::EDrawLine;
       
   676     buffer->iRect.iTl = aPoint1;
       
   677     buffer->iRect.iBr = aPoint2;
       
   678     _AKNTRACE_FUNC_EXIT;
   642     }
   679     }
   643     
   680     
   644     
   681     
   645 // ---------------------------------------------------------------------------
   682 // ---------------------------------------------------------------------------
   646 // From class CWindowGc
   683 // From class CWindowGc
   893 //
   930 //
   894 void CAknRecordingGc::BitBltMasked( const TPoint& aPoint, 
   931 void CAknRecordingGc::BitBltMasked( const TPoint& aPoint, 
   895     const CFbsBitmap* aBitmap, const TRect& aSourceRect, 
   932     const CFbsBitmap* aBitmap, const TRect& aSourceRect, 
   896     const CFbsBitmap* aMaskBitmap, TBool aInvertMask )
   933     const CFbsBitmap* aMaskBitmap, TBool aInvertMask )
   897     {
   934     {
       
   935     _AKNTRACE_FUNC_ENTER;
   898     if ( !iUseBitGc )
   936     if ( !iUseBitGc )
   899         {
   937         {
   900         CBufferItem* buffer = BufferItem();
   938         CBufferItem* buffer = BufferItem();
   901         buffer->iType = CBufferItem::EBitBltMasked1;
   939         buffer->iType = CBufferItem::EBitBltMasked1;
   902         buffer->iPosition = aPoint;
   940         buffer->iPosition = aPoint;
   917         }
   955         }
   918     else
   956     else
   919         {
   957         {
   920         iBitGc->BitBltMasked( aPoint, aBitmap, aSourceRect, aMaskBitmap, aInvertMask );
   958         iBitGc->BitBltMasked( aPoint, aBitmap, aSourceRect, aMaskBitmap, aInvertMask );
   921         }
   959         }
       
   960     _AKNTRACE_FUNC_EXIT;
   922     }
   961     }
   923     
   962     
   924     
   963     
   925 // ---------------------------------------------------------------------------
   964 // ---------------------------------------------------------------------------
   926 // From class CWindowGc
   965 // From class CWindowGc
  1089 // ---------------------------------------------------------------------------
  1128 // ---------------------------------------------------------------------------
  1090 //
  1129 //
  1091 TInt CAknRecordingGc::APIExtension( TUid aUid, TAny*& /*aOutput*/,
  1130 TInt CAknRecordingGc::APIExtension( TUid aUid, TAny*& /*aOutput*/,
  1092     TAny* aInput )
  1131     TAny* aInput )
  1093     {
  1132     {
       
  1133     _AKNTRACE_FUNC_ENTER;
  1094     if (aUid == KDrawTextInContextUid)
  1134     if (aUid == KDrawTextInContextUid)
  1095         {
  1135         {
  1096         __ASSERT_DEBUG( aInput, User::Panic(KBadArgument, KErrArgument ));
  1136         __ASSERT_DEBUG( aInput, User::Panic(KBadArgument, KErrArgument ));
  1097         TDrawTextInContextInternal* contextParam = 
  1137         TDrawTextInContextInternal* contextParam = 
  1098             static_cast<TDrawTextInContextInternal*>(aInput);
  1138             static_cast<TDrawTextInContextInternal*>(aInput);
  1099         const TTextParameters* params = &contextParam->iParam;
  1139         const TTextParameters* params = &contextParam->iParam;
  1100         __ASSERT_DEBUG( params, User::Panic(KBadArgument, KErrArgument ));
  1140         __ASSERT_DEBUG( params, User::Panic(KBadArgument, KErrArgument ));
  1101         TPtrC textToDraw = contextParam->iText.Mid( params->iStart, 
  1141         TPtrC textToDraw = contextParam->iText.Mid( params->iStart, 
  1102                                                     params->iEnd - params->iStart );
  1142                                                     params->iEnd - params->iStart );
  1103         DrawText(textToDraw, contextParam->iPosition);
  1143         DrawText(textToDraw, contextParam->iPosition);
       
  1144 		_AKNTRACE_FUNC_EXIT;
  1104         return KErrNone;
  1145         return KErrNone;
  1105         }
  1146         }
  1106     else
  1147     else
  1107         {
  1148         {
       
  1149 		_AKNTRACE_FUNC_EXIT;
  1108         return KErrNotSupported;
  1150         return KErrNotSupported;
  1109         }
  1151         }
  1110     }
  1152     }