×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    3

    Smile Fast image drawing

    Hi,

    I'm wondering what is the fastest way to bring a full screen image, what is in my case an unsigned int image array, 32 bit, ARGB to the screen. As far as I understand QWidget implements a double buffer mechanism and I have to use painter.drawImage to do this.
    Copy operations, especially for the whole screen content are slow on the device. With the approach mentioned before I have at least 2 copy operations (back buffer switch + painter.drawImage) and of course I have some application specific operations to fill the image. So we are talking about at least 3 pixel fill operations per frame for the whole screen.

    What I'm looking for is something like
    1) switching to QWidget single buffer + a fast bitblt/memcpy
    2) direct screen buffer access like S60's DSA

    Are there any possibilities to do this with Qt?

    Best regards,
    Henrik

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    48

    Re: Fast image drawing

    Hi,

    I guess that the QPainter should be the "fast" blitter in QT.
    In the QT 4.5 the QPainter should be faster, see this blog entry http://labs.trolltech.com/blogs/2008...-for-the-blit/ . However I seriously doubt that it will be fast on S60 port It would be nice to know, if similar functionality is coming to S60 port too, as they already have in the desktop version.

    Update: There seems to be also QDirectPainter in Embedded linux http://doc.trolltech.com/4.5/qdirectpainter.html The QDirectPainter will give you direct access to the devices framebuffer. This would be ideal for very fast image drawin/blitting ;-)

    -summeli
    Last edited by summeli; 2009-05-08 at 11:39.

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    3

    Re: Fast image drawing

    We found finally a very fast solution by bypassing the Qt rendering pipeline by using DSA. Now we see the achievable performance on S60.

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    48

    Re: Fast image drawing

    How did you bypass the QT pipeline? Can you post some source code, please?

    -summeli

  5. #5
    Registered User
    Join Date
    Jul 2008
    Posts
    8

    Re: Fast image drawing

    Hello,

    as mentioned before we used Direct Screen Access with Qt. About DSA itself more informations can be found for example here http://wiki.forum.nokia.com/index.ph...ctScreenBitmap , http://wiki.forum.nokia.com/index.ph...creen_directly or http://developer.symbian.com/main/do...een_access.pdf.

    What about using DSA with Qt on s60, we created one single central QWidget for drawing contents:
    Code:
    class Window : public QWidget, public CActive, public MDirectScreenAccess
    {
        Q_OBJECT
      //...
    
      // from MDirectScreenAccess class  
      void Restart(RDirectScreenAccess::TTerminationReasons aReason); 
      void AbortNow(RDirectScreenAccess::TTerminationReasons aReason);
      
      // from CActive 
      virtual void DoCancel();
      virtual void RunL();
     
      CDirectScreenAccess *iDSA;
      CDirectScreenBitmap *iDSBitmap;
      bool iDraw_dsa;
    }
    Implementation is very similar to examples that I gave before. Only (but very important) difference is implementation of starting DSA method:
    Code:
    void Window::startDSA(){
      if(!iDSA){
        iDSBitmap = CDirectScreenBitmap::NewL();
        iDSA = CDirectScreenAccess::NewL(CEikonEnv::Static()->WsSession(),
      		*CEikonEnv::Static()->ScreenDevice(),
        		*winId()->DrawableWindow(),
        		*this);
        CEikonEnv::Static()->WsSession().Flush();
        iDSA->StartL();
        CFbsBitGc *gc = iDSA->Gc();
        RRegion *region = iDSA->DrawingRegion();
        gc->SetClippingRegion(region);
        User::LeaveIfError(iDSBitmap->Create(TRect(0, 0, iScreenWidth, iScreenHeight), CDirectScreenBitmap::EDoubleBuffer));
      }
    }
    Solution was tested on device, works pretty good.

    Regards
    Pawel

  6. #6
    Regular Contributor
    Join Date
    Jul 2007
    Location
    Eindhoven, the Netherlands
    Posts
    187

    Re: Fast image drawing

    Hi,

    Since i have a wish to improve the refresh rate for some widgets in my Qt application, i am considering to take the approach shown here.

    But while experimenting, some questions arise:
    1) In the example code (http://wiki.forum.nokia.com/index.ph...ctScreenBitmap) it is mentioned to render the content usint iScreenBuffer. How do i make my QWidget do that? Does it happen automatically?
    2) I'm currently doing the rendering in MyWidget:: paintEvent(), do i need to wrap that in calls to BeginDraw() and EndDraw()?

    Regards,
    Mark.

  7. #7
    Registered User
    Join Date
    Jun 2005
    Posts
    48

    Re: Fast image drawing

    The DSA bybasses the Qt stuff, so you can just make your own update() method, and use the DSA from there.

Similar Threads

  1. Transparency proble in drawing PNG file.
    By prajapatmanoj in forum Symbian Media (Closed)
    Replies: 10
    Last Post: 2008-10-20, 05:33
  2. Replies: 1
    Last Post: 2008-07-11, 02:32
  3. Drawing Image between Option and Exit on Menue bar
    By bashirpk in forum Symbian C++
    Replies: 0
    Last Post: 2006-07-07, 12:04
  4. Drawing image problem
    By cmonteiro in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2004-10-26, 15:42
  5. Scrolling an image and fast screen access
    By mrmop in forum Mobile Java General
    Replies: 2
    Last Post: 2003-12-31, 17:04

Posting Permissions

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