Results 1 to 2 of 2

Thread: Problem with bitBlt

  1. #1
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default Problem with bitBlt

    Hi !

    I have a widget for playing animations (an animation is constituted of many PNG or JPG files) an something strange occured in the paintEvent function of my widget, I simply do :
    Qt Code:
    1. void CAnimation::paintEvent(QPaintEvent* event)
    2. {
    3. if( this->isShown )
    4. {
    5. QPixmap pixmap(images[imageCurrentIndex]);
    6. QRect rect(event->rect());
    7. bitBlt(this, rect.topLeft(), &pixmap);
    8. }
    9. }
    To copy to clipboard, switch view to plain text mode 

    images and imageNames are defined as follow :
    Qt Code:
    1. QStringList imageNames;
    2. QMap <int, QPixmap>images;
    To copy to clipboard, switch view to plain text mode 

    and initialised like this :
    Qt Code:
    1. int CAnimation::setImageNames(QStringList values)
    2. {
    3. // Update property
    4. this->imageNames = values;
    5.  
    6. // Load images
    7. int index = 0;
    8. for ( QStringList::Iterator it = imageNames.begin(); it != imageNames.end(); ++it )
    9. {
    10. images[index] = QPixmap(*it);
    11. index++;
    12. }
    13.  
    14. return 0;
    15. }
    To copy to clipboard, switch view to plain text mode 

    So, here is my problem : when my animation contains more than a specific number of images I have the following debug trace and the image is not displayed :
    Qt Code:
    1. ASSERT: "src_dc && dst_dc" in kernel\qpaintdevice_win.cpp (388)
    To copy to clipboard, switch view to plain text mode 
    ... in fact when I have an animation with more than 165 images, each time I'm trying to display the image of index greather than 166 I have this problem.

    I first thought my last images were bugged but I did the following test : I just load images from index 100 to 175 (my animation has 175 images) and this time I do not have the problem and my last images are correctly displayed.

    Isn't it a problem of memory ? How could I correct this (allocation more memory for my application for example).

    Thanks in advance.

  2. #2
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default [SOLVED] Re: Problem with bitBlt

    I've tried another solution, instead of pre loading all images, I just load the image before drawing it. It's not optimized in term of CPU load but the problem is solved ... in fact I think the source of the problem was the number of images to manage in memory.
    Last edited by yellowmat; 5th April 2006 at 15:09. Reason: probelm solved

Similar Threads

  1. deployment problem: msvc++ 2008 Express, Qt 4.4.3
    By vonCZ in forum Qt Programming
    Replies: 7
    Last Post: 10th November 2008, 15:38
  2. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 10:12
  3. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 09:47
  4. problem with paint and erase in frame
    By M.A.M in forum Qt Programming
    Replies: 9
    Last Post: 4th May 2008, 21:17
  5. Replies: 16
    Last Post: 7th March 2006, 16:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.