OSDN Git Service

various cleanups
authorIvailo Monev <xakepa10@laimg.moc>
Sat, 6 Aug 2016 13:21:14 +0000 (13:21 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Sat, 6 Aug 2016 13:21:14 +0000 (13:21 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/gui/image/qpixmap.cpp
src/gui/image/qpixmap_x11.cpp
src/gui/image/qpixmapcache.cpp
src/gui/image/qpixmapdata_p.h
src/gui/painting/qwindowsurface_raster.cpp

index 7ae9ae6..23dafcf 100644 (file)
@@ -1803,10 +1803,8 @@ QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionF
 */
 QPixmapData* QPixmap::pixmapData() const
 {
-    if (data) {
-        QPixmapData* pm = data.data();
-        return pm->runtimeData() ? pm->runtimeData() : pm;
-    }
+    if (data)
+        return data.data();
 
     return 0;
 }
index 392bed2..914371f 100644 (file)
@@ -2177,9 +2177,9 @@ bool QX11PixmapData::hasAlphaChannel() const
 
 const QX11Info &QPixmap::x11Info() const
 {
-    if (data && data->classId() == QPixmapData::X11Class)
+    if (data && data->classId() == QPixmapData::X11Class) {
         return static_cast<QX11PixmapData*>(data.data())->xinfo;
-    else {
+    else {
         static QX11Info nullX11Info;
         return nullX11Info;
     }
index 37f3097..8befbfa 100644 (file)
@@ -39,7 +39,7 @@
 **
 ****************************************************************************/
 
-#define Q_TEST_QPIXMAPCACHE
+// #define Q_TEST_QPIXMAPCACHE
 #include "qpixmapcache.h"
 #include "qobject.h"
 #include "qdebug.h"
@@ -191,8 +191,6 @@ public:
     static inline QPixmapCache::KeyData *get(const QPixmapCache::Key &key)
     {return key.d;}
 
-    static QPixmapCache::KeyData* getKeyData(QPixmapCache::Key *key);
-
     QList< QPair<QString,QPixmap> > allPixmaps() const;
     bool flushDetachedPixmaps(bool nt);
 
@@ -401,8 +399,8 @@ QPixmapCache::Key QPMCache::createKey()
     int id = freeKey;
     freeKey = keyArray[id];
     QPixmapCache::Key key;
-    QPixmapCache::KeyData *d = QPMCache::getKeyData(&key);
-    d->key = ++id;
+    key.d = new QPixmapCache::KeyData;
+    key.d->key = ++id;
     return key;
 }
 
@@ -430,13 +428,6 @@ void QPMCache::clear()
     QCache<QPixmapCache::Key, QPixmapCacheEntry>::clear();
 }
 
-QPixmapCache::KeyData* QPMCache::getKeyData(QPixmapCache::Key *key)
-{
-    if (!key->d)
-        key->d = new QPixmapCache::KeyData;
-    return key->d;
-}
-
 QList< QPair<QString,QPixmap> > QPMCache::allPixmaps() const
 {
     QList< QPair<QString,QPixmap> > r;
@@ -658,6 +649,7 @@ void QPixmapCache::clear()
     }
 }
 
+#ifdef Q_TEST_QPIXMAPCACHE
 void QPixmapCache::flushDetachedPixmaps()
 {
     pm_cache()->flushDetachedPixmaps(true);
@@ -672,6 +664,7 @@ QList< QPair<QString,QPixmap> > QPixmapCache::allPixmaps()
 {
     return pm_cache()->allPixmaps();
 }
+#endif // Q_TEST_QPIXMAPCACHE
 
 QT_END_NAMESPACE
 
index d22be34..1ee8cb6 100644 (file)
@@ -127,8 +127,6 @@ public:
 
     static QPixmapData *create(int w, int h, PixelType type);
 
-    virtual QPixmapData *runtimeData() const { return 0; }
-
 protected:
 
     void setSerialNumber(int serNo);
index f92c869..7c0c30f 100644 (file)
@@ -218,7 +218,6 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
 
 #ifdef Q_WS_X11
     extern void *qt_getClipRects(const QRegion &r, int &num); // in qpaintengine_x11.cpp
-    extern QWidgetData* qt_widget_data(QWidget *);
     QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft();
 
     if (widget->window() != window()) {
@@ -274,7 +273,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
 
     if (wrgn.rectCount() != 1)
         XSetClipMask(X11->display, d_ptr->gc, XNone);
-#endif // FALCON
+#endif // Q_WS_X11
 
 #ifdef Q_WS_MAC