Changeset View
Changeset View
Standalone View
Standalone View
lib/documentview/rasterimageview.cpp
Show First 20 Lines • Show All 403 Lines • ▼ Show 20 Line(s) | |||||
404 | 404 | | |||
405 | void RasterImageView::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget* /*widget*/) | 405 | void RasterImageView::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*option*/, QWidget* /*widget*/) | ||
406 | { | 406 | { | ||
407 | QPointF topLeft = imageOffset(); | 407 | QPointF topLeft = imageOffset(); | ||
408 | if (zoomToFit()) { | 408 | if (zoomToFit()) { | ||
409 | // In zoomToFit mode, scale crudely the buffer to fit the screen. This | 409 | // In zoomToFit mode, scale crudely the buffer to fit the screen. This | ||
410 | // provide an approximate rendered which will be replaced when the scheduled | 410 | // provide an approximate rendered which will be replaced when the scheduled | ||
411 | // proper scale is ready. | 411 | // proper scale is ready. | ||
412 | QSizeF size = documentSize() * zoom(); | 412 | // Round point and size independently, to keep consistency with the below (non zoomToFit) painting | ||
413 | painter->drawPixmap(topLeft.x(), topLeft.y(), size.width(), size.height(), d->mCurrentBuffer); | 413 | const QRect rect = QRect(topLeft.toPoint(), (documentSize() * zoom()).toSize()); | ||
414 | painter->drawPixmap(rect, d->mCurrentBuffer); | ||||
414 | } else { | 415 | } else { | ||
415 | painter->drawPixmap(topLeft, d->mCurrentBuffer); | 416 | painter->drawPixmap(topLeft.toPoint(), d->mCurrentBuffer); | ||
416 | } | 417 | } | ||
417 | 418 | | |||
418 | if (d->mTool) { | 419 | if (d->mTool) { | ||
419 | d->mTool.data()->paint(painter); | 420 | d->mTool.data()->paint(painter); | ||
420 | } | 421 | } | ||
421 | 422 | | |||
422 | // Debug | 423 | // Debug | ||
423 | #if 0 | 424 | #if 0 | ||
▲ Show 20 Lines • Show All 142 Lines • Show Last 20 Lines |