mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 08:21:24 +02:00
Create empty difference image if images differ in size.
This commit is contained in:
parent
ca3c797c84
commit
d74d3ecab3
1 changed files with 5 additions and 0 deletions
|
@ -22,6 +22,11 @@ MismatchWindow::MismatchWindow(QWidget *parent) : QDialog(parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap MismatchWindow::computeDiffPixmap(QImage expectedImage, QImage resultImage) {
|
QPixmap MismatchWindow::computeDiffPixmap(QImage expectedImage, QImage resultImage) {
|
||||||
|
// Create an empty difference image if the images differ in size
|
||||||
|
if (expectedImage.height() != resultImage.height() || expectedImage.width() != resultImage.width()) {
|
||||||
|
return QPixmap();
|
||||||
|
}
|
||||||
|
|
||||||
// This is an optimization, as QImage.setPixel() is embarrassingly slow
|
// This is an optimization, as QImage.setPixel() is embarrassingly slow
|
||||||
unsigned char* buffer = new unsigned char[expectedImage.height() * expectedImage.width() * 3];
|
unsigned char* buffer = new unsigned char[expectedImage.height() * expectedImage.width() * 3];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue