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: */ sl@0: sl@0: #include // for ASSERT macros sl@0: #include "egltestcommoninisettings.h" sl@0: sl@0: EXPORT_C CEglTestCommonIniSettings* CEglTestCommonIniSettings::NewL() sl@0: { sl@0: CEglTestCommonIniSettings* self = CEglTestCommonIniSettings::NewLC(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: EXPORT_C CEglTestCommonIniSettings* CEglTestCommonIniSettings::NewLC() sl@0: { sl@0: CEglTestCommonIniSettings* self = new(ELeave) CEglTestCommonIniSettings; sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: return self; sl@0: } sl@0: sl@0: void CEglTestCommonIniSettings::ConstructL() sl@0: { sl@0: iIniData = CIniData::NewL(KConfigFileName); sl@0: } sl@0: sl@0: EXPORT_C CEglTestCommonIniSettings::~CEglTestCommonIniSettings() sl@0: { sl@0: delete iIniData; sl@0: } sl@0: sl@0: EXPORT_C VGImageFormat CEglTestCommonIniSettings::GetVgFormat(const TDesC& aSectioName, const TInt aWhich) sl@0: { sl@0: TBuf<20> bufVgPixelFormatNameKey; sl@0: bufVgPixelFormatNameKey.Format(KKeyFormatX, aWhich); sl@0: TBuf16<100> bufPixelValue16; sl@0: TPtrC16 ptrPixelValue16(bufPixelValue16); sl@0: if(!iIniData->FindVar(aSectioName,bufVgPixelFormatNameKey,ptrPixelValue16)) sl@0: { sl@0: return VG_IMAGE_FORMAT_INVALID; sl@0: } sl@0: sl@0: _LIT(K565,"VG_sRGB_565"); sl@0: _LIT(KX8888,"VG_sXRGB_8888"); sl@0: _LIT(KA8888,"VG_sARGB_8888"); sl@0: _LIT(KA8888PRE,"VG_sARGB_8888_PRE"); sl@0: sl@0: if(!ptrPixelValue16.Compare(K565)) sl@0: { sl@0: return VG_sRGB_565; sl@0: } sl@0: if(!ptrPixelValue16.Compare(KX8888)) sl@0: { sl@0: return VG_sXRGB_8888; sl@0: } sl@0: if(!ptrPixelValue16.Compare(KA8888)) sl@0: { sl@0: return VG_sARGB_8888; sl@0: } sl@0: if(!ptrPixelValue16.Compare(KA8888PRE)) sl@0: { sl@0: return VG_sARGB_8888_PRE; sl@0: } sl@0: sl@0: return VG_IMAGE_FORMAT_INVALID; sl@0: } sl@0: sl@0: EXPORT_C TUidPixelFormat CEglTestCommonIniSettings::GetPixelFormat(const TDesC& aSectioName, const TInt aWhich) sl@0: { sl@0: TBuf<20> bufPixelNameKey; sl@0: bufPixelNameKey.Format(KKeyFormatX, aWhich); sl@0: TBuf16<100> bufPixelValue16; sl@0: TPtrC16 ptrPixelValue16(bufPixelValue16); sl@0: if(!iIniData->FindVar(aSectioName,bufPixelNameKey,ptrPixelValue16)) sl@0: { sl@0: return EUidPixelFormatUnknown; sl@0: } sl@0: sl@0: _LIT(K565,"EUidPixelFormatRGB_565"); sl@0: _LIT(KX8888,"EUidPixelFormatXRGB_8888"); sl@0: _LIT(KA8888,"EUidPixelFormatARGB_8888"); sl@0: _LIT(KA8888PRE,"EUidPixelFormatARGB_8888_PRE"); sl@0: _LIT(KA8,"EUidPixelFormatA_8"); sl@0: sl@0: if(!ptrPixelValue16.Compare(K565)) sl@0: { sl@0: return EUidPixelFormatRGB_565; sl@0: } sl@0: if(!ptrPixelValue16.Compare(KX8888)) sl@0: { sl@0: return EUidPixelFormatXRGB_8888; sl@0: } sl@0: if(!ptrPixelValue16.Compare(KA8888)) sl@0: { sl@0: return EUidPixelFormatARGB_8888; sl@0: } sl@0: if(!ptrPixelValue16.Compare(KA8888PRE)) sl@0: { sl@0: return EUidPixelFormatARGB_8888_PRE; sl@0: } sl@0: if(!ptrPixelValue16.Compare(KA8)) sl@0: { sl@0: return EUidPixelFormatA_8; sl@0: } sl@0: return EUidPixelFormatUnknown; sl@0: } sl@0: sl@0: EXPORT_C TInt CEglTestCommonIniSettings::GetNumberOfFormats(const TDesC& aSectioName) sl@0: { sl@0: TInt numFormats = 0; sl@0: if(iIniData->FindVar(aSectioName,KKeyNumFormats,numFormats)) sl@0: { sl@0: return numFormats; sl@0: } sl@0: return 0; sl@0: } sl@0: sl@0: EXPORT_C TInt CEglTestCommonIniSettings::GetNumberOfIterations(const TDesC& aSectioName) sl@0: { sl@0: _LIT(KKeyNumIterations, "NumIterations"); sl@0: TInt numIterations = 0; sl@0: if(iIniData->FindVar(aSectioName, KKeyNumIterations, numIterations)) sl@0: { sl@0: return numIterations; sl@0: } sl@0: return 0; sl@0: } sl@0: sl@0: EXPORT_C TSize CEglTestCommonIniSettings::GetImageSize(const TDesC& aSectioName) sl@0: { sl@0: _LIT(KKeyBufferWidth, "ImageWidth"); sl@0: _LIT(KKeyBufferHeight, "ImageHeight"); sl@0: TSize size(0, 0); sl@0: if(iIniData->FindVar(aSectioName, KKeyBufferWidth, size.iWidth) && sl@0: iIniData->FindVar(aSectioName, KKeyBufferHeight, size.iHeight)) sl@0: { sl@0: return size; sl@0: } sl@0: return TSize(0,0); sl@0: } sl@0: sl@0: EXPORT_C TSize CEglTestCommonIniSettings::GetWindowSize(const TDesC& aSectioName) sl@0: { sl@0: _LIT(KKeyWindowWidth, "WindowWidth"); sl@0: _LIT(KKeyWindowHeight, "WindowHeight"); sl@0: TSize size(0, 0); sl@0: if(iIniData->FindVar(aSectioName, KKeyWindowWidth, size.iWidth) && sl@0: iIniData->FindVar(aSectioName, KKeyWindowHeight, size.iHeight)) sl@0: { sl@0: return size; sl@0: } sl@0: return TSize(0,0); sl@0: } sl@0: sl@0: EXPORT_C TInt CEglTestCommonIniSettings::GetThresholdGPUUsedMemory(const TDesC& aSectioName) sl@0: { sl@0: _LIT(KKeyThresholdGPUUsedMemory, "ThresholdGPUUsedMemory"); sl@0: TInt thresholdGPUUsedMemory = 0; sl@0: if(iIniData->FindVar(aSectioName, KKeyThresholdGPUUsedMemory, thresholdGPUUsedMemory)) sl@0: { sl@0: return thresholdGPUUsedMemory; sl@0: } sl@0: return 0; sl@0: } sl@0: sl@0: EXPORT_C TInt CEglTestCommonIniSettings::GetThresholdLastIteration(const TDesC& aSectioName) sl@0: { sl@0: _LIT(KKeyThresholdLastIteration, "ThresholdLastIteration"); sl@0: TInt thresholdLastIteration = 0; sl@0: if(iIniData->FindVar(aSectioName, KKeyThresholdLastIteration, thresholdLastIteration)) sl@0: { sl@0: return thresholdLastIteration; sl@0: } sl@0: return 0; sl@0: }