summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2012-02-25 12:40:20 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-26 02:23:01 +0100
commitddf4b378f1e7eac62bd504a1e453cb7b894e21f2 (patch)
treeb9060a30ec5e656eeaabb996416afb18f27ae315 /src/gui/image
parentc951908bc201afa59402967d50fa926212845fae (diff)
Inline and mark as deprecated images's serialNumber()
These function are marked as obsolete since Qt 4.3 The motivation here was too fix QPixmap::serialNumber which is marked as QT_DEPRECATED_SINCE but was not inlined. But then I took the oportunity to do the same with all the other functions. Change-Id: Ic50a7857461fc402b2f2b4528c83e53e8e28ea30 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qimage.cpp11
-rw-r--r--src/gui/image/qimage.h4
-rw-r--r--src/gui/image/qpixmap.cpp9
-rw-r--r--src/gui/image/qpixmap.h2
-rw-r--r--src/gui/image/qpixmap_raster.cpp4
5 files changed, 10 insertions, 20 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 5b23dbf4dc..23d212cc92 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -5132,7 +5132,8 @@ bool qt_xForm_helper(const QTransform &trueMat, int xoffset, int type, int depth
#undef IWX_LSB
#undef IWX_PIX
-/*! \obsolete
+/*! \fn int QImage::serialNumber() const
+ \obsolete
Returns a number that identifies the contents of this
QImage object. Distinct QImage objects can only have the same
serial number if they refer to the same contents (but they don't
@@ -5147,14 +5148,6 @@ bool qt_xForm_helper(const QTransform &trueMat, int xoffset, int type, int depth
\sa operator==()
*/
-int QImage::serialNumber() const
-{
- if (!d)
- return 0;
- else
- return d->ser_no;
-}
-
/*!
Returns a number that identifies the contents of this QImage
object. Distinct QImage objects can only have the same key if they
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 5a3ae8f886..e9192f1031 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -253,7 +253,9 @@ public:
inline static QImage fromData(const QByteArray &data, const char *format = 0)
{ return fromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), format); }
- int serialNumber() const;
+#if QT_DEPRECATED_SINCE(5, 0)
+ QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; }
+#endif
qint64 cacheKey() const;
QPaintEngine *paintEngine() const;
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index e8c1304b74..1f325f5b6b 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -885,7 +885,8 @@ void QPixmap::fill(const QColor &color)
data->fill(color);
}
-/*! \obsolete
+/*! \fn int QPixmap::serialNumber() const
+ \obsolete
Returns a number that identifies the contents of this QPixmap
object. Distinct QPixmap objects can only have the same serial
number if they refer to the same contents (but they don't have
@@ -898,12 +899,6 @@ void QPixmap::fill(const QColor &color)
it as a cache key. For caching pixmaps, we recommend using the
QPixmapCache class whenever possible.
*/
-int QPixmap::serialNumber() const
-{
- if (isNull())
- return 0;
- return data->serialNumber();
-}
/*!
Returns a number that identifies this QPixmap. Distinct QPixmap
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index 27bfe15688..3d78a43917 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -146,7 +146,7 @@ public:
void scroll(int dx, int dy, const QRect &rect, QRegion *exposed = 0);
#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED int serialNumber() const;
+ QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; }
#endif
qint64 cacheKey() const;
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 8125b1360d..7c7c4652e3 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -115,7 +115,7 @@ void QRasterPlatformPixmap::resize(int width, int height)
image.setColor(1, QColor(Qt::color1).rgba());
}
- setSerialNumber(image.serialNumber());
+ setSerialNumber(image.cacheKey() >> 32);
}
bool QRasterPlatformPixmap::fromData(const uchar *buffer, uint len, const char *format,
@@ -349,7 +349,7 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC
}
is_null = (w <= 0 || h <= 0);
- setSerialNumber(image.serialNumber());
+ setSerialNumber(image.cacheKey() >> 32);
}
QImage* QRasterPlatformPixmap::buffer()