summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2010-04-22 13:16:32 (GMT)
committerPaul Olav Tvete <paul.tvete@nokia.com>2010-04-22 13:16:32 (GMT)
commit535161b217a9fb5117803cbff1ddcc97242c10f3 (patch)
treeac211dd553dfb167b6539a715ddd9bf737231ea1
parentbf9b927dd7143ef02591308b1cecc0c44417deb9 (diff)
downloadQt-535161b217a9fb5117803cbff1ddcc97242c10f3.zip
Qt-535161b217a9fb5117803cbff1ddcc97242c10f3.tar.gz
Qt-535161b217a9fb5117803cbff1ddcc97242c10f3.tar.bz2
Avoid copying code.
-rw-r--r--src/gui/kernel/qapplication_lite.cpp2
-rw-r--r--src/gui/painting/qwindowsurface.cpp8
-rw-r--r--src/plugins/platforms/testlite/qtestlitewindowsurface.cpp52
3 files changed, 11 insertions, 51 deletions
diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp
index 867c2dc..fae7663 100644
--- a/src/gui/kernel/qapplication_lite.cpp
+++ b/src/gui/kernel/qapplication_lite.cpp
@@ -627,7 +627,7 @@ void QApplicationPrivate::processMouseEvent(QWindowSystemInterface::MouseEvent *
//even if we're blocked by modality, we should deliver the mouse release event..
//### this code is not completely correct: multiple buttons can be pressed simultaneously
if (!(implicit_mouse_grabber && buttons == Qt::NoButton)) {
- qDebug() << "modal blocked mouse event to" << tlw;
+ //qDebug() << "modal blocked mouse event to" << tlw;
return;
}
}
diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp
index 7558cad..3b542bc 100644
--- a/src/gui/painting/qwindowsurface.cpp
+++ b/src/gui/painting/qwindowsurface.cpp
@@ -342,7 +342,13 @@ void QWindowSurface::setPartialUpdateSupport(bool enable)
d_ptr->partialUpdateSupport = enable;
}
-void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset)
+#ifdef Q_WS_LITE
+#define Q_EXPORT_SCROLLRECT Q_GUI_EXPORT
+#else
+#define Q_EXPORT_SCROLLRECT
+#endif
+
+void Q_EXPORT_SCROLLRECT qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset)
{
// make sure we don't detach
uchar *mem = const_cast<uchar*>(const_cast<const QImage &>(img).bits());
diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp
index 3567118..a14a50e 100644
--- a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp
+++ b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp
@@ -197,54 +197,8 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion &region, const
#endif
}
-//### scroll logic copied from QRasterWindowSurface, we should make better API for this
-
-void copied_qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset)
-{
- // make sure we don't detach
- uchar *mem = const_cast<uchar*>(const_cast<const QImage &>(img).bits());
-
- int lineskip = img.bytesPerLine();
- int depth = img.depth() >> 3;
-
- const QRect imageRect(0, 0, img.width(), img.height());
- const QRect r = rect & imageRect & imageRect.translated(-offset);
- const QPoint p = rect.topLeft() + offset;
-
- if (r.isEmpty())
- return;
-
- const uchar *src;
- uchar *dest;
-
- if (r.top() < p.y()) {
- src = mem + r.bottom() * lineskip + r.left() * depth;
- dest = mem + (p.y() + r.height() - 1) * lineskip + p.x() * depth;
- lineskip = -lineskip;
- } else {
- src = mem + r.top() * lineskip + r.left() * depth;
- dest = mem + p.y() * lineskip + p.x() * depth;
- }
-
- const int w = r.width();
- int h = r.height();
- const int bytes = w * depth;
-
- // overlapping segments?
- if (offset.y() == 0 && qAbs(offset.x()) < w) {
- do {
- ::memmove(dest, src, bytes);
- dest += lineskip;
- src += lineskip;
- } while (--h);
- } else {
- do {
- ::memcpy(dest, src, bytes);
- dest += lineskip;
- src += lineskip;
- } while (--h);
- }
-}
+// from qwindowsurface.cpp
+extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset);
bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy)
{
@@ -253,7 +207,7 @@ bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy)
const QVector<QRect> rects = area.rects();
for (int i = 0; i < rects.size(); ++i)
- copied_qt_scrollRectInImage(shm_img, rects.at(i), QPoint(dx, dy));
+ qt_scrollRectInImage(shm_img, rects.at(i), QPoint(dx, dy));
return true;
}