windowing/windowserver/stdgraphic/wsgraphicdrawernonngacontext.cpp
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #undef SYMBIAN_GRAPHICS_GCE
       
    17 
       
    18 #include "wsgraphicdrawercontext.h"
       
    19 #include "stdgraphictestdrawer.h"
       
    20 #include <bitstd.h>
       
    21 
       
    22 MWsGraphicDrawerContext* CWsGraphicDrawerNonNgaContext::NewL()
       
    23 	{
       
    24 	return new(ELeave) CWsGraphicDrawerNonNgaContext();
       
    25 	}
       
    26 
       
    27 void CWsGraphicDrawerNonNgaContext::Destroy()
       
    28 	{
       
    29 	delete this;
       
    30 	}
       
    31 
       
    32 MWsClient& CWsGraphicDrawerNonNgaContext::Client(MWsGc& aGc)
       
    33 	{
       
    34 	return aGc.Client();
       
    35 	}
       
    36 
       
    37 MWsScreen& CWsGraphicDrawerNonNgaContext::Screen(MWsGc& aGc)
       
    38 	{
       
    39 	return aGc.Screen();
       
    40 	}
       
    41 
       
    42 const TTime& CWsGraphicDrawerNonNgaContext::Now(MWsGc& aGc) const
       
    43 	{
       
    44 	return aGc.Now();
       
    45 	}
       
    46 
       
    47 void CWsGraphicDrawerNonNgaContext::ScheduleAnimation(MWsGc& aGc, const TRect& aRect,const TTimeIntervalMicroSeconds& aFromNow)
       
    48 	{
       
    49 	aGc.ScheduleAnimation(aRect, aFromNow);
       
    50 	}
       
    51 
       
    52 void CWsGraphicDrawerNonNgaContext::ScheduleAnimation(MWsGc& aGc, const TRect& aRect,const TTimeIntervalMicroSeconds& aFromNow,const TTimeIntervalMicroSeconds& aFreq,const TTimeIntervalMicroSeconds& aStop)
       
    53 	{
       
    54 	aGc.ScheduleAnimation(aRect, aFromNow, aFreq, aStop);
       
    55 	}
       
    56 
       
    57 void CWsGraphicDrawerNonNgaContext::SetGcOrigin(MWsGc& aGc, const TPoint& aOrigin)
       
    58 	{
       
    59 	aGc.SetGcOrigin(aOrigin);
       
    60 	}
       
    61 
       
    62 TInt CWsGraphicDrawerNonNgaContext::Push(MWsGc& aGc) const
       
    63 	{
       
    64 	return aGc.PushBitGcSettings();
       
    65 	}
       
    66 
       
    67 void CWsGraphicDrawerNonNgaContext::Pop(MWsGc& aGc) const
       
    68 	{
       
    69 	aGc.PopBitGcSettings();
       
    70 	}
       
    71 
       
    72 void CWsGraphicDrawerNonNgaContext::DrawBitmap(MWsGc& aGc, const TPoint& aDestPos, const CFbsBitmap* aSourceBitmap, const TRect& aSourceRect, const CFbsBitmap* aMaskBitmap) const
       
    73 	{
       
    74 	CFbsBitGc& bitGc = aGc.BitGc();
       
    75 	if (aMaskBitmap)
       
    76 		{
       
    77 		bitGc.BitBltMasked(aDestPos, aSourceBitmap, aSourceRect, aMaskBitmap, EFalse);
       
    78 		}
       
    79 	else
       
    80 		{
       
    81 		bitGc.BitBlt(aDestPos, aSourceBitmap, aSourceRect);
       
    82 		}
       
    83 	}
       
    84 
       
    85 void CWsGraphicDrawerNonNgaContext::DrawFrameRate(MWsGc& aGc, const TRect& aRect, const CFrameRate& aFps) const
       
    86 	{
       
    87 	CFbsBitGc& bitGc = aGc.BitGc();
       
    88 	bitGc.SetDrawMode(CGraphicsContext::EDrawModePEN);
       
    89 	bitGc.SetPenStyle(CGraphicsContext::ENullPen);
       
    90 	bitGc.SetBrushStyle(CGraphicsContext::ENullBrush);
       
    91 
       
    92 	if ((aFps.CountSamples() > 1) && bitGc.IsFontUsed())
       
    93 		{
       
    94 		TBuf<20> buf;
       
    95 		buf.AppendNum(aFps.Fps());
       
    96 		bitGc.SetPenColor(KRgbRed);
       
    97 		bitGc.DrawText(buf,NULL,TPoint(aRect.iTl.iX,aRect.iBr.iY));
       
    98 		}
       
    99 	}