From 535161b217a9fb5117803cbff1ddcc97242c10f3 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 22 Apr 2010 15:16:32 +0200 Subject: Avoid copying code. --- src/gui/kernel/qapplication_lite.cpp | 2 +- src/gui/painting/qwindowsurface.cpp | 8 +++- .../platforms/testlite/qtestlitewindowsurface.cpp | 52 ++-------------------- 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(const_cast(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 ®ion, 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(const_cast(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 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; } -- cgit v0.12