toolbar->setEnabled(true);
vnc_view->setZoomLevel(zoom_slider->value());
+ vnc_view->useFastTransformations(false);
vnc_view->repaint();
break;
case RemoteView::Disconnecting:
scroll_area->ensureVisible(center.x(), center.y(),
vnc_view->visibleRegion().boundingRect().width()/2,
vnc_view->visibleRegion().boundingRect().height()/2);
+
+ vnc_view->useFastTransformations(zoom_slider->isSliderDown());
vnc_view->update();
scroll_area->showMessage(tr("Zoom: %1\%").arg(qRound(100*new_factor)));
zoom_slider->setValue(95); //100%
time.restart();
+
+ //stopped zooming, reenable high quality
+ vnc_view->useFastTransformations(false);
}
m_verticalFactor(1.0),
m_forceLocalCursor(false),
quality(quality),
- listen_port(listen_port)
+ listen_port(listen_port),
+ transformation_mode(Qt::FastTransformation)
{
m_url = url;
m_host = url.host();
old_frame_size = m_frame.size();
kDebug(5011) << "Updating framebuffer size";
setZoomLevel();
+ useFastTransformations(false);
+
emit framebufferSizeChanged(m_frame.width(), m_frame.height());
}
event->accept();
- Qt::TransformationMode transformation_mode = Qt::SmoothTransformation;
- if( m_horizontalFactor >= 1.0 )
- transformation_mode = Qt::FastTransformation;
-
const QRect update_rect = event->rect();
QPainter painter(this);
if (update_rect != rect()) {
const int sh = qRound(update_rect.height()/m_verticalFactor);
painter.drawImage(update_rect,
- m_frame.copy(sx, sy, sw, sh).scaled(update_rect.size(), Qt::IgnoreAspectRatio, transformation_mode));
+ m_frame.copy(sx, sy, sw, sh)
+ .scaled(update_rect.size(), Qt::IgnoreAspectRatio, transformation_mode));
} else {
kDebug(5011) << "Full repaint" << width() << height() << m_frame.width() << m_frame.height();
painter.drawImage(rect(),
- m_frame.scaled(size(), Qt::IgnoreAspectRatio, transformation_mode));
+ m_frame.scaled(size(), Qt::IgnoreAspectRatio, transformation_mode));
}
//draw local cursor ourselves, normal mouse pointer doesn't deal with scrolling
}
}
+void VncView::useFastTransformations(bool enabled)
+{
+ if(enabled or getZoomFactor() >= 1.0) {
+ transformation_mode = Qt::FastTransformation;
+ } else {
+ transformation_mode = Qt::SmoothTransformation;
+ update();
+ }
+}
#include "moc_vncview.cpp"
void setQuality(int q);
void setViewOnly(bool viewOnly);
void showDotCursor(DotCursorState state);
+ void useFastTransformations(bool enabled);
public slots:
void setZoomLevel(int level = -1); //'level' doesn't correspond to actual magnification, though mapping is done here
bool disable_tapping;
RemoteView::Quality quality;
int listen_port;
+ Qt::TransformationMode transformation_mode;
void keyEventHandler(QKeyEvent *e);
void unpressModifiers();