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 :
{
if( this->isShown )
{
QPixmap pixmap
(images
[imageCurrentIndex
]);
QRect rect
(event
->rect
());
bitBlt(this, rect.topLeft(), &pixmap);
}
}
void CAnimation::paintEvent(QPaintEvent* event)
{
if( this->isShown )
{
QPixmap pixmap(images[imageCurrentIndex]);
QRect rect(event->rect());
bitBlt(this, rect.topLeft(), &pixmap);
}
}
To copy to clipboard, switch view to plain text mode
images and imageNames are defined as follow :
QMap <int, QPixmap>images;
QStringList imageNames;
QMap <int, QPixmap>images;
To copy to clipboard, switch view to plain text mode
and initialised like this :
{
// Update property
this->imageNames = values;
// Load images
int index = 0;
for ( QStringList::Iterator it
= imageNames.
begin(); it
!= imageNames.
end();
++it
) {
index++;
}
return 0;
}
int CAnimation::setImageNames(QStringList values)
{
// Update property
this->imageNames = values;
// Load images
int index = 0;
for ( QStringList::Iterator it = imageNames.begin(); it != imageNames.end(); ++it )
{
images[index] = QPixmap(*it);
index++;
}
return 0;
}
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 :
ASSERT: "src_dc && dst_dc" in kernel\qpaintdevice_win.cpp (388)
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.
Bookmarks