diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-07-24 09:22:16 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-07-24 22:51:46 +0200 |
commit | f06dfb60b96004971917a27559713314b7f60de6 (patch) | |
tree | 269572c9e5a564851d410b871fe0d78cfadeb567 /tests/auto/gui/image/qimage | |
parent | b4aee30692c166025b4e2283c19dbc1247bcce54 (diff) |
QtGui: Add Windows conversion functions for to QImage
Add conversions from/to HBITMAP, HICON to QImage. Split the pixmap
conversion functions apart to use them.
Task-number: QTBUG-81876
Change-Id: Ic0c41a402a1f6e9bec572fc4d691357bd48e6423
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'tests/auto/gui/image/qimage')
-rw-r--r-- | tests/auto/gui/image/qimage/tst_qimage.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp index c9c5b5b201..7fcbabd532 100644 --- a/tests/auto/gui/image/qimage/tst_qimage.cpp +++ b/tests/auto/gui/image/qimage/tst_qimage.cpp @@ -3777,10 +3777,6 @@ void tst_QImage::wideImage() } #if defined(Q_OS_WIN) -QT_BEGIN_NAMESPACE -Q_GUI_EXPORT HBITMAP qt_imageToWinHBITMAP(const QImage &p, int hbitmapFormat = 0); -Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat = 0); -QT_END_NAMESPACE static inline QColor COLORREFToQColor(COLORREF cr) { @@ -3844,7 +3840,7 @@ void tst_QImage::toWinHBITMAP() ? createTestImage(QImage::Format_RGB32, width, height, color, bottomRightColor).convertToFormat(format) : createTestImage(format, width, height, color, bottomRightColor); - const HBITMAP bitmap = qt_imageToWinHBITMAP(image); + const HBITMAP bitmap = image.toHBITMAP(); QVERIFY(bitmap != 0); @@ -3867,7 +3863,7 @@ void tst_QImage::toWinHBITMAP() QCOMPARE(COLORREFToQColor(GetPixel(bitmapDc, 3, height - 1)), color); QCOMPARE(COLORREFToQColor(GetPixel(bitmapDc, width - 1, height - 1)), bottomRightColor); - const QImage convertedBack = qt_imageFromWinHBITMAP(bitmap); + const QImage convertedBack = QImage::fromHBITMAP(bitmap); QCOMPARE(convertedBack.convertToFormat(QImage::Format_ARGB32_Premultiplied), image.convertToFormat(QImage::Format_ARGB32_Premultiplied)); @@ -3884,7 +3880,7 @@ void tst_QImage::fromMonoHBITMAP() // QTBUG-72343, corruption for mono bitmaps char bitmapData[size]; memset(bitmapData, 0, size); const HBITMAP hbitmap = CreateBitmap(width, height, /* planes */ 1, /* bitcount */ 1, bitmapData); - const QImage image = qt_imageFromWinHBITMAP(hbitmap); + const QImage image = QImage::fromHBITMAP(hbitmap); QCOMPARE(image.size(), QSize(width, height)); QCOMPARE(image.scanLine(0)[0], 0u); DeleteObject(hbitmap); |