remove some unused code
authorLars Knoll <lars.knoll@nokia.com>
Wed, 4 May 2011 12:54:22 +0000 (14:54 +0200)
committerLars Knoll <lars.knoll@nokia.com>
Wed, 4 May 2011 12:55:11 +0000 (14:55 +0200)
QPaintDeviceRedirection is not being used any more.
Remove all code related to it.

src/gui/painting/qpaintdevice.cpp
src/gui/painting/qpaintdevice_qpa.cpp
src/gui/painting/qpainter.cpp

index 8a0ccfb..c0fd0e6 100644 (file)
@@ -43,8 +43,6 @@
 
 QT_BEGIN_NAMESPACE
 
-extern void qt_painter_removePaintDevice(QPaintDevice *); //qpainter.cpp
-
 QPaintDevice::QPaintDevice()
 {
     painters = 0;
@@ -55,7 +53,6 @@ QPaintDevice::~QPaintDevice()
     if (paintingActive())
         qWarning("QPaintDevice: Cannot destroy paint device that is being "
                   "painted");
-    qt_painter_removePaintDevice(this);
 }
 
 
index 0d1ca92..44e169c 100644 (file)
 
 #include "qpaintdevice.h"
 #include "qpainter.h"
-#include "qwidget.h"
 #include "qbitmap.h"
 #include "qapplication.h"
 
 QT_BEGIN_NAMESPACE
 
-extern void qt_painter_removePaintDevice(QPaintDevice *); //qpainter.cpp
-
 int QPaintDevice::metric(PaintDeviceMetric m) const
 {
     qWarning("QPaintDevice::metrics: Device has no metric information");
index 929685d..f974186 100644 (file)
@@ -7370,27 +7370,6 @@ void QPainter::setViewTransformEnabled(bool enable)
     d->updateMatrix();
 }
 
-
-struct QPaintDeviceRedirection
-{
-    QPaintDeviceRedirection() : device(0), replacement(0), internalWidgetRedirectionIndex(-1) {}
-    QPaintDeviceRedirection(const QPaintDevice *device, QPaintDevice *replacement,
-                            const QPoint& offset, int internalWidgetRedirectionIndex)
-        : device(device), replacement(replacement), offset(offset),
-          internalWidgetRedirectionIndex(internalWidgetRedirectionIndex) { }
-    const QPaintDevice *device;
-    QPaintDevice *replacement;
-    QPoint offset;
-    int internalWidgetRedirectionIndex;
-    bool operator==(const QPaintDevice *pdev) const { return device == pdev; }
-    Q_DUMMY_COMPARISON_OPERATOR(QPaintDeviceRedirection)
-};
-
-typedef QList<QPaintDeviceRedirection> QPaintDeviceRedirectionList;
-Q_GLOBAL_STATIC(QPaintDeviceRedirectionList, globalRedirections)
-Q_GLOBAL_STATIC(QMutex, globalRedirectionsMutex)
-Q_GLOBAL_STATIC(QAtomicInt, globalRedirectionAtomic)
-
 /*!
     \threadsafe
 
@@ -7467,36 +7446,6 @@ QPaintDevice *QPainter::redirected(const QPaintDevice *device, QPoint *offset)
     return 0;
 }
 
-
-void qt_painter_removePaintDevice(QPaintDevice *dev)
-{
-    if (!globalRedirectionAtomic() || *globalRedirectionAtomic() == 0)
-        return;
-
-    QMutex *mutex = 0;
-    QT_TRY {
-        mutex = globalRedirectionsMutex();
-    } QT_CATCH(...) {
-        // ignore the missing mutex, since we could be called from
-        // a destructor, and destructors shall not throw
-    }
-    QMutexLocker locker(mutex);
-    QPaintDeviceRedirectionList *redirections = 0;
-    QT_TRY {
-        redirections = globalRedirections();
-    } QT_CATCH(...) {
-        // do nothing - code below is safe with redirections being 0.
-    }
-    if (redirections) {
-        for (int i = 0; i < redirections->size(); ) {
-            if(redirections->at(i) == dev || redirections->at(i).replacement == dev)
-                redirections->removeAt(i);
-            else
-                ++i;
-        }
-    }
-}
-
 void qt_format_text(const QFont &fnt, const QRectF &_r,
                     int tf, const QString& str, QRectF *brect,
                     int tabstops, int *ta, int tabarraylen,