×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    136

    DrawBitmapMasked = wserv 7

    Hi,

    this is my Draw callback being notified by wserv:

    Code:
    void CWindowDrawer::Draw(void)
    {
    ...
       DrwRect.SetRect(TPoint(0,0), iSplashWindow.Size());
    
       if (iSplashBmp && iSplashMaskBmp)
    	iWindowGc->DrawBitmapMasked(DrwRect, iSplashBmp, bmpSize, iSplashMaskBmp, ETrue);    //WSERV 7
    	//iWindowGc->DrawBitmap(DrwRect, iSplashMaskBmp);                                    //works fine
            //iWindowGc->DrawBitmap(DrwRect, iSplashBmp);                                        //works fine
    ...
    }
    soooo... halp ?!

    thank you

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: DrawBitmapMasked = wserv 7

    you could maybe check the error description from the SDK docs, for WSERV 7 it says: "Invalid bitmap handle. ".

  3. #3
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    136

    Re: DrawBitmapMasked = wserv 7

    Quote Originally Posted by symbianyucca View Post
    you could maybe check the error description from the SDK docs, for WSERV 7 it says: "Invalid bitmap handle. ".
    Yes, but, would it not be the case for at least one of the following lines to also cause WSERV 7 ?

    Code:
    	//iWindowGc->DrawBitmap(DrwRect, iSplashMaskBmp);                                    //works fine
            //iWindowGc->DrawBitmap(DrwRect, iSplashBmp);                                        //works fine
    Those handles appear to be just fine. How can I investigate deeper ?


    thanks

  4. #4
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: DrawBitmapMasked = wserv 7

    I hope you know that commenting them out with "//" actually means that those lines are not compiled into the executable..

    Anyway try checking the Handle() from the bitmaps before drawing and it should be ok then..

  5. #5
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    136

    Re: DrawBitmapMasked = wserv 7

    Quote Originally Posted by symbianyucca View Post
    I hope you know that commenting them out with "//" actually means that those lines are not compiled into the executable..

    Anyway try checking the Handle() from the bitmaps before drawing and it should be ok then..
    Hey, if you dont feel like helping please stop relping.

    Gee

  6. #6
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    136

    Re: DrawBitmapMasked = wserv 7

    Quote Originally Posted by symbianyucca View Post

    Anyway try checking the Handle() from the bitmaps before drawing and it should be ok then..
    Err, I have missed this line sorry for bashing you

    Well, the thing is the handles seem to be valid.
    Captured from carbide debugger:

    h1 140866460
    h2 140868544

    So, as you have probably understood, the thing is these two lines

    Code:
    //iWindowGc->DrawBitmap(DrwRect, iSplashMaskBmp);                                    //works fine
            //iWindowGc->DrawBitmap(DrwRect, iSplashBmp);
    //works fine

    do not cause any errors. I was thinking about the iWindowGc which belongs to some RWindow onto which I have never called any SetTransparency function. But would this also throw WSERV 7 ? Pretty strange.

    However, If I attempt to enable transparency on that RWindow I get into even more headaches. See them described here

    Thank you

  7. #7
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: DrawBitmapMasked = wserv 7

    how do you construct & delete the images then ?
    also should not really matter, but how is the bmpSize set ?

  8. #8
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    136

    Re: DrawBitmapMasked = wserv 7

    I am doing it like this:

    Code:
    CWindowDrawer::CWindowDrawer() :
    CActive(EPriorityLow),
    iSplashBmp (NULL),
    iSplashMaskBmp (NULL),
    iLogoBmp (NULL),
    iLogoMaskBmp (NULL)
    {
    	iSplashBmp = CEikonEnv::Static()->CreateBitmapL(_L("*"), EMbmOdcSplash);
    	iSplashMaskBmp = CEikonEnv::Static()->CreateBitmapL(_L("*"), EMbmOdcSplash_mask);
    	iLogoBmp = CEikonEnv::Static()->CreateBitmapL(_L("*"), EMbmOdcLogo);
    	iLogoMaskBmp = CEikonEnv::Static()->CreateBitmapL(_L("*"), EMbmOdcLogo_mask);
    }
    
    
    
    void CWindowDrawer::ConstructL(void)
    {
    	CActiveScheduler::Add(this);
     
    	User::LeaveIfError(iWsSession.Connect());
     
    	iScreenDevice=new (ELeave) CWsScreenDevice(iWsSession);
    	User::LeaveIfError(iScreenDevice->Construct());
    	User::LeaveIfError(iScreenDevice->CreateContext(iWindowGc));
     
    	TFontSpec MyeFontSpec(KFontArial, 12*12);	
    	MyeFontSpec.iTypeface.SetIsProportional(ETrue);
    	MyeFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
    	User::LeaveIfError(iScreenDevice->GetNearestFontInTwips(iMyFont,MyeFontSpec));
     
    	iWindowGroup=RWindowGroup(iWsSession);
    	User::LeaveIfError(iWindowGroup.Construct((TUint32)&iWindowGroup, EFalse));
    	iWindowGroup.SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront);
    	iWindowGroup.EnableReceiptOfFocus(EFalse);
     
    	CApaWindowGroupName* winGroupName=CApaWindowGroupName::NewLC(iWsSession);
    	winGroupName->SetHidden(ETrue);
    	winGroupName->SetWindowGroupName(iWindowGroup);
    	CleanupStack::PopAndDestroy();
    	
    	ConstructSplashL();
    	ConstructLogoL();
    		
    	Draw();
    	iWsSession.RedrawReady(&iStatus);
    	SetActive();
    }
    
    
    void CWindowDrawer::RunL()
    {
    	if (iStatus != KErrCancel) 
    	{
    		TWsRedrawEvent e;
    		iWsSession.GetRedraw(e);
     
    		// if Windows Server does not want a redraw the window handle is 0
    		if (e.Handle() != 0)
    			{
    			//draw our only window
    			Draw();
    			}
     
    		iWsSession.RedrawReady(&iStatus);
    		SetActive();
    	}
    }
    
    void CWindowDrawer::Draw(void)
    {
    	.....
    	
    	iWindowGc->Activate(iSplashWindow);
    	DrwRect.SetRect(TPoint(0,0), iSplashWindow.Size());
    	iSplashWindow.Invalidate(DrwRect);
    	iSplashWindow.BeginRedraw();
    	iWindowGc->Clear(DrwRect);
    	
    	TSize bmpSize = iSplashBmp->SizeInPixels();
    			
    	if (iSplashBmp && iSplashMaskBmp)
    	{
    		TInt h1 = iSplashMaskBmp->Handle();
    		TInt h2 = iSplashBmp->Handle();
    		iWindowGc->DrawBitmapMasked(DrwRect, iSplashBmp, bmpSize, iSplashMaskBmp, ETrue);
    		//iWindowGc->DrawBitmap(DrwRect, iSplashBmp);
    	}
    
    	iSplashWindow.EndRedraw();
    	iWindowGc->Deactivate();
    		
    	iWsSession.Flush();
    }
    
    
    
    void CWindowDrawer::ConstructSplashL()
    {
    	
    	iSplashWindow = RWindow(iWsSession);
    	
    	RWindowGroup& root =CEikonEnv::Static()->RootWin();
    	
    	TInt err = iSplashWindow.Construct(iWindowGroup, (TUint32)&iSplashWindow);
    	//User::LeaveIfError(iSplashWindow.Construct(root, (TUint32)&iSplashWindow));
    	
    	TPixelsTwipsAndRotation SizeAndRotation;
    	iScreenDevice->GetDefaultScreenSizeAndRotation(SizeAndRotation);
    	
    	TInt top = SizeAndRotation.iPixelSize.iHeight / 4;
    	TInt left = SizeAndRotation.iPixelSize.iWidth / 4;
    	TInt width = left * 2;
    	TInt heigth = top * 2;
    	
    	iSplashWindow.SetExtent(TPoint(left, top), TSize(width, heigth));		
    	iSplashWindow.SetBackgroundColor(TRgb(255,255,255));
    	//iSplashWindow.SetTransparencyWsBitmap(*iSplashMaskBmp);
    	iSplashWindow.SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
    	iSplashWindow.Activate();
    	iSplashWindow.SetNonFading(EFalse);
    	 
    }
    thanks

  9. #9
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: DrawBitmapMasked = wserv 7

    there are small things that re really wrong, but can not see too clear reason for the WSERV 7 error, anyway, is this code run in a app-framework app or in something else ?

  10. #10
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    136

    Re: DrawBitmapMasked = wserv 7

    Quote Originally Posted by symbianyucca View Post
    there are small things that re really wrong, but can not see too clear reason for the WSERV 7 error, anyway, is this code run in a app-framework app or in something else ?
    I am not quite sure I get your question. This class is instantiated from some CAknViewAppUi 's ConstructL if it helps.

  11. #11
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: DrawBitmapMasked = wserv 7

    The point is that you are doing it way too difficult way, and thus having more problems than you should. instead you should just use a simple container with timer, here's a very simple splash screen container example: http://wiki.forum.nokia.com/index.ph...implementation

    and wiki also has simple timeout timer examples you could use.

  12. #12
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    136

    Re: DrawBitmapMasked = wserv 7

    Thanks, but it has to be done with RWindow. Besides the logo screen, there s another screen in my app that needs to cover the "Dialing 07564868" window, and that also needs some transparency..

Similar Threads

  1. DrawBitmapMasked crashed on S60 2nd Fp1 and Fp2 devices????
    By daveice in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2009-08-21, 04:18
  2. Call rejecting with screen flicker of wserv
    By mateen_maldar in forum Symbian User Interface
    Replies: 0
    Last Post: 2009-07-19, 17:08
  3. Help: WSERV 66
    By yotiger in forum Symbian
    Replies: 1
    Last Post: 2008-11-28, 07:02
  4. CEikEdwin and WSERV 66 panic on Nokia E61
    By mike.b in forum Symbian
    Replies: 2
    Last Post: 2006-08-29, 15:01
  5. WSERV crash when using CActive
    By thewisemonkey in forum Symbian
    Replies: 2
    Last Post: 2004-07-21, 08:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •