Skip to content

Commit

Permalink
Honor apparent QImage alignment requirements
Browse files Browse the repository at this point in the history
QImage seems to require image scanlines to be divisible by 4 bytes. This
change makes preview-image to display correctly, albeit upside down.
  • Loading branch information
latami committed May 19, 2015
1 parent 78a98db commit 8e0e1ca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions testui2/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,9 @@ void MainWindow::on_pushButton_11_clicked()
unsigned short width = values[0].toUShort();
unsigned short height = values[1].toUShort();

uchar *array = mySphere->exportEquirectangularMap(250, 125);
QImage image = QImage(array, 250,150, QImage::Format_RGB888);
// One scanline must be divisible by 4 bytes
uchar *array = mySphere->exportEquirectangularMap(248, 124);
QImage image = QImage(array, 248,124, QImage::Format_RGB888);

QGraphicsScene *scene = new QGraphicsScene();
scene->addPixmap(QPixmap::fromImage(image));
Expand Down

0 comments on commit 8e0e1ca

Please sign in to comment.