diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-03-08 13:25:23 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-03-30 17:35:41 +0000 |
commit | bf537516a93ae9297a90a6369a3f613ded0dc84c (patch) | |
tree | 6e8f925617233bc49df2d76d4a6e87dfcd026891 /src | |
parent | c8c3893f37594c9e00f75b676d4a0d5bd0324144 (diff) |
QtGui: Remove Windows CE.
Remove #ifdef sections for Q_OS_WINCE and wince .pro file clauses in library,
and tests.
Task-number: QTBUG-51673
Change-Id: I55f61845c3b54027c467a5c59c122e7d16955358
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/image/qpixmap_win.cpp | 170 | ||||
-rw-r--r-- | src/gui/image/qpnghandler.cpp | 28 | ||||
-rw-r--r-- | src/gui/image/qxpmhandler.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 10 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 8 |
5 files changed, 18 insertions, 200 deletions
diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp index 7f20586156..92f6964783 100644 --- a/src/gui/image/qpixmap_win.cpp +++ b/src/gui/image/qpixmap_win.cpp @@ -48,84 +48,6 @@ QT_BEGIN_NAMESPACE -#ifdef Q_OS_WINCE -#define GetDIBits(a,b,c,d,e,f,g) qt_wince_GetDIBits(a,b,c,d,e,f,g) -int qt_wince_GetDIBits(HDC /*hdc*/ , HBITMAP hSourceBitmap, uint, uint, LPVOID lpvBits, LPBITMAPINFO, uint) -{ - if (!lpvBits) { - qWarning("::GetDIBits(), lpvBits NULL"); - return 0; - } - BITMAP bm; - GetObject(hSourceBitmap, sizeof(BITMAP), &bm); - bm.bmHeight = qAbs(bm.bmHeight); - - HBITMAP hTargetBitmap; - void *pixels; - - BITMAPINFO dibInfo; - memset(&dibInfo, 0, sizeof(dibInfo)); - dibInfo.bmiHeader.biBitCount = 32; - dibInfo.bmiHeader.biClrImportant = 0; - dibInfo.bmiHeader.biClrUsed = 0; - dibInfo.bmiHeader.biCompression = BI_RGB;; - dibInfo.bmiHeader.biHeight = -bm.bmHeight; - dibInfo.bmiHeader.biWidth = bm.bmWidth; - dibInfo.bmiHeader.biPlanes = 1; - dibInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - dibInfo.bmiHeader.biSizeImage = bm.bmWidth * bm.bmHeight * 4; - - HDC displayDC = GetDC(NULL); - if (!displayDC) { - qWarning("::GetDIBits(), failed to GetDC"); - return 0; - } - - int ret = bm.bmHeight; - - hTargetBitmap = CreateDIBSection(displayDC, (const BITMAPINFO*) &dibInfo, DIB_RGB_COLORS, - (void**)&pixels, NULL, 0); - if (!hTargetBitmap) { - qWarning("::GetDIBits(), failed to CreateDIBSection"); - return 0; - } - - HDC hdcSrc = CreateCompatibleDC(displayDC); - HDC hdcDst = CreateCompatibleDC(displayDC); - - if (!(hdcDst && hdcSrc)) { - qWarning("::GetDIBits(), failed to CreateCompatibleDC"); - ret = 0; - } - - HBITMAP hOldBitmap1 = (HBITMAP) SelectObject(hdcSrc, hSourceBitmap); - HBITMAP hOldBitmap2 = (HBITMAP) SelectObject(hdcDst, hTargetBitmap); - - if (!(hOldBitmap1 && hOldBitmap2)) { - qWarning("::GetDIBits(), failed to SelectObject for bitmaps"); - ret = 0; - } - - if (!BitBlt(hdcDst, 0, 0, bm.bmWidth, bm.bmHeight, hdcSrc, 0, 0, SRCCOPY)) { - qWarning("::GetDIBits(), BitBlt failed"); - ret = 0; - } - - SelectObject(hdcSrc, hOldBitmap1); - SelectObject(hdcDst, hOldBitmap2); - - DeleteDC(hdcSrc); - DeleteDC(hdcDst); - - ReleaseDC(NULL, displayDC); - - memcpy(lpvBits, pixels, dibInfo.bmiHeader.biSizeImage); - - DeleteObject(hTargetBitmap); - return ret; -} -#endif - static inline void initBitMapInfoHeader(int width, int height, bool topToBottom, BITMAPINFOHEADER *bih) { memset(bih, 0, sizeof(BITMAPINFOHEADER)); @@ -325,8 +247,6 @@ Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &p) return hIcon; } -#ifndef Q_OS_WINCE - Q_GUI_EXPORT QImage qt_imageFromWinHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h) { QImage image(w, h, QImage::Format_ARGB32_Premultiplied); @@ -415,95 +335,5 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon) DeleteDC(hdc); return QPixmap::fromImage(image); } -#else //ifndef Q_OS_WINCE -Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon) -{ - HDC screenDevice = GetDC(0); - HDC hdc = CreateCompatibleDC(screenDevice); - ReleaseDC(0, screenDevice); - - ICONINFO iconinfo; - bool result = GetIconInfo(icon, &iconinfo); - if (!result) - qWarning("QPixmap::fromWinHICON(), failed to GetIconInfo()"); - - int w = 0; - int h = 0; - if (!iconinfo.xHotspot || !iconinfo.yHotspot) { - // We could not retrieve the icon size via GetIconInfo, - // so we try again using the icon bitmap. - BITMAP bm; - int result = GetObject(iconinfo.hbmColor, sizeof(BITMAP), &bm); - if (!result) result = GetObject(iconinfo.hbmMask, sizeof(BITMAP), &bm); - if (!result) { - qWarning("QPixmap::fromWinHICON(), failed to retrieve icon size"); - return QPixmap(); - } - w = bm.bmWidth; - h = bm.bmHeight; - } else { - // x and y Hotspot describes the icon center - w = iconinfo.xHotspot * 2; - h = iconinfo.yHotspot * 2; - } - const DWORD dwImageSize = w * h * 4; - - BITMAPINFO bmi; - memset(&bmi, 0, sizeof(bmi)); - bmi.bmiHeader.biSize = sizeof(BITMAPINFO); - bmi.bmiHeader.biWidth = w; - bmi.bmiHeader.biHeight = -h; - bmi.bmiHeader.biPlanes = 1; - bmi.bmiHeader.biBitCount = 32; - bmi.bmiHeader.biCompression = BI_RGB; - bmi.bmiHeader.biSizeImage = dwImageSize; - - uchar* bits; - - HBITMAP winBitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**) &bits, 0, 0); - if (winBitmap ) - memset(bits, 0xff, dwImageSize); - if (!winBitmap) { - qWarning("QPixmap::fromWinHICON(), failed to CreateDIBSection()"); - return QPixmap(); - } - - HGDIOBJ oldhdc = (HBITMAP)SelectObject(hdc, winBitmap); - if (!DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_NORMAL)) - qWarning("QPixmap::fromWinHICON(), failed to DrawIcon()"); - - uint mask = 0xff000000; - // Create image and copy data into image. - QImage image(w, h, QImage::Format_ARGB32); - - if (!image.isNull()) { // failed to alloc? - int bytes_per_line = w * sizeof(QRgb); - for (int y=0; y < h; ++y) { - QRgb *dest = (QRgb *) image.scanLine(y); - const QRgb *src = (const QRgb *) (bits + y * bytes_per_line); - for (int x=0; x < w; ++x) { - dest[x] = src[x]; - } - } - } - if (!DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_MASK)) - qWarning("QPixmap::fromWinHICON(), failed to DrawIcon()"); - if (!image.isNull()) { // failed to alloc? - int bytes_per_line = w * sizeof(QRgb); - for (int y=0; y < h; ++y) { - QRgb *dest = (QRgb *) image.scanLine(y); - const QRgb *src = (const QRgb *) (bits + y * bytes_per_line); - for (int x=0; x < w; ++x) { - if (!src[x]) - dest[x] = dest[x] | mask; - } - } - } - SelectObject(hdc, oldhdc); //restore state - DeleteObject(winBitmap); - DeleteDC(hdc); - return QPixmap::fromImage(image); -} -#endif //ifndef Q_OS_WINCE QT_END_NAMESPACE diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index c84f429e46..7fbb498bbb 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -75,20 +75,8 @@ # endif #endif -#ifdef Q_OS_WINCE -#define CALLBACK_CALL_TYPE __cdecl -#else -#define CALLBACK_CALL_TYPE -#endif - QT_BEGIN_NAMESPACE -#if defined(Q_OS_WINCE) && defined(STANDARDSHELL_UI_MODEL) -# define Q_INTERNAL_WIN_NO_THROW __declspec(nothrow) -#else -# define Q_INTERNAL_WIN_NO_THROW -#endif - // avoid going through QImage::scanLine() which calls detach #define FAST_SCAN_LINE(data, bpl, y) (data + (y) * bpl) @@ -190,7 +178,7 @@ private: extern "C" { static -void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length) +void iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length) { QPngHandlerPrivate *d = (QPngHandlerPrivate *)png_get_io_ptr(png_ptr); QIODevice *in = d->q->device(); @@ -215,7 +203,7 @@ void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_siz static -void CALLBACK_CALL_TYPE qpiw_write_fn(png_structp png_ptr, png_bytep data, png_size_t length) +void qpiw_write_fn(png_structp png_ptr, png_bytep data, png_size_t length) { QPNGImageWriter* qpiw = (QPNGImageWriter*)png_get_io_ptr(png_ptr); QIODevice* out = qpiw->device(); @@ -229,7 +217,7 @@ void CALLBACK_CALL_TYPE qpiw_write_fn(png_structp png_ptr, png_bytep data, png_s static -void CALLBACK_CALL_TYPE qpiw_flush_fn(png_structp /* png_ptr */) +void qpiw_flush_fn(png_structp /* png_ptr */) { } @@ -487,7 +475,7 @@ static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop i } extern "C" { -static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const_charp message) +static void qt_png_warning(png_structp /*png_ptr*/, png_const_charp message) { qWarning("libpng warning: %s", message); } @@ -495,7 +483,7 @@ static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const } -void Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngTexts(png_info *info) +void QPngHandlerPrivate::readPngTexts(png_info *info) { png_textp text_ptr; int num_text=0; @@ -522,7 +510,7 @@ void Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngTexts(png_info *info) } -bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader() +bool QPngHandlerPrivate::readPngHeader() { state = Error; png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0); @@ -566,7 +554,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader() return true; } -bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage) +bool QPngHandlerPrivate::readPngImage(QImage *outImage) { if (state == Error) return false; @@ -810,7 +798,7 @@ bool QPNGImageWriter::writeImage(const QImage& image, int off_x, int off_y) return writeImage(image, -1, QString(), off_x, off_y); } -bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image, volatile int quality_in, const QString &description, +bool QPNGImageWriter::writeImage(const QImage& image, volatile int quality_in, const QString &description, int off_x_in, int off_y_in) { QPoint offset = image.offset(); diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp index 5ae8e893cb..5c8ff84929 100644 --- a/src/gui/image/qxpmhandler.cpp +++ b/src/gui/image/qxpmhandler.cpp @@ -845,7 +845,7 @@ static bool read_xpm_header( if (!read_xpm_string(buf, device, source, index, state)) return false; -#if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(Q_OS_WINCE) +#ifdef Q_CC_MSVC if (sscanf_s(buf, "%d %d %d %d", w, h, ncols, cpp) < 4) #else if (sscanf(buf, "%d %d %d %d", w, h, ncols, cpp) < 4) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 31b30c6e5a..0639b5bbc5 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -104,13 +104,13 @@ #if defined(Q_OS_MAC) # include "private/qcore_mac_p.h" -#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#elif defined(Q_OS_WIN) # include <QtCore/qt_windows.h> # include <QtCore/QLibraryInfo> # if defined(Q_OS_WINPHONE) # include <Objbase.h> # endif -#endif // Q_OS_WIN && !Q_OS_WINCE +#endif // Q_OS_WIN #include <ctype.h> @@ -1102,12 +1102,12 @@ static void init_platform(const QString &pluginArgument, const QString &platform keys.join(QStringLiteral(", "))); } fatalMessage += QStringLiteral("Reinstalling the application may fix this problem."); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // Windows: Display message box unless it is a console application // or debug build showing an assert box. if (!QLibraryInfo::isDebugBuild() && !GetConsoleWindow()) MessageBox(0, (LPCTSTR)fatalMessage.utf16(), (LPCTSTR)(QCoreApplication::applicationName().utf16()), MB_OK | MB_ICONERROR); -#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT +#endif // Q_OS_WIN && !Q_OS_WINRT qFatal("%s", qPrintable(fatalMessage)); return; } @@ -1310,7 +1310,7 @@ void QGuiApplicationPrivate::init() #ifndef QT_NO_SESSIONMANAGER QString session_id; QString session_key; -# if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +# if defined(Q_OS_WIN) wchar_t guidstr[40]; GUID guid; CoCreateGuid(&guid); diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 29c3ba3480..ae6d373f0e 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -5758,7 +5758,7 @@ static inline void rgbBlendPixel(quint32 *dst, int coverage, int sr, int sg, int *dst = qRgb(nr, ng, nb); } -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) Q_GUI_EXPORT bool qt_needs_a8_gamma_correction = false; static inline void grayBlendPixel(quint32 *dst, int coverage, int sr, int sg, int sb, const uint *gamma, const uchar *invgamma) @@ -5795,7 +5795,7 @@ static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer, const quint32 c = color; const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) const QDrawHelperGammaTables *tables = QGuiApplicationPrivate::instance()->gammaTables(); if (!tables) return; @@ -5822,7 +5822,7 @@ static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer, } else if (coverage == 255) { dest[i] = c; } else { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && doGrayBlendPixel && qAlpha(dest[i]) == 255) { grayBlendPixel(dest+i, coverage, sr, sg, sb, gamma, invgamma); @@ -5863,7 +5863,7 @@ static void qt_alphamapblit_uint32(QRasterBuffer *rasterBuffer, } else if (coverage == 255) { dest[xp] = c; } else { -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +#if defined(Q_OS_WIN) if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && doGrayBlendPixel && qAlpha(dest[xp]) == 255) { grayBlendPixel(dest+xp, coverage, sr, sg, sb, gamma, invgamma); |