Read-only archive of the All About Symbian forum (2001–2013) · About this archive

Direct Screen Access

0 replies · 4,633 views · Started 11 September 2004

Hi,
I am trying to write a routine to perform direct screen access on the symbian series 60 device. I use the following code to initialize the graphics mode:


iOffScreenBmp = new (ELeave) CFbsBitmap;
iOffScreenBmp->Create(CCoeEnv::Static()->ScreenDevice()->SizeInPixels(), EColor4K);
#if defined(__MARM__) // ARMI DEVICE CODE
TScreenInfoV01 screenInfo;
TPckg<TScreenInfoV01> sInfo(screenInfo);
UserSvr::ScreenInfo(sInfo);
iScreenAdr = screenInfo.iScreenAddressValid ? (TUint8*)screenInfo.iScreenAddress : 0;
User::LeaveIfNull(iScreenAdr);
//skip the palette data (assumes screen mode is 12-bit)
iScreenAdr += 16; // 16 for TUint16*, 32 for TUint8*
iOffScreenAdr = (TUint16*)iOffScreenAdr->DataAddress();
#else // begin emulator code
iScreenAdr = (TUint16*)iOffScreenBmp->DataAddress();
TRAPD(err, iScreenDevice = CFbsScreenDevice::NewL(_L("scdv"😉, EColor4K));
User::LeaveIfError(err);
User::LeaveIfError(iScreenDevice->CreateContext((CGraphicsContext*&😉iGc));
#endif
// I verfiied that this point is reached.

I added the following lines of code to test that I can write directory to the screen:


void Test::FillScreen()
{
TUint16* tmpScreenAddress = iScreenAdr;
for(TInt k = 0; k < 176 * 208; k++)
*(tmpScreenAddress++) = 0xa0;
}

At some point in the code this is called to draw:

void Test::BitBlt()
{
#if !defined(__WINS__) // device code
AsmBitBlt(iScreenAdr, iOffScreenAdr);
TRawEvent redraw;
redraw.Set(TRawEvent::ERedraw);
UserSvr::AddEvent(redraw);
#else // emu code
iGc->BitBlt(TPoint(0,0),iOffScreenBmp); // IS IT POSSIBLE TO DO WITHOUT USING iGc STUFF?
TRawEvent redraw;
redraw.Set(TRawEvent::ERedraw);
UserSvr::AddEvent(redraw);
#endif
}

I can only test the __WINS__ part of the code until I get a phone, but program crashes. If the pixels are being treated as 16bit pixels,of which the first 4 upper bits is ignored, why is it crashing? What have I done wrong?
When I treated it as 8bit unsigned short, as in

void Test::FillScreen()
{
TUint8* tmpScreenAddress = (TUint8*)iScreenAdr;
for(TInt k = 0; k < 176 * 208; k++)
*(tmpScreenAddress++) = 0xa0;
}

The program doesn't crash and I get the following output:
Emulator Image (ignore the "214x251" artiffact from screen capture) only a portition of the screen is filled, about 1/3!

Any guidance,examples and/or help will greatly be appreciated!