os/graphics/windowing/windowserver/test/t_ratelimiter/tratelimitdrawer/wsratelimitdrawer.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/t_ratelimiter/tratelimitdrawer/wsratelimitdrawer.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,88 @@
1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +/**
1.20 + @file
1.21 + @test
1.22 + @internalComponent - Internal Symbian test code
1.23 +*/
1.24 +
1.25 +#include "wsratelimitdrawer.h"
1.26 +
1.27 +//Constant message handle, which is used to send count value between client and plug-in
1.28 +const TUint8 KCmdCount=0;
1.29 +
1.30 +/**
1.31 +Creates new object of type CWsRateLimitGraphic based on existing plug-in id.
1.32 +This interally constructs CWsGraphic object
1.33 +@param TUid Test plug-in id
1.34 +*/
1.35 +EXPORT_C CWsRateLimitGraphic* CWsRateLimitGraphic::NewL(TUid aUid)
1.36 + {
1.37 + CWsRateLimitGraphic* self = new(ELeave) CWsRateLimitGraphic;
1.38 + CleanupStack::PushL(self);
1.39 + self->BaseConstructL(aUid,KRateLimitDrawerImplId,KNullDesC8());
1.40 + CleanupStack::Pop(self);
1.41 + return self;
1.42 + }
1.43 +
1.44 +/**
1.45 +Creates new object of type CWsRateLimitGraphic based on active screen number.
1.46 +This interally constructs CWsGraphic object
1.47 +*/
1.48 +EXPORT_C CWsRateLimitGraphic* CWsRateLimitGraphic::NewL()
1.49 + {
1.50 + CWsRateLimitGraphic* self = new(ELeave) CWsRateLimitGraphic;
1.51 + CleanupStack::PushL(self);
1.52 + self->BaseConstructL(KRateLimitDrawerImplId,KNullDesC8());
1.53 + CleanupStack::Pop(self);
1.54 + return self;
1.55 + }
1.56 +
1.57 +EXPORT_C CWsRateLimitGraphic::~CWsRateLimitGraphic()
1.58 + {
1.59 + }
1.60 +
1.61 +CWsRateLimitGraphic::CWsRateLimitGraphic()
1.62 + {
1.63 + }
1.64 +
1.65 +void CWsRateLimitGraphic::HandleMessage(const TDesC8& aData)
1.66 + {
1.67 + if (aData.Size()>1)
1.68 + {
1.69 + Mem::Copy(iAnimData, aData.Ptr(),(aData.Size()));
1.70 + }
1.71 + }
1.72 +
1.73 +void CWsRateLimitGraphic::OnReplace()
1.74 + {
1.75 + }
1.76 +
1.77 +/**
1.78 +Query a message value from test plug-in.
1.79 +@param TAnimData Drawing count for two animations.
1.80 +*/
1.81 +EXPORT_C TInt CWsRateLimitGraphic::QueryPluginForFrameRate(TAnimData& aAnimData)
1.82 + {
1.83 + TBuf8<1> cmd;
1.84 + cmd.Append(KCmdCount);
1.85 + SendMessage(cmd);
1.86 + TInt err = Flush();
1.87 + if (err!=KErrNone)
1.88 + return err;
1.89 + iAnimData=&aAnimData;
1.90 + return KErrNone;
1.91 + }