mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Use exiting variable instead of request the image several times
This commit is contained in:
parent
0503a83a86
commit
0ab94181cc
@ -81,11 +81,11 @@ void MagnifyingGlass::updateImage(int x, int y)
|
|||||||
img.fill(Configuration::getConfiguration().getBackgroundColor());
|
img.fill(Configuration::getConfiguration().getBackgroundColor());
|
||||||
if (zw > 0 && zh > 0) {
|
if (zw > 0 && zh > 0) {
|
||||||
QPainter painter(&img);
|
QPainter painter(&img);
|
||||||
painter.drawPixmap(xOffset, yOffset, p->pixmap()->copy(xp, yp, zw, zh));
|
painter.drawPixmap(xOffset, yOffset, image->copy(xp, yp, zw, zh));
|
||||||
}
|
}
|
||||||
setPixmap(QPixmap().fromImage(img));
|
setPixmap(QPixmap().fromImage(img));
|
||||||
} else
|
} else
|
||||||
setPixmap(p->pixmap()->copy(xp, yp, zoomWidth, zoomHeight));
|
setPixmap(image->copy(xp, yp, zoomWidth, zoomHeight));
|
||||||
} else {
|
} else {
|
||||||
int xp = static_cast<int>(((x - p->widget()->pos().x()) * wFactor) - zoomWidth / 2);
|
int xp = static_cast<int>(((x - p->widget()->pos().x()) * wFactor) - zoomWidth / 2);
|
||||||
int yp = static_cast<int>((y + currentPos) * hFactor - zoomHeight / 2);
|
int yp = static_cast<int>((y + currentPos) * hFactor - zoomHeight / 2);
|
||||||
@ -122,11 +122,11 @@ void MagnifyingGlass::updateImage(int x, int y)
|
|||||||
img.fill(Configuration::getConfiguration().getBackgroundColor());
|
img.fill(Configuration::getConfiguration().getBackgroundColor());
|
||||||
if (zw > 0 && zh > 0) {
|
if (zw > 0 && zh > 0) {
|
||||||
QPainter painter(&img);
|
QPainter painter(&img);
|
||||||
painter.drawPixmap(xOffset, yOffset, p->pixmap()->copy(xp, yp, zw, zh));
|
painter.drawPixmap(xOffset, yOffset, image->copy(xp, yp, zw, zh));
|
||||||
}
|
}
|
||||||
setPixmap(QPixmap().fromImage(img));
|
setPixmap(QPixmap().fromImage(img));
|
||||||
} else
|
} else
|
||||||
setPixmap(p->pixmap()->copy(xp, yp, zoomWidth, zoomHeight));
|
setPixmap(image->copy(xp, yp, zoomWidth, zoomHeight));
|
||||||
}
|
}
|
||||||
move(static_cast<int>(x - float(width()) / 2), static_cast<int>(y - float(height()) / 2));
|
move(static_cast<int>(x - float(width()) / 2), static_cast<int>(y - float(height()) / 2));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user