From d74d3ecab3486cd2624eee7a7820a5f2016272e0 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Tue, 4 Sep 2018 16:17:33 -0700 Subject: [PATCH] Create empty difference image if images differ in size. --- tools/auto-tester/src/ui/MismatchWindow.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/auto-tester/src/ui/MismatchWindow.cpp b/tools/auto-tester/src/ui/MismatchWindow.cpp index 79d2ce9f61..ef6e35ba8a 100644 --- a/tools/auto-tester/src/ui/MismatchWindow.cpp +++ b/tools/auto-tester/src/ui/MismatchWindow.cpp @@ -22,6 +22,11 @@ MismatchWindow::MismatchWindow(QWidget *parent) : QDialog(parent) { } 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 unsigned char* buffer = new unsigned char[expectedImage.height() * expectedImage.width() * 3];