Commit 3d375fb4 authored by Aurélien Gâteau's avatar Aurélien Gâteau
Browse files

Use similar code for resizeEvent and for scrollContentsBy.

svn path=/trunk/playground/graphics/gwenview/; revision=655364
parent 00c68f40
......@@ -81,12 +81,13 @@ void ImageView::paintEvent(QPaintEvent* event) {
}
void ImageView::resizeEvent(QResizeEvent*) {
QImage tmp = d->mBuffer.copy(0, 0, viewport()->width(), viewport()->height());
d->mBuffer = QImage(viewport()->size(), QImage::Format_ARGB32);
QImage newBuffer = QImage(viewport()->size(), QImage::Format_ARGB32);
newBuffer.fill(0);
{
QPainter painter(&d->mBuffer);
painter.drawImage(0, 0, tmp);
QPainter painter(&newBuffer);
painter.drawImage(0, 0, d->mBuffer);
}
d->mBuffer = newBuffer;
if (d->mZoomToFit) {
setZoom(computeZoomToFit());
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment