Reader: Save RAM when displaying images

This commit is contained in:
Nicolas Mailloux 2022-01-09 16:15:07 -05:00
parent df4e2e26a7
commit e0ff65505c

View file

@ -2032,6 +2032,7 @@ void reader::setupPng() {
if(is_pdf == true) { if(is_pdf == true) {
// Note: Output file is supposed to be '/run/page.png', but somehow mutool puts it in '/run/page1.png' // Note: Output file is supposed to be '/run/page.png', but somehow mutool puts it in '/run/page1.png'
QPixmap pixmap("/run/page1.png"); QPixmap pixmap("/run/page1.png");
QFile::remove("/run/page1.png");
// Initialized above // Initialized above
graphicsScene->clear(); graphicsScene->clear();
graphicsScene->addPixmap(pixmap); graphicsScene->addPixmap(pixmap);
@ -2043,6 +2044,7 @@ void reader::setupPng() {
} }
else if(is_image == true) { else if(is_image == true) {
QPixmap pixmap("/run/image.png"); QPixmap pixmap("/run/image.png");
QFile::remove("/run/image.png");
// Initialized above // Initialized above
graphicsScene->clear(); graphicsScene->clear();
graphicsScene->addPixmap(pixmap); graphicsScene->addPixmap(pixmap);