yellowmat
5th April 2006, 13:11
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 :
void CAnimation::paintEvent(QPaintEvent* event)
{
if( this->isShown )
{
QPixmap pixmap(images[imageCurrentIndex]);
QRect rect(event->rect());
bitBlt(this, rect.topLeft(), &pixmap);
}
}
images and imageNames are defined as follow :
QStringList imageNames;
QMap <int, QPixmap>images;
and initialised like this :
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;
}
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)
... 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.
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 :
void CAnimation::paintEvent(QPaintEvent* event)
{
if( this->isShown )
{
QPixmap pixmap(images[imageCurrentIndex]);
QRect rect(event->rect());
bitBlt(this, rect.topLeft(), &pixmap);
}
}
images and imageNames are defined as follow :
QStringList imageNames;
QMap <int, QPixmap>images;
and initialised like this :
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;
}
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)
... 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.