I use the following code to get the screen address, I took it from code that I found on forum:
On the emulator side, where do I get iScreenDevice from? Once I have iScreenAddr, can I write directly to the screen the same way for both device and emu using iScreenAddr, For example:Code:#if !defined(__WINS__) // device code // fetch screen buffer address TScreenInfoV01 screenInfo; TPckg<TScreenInfoV01> sInfo(screenInfo); UserSvr::ScreenInfo(sInfo); iScreenAddr = screenInfo.iScreenAddressValid ? (TUint8*)iScreenInfo.iScreenAddress : 0; User::LeaveIfNull(iScreenAddr); //skip the palette data (assumes screen mode is 12-bit) iScreenAddr += 32; #else // begin emulator code iOffScreenBufferedBmp = new (ELeave)CFbsBitmap; iOffScreenBmp = new (ELeave) CFbsBitmap; iOffScreenBmp->Create(iScreenDevice.SizeInPixels(), EColor4K); iOffScreenBufferedBmp->Create(iScreenDevice.SizeInPixels(),EColor4K); iScreenAddr = (TUint8*)iOffScreenBmp->DataAddress(); #endif
The above code will clear the screen on both the device and emulator?Code:void ClearScreen(TUint16 color) { TUint16* tmpScreenAddress = iScreenAddr; for(TInt k = 0; k < 176 * 208; k++) *(tmpScreenAddress++) = color; }
This is code that I created to BitBlt to the screen:
Is this code correct? I haven't tested it yet, but I compiled it using various questions from previous forum questions. I don't know what "Code:--- header-- private: TUint8* iScreenAddr; //device/emu screen addr CFbsBitmap* iOffScreenBmp; // offscreen buffer #if defined(__WINS__) CFbsBitmap* iOffScreenBufferedBmp; // for emu create another area for buffering data #endif --- cpp --- void CGraphicsEngine::BitBlt() { #if !defined(__WINS__) // device code AsmBitBlt(iScreenAddr, iOffscreenBmp->DataAddress()) TRawEvent redraw; redraw.Set(TRawEvent::ERedraw); UserSvr::AddEvent(redraw); #else // emu code Mem::Copy(iScreenAddr, iOffScreenBufferedBmp->DataAddress(), 208*176); TRawEvent redraw; redraw.Set(TRawEvent::ERedraw); UserSvr::AddEvent(redraw); #endif }
TRawEvent redraw;
redraw.Set(TRawEvent::ERedraw);
UserSvr::AddEvent(redraw);"
does, or even if it's necessary, because I copied it from the forum code too.
The reason that I am not using CDirectScreenAccess is becaues I am not concerned with interfering with WinServer because the Asm routine should be so fast that it will never interfere with the WinServer and thus the screen will not get garbled. Please Comment!
Thank You!
earamsey




Reply With Quote

