Update contrib.
1 // Copyright (c) 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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 @internalComponent - Internal Symbian test code
23 #include "tsmallwindowraster.h"
26 _LIT(KBitmapPattern, "*.mbm");
29 CTSmallWindowRaster::CTSmallWindowRaster(const TPoint& aStartingPoint, const TSize& aWindowSize) :
30 CTWindow(aStartingPoint, aWindowSize)
35 CTSmallWindowRaster::~CTSmallWindowRaster()
46 CTWindow* CTSmallWindowRaster::NewL(RWsSession &aWs,
47 const RWindowTreeNode &aParent,
48 const TPoint& aStartingPoint,
49 const TSize& aWindowSize)
51 CTSmallWindowRaster* self = new (ELeave) CTSmallWindowRaster(aStartingPoint, aWindowSize);
52 CleanupStack::PushL(self);
53 self->ConstructL(aWs, aParent);
54 CleanupStack::Pop(self);
58 void CTSmallWindowRaster::ConstructL(RWsSession &aWs, const RWindowTreeNode &aParent)
60 CTWindow::ConstructL(aWs, aParent);
61 iScreenDev = new (ELeave) CWsScreenDevice(aWs);
62 User::LeaveIfError(iScreenDev->Construct());
63 iGc = new (ELeave)CWindowGc(iScreenDev);
64 User::LeaveIfError(iGc->Construct());
65 iGc->Activate(iWindow);
68 void CTSmallWindowRaster::LoadL(CSurfaceUtility* /*aUtility*/, TPtrC aFileName)
71 if (aFileName.Match(KBitmapPattern()) != KErrNotFound) // it's a Bitmap
73 iSourceBitmap = new(ELeave) CFbsBitmap();
74 User::LeaveIfError(iSourceBitmap->Load(aFileName, 0));
78 iSourceBitmap = CreateBitmapFromFileL(aFileName);
80 iSourceRect = iSourceBitmap->SizeInPixels();
81 iDestRect = TRect(Size());
84 void CTSmallWindowRaster::DrawBitmap(TRect& aSourceRect)
86 iWindow.BeginRedraw();
87 iGc->DrawBitmap(iDestRect, iSourceBitmap, aSourceRect);
91 void CTSmallWindowRaster::RenderL()
96 DrawBitmap(iSourceRect);