sl@0: // Copyright (c) 2008-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: #include "trasterizer.h" sl@0: #include "testutils.h" sl@0: #include "examplerasterizer.h" sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: const TDisplayMode KDisplayModes[] = {EGray256, EColor64K, EColor16MU, EColor16MAP}; sl@0: const TInt KNumDisplayModes = sizeof(KDisplayModes)/sizeof(KDisplayModes[0]); sl@0: const TRgb KStripeColours[3] = {TRgb(255,255,0), TRgb(255,0,255), TRgb(0,255,255)}; sl@0: sl@0: CTRasterizer::CTRasterizer() sl@0: { sl@0: SetTestStepName(KTRasterizerStep); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID sl@0: GRAPHICS-FBSERV-RASTERIZER-001 sl@0: sl@0: @SYMTestPriority sl@0: High sl@0: sl@0: @SYMPREQ sl@0: PREQ2096 sl@0: sl@0: @SYMREQ sl@0: REQ10860 sl@0: REQ10861 sl@0: sl@0: @SYMTestCaseDesc sl@0: Test that the example rasterizer dll "fbsrasterizer_test.dll" has been loaded. sl@0: sl@0: @SYMTestActions sl@0: On the emulator check that the rasterizer setting is "fbsrasterizer_test.dll". sl@0: Get a pointer to the rasterizer. sl@0: sl@0: @SYMTestExpectedResults sl@0: "fbsrasterizer_test.dll" has been loaded successfully sl@0: */ sl@0: void CTRasterizer::TestLoadRasterizerDllL() sl@0: { sl@0: INFO_PRINTF1(_L("TestLoadRasterizerDll")); sl@0: #ifdef __WINS__ sl@0: _LIT8(KTestRasterizerName, "fbsrasterizer_test.dll"); sl@0: TUint8* rasterizerSetting = NULL; sl@0: UserSvr::HalFunction(EHalGroupEmulator, EEmulatorHalStringProperty, (TAny*)"FBSRASTERIZER_DLL", &rasterizerSetting); sl@0: TESTL(rasterizerSetting != NULL); sl@0: TESTL(TPtrC8(rasterizerSetting).CompareF(KTestRasterizerName) == 0); sl@0: #endif sl@0: GetExampleRasterizerL(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID sl@0: GRAPHICS-FBSERV-RASTERIZER-002 sl@0: sl@0: @SYMTestPriority sl@0: High sl@0: sl@0: @SYMPREQ sl@0: PREQ2096 sl@0: sl@0: @SYMREQ sl@0: REQ10860 sl@0: REQ10861 sl@0: sl@0: @SYMTestCaseDesc sl@0: Test that a scanline retrieved from the example rasterizer is what we expect. sl@0: sl@0: @SYMTestActions sl@0: Create an extended bitmap and set its extended data to three colours followed by a TUint8. sl@0: The example rasterizer interprets this data as the three colours in a tricolour flag drawn sl@0: with either horizontal or vertical stripes depending on the value of the TUint8. sl@0: Draw a scanline of the extended bitmap by calling: sl@0: - CFbsRasterizer::BeginBitmap() sl@0: - CFbsRasterizer::ScanLine() sl@0: - CFbsRasterizer::EndBitmap() sl@0: sl@0: @SYMTestExpectedResults sl@0: The scan line returned by the example rasterizer should be exactly the same as the sl@0: corresponding scanline in the test data. sl@0: */ sl@0: void CTRasterizer::TestScanLineL() sl@0: { sl@0: TBuf<32> displayModeDes(TestUtils::DisplayModeToString(iDisplayMode)); sl@0: INFO_PRINTF2(_L("TestScanLine, display mode %S"), &displayModeDes); sl@0: sl@0: const TInt KNumBeginBitmapCalls = 5; sl@0: sl@0: // Get the example rasterizer sl@0: GetExampleRasterizerL(); sl@0: sl@0: // Test for both stripe styles, 0 for vertical stripes and 1 for horizontal stripes sl@0: for (TInt stripeStyle = 0; stripeStyle < 2; stripeStyle++) sl@0: { sl@0: if (stripeStyle == 0) sl@0: { sl@0: INFO_PRINTF1(_L("... Vertical stripes")); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("... Horizontal stripes")); sl@0: } sl@0: sl@0: const TSize sizeInPixels(64,32); sl@0: CFbsBitmap* extendedBitmap = CreateExtendedBitmapLC(KStripeColours, stripeStyle, sizeInPixels); sl@0: sl@0: // Begin scanline access to the extended bitmap sl@0: CFbsRasterizer::TBitmapDesc bitmapDesc; sl@0: TInt64 bitmapId = extendedBitmap->SerialNumber(); sl@0: bitmapDesc.iSizeInPixels = sizeInPixels; sl@0: bitmapDesc.iDispMode = iDisplayMode; sl@0: bitmapDesc.iDataType = KUidExampleExtendedBitmap; sl@0: bitmapDesc.iData = extendedBitmap->DataAddress(); sl@0: bitmapDesc.iDataSize = extendedBitmap->DataSize(); sl@0: extendedBitmap->BeginDataAccess(); sl@0: // test calling BeginBitmap more than once as each additional call should just increment as reference count sl@0: for (TInt i = 0; i < KNumBeginBitmapCalls; i++) sl@0: { sl@0: iRasterizer->BeginBitmap(bitmapId, bitmapDesc, NULL); sl@0: } sl@0: sl@0: TInt scanlineLength; sl@0: TPoint startPixel; sl@0: TRgb bufferColour; sl@0: // The width or height of a stripe in the tricolour flag that the extended bitmap rasterizer draws sl@0: TInt stripeSize = (stripeStyle == 0) ? sizeInPixels.iWidth/3 : sizeInPixels.iHeight/3; sl@0: for (TInt h = 0; h < sizeInPixels.iHeight; h++) sl@0: { sl@0: // Get a full scanline from the extended bitmap using the rasterizer sl@0: startPixel = TPoint(0, h); sl@0: scanlineLength = sizeInPixels.iWidth; sl@0: const TUint8* scanline = reinterpret_cast(iRasterizer->ScanLine(bitmapId, startPixel, scanlineLength)); sl@0: TESTL(scanline != NULL); sl@0: sl@0: // Make sure each pixel in the scanline is the colour that we expect sl@0: TRgb compareColour; sl@0: sl@0: for (TInt w = 0; w < scanlineLength; w++) sl@0: { sl@0: if (((stripeStyle == 0) && (w < stripeSize)) sl@0: || ((stripeStyle == 1) && (h < stripeSize))) sl@0: { sl@0: compareColour = KStripeColours[0]; // left or top sl@0: } sl@0: else if (((stripeStyle == 0) && (w >= sizeInPixels.iWidth-stripeSize)) sl@0: || ((stripeStyle == 1) && (h >= sizeInPixels.iHeight-stripeSize))) sl@0: { sl@0: compareColour = KStripeColours[2]; // right or bottom sl@0: } sl@0: else sl@0: { sl@0: compareColour = KStripeColours[1]; // middle sl@0: } sl@0: bufferColour = ExtractRgb(scanline, w, iDisplayMode); sl@0: if (((iDisplayMode != EGray256) && (bufferColour != compareColour)) sl@0: || ((iDisplayMode == EGray256) && (bufferColour != TRgb::Gray256(compareColour.Gray256())))) sl@0: { sl@0: INFO_PRINTF3(_L("Pixel comparison failed for pixel %d,%d"), w, h); sl@0: TEST(EFalse); sl@0: } sl@0: } sl@0: } sl@0: sl@0: // End scanline access to the extended bitmap sl@0: for (TInt i = 0; i < KNumBeginBitmapCalls; i++) sl@0: { sl@0: iRasterizer->EndBitmap(bitmapId); sl@0: } sl@0: extendedBitmap->EndDataAccess(); sl@0: sl@0: // Clean up sl@0: CleanupStack::Pop(1, extendedBitmap); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID sl@0: GRAPHICS-FBSERV-RASTERIZER-003 sl@0: sl@0: @SYMTestPriority sl@0: High sl@0: sl@0: @SYMPREQ sl@0: PREQ2096 sl@0: sl@0: @SYMREQ sl@0: REQ10860 sl@0: REQ10861 sl@0: sl@0: @SYMTestCaseDesc sl@0: Test that we can get scanlines from 3 extended bitmaps simultaneously using the example rasterizer. sl@0: sl@0: @SYMTestActions sl@0: Load a normal bitmap. sl@0: Create 3 extended bitmaps and set their extended data to be vertically striped colours. sl@0: Draw a scanline of each extended bitmap by calling: sl@0: - CFbsRasterizer::BeginBitmap() for each extended bitmap sl@0: - CFbsRasterizer::ScanLine() for each extended bitmap sl@0: - CFbsRasterizer::EndBitmap() for each extended bitmap sl@0: Compare the first pixel of each scanline and the last pixel of each scanline against the sl@0: expected colour. sl@0: sl@0: @SYMTestExpectedResults sl@0: The rasterizer should be able to handle rasterizing up to 3 extended bitmaps at once, sl@0: all three scanlines should be returned with no errors. sl@0: The colours compared should match exactly. sl@0: */ sl@0: void CTRasterizer::TestMultipleScanLinesL() sl@0: { sl@0: TBuf<32> displayModeDes(TestUtils::DisplayModeToString(iDisplayMode)); sl@0: INFO_PRINTF2(_L("TestMultipleScanLines, vertical stripes, display mode %S"), &displayModeDes); sl@0: sl@0: const TInt KNumBitmaps = 3; sl@0: const TInt KBaseSize = 10; sl@0: RArray bitmaps; sl@0: CleanupClosePushL(bitmaps); sl@0: sl@0: // Get the example rasterizer sl@0: GetExampleRasterizerL(); sl@0: sl@0: // Create the three differently sized extended bitmaps each coloured with vertical stripes sl@0: for (TInt i = 0; i < KNumBitmaps; i++) sl@0: { sl@0: const TSize KSizeInPixels = TSize(KBaseSize*(i+1), KBaseSize*(i+1)); sl@0: CFbsBitmap* extendedBitmap = CreateExtendedBitmapLC(KStripeColours, EFalse, KSizeInPixels); sl@0: bitmaps.AppendL(extendedBitmap); sl@0: } sl@0: sl@0: // Begin scanline access to the extended bitmaps sl@0: for (TInt i = 0; i < KNumBitmaps; i++) sl@0: { sl@0: bitmaps[i]->BeginDataAccess(); sl@0: sl@0: CFbsRasterizer::TBitmapDesc bitmapDesc; sl@0: TInt64 bitmapId = bitmaps[i]->SerialNumber(); sl@0: bitmapDesc.iSizeInPixels = bitmaps[i]->SizeInPixels(); sl@0: bitmapDesc.iDispMode = iDisplayMode; sl@0: bitmapDesc.iDataType = KUidExampleExtendedBitmap; sl@0: bitmapDesc.iData = bitmaps[i]->DataAddress(); sl@0: bitmapDesc.iDataSize = bitmaps[i]->DataSize(); sl@0: iRasterizer->BeginBitmap(bitmapId, bitmapDesc, NULL); sl@0: } sl@0: sl@0: // Get scanlines from each extended bitmap and check that the first and last pixel in each is the correct colour sl@0: for (TInt h = 0; h < KBaseSize; h++) sl@0: { sl@0: for (TInt i = 0; i < KNumBitmaps; i++) sl@0: { sl@0: const TUint8* scanline = reinterpret_cast(iRasterizer->ScanLine(bitmaps[i]->SerialNumber(), TPoint(0,h), KBaseSize*(i+1))); sl@0: TESTL(scanline != NULL); sl@0: sl@0: // Test that the first pixel is the correct colour (the first pixel in each scanline should be KStripeColours[0] sl@0: // as the bitmaps should have all been drawn with vertical stripes with the first stripe being KStripeColours[0] sl@0: TRgb bufferColour = ExtractRgb(scanline, 0, iDisplayMode); sl@0: if (((iDisplayMode != EGray256) && (bufferColour != KStripeColours[0])) sl@0: || ((iDisplayMode == EGray256) && (bufferColour != TRgb::Gray256(KStripeColours[0].Gray256())))) sl@0: { sl@0: INFO_PRINTF3(_L("Pixel comparison failed for bitmap %d, pixel 0,%d"), i, h); sl@0: TEST(EFalse); sl@0: } sl@0: // The last pixel should be KStripeColours[2] sl@0: bufferColour = ExtractRgb(scanline, (KBaseSize*(i+1))-1, iDisplayMode); sl@0: if (((iDisplayMode != EGray256) && (bufferColour != KStripeColours[2])) sl@0: || ((iDisplayMode == EGray256) && (bufferColour != TRgb::Gray256(KStripeColours[2].Gray256())))) sl@0: { sl@0: INFO_PRINTF4(_L("Pixel comparison failed for bitmap %d, pixel %d,%d"), i, (KBaseSize*(i+1))-1, h); sl@0: TEST(EFalse); sl@0: } sl@0: } sl@0: } sl@0: sl@0: // Unregister each extended bitmap sl@0: for (TInt i = 0; i < KNumBitmaps; i++) sl@0: { sl@0: iRasterizer->EndBitmap(bitmaps[i]->SerialNumber()); sl@0: bitmaps[i]->EndDataAccess(); sl@0: } sl@0: sl@0: // Cleanup sl@0: CleanupStack::PopAndDestroy(KNumBitmaps+1); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID sl@0: GRAPHICS-FBSERV-RASTERIZER-004 sl@0: sl@0: @SYMTestPriority sl@0: High sl@0: sl@0: @SYMPREQ sl@0: PREQ2096 sl@0: sl@0: @SYMREQ sl@0: REQ10860 sl@0: REQ10861 sl@0: sl@0: @SYMTestCaseDesc sl@0: Test that the rasterizer returns portions of scanline correctly sl@0: when a region of interest is specified. sl@0: sl@0: @SYMTestActions sl@0: Create an extended bitmap. sl@0: Rasterize it specifying a region of interest that has three regions that roughly sl@0: form a squared off C shape. sl@0: sl@0: @SYMTestExpectedResults sl@0: Check that scanlines returned are correct in the specified region of interest. sl@0: (Anything outside the region of interest does not matter). sl@0: */ sl@0: void CTRasterizer::TestRegionOfInterestL() sl@0: { sl@0: TBuf<32> displayModeDes(TestUtils::DisplayModeToString(iDisplayMode)); sl@0: INFO_PRINTF2(_L("TestRegionOfInterest, horizontal stripes, display mode %S"), &displayModeDes); sl@0: sl@0: // Get the example rasterizer sl@0: GetExampleRasterizerL(); sl@0: sl@0: // Create an extended bitmap with horizontal stripes sl@0: const TSize sizeInPixels(24,24); sl@0: CFbsBitmap* extendedBitmap = CreateExtendedBitmapLC(KStripeColours, ETrue, sizeInPixels); sl@0: sl@0: // Create a region of interest in the shape of a square with a hole in the middle sl@0: TRegionFix<4> regionOfInterest; sl@0: const TInt KStripeSize = sizeInPixels.iHeight/3; sl@0: const TInt KEdgeOffset = 2; sl@0: regionOfInterest.AddRect(TRect(TPoint(KEdgeOffset,KEdgeOffset), TSize(sizeInPixels.iWidth-(KEdgeOffset*2),KStripeSize))); // top of the square sl@0: regionOfInterest.AddRect(TRect(TPoint(KEdgeOffset,sizeInPixels.iHeight-KEdgeOffset-KStripeSize), TSize(sizeInPixels.iWidth-(KEdgeOffset*2),KStripeSize))); // bottom of the square sl@0: regionOfInterest.AddRect(TRect(TPoint(KEdgeOffset,KEdgeOffset+KStripeSize), TSize(KStripeSize,sizeInPixels.iHeight-(KEdgeOffset*2)-(KStripeSize*2)))); // left of the square sl@0: regionOfInterest.AddRect(TRect(TPoint(sizeInPixels.iWidth-KEdgeOffset-KStripeSize,KEdgeOffset+KStripeSize), TSize(KStripeSize,sizeInPixels.iHeight-(KEdgeOffset*2)-(KStripeSize*2)))); // right of the square sl@0: TEST(regionOfInterest.CheckError() == EFalse); sl@0: sl@0: // Begin scanline access to the extended bitmap sl@0: CFbsRasterizer::TBitmapDesc bitmapDesc; sl@0: TInt64 bitmapId = extendedBitmap->SerialNumber(); sl@0: bitmapDesc.iSizeInPixels = sizeInPixels; sl@0: bitmapDesc.iDispMode = iDisplayMode; sl@0: bitmapDesc.iDataType = KUidExampleExtendedBitmap; sl@0: bitmapDesc.iData = extendedBitmap->DataAddress(); sl@0: bitmapDesc.iDataSize = extendedBitmap->DataSize(); sl@0: extendedBitmap->BeginDataAccess(); sl@0: iRasterizer->BeginBitmap(bitmapId, bitmapDesc, ®ionOfInterest); sl@0: sl@0: TInt scanlineLength; sl@0: TPoint startPixel; sl@0: TRgb bufferColour; sl@0: sl@0: for (TInt h = 0; h < sizeInPixels.iHeight; h++) sl@0: { sl@0: // Get scanlines from the extended bitmap using the rasterizer sl@0: startPixel = TPoint(0, h); sl@0: scanlineLength = sizeInPixels.iWidth; sl@0: const TUint8* scanline = reinterpret_cast(iRasterizer->ScanLine(bitmapId, startPixel, scanlineLength)); sl@0: TESTL(scanline != NULL); sl@0: sl@0: // Make sure each pixel in the scanline is the colour that we expect sl@0: for (TInt w = 0; w < sizeInPixels.iWidth; w++) sl@0: { sl@0: bufferColour = ExtractRgb(scanline, w, iDisplayMode); sl@0: sl@0: // Pixels that lie inside the region should be set to a flag stripe colour, pixels sl@0: // outside of the region should be white sl@0: if (regionOfInterest.Contains(TPoint(w,h))) sl@0: { sl@0: if (((iDisplayMode != EGray256) && (bufferColour != KStripeColours[h/KStripeSize])) sl@0: || ((iDisplayMode == EGray256) && (bufferColour != TRgb::Gray256(KStripeColours[h/KStripeSize].Gray256())))) sl@0: { sl@0: INFO_PRINTF3(_L("Pixel comparison failed for pixel %d,%d"), w, h); sl@0: TEST(EFalse); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: if (bufferColour != KRgbWhite) sl@0: { sl@0: INFO_PRINTF3(_L("Pixel comparison failed for pixel %d,%d"), w, h); sl@0: TEST(EFalse); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: // End scanline access to the extended bitmap sl@0: iRasterizer->EndBitmap(bitmapId); sl@0: extendedBitmap->EndDataAccess(); sl@0: sl@0: // Clean up sl@0: CleanupStack::Pop(1, extendedBitmap); sl@0: } sl@0: sl@0: /** sl@0: Override of base class pure virtual sl@0: Lists the tests to be run sl@0: */ sl@0: TVerdict CTRasterizer::doTestStepL() sl@0: { sl@0: TestLoadRasterizerDllL(); sl@0: sl@0: // Tests that require testing in multiple display modes sl@0: for (TInt i = 0; i < KNumDisplayModes; i++) sl@0: { sl@0: iDisplayMode = KDisplayModes[i]; sl@0: sl@0: TestScanLineL(); sl@0: TestMultipleScanLinesL(); sl@0: TestRegionOfInterestL(); sl@0: } sl@0: sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** Helper function for getting a TRgb colour value from a buffer given a pixel offset and sl@0: a display mode. sl@0: @param aBuffer A buffer to extract the TRgb from sl@0: @param aPixelOffset The pixel position in the buffer to extract the TRgb from sl@0: @param aDispMode The display mode of the buffer sl@0: @return The TRgb value found at the pixel position specified sl@0: */ sl@0: TRgb CTRasterizer::ExtractRgb(const TUint8* aBuffer, TInt aPixelOffset, TDisplayMode aDispMode) sl@0: { sl@0: switch (aDispMode) sl@0: { sl@0: case EGray2: sl@0: { sl@0: TUint8 byte = *(aBuffer + (aPixelOffset >> 3)); sl@0: if (byte & (1 << (aPixelOffset & 7))) sl@0: return KRgbWhite; sl@0: return KRgbBlack; sl@0: } sl@0: case EGray4: sl@0: { sl@0: TUint8 byte = *(aBuffer + (aPixelOffset >> 2)); sl@0: byte >>= ((aPixelOffset & 3) << 1); sl@0: return TRgb::Gray4(byte & 3); sl@0: } sl@0: case EGray16: sl@0: { sl@0: TUint8 byte = *(aBuffer + (aPixelOffset >> 1)); sl@0: if (aPixelOffset & 1) sl@0: byte >>= 4; sl@0: return TRgb::Gray16(byte & 0xf); sl@0: } sl@0: case EGray256: sl@0: return TRgb::Gray256(*(aBuffer + aPixelOffset)); sl@0: case EColor16: sl@0: { sl@0: TUint8 byte = *(aBuffer + (aPixelOffset >> 1)); sl@0: if (aPixelOffset & 1) sl@0: byte >>= 4; sl@0: return TRgb::Color16(byte & 0xf); sl@0: } sl@0: case EColor256: sl@0: return TRgb::Color256(*(aBuffer + aPixelOffset)); sl@0: case EColor4K: sl@0: { sl@0: TUint16 doubleByte = *(((TUint16*)aBuffer) + aPixelOffset); sl@0: return TRgb::Color4K(doubleByte & 0xfff); sl@0: } sl@0: case EColor64K: sl@0: { sl@0: TUint16 doubleByte = *(((TUint16*)aBuffer) + aPixelOffset); sl@0: return TRgb::Color64K(doubleByte); sl@0: } sl@0: case EColor16M: sl@0: { sl@0: aBuffer += aPixelOffset * 3; sl@0: TInt value = *aBuffer++; sl@0: value |= *aBuffer++ << 8; sl@0: value |= *aBuffer << 16; sl@0: return TRgb::Color16M(value); sl@0: } sl@0: case ERgb: sl@0: return *(((TRgb*)aBuffer) + aPixelOffset); sl@0: case EColor16MU: sl@0: { sl@0: // Note this is | with 0xFF000000 to match the example rasterizer which sets sl@0: // the alpha to 0xFF when drawing using EColor16MU sl@0: return TRgb::Color16MU((*(((TUint32*)aBuffer) + aPixelOffset)) | 0xFF000000); sl@0: } sl@0: case EColor16MA: sl@0: { sl@0: return TRgb::Color16MA(*(((TUint32*)aBuffer) + aPixelOffset)); sl@0: } sl@0: case EColor16MAP: sl@0: { sl@0: return TRgb::_Color16MAP(*(((TUint32*)aBuffer) + aPixelOffset)); sl@0: } sl@0: default: sl@0: break; sl@0: }; sl@0: return KRgbBlack; sl@0: } sl@0: sl@0: /** Helper function for creating an extended bitmap. sl@0: @param aColours A pointer to an array of three colours to use when creating the extended bitmap, sl@0: these colours define the colours used when drawing the stripes in the extended bitmap. sl@0: @param aHorizontalStripe ETrue for horizontal stripes, EFalse for vertical stripes. sl@0: @param aSizeInPixels The size of the extended bitmap to create. sl@0: @return A pointer to a newly created extended bitmap that has been pushed on to the cleanup stack. sl@0: */ sl@0: CFbsBitmap* CTRasterizer::CreateExtendedBitmapLC(const TRgb* aColours, TBool aHorizontalStripe, TSize aSizeInPixels) sl@0: { sl@0: // Set up the buffer containing the three TRgb values and one TUint8 value that the rasterizer expects sl@0: TInt dataSize = (sizeof(TRgb)*3) + sizeof(TUint8); // estimate the size to be written sl@0: TUint8* data = new (ELeave)TUint8[dataSize]; sl@0: CleanupArrayDeletePushL(data); sl@0: RMemWriteStream writeStream; sl@0: writeStream.Open(data, dataSize); sl@0: CleanupClosePushL(writeStream); sl@0: writeStream << aColours[0]; sl@0: writeStream << aColours[1]; sl@0: writeStream << aColours[2]; sl@0: TUint8 stripe = aHorizontalStripe; // EFalse is vertical stripes, ETrue is horizontal stripes sl@0: writeStream << stripe; sl@0: dataSize = writeStream.Sink()->TellL(MStreamBuf::EWrite).Offset(); // get the actual size written sl@0: CleanupStack::PopAndDestroy(&writeStream); sl@0: sl@0: CFbsBitmap* extendedBitmap = new(ELeave) CFbsBitmap; sl@0: sl@0: TInt err = extendedBitmap->CreateExtendedBitmap(aSizeInPixels, sl@0: iDisplayMode, sl@0: KUidExampleExtendedBitmap, sl@0: data, sl@0: dataSize); sl@0: CleanupStack::PopAndDestroy(data); sl@0: CleanupStack::PushL(extendedBitmap); sl@0: TESTL(err == KErrNone); sl@0: sl@0: return extendedBitmap; sl@0: }