Commit 73d9b19f authored by Christoph Feck's avatar Christoph Feck

Setup matrix in a separate method

svn path=/trunk/KDE/kdeaccessibility/kmag/; revision=1187972
parent 59a7aee2
......@@ -105,12 +105,11 @@ KMagZoomView::KMagZoomView(QWidget *parent, const char *name)
viewport()->setMouseTracking(true);
viewport()->setAttribute(Qt::WA_NoSystemBackground, true);
viewport()->setAutoFillBackground(false);
viewport()->setFocusPolicy(Qt::StrongFocus);
// init the zoom matrix
m_zoomMatrix.reset();
m_zoomMatrix.scale(m_zoom, m_zoom);
m_zoomMatrix.rotate(m_rotation);
setupMatrix();
m_ctrlKeyPressed = false;
m_shiftKeyPressed = false;
......@@ -180,6 +179,13 @@ void KMagZoomView::setContentsPos(int x, int y)
verticalScrollBar()->setValue(y);
}
void KMagZoomView::setupMatrix()
{
m_zoomMatrix.reset();
m_zoomMatrix.scale(m_zoom, m_zoom);
m_zoomMatrix.rotate(m_rotation);
}
/**
* This function will set/reset mouse following of grab window.
*/
......@@ -964,9 +970,7 @@ void KMagZoomView::setZoom(float zoom)
fitToWindow();
// recompute the zoom matrix
m_zoomMatrix.reset();
m_zoomMatrix.scale(m_zoom, m_zoom);
m_zoomMatrix.rotate(m_rotation);
setupMatrix();
viewport()->update();
}
......@@ -984,9 +988,7 @@ void KMagZoomView::setRotation(int rotation)
fitToWindow();
// recompute the zoom matrix
m_zoomMatrix.reset();
m_zoomMatrix.scale(m_zoom, m_zoom);
m_zoomMatrix.rotate(m_rotation);
setupMatrix();
viewport()->update();
}
......
......@@ -180,6 +180,9 @@ class KMagZoomView : public QAbstractScrollArea
int visibleHeight() const;
void setContentsPos(int x, int y);
/// Setup transformation matrix for zooming, rotating, and mirroring
void setupMatrix();
private:
/// Stores the pixmap which is recolored from the grabbed one
QPixmap m_coloredPixmap;
......
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