fixed DebugTask when called multiple times

This commit is contained in:
2020-05-12 09:57:40 +02:00
parent 5bb5dec0f5
commit 3378e6451b
@@ -1,9 +1,13 @@
package de.unidue.nes.gpu.testframework.tasks;
import java.util.Arrays;
import java.util.Map;
import javax.swing.JFrame;
import org.opencv.core.Mat;
import org.opencv.highgui.HighGui;
import org.opencv.highgui.ImageWindow;
/**
* Task is used for debugging
@@ -28,9 +32,22 @@ public class DebugTask implements Task {
HighGui.imshow("Image " + i, this.mats[i]);
}
HighGui.waitKey();
Map<String, ImageWindow> windows = HighGui.windows;
destroyWindows(windows);
HighGui.destroyAllWindows();
};
}
private void destroyWindows(Map<String, ImageWindow> windows) {
for (ImageWindow w : windows.values()) {
JFrame frame = w.frame;
if (frame != null) {
frame.dispose();
}
}
}
@Override
public GpuTask toGpuTask() {
return null;