From 3a51462bfb3cca8c90e1c690cf045b371d2ab393 Mon Sep 17 00:00:00 2001 From: Charles Yin Date: Fri, 16 Jul 2010 11:17:02 +1000 Subject: Fixes the Oracle invalid date bug when date is greater or equal to 2800 By converting the char into unsigned char to avoid the overflow when getting the century from a char for years greater or equal to 2800. Task-number: QTBUG-8210 Reviewed-by: Michael Goddard --- src/sql/drivers/oci/qsql_oci.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index 2f0cfdc..c56b995 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -648,7 +648,7 @@ QByteArray qMakeOraDate(const QDateTime& dt) QDateTime qMakeDate(const char* oraDate) { - int century = oraDate[0]; + int century = uchar(oraDate[0]); if(century >= 100){ int year = uchar(oraDate[1]); year = ((century-100)*100) + (year-100); -- cgit v0.12 From 7a0b487ec10abd71bda6053021749740dc0ac545 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 16 Jul 2010 10:15:49 +0200 Subject: unused struct DIBINFO removed from qguifunctions_wince.cpp Reviewed-by: Martin Petersson --- src/gui/kernel/qguifunctions_wince.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/gui/kernel/qguifunctions_wince.cpp b/src/gui/kernel/qguifunctions_wince.cpp index f5004b0..cafddbf 100644 --- a/src/gui/kernel/qguifunctions_wince.cpp +++ b/src/gui/kernel/qguifunctions_wince.cpp @@ -131,15 +131,6 @@ static void resolveAygLibs() } } -struct DIBINFO : public BITMAPINFO -{ - RGBQUAD arColors[255]; - - operator LPBITMAPINFO() { return (LPBITMAPINFO) this; } - operator LPBITMAPINFOHEADER() { return &bmiHeader; } - RGBQUAD* ColorTable() { return bmiColors; } -}; - int qt_wince_GetDIBits(HDC /*hdc*/ , HBITMAP hSourceBitmap, uint, uint, LPVOID lpvBits, LPBITMAPINFO, uint) { if (!lpvBits) { -- cgit v0.12 From 5f76c2b168ded91835d5d161b738a5dc03556cf6 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 16 Jul 2010 10:17:32 +0200 Subject: Windows mobile: show the [X] button in the taskbar when maximizing We're now showing the cancel button explicitly in the taskbar on maximize, if the widget does not have the widget flags CancelButtonHint and OKButtonHint. Task-number: QTBUG-8408 Reviewed-by: Martin Petersson --- src/gui/kernel/qguifunctions_wince.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/kernel/qguifunctions_wince.cpp b/src/gui/kernel/qguifunctions_wince.cpp index cafddbf..bdaed65 100644 --- a/src/gui/kernel/qguifunctions_wince.cpp +++ b/src/gui/kernel/qguifunctions_wince.cpp @@ -314,6 +314,8 @@ void qt_wince_maximize(QWidget *widget) shidi.dwFlags |= SHIDIF_CANCELBUTTON; if (widget->windowFlags() & Qt::WindowOkButtonHint) shidi.dwFlags |= SHIDIF_DONEBUTTON; + if (!(widget->windowFlags() & (Qt::WindowCancelButtonHint | Qt::WindowOkButtonHint))) + shidi.dwFlags |= SHIDIF_CANCELBUTTON; resolveAygLibs(); if (ptrAygInitDialog) ptrAygInitDialog(&shidi); -- cgit v0.12 From 2c1aafa47b8915ea8aae8da229d65086e42543b3 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 16 Jul 2010 10:37:58 +0200 Subject: Windows mobile: the [X] button in the taskbar minimizes the widget The [X] or cancel button in the task bar shall just "minimize" the widget on Windows mobile. A press on this button results in a WM_COMMAND, IDCANCEL message. Before this patch we just sent a QCloseEvent to the widget, which had basically no effect. Now, we're calling showMinimzed(), which is the desired behaviour. Task-number: QTBUG-8408 Reviewed-by: Martin Petersson --- src/gui/kernel/qapplication_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 9e8a128..ec26e81 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -2485,7 +2485,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa if (OkCommand) QApplication::postEvent(widget, new QEvent(QEvent::OkRequest)); if (CancelCommand) - QApplication::postEvent(widget, new QEvent(QEvent::Close)); + widget->showMinimized(); else #ifndef QT_NO_MENUBAR QMenuBar::wceCommands(LOWORD(wParam)); -- cgit v0.12 From ad4aff6e2d188d88a2c6b4b692932adb08491d22 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 16 Jul 2010 10:43:14 +0200 Subject: Windows mobile: hide [X] button in task bar on unmaximize When calling showNormal on a window that was maximized, we must remove the [X] button from the task bar. But only if it was added by qt_wince_maximize. Task-number: QTBUG-8408 Reviewed-by: Martin Petersson --- src/gui/kernel/qguifunctions_wince.cpp | 17 +++++++++++++++++ src/gui/kernel/qwidget_win.cpp | 1 + src/gui/kernel/qwidget_wince.cpp | 1 + 3 files changed, 19 insertions(+) diff --git a/src/gui/kernel/qguifunctions_wince.cpp b/src/gui/kernel/qguifunctions_wince.cpp index bdaed65..377dfe3 100644 --- a/src/gui/kernel/qguifunctions_wince.cpp +++ b/src/gui/kernel/qguifunctions_wince.cpp @@ -76,6 +76,10 @@ struct AygSIPINFO #define SHIDIF_SIZEDLGFULLSCREEN 0x0004 #endif +#ifndef SHDB_HIDE +#define SHDB_HIDE 0x0002 +#endif + #ifndef SHFS_SHOWTASKBAR #define SHFS_SHOWTASKBAR 0x0001 #endif @@ -112,10 +116,12 @@ struct AygSIPINFO typedef BOOL (*AygInitDialog)(AygSHINITDLGINFO*); typedef BOOL (*AygFullScreen)(HWND, DWORD); typedef BOOL (*AygSHSipInfo)(UINT, UINT, PVOID, UINT); +typedef BOOL (*AygSHDoneButton)(HWND, DWORD); static AygInitDialog ptrAygInitDialog = 0; static AygFullScreen ptrAygFullScreen = 0; static AygSHSipInfo ptrAygSHSipInfo = 0; +static AygSHDoneButton ptrAygSHDoneButton = 0; static bool aygResolved = false; static void resolveAygLibs() @@ -128,6 +134,7 @@ static void resolveAygLibs() ptrAygInitDialog = (AygInitDialog) ayglib.resolve("SHInitDialog"); ptrAygFullScreen = (AygFullScreen) ayglib.resolve("SHFullScreen"); ptrAygSHSipInfo = (AygSHSipInfo) ayglib.resolve("SHSipInfo"); + ptrAygSHDoneButton = (AygSHDoneButton) ayglib.resolve("SHDoneButton"); } } @@ -327,6 +334,16 @@ void qt_wince_maximize(QWidget *widget) } } +void qt_wince_unmaximize(QWidget *widget) +{ + if (ptrAygSHDoneButton && qt_wince_is_mobile() + && !(widget->windowFlags() & (Qt::WindowCancelButtonHint | Qt::WindowOkButtonHint))) + { + // Hide the [X] button, we've added in qt_wince_maximize. + ptrAygSHDoneButton(widget->winId(), SHDB_HIDE); + } +} + void qt_wince_minimize(HWND hwnd) { #ifdef Q_OS_WINCE_WM diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp index 0f05c6b..23f57da 100644 --- a/src/gui/kernel/qwidget_win.cpp +++ b/src/gui/kernel/qwidget_win.cpp @@ -70,6 +70,7 @@ #include "qguifunctions_wince.h" QT_USE_NAMESPACE extern void qt_wince_maximize(QWidget *widget); //defined in qguifunctions_wince.cpp +extern void qt_wince_unmaximize(QWidget *widget); //defined in qguifunctions_wince.cpp extern void qt_wince_minimize(HWND hwnd); //defined in qguifunctions_wince.cpp extern void qt_wince_full_screen(HWND hwnd, bool fullScreen, UINT swpf); //defined in qguifunctions_wince.cpp extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp diff --git a/src/gui/kernel/qwidget_wince.cpp b/src/gui/kernel/qwidget_wince.cpp index fc1e52c..76532ed 100644 --- a/src/gui/kernel/qwidget_wince.cpp +++ b/src/gui/kernel/qwidget_wince.cpp @@ -498,6 +498,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) int style = GetWindowLong(internalWinId(), GWL_STYLE) | WS_BORDER | WS_POPUP | WS_CAPTION; SetWindowLong(internalWinId(), GWL_STYLE, style); SetWindowLong(internalWinId(), GWL_EXSTYLE, GetWindowLong (internalWinId(), GWL_EXSTYLE) & ~ WS_EX_NODRAG); + qt_wince_unmaximize(this); } if (isVisible() && newstate & Qt::WindowMaximized) qt_wince_maximize(this); -- cgit v0.12 From 3c11c0a8f2a99cb3734a24d9d6c43977807471d7 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Fri, 16 Jul 2010 20:32:38 +0200 Subject: Used aligned load and store when possible for the blending of ARGB32 Unaligned load and store can be costly. This patch mitigate the problem by aligning the destination before using SSE2. The destination is aligned because it is used by load and store, while the source is only use by load. On Atom, the blending test is 7% faster for ARGB32. Reviewed-by: Andreas Kling --- src/gui/painting/qdrawingprimitive_sse2_p.h | 34 ++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h index 3c96946..65292bc 100644 --- a/src/gui/painting/qdrawingprimitive_sse2_p.h +++ b/src/gui/painting/qdrawingprimitive_sse2_p.h @@ -43,6 +43,7 @@ #define QDRAWINGPRIMITIVE_SSE2_P_H #include +#include #ifdef QT_HAVE_SSE2 @@ -141,12 +142,24 @@ QT_BEGIN_NAMESPACE // with shortcuts if fully opaque or fully transparent. #define BLEND_SOURCE_OVER_ARGB32_SSE2(dst, src, length, nullVector, half, one, colorMask, alphaMask) { \ int x = 0; \ +\ + /* First, get dst aligned. */ \ + const int offsetToAlignOn16Bytes = (4 - (reinterpret_cast(dst) >> 2 & 0x3)) & 0x3;\ + const int prologLength = qMin(length, offsetToAlignOn16Bytes);\ + for (; x < prologLength; ++x) { \ + uint s = src[x]; \ + if (s >= 0xff000000) \ + dst[x] = s; \ + else if (s != 0) \ + dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \ + } \ +\ for (; x < length-3; x += 4) { \ const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); \ const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); \ if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff) { \ /* all opaque */ \ - _mm_storeu_si128((__m128i *)&dst[x], srcVector); \ + _mm_store_si128((__m128i *)&dst[x], srcVector); \ } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff) { \ /* not fully transparent */ \ /* extract the alpha channel on 2 x 16 bits */ \ @@ -157,13 +170,13 @@ QT_BEGIN_NAMESPACE alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); \ alphaChannel = _mm_sub_epi16(one, alphaChannel); \ \ - const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); \ + const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \ __m128i destMultipliedByOneMinusAlpha; \ BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \ \ /* result = s + d * (1-alpha) */\ const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \ - _mm_storeu_si128((__m128i *)&dst[x], result); \ + _mm_store_si128((__m128i *)&dst[x], result); \ } \ } \ for (; x < length; ++x) { \ @@ -189,6 +202,17 @@ QT_BEGIN_NAMESPACE #define BLEND_SOURCE_OVER_ARGB32_WITH_CONST_ALPHA_SSE2(dst, src, length, nullVector, half, one, colorMask, constAlphaVector) \ { \ int x = 0; \ +\ + const int offsetToAlignOn16Bytes = (4 - (reinterpret_cast(dst) >> 2 & 0x3)) & 0x3;\ + const int prologLength = qMin(length, offsetToAlignOn16Bytes);\ + for (; x < prologLength; ++x) { \ + uint s = src[x]; \ + if (s >= 0xff000000) \ + dst[x] = s; \ + else if (s != 0) \ + dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \ + } \ +\ for (; x < length-3; x += 4) { \ __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); \ if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff) { \ @@ -198,12 +222,12 @@ QT_BEGIN_NAMESPACE alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); \ alphaChannel = _mm_sub_epi16(one, alphaChannel); \ \ - const __m128i dstVector = _mm_loadu_si128((__m128i *)&dst[x]); \ + const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); \ __m128i destMultipliedByOneMinusAlpha; \ BYTE_MUL_SSE2(destMultipliedByOneMinusAlpha, dstVector, alphaChannel, colorMask, half); \ \ const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); \ - _mm_storeu_si128((__m128i *)&dst[x], result); \ + _mm_store_si128((__m128i *)&dst[x], result); \ } \ } \ for (; x < length; ++x) { \ -- cgit v0.12