diff --git a/ui/annotationtools.cpp b/ui/annotationtools.cpp --- a/ui/annotationtools.cpp +++ b/ui/annotationtools.cpp @@ -176,8 +176,9 @@ for ( ; pIt != pEnd; ++pIt ) { Okular::NormalizedPoint pB = *pIt; - painter->drawLine( (int)(pA.x * (double)xScale), (int)(pA.y * (double)yScale), - (int)(pB.x * (double)xScale), (int)(pB.y * (double)yScale) ); + QPointF pAScaled( pA.x * xScale, pA.y * yScale ); + QPointF pBScaled( pB.x * xScale, pB.y * yScale ); + painter->drawLine( pAScaled, pBScaled ); pA = pB; } } diff --git a/ui/presentationwidget.cpp b/ui/presentationwidget.cpp --- a/ui/presentationwidget.cpp +++ b/ui/presentationwidget.cpp @@ -897,16 +897,20 @@ const QRect & geom = m_frames[ m_frameIndex ]->geometry; - QPixmap pm( geom.size() ); + QPixmap pm( QSize( geom.size().width() * dpr, geom.size().height() * dpr ) ); pm.fill( Qt::transparent ); QPainter pmPainter( &pm ); + pm.setDevicePixelRatio( dpr ); pmPainter.setRenderHints( QPainter::Antialiasing ); + + // Paint old paths foreach ( const SmoothPath &drawing, m_frames[ m_frameIndex ]->drawings ) - drawing.paint( &pmPainter, geom.width(), geom.height() ); + drawing.paint( &pmPainter, dpr * geom.width(), dpr * geom.height() ); + // Paint the path that is currently being drawn by the user if ( m_drawingEngine && m_drawingRect.intersects( pe->rect() ) ) - m_drawingEngine->paint( &pmPainter, geom.width(), geom.height(), m_drawingRect.intersected( pe->rect() ) ); + m_drawingEngine->paint( &pmPainter, dpr * geom.width(), dpr* geom.height(), m_drawingRect.intersected( pe->rect() ) ); painter.setRenderHints( QPainter::Antialiasing ); painter.drawPixmap( geom.topLeft() , pm ); @@ -1322,8 +1326,9 @@ if ( eventType == AnnotatorEngine::Press ) hasclicked = true; - double nX = ( (double)e->x() - (double)geom.left() ) / (double)geom.width(); - double nY = ( (double)e->y() - (double)geom.top() ) / (double)geom.height(); + QPointF mousePos = e->screenPos(); + double nX = ( mousePos.x() - (double)geom.left() ) / (double)geom.width(); + double nY = ( mousePos.y() - (double)geom.top() ) / (double)geom.height(); QRect ret; bool isInside = nX >= 0 && nX < 1 && nY >= 0 && nY < 1;