[Qt-interest] Pixmap corruption
Scott Sibley
sisibley at gmail.com
Fri Oct 16 06:12:27 CEST 2009
There's an attached png file. What could cause the little bit of corruption
on the number 2? When the program starts up, the 2's fine at first, but then
it corrupts.
Here's how I'm creating the pixmaps.
QPixmap *CreatePixmapFromData(QtDisplay *lcdP, unsigned char *ch) {
int width = lcdP->GetCharWidth();
int height = lcdP->GetCharHeight();
int k, m, mask;
QPixmap *pixmap = new QPixmap( width, height );
pixmap->fill(*lcdP->bg_color);
QPainter *painter = new QPainter(pixmap);
painter->setPen( *lcdP->fg_color );
for(int j = 0; j < lcdP->dots.y; j++ ) {
k = j * lcdP->pixels.y;
mask = 1<<lcdP->dots.x;
for(int i = 0; i < lcdP->dots.x; i++ ) {
mask>>= 1;
if( (mask & ch[j]) == 0 )
continue;
m = i * lcdP->pixels.y;
for(int jj = k; jj < k+lcdP->pixels.y-1; jj++)
{
for(int ii = m+1; ii < m+lcdP->pixels.x; ii++)
{
painter->drawPoint(ii, jj);
}
}
}
}
delete painter;
return pixmap;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091015/e4ce81eb/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LCD.png
Type: image/png
Size: 7122 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091015/e4ce81eb/attachment.png
More information about the Qt-interest-old
mailing list