sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent sl@0: */ sl@0: sl@0: #include sl@0: #include "t_winutils.h" sl@0: #include "t_pseudoapputils.h" sl@0: sl@0: EXPORT_C CTestBitmap* CTestBitmap::NewLC(const TSize& aSizeInPixels, TDisplayMode aDispMode) sl@0: { sl@0: return NewLC(0, aSizeInPixels, aDispMode); sl@0: } sl@0: sl@0: EXPORT_C CTestBitmap* CTestBitmap::NewL(const TSize& aSizeInPixels, TDisplayMode aDispMode) sl@0: { sl@0: CTestBitmap* self = NewLC(0, aSizeInPixels, aDispMode); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: EXPORT_C CTestBitmap* CTestBitmap::NewL(TInt aHandle) sl@0: { sl@0: CTestBitmap* self = NewLC(aHandle, TSize(), ENone); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: CTestBitmap* CTestBitmap::NewLC(TInt aHandle, const TSize& aSizeInPixels, TDisplayMode aDispMode) sl@0: { sl@0: CTestBitmap* self = new(ELeave) CTestBitmap(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(aHandle, aSizeInPixels, aDispMode); sl@0: return self; sl@0: } sl@0: sl@0: void CTestBitmap::ConstructL(TInt aHandle, const TSize& aSizeInPixels, TDisplayMode aDispMode) sl@0: { sl@0: iBitmap = new(ELeave) CFbsBitmap(); sl@0: CleanupStack::PushL(iBitmap); sl@0: sl@0: if (aHandle==0) sl@0: { sl@0: User::LeaveIfError(iBitmap->Create(aSizeInPixels, aDispMode)); sl@0: } sl@0: else sl@0: { sl@0: User::LeaveIfError(iBitmap->Duplicate(aHandle)); sl@0: } sl@0: iDevice = CFbsBitmapDevice::NewL(iBitmap); sl@0: CleanupStack::PushL(iDevice); sl@0: sl@0: User::LeaveIfError(iDevice->CreateContext(iGc)); sl@0: sl@0: CleanupStack::Pop(2); sl@0: } sl@0: sl@0: CTestBitmap::~CTestBitmap() sl@0: { sl@0: delete iGc; sl@0: delete iDevice; sl@0: delete iBitmap; sl@0: } sl@0: sl@0: EXPORT_C void TImportPseudoAppConfig::ImportPseudoAppConfigL(TInt aScreenNo, TInt& aFrameDuration, TInt& aFrameDelay, sl@0: TDisplayMode& aMode, TSize& aScreenSize, CIniData* aUtils) sl@0: { sl@0: TInt screenMode; sl@0: TInt numberOfScreens; sl@0: TPtrC screenAspectRatio; sl@0: TInt screenNumber; sl@0: sl@0: READ_INI1(frame_duration, aFrameDuration, aUtils); sl@0: READ_INI1(screen_aspect_ratio, screenAspectRatio, aUtils); sl@0: READ_INI1(number_of_screens, numberOfScreens, aUtils); sl@0: READ_INI1(frame_delay, aFrameDelay, aUtils); sl@0: READ_INI2(screen_mode, EColor16MA, EColor64K, screenMode, EColor16MA, EColor64K, aUtils); sl@0: sl@0: aMode = static_cast(screenMode); sl@0: sl@0: //Determine the number of screens from the hardware and compare with the value from the ini file sl@0: HAL::Get(HALData::EDisplayNumberOfScreens, screenNumber); sl@0: if(numberOfScreens != screenNumber) sl@0: { sl@0: RDebug::Print(_L("Error: A %d screen test has been indicated, but %d screen(s) exist\n"), numberOfScreens, screenNumber); sl@0: } sl@0: sl@0: //Determine the screen dimensions sl@0: RWsSession session; sl@0: User::LeaveIfError(session.Connect()); sl@0: sl@0: CWsScreenDevice* screenDevice = new(ELeave) CWsScreenDevice(session); sl@0: CleanupStack::PushL(screenDevice); sl@0: sl@0: User::LeaveIfError(screenDevice->Construct(aScreenNo)); sl@0: sl@0: aScreenSize = screenDevice->SizeInPixels(); sl@0: sl@0: //Check that the aspect ratio matches that of the screen sl@0: TSize aSpectRatio; sl@0: sl@0: if(TImportScreenConfig::ExtractAspectRatio(screenAspectRatio, aSpectRatio) == KErrNone) sl@0: { sl@0: if(aScreenSize.iWidth*aSpectRatio.iHeight != aScreenSize.iHeight*aSpectRatio.iWidth) sl@0: { sl@0: RDebug::Print(_L("Aspect ratio from string does not match screen dimensions\n")); sl@0: RDebug::Print(_L("Read in %d:%d, Actual dimensions %d:%d\n"), aSpectRatio.iWidth, aSpectRatio.iHeight, aScreenSize.iWidth, aScreenSize.iHeight); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: RDebug::Print(_L("Cannot determine aspect ratio from string, quitting: %s\n"), screenAspectRatio.Ptr()); sl@0: User::Exit(0); sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(screenDevice); sl@0: session.Close(); sl@0: }