diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qmath.cpp | 512 | ||||
-rw-r--r-- | src/gui/dialogs/qfiledialog.cpp | 8 | ||||
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 11 | ||||
-rw-r--r-- | src/gui/itemviews/qtreeview.cpp | 16 | ||||
-rw-r--r-- | src/gui/painting/qoutlinemapper.cpp | 9 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 4 | ||||
-rw-r--r-- | src/gui/painting/qpaintengineex.cpp | 8 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath_p.h | 16 | ||||
-rw-r--r-- | src/gui/styles/qcleanlooksstyle.cpp | 2 | ||||
-rw-r--r-- | src/gui/styles/qmacstyle_mac.mm | 2 | ||||
-rw-r--r-- | src/gui/text/qfont.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/qspinbox.cpp | 16 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 48 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | 20 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 45 | ||||
-rw-r--r-- | src/opengl/qgl.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qpaintengine_opengl.cpp | 3 |
17 files changed, 400 insertions, 325 deletions
diff --git a/src/corelib/kernel/qmath.cpp b/src/corelib/kernel/qmath.cpp index e89c1e6..a3586a4 100644 --- a/src/corelib/kernel/qmath.cpp +++ b/src/corelib/kernel/qmath.cpp @@ -44,262 +44,262 @@ QT_BEGIN_NAMESPACE const qreal qt_sine_table[QT_SINE_TABLE_SIZE] = { - 0.0, - 0.024541228522912288, - 0.049067674327418015, - 0.073564563599667426, - 0.098017140329560604, - 0.1224106751992162, - 0.14673047445536175, - 0.17096188876030122, - 0.19509032201612825, - 0.2191012401568698, - 0.24298017990326387, - 0.26671275747489837, - 0.29028467725446233, - 0.31368174039889152, - 0.33688985339222005, - 0.35989503653498811, - 0.38268343236508978, - 0.40524131400498986, - 0.42755509343028208, - 0.44961132965460654, - 0.47139673682599764, - 0.49289819222978404, - 0.51410274419322166, - 0.53499761988709715, - 0.55557023301960218, - 0.57580819141784534, - 0.59569930449243336, - 0.61523159058062682, - 0.63439328416364549, - 0.65317284295377676, - 0.67155895484701833, - 0.68954054473706683, - 0.70710678118654746, - 0.72424708295146689, - 0.74095112535495911, - 0.75720884650648446, - 0.77301045336273699, - 0.78834642762660623, - 0.80320753148064483, - 0.81758481315158371, - 0.83146961230254524, - 0.84485356524970701, - 0.85772861000027212, - 0.87008699110871135, - 0.88192126434835494, - 0.89322430119551532, - 0.90398929312344334, - 0.91420975570353069, - 0.92387953251128674, - 0.93299279883473885, - 0.94154406518302081, - 0.94952818059303667, - 0.95694033573220894, - 0.96377606579543984, - 0.97003125319454397, - 0.97570213003852857, - 0.98078528040323043, - 0.98527764238894122, - 0.98917650996478101, - 0.99247953459870997, - 0.99518472667219682, - 0.99729045667869021, - 0.99879545620517241, - 0.99969881869620425, - 1.0, - 0.99969881869620425, - 0.99879545620517241, - 0.99729045667869021, - 0.99518472667219693, - 0.99247953459870997, - 0.98917650996478101, - 0.98527764238894122, - 0.98078528040323043, - 0.97570213003852857, - 0.97003125319454397, - 0.96377606579543984, - 0.95694033573220894, - 0.94952818059303667, - 0.94154406518302081, - 0.93299279883473885, - 0.92387953251128674, - 0.91420975570353069, - 0.90398929312344345, - 0.89322430119551521, - 0.88192126434835505, - 0.87008699110871146, - 0.85772861000027212, - 0.84485356524970723, - 0.83146961230254546, - 0.81758481315158371, - 0.80320753148064494, - 0.78834642762660634, - 0.7730104533627371, - 0.75720884650648468, - 0.74095112535495899, - 0.72424708295146689, - 0.70710678118654757, - 0.68954054473706705, - 0.67155895484701855, - 0.65317284295377664, - 0.63439328416364549, - 0.61523159058062693, - 0.59569930449243347, - 0.57580819141784545, - 0.55557023301960218, - 0.53499761988709715, - 0.51410274419322177, - 0.49289819222978415, - 0.47139673682599786, - 0.44961132965460687, - 0.42755509343028203, - 0.40524131400498992, - 0.38268343236508989, - 0.35989503653498833, - 0.33688985339222033, - 0.31368174039889141, - 0.29028467725446239, - 0.26671275747489848, - 0.24298017990326407, - 0.21910124015687005, - 0.19509032201612861, - 0.17096188876030122, - 0.1467304744553618, - 0.12241067519921635, - 0.098017140329560826, - 0.073564563599667732, - 0.049067674327417966, - 0.024541228522912326, - 0.0, - -0.02454122852291208, - -0.049067674327417724, - -0.073564563599667496, - -0.09801714032956059, - -0.1224106751992161, - -0.14673047445536158, - -0.17096188876030097, - -0.19509032201612836, - -0.2191012401568698, - -0.24298017990326382, - -0.26671275747489825, - -0.29028467725446211, - -0.31368174039889118, - -0.33688985339222011, - -0.35989503653498811, - -0.38268343236508967, - -0.40524131400498969, - -0.42755509343028181, - -0.44961132965460665, - -0.47139673682599764, - -0.49289819222978393, - -0.51410274419322155, - -0.53499761988709693, - -0.55557023301960196, - -0.57580819141784534, - -0.59569930449243325, - -0.61523159058062671, - -0.63439328416364527, - -0.65317284295377653, - -0.67155895484701844, - -0.68954054473706683, - -0.70710678118654746, - -0.72424708295146678, - -0.74095112535495888, - -0.75720884650648423, - -0.77301045336273666, - -0.78834642762660589, - -0.80320753148064505, - -0.81758481315158382, - -0.83146961230254524, - -0.84485356524970701, - -0.85772861000027201, - -0.87008699110871135, - -0.88192126434835494, - -0.89322430119551521, - -0.90398929312344312, - -0.91420975570353047, - -0.92387953251128652, - -0.93299279883473896, - -0.94154406518302081, - -0.94952818059303667, - -0.95694033573220882, - -0.96377606579543984, - -0.97003125319454397, - -0.97570213003852846, - -0.98078528040323032, - -0.98527764238894111, - -0.9891765099647809, - -0.99247953459871008, - -0.99518472667219693, - -0.99729045667869021, - -0.99879545620517241, - -0.99969881869620425, - -1.0, - -0.99969881869620425, - -0.99879545620517241, - -0.99729045667869021, - -0.99518472667219693, - -0.99247953459871008, - -0.9891765099647809, - -0.98527764238894122, - -0.98078528040323043, - -0.97570213003852857, - -0.97003125319454397, - -0.96377606579543995, - -0.95694033573220894, - -0.94952818059303679, - -0.94154406518302092, - -0.93299279883473907, - -0.92387953251128663, - -0.91420975570353058, - -0.90398929312344334, - -0.89322430119551532, - -0.88192126434835505, - -0.87008699110871146, - -0.85772861000027223, - -0.84485356524970723, - -0.83146961230254546, - -0.81758481315158404, - -0.80320753148064528, - -0.78834642762660612, - -0.77301045336273688, - -0.75720884650648457, - -0.74095112535495911, - -0.724247082951467, - -0.70710678118654768, - -0.68954054473706716, - -0.67155895484701866, - -0.65317284295377709, - -0.63439328416364593, - -0.61523159058062737, - -0.59569930449243325, - -0.57580819141784523, - -0.55557023301960218, - -0.53499761988709726, - -0.51410274419322188, - -0.49289819222978426, - -0.47139673682599792, - -0.44961132965460698, - -0.42755509343028253, - -0.40524131400499042, - -0.38268343236509039, - -0.359895036534988, - -0.33688985339222, - -0.31368174039889152, - -0.2902846772544625, - -0.26671275747489859, - -0.24298017990326418, - -0.21910124015687016, - -0.19509032201612872, - -0.17096188876030177, - -0.14673047445536239, - -0.12241067519921603, - -0.098017140329560506, - -0.073564563599667412, - -0.049067674327418091, - -0.024541228522912448 + qreal(0.0), + qreal(0.024541228522912288), + qreal(0.049067674327418015), + qreal(0.073564563599667426), + qreal(0.098017140329560604), + qreal(0.1224106751992162), + qreal(0.14673047445536175), + qreal(0.17096188876030122), + qreal(0.19509032201612825), + qreal(0.2191012401568698), + qreal(0.24298017990326387), + qreal(0.26671275747489837), + qreal(0.29028467725446233), + qreal(0.31368174039889152), + qreal(0.33688985339222005), + qreal(0.35989503653498811), + qreal(0.38268343236508978), + qreal(0.40524131400498986), + qreal(0.42755509343028208), + qreal(0.44961132965460654), + qreal(0.47139673682599764), + qreal(0.49289819222978404), + qreal(0.51410274419322166), + qreal(0.53499761988709715), + qreal(0.55557023301960218), + qreal(0.57580819141784534), + qreal(0.59569930449243336), + qreal(0.61523159058062682), + qreal(0.63439328416364549), + qreal(0.65317284295377676), + qreal(0.67155895484701833), + qreal(0.68954054473706683), + qreal(0.70710678118654746), + qreal(0.72424708295146689), + qreal(0.74095112535495911), + qreal(0.75720884650648446), + qreal(0.77301045336273699), + qreal(0.78834642762660623), + qreal(0.80320753148064483), + qreal(0.81758481315158371), + qreal(0.83146961230254524), + qreal(0.84485356524970701), + qreal(0.85772861000027212), + qreal(0.87008699110871135), + qreal(0.88192126434835494), + qreal(0.89322430119551532), + qreal(0.90398929312344334), + qreal(0.91420975570353069), + qreal(0.92387953251128674), + qreal(0.93299279883473885), + qreal(0.94154406518302081), + qreal(0.94952818059303667), + qreal(0.95694033573220894), + qreal(0.96377606579543984), + qreal(0.97003125319454397), + qreal(0.97570213003852857), + qreal(0.98078528040323043), + qreal(0.98527764238894122), + qreal(0.98917650996478101), + qreal(0.99247953459870997), + qreal(0.99518472667219682), + qreal(0.99729045667869021), + qreal(0.99879545620517241), + qreal(0.99969881869620425), + qreal(1.0), + qreal(0.99969881869620425), + qreal(0.99879545620517241), + qreal(0.99729045667869021), + qreal(0.99518472667219693), + qreal(0.99247953459870997), + qreal(0.98917650996478101), + qreal(0.98527764238894122), + qreal(0.98078528040323043), + qreal(0.97570213003852857), + qreal(0.97003125319454397), + qreal(0.96377606579543984), + qreal(0.95694033573220894), + qreal(0.94952818059303667), + qreal(0.94154406518302081), + qreal(0.93299279883473885), + qreal(0.92387953251128674), + qreal(0.91420975570353069), + qreal(0.90398929312344345), + qreal(0.89322430119551521), + qreal(0.88192126434835505), + qreal(0.87008699110871146), + qreal(0.85772861000027212), + qreal(0.84485356524970723), + qreal(0.83146961230254546), + qreal(0.81758481315158371), + qreal(0.80320753148064494), + qreal(0.78834642762660634), + qreal(0.7730104533627371), + qreal(0.75720884650648468), + qreal(0.74095112535495899), + qreal(0.72424708295146689), + qreal(0.70710678118654757), + qreal(0.68954054473706705), + qreal(0.67155895484701855), + qreal(0.65317284295377664), + qreal(0.63439328416364549), + qreal(0.61523159058062693), + qreal(0.59569930449243347), + qreal(0.57580819141784545), + qreal(0.55557023301960218), + qreal(0.53499761988709715), + qreal(0.51410274419322177), + qreal(0.49289819222978415), + qreal(0.47139673682599786), + qreal(0.44961132965460687), + qreal(0.42755509343028203), + qreal(0.40524131400498992), + qreal(0.38268343236508989), + qreal(0.35989503653498833), + qreal(0.33688985339222033), + qreal(0.31368174039889141), + qreal(0.29028467725446239), + qreal(0.26671275747489848), + qreal(0.24298017990326407), + qreal(0.21910124015687005), + qreal(0.19509032201612861), + qreal(0.17096188876030122), + qreal(0.1467304744553618), + qreal(0.12241067519921635), + qreal(0.098017140329560826), + qreal(0.073564563599667732), + qreal(0.049067674327417966), + qreal(0.024541228522912326), + qreal(0.0), + qreal(-0.02454122852291208), + qreal(-0.049067674327417724), + qreal(-0.073564563599667496), + qreal(-0.09801714032956059), + qreal(-0.1224106751992161), + qreal(-0.14673047445536158), + qreal(-0.17096188876030097), + qreal(-0.19509032201612836), + qreal(-0.2191012401568698), + qreal(-0.24298017990326382), + qreal(-0.26671275747489825), + qreal(-0.29028467725446211), + qreal(-0.31368174039889118), + qreal(-0.33688985339222011), + qreal(-0.35989503653498811), + qreal(-0.38268343236508967), + qreal(-0.40524131400498969), + qreal(-0.42755509343028181), + qreal(-0.44961132965460665), + qreal(-0.47139673682599764), + qreal(-0.49289819222978393), + qreal(-0.51410274419322155), + qreal(-0.53499761988709693), + qreal(-0.55557023301960196), + qreal(-0.57580819141784534), + qreal(-0.59569930449243325), + qreal(-0.61523159058062671), + qreal(-0.63439328416364527), + qreal(-0.65317284295377653), + qreal(-0.67155895484701844), + qreal(-0.68954054473706683), + qreal(-0.70710678118654746), + qreal(-0.72424708295146678), + qreal(-0.74095112535495888), + qreal(-0.75720884650648423), + qreal(-0.77301045336273666), + qreal(-0.78834642762660589), + qreal(-0.80320753148064505), + qreal(-0.81758481315158382), + qreal(-0.83146961230254524), + qreal(-0.84485356524970701), + qreal(-0.85772861000027201), + qreal(-0.87008699110871135), + qreal(-0.88192126434835494), + qreal(-0.89322430119551521), + qreal(-0.90398929312344312), + qreal(-0.91420975570353047), + qreal(-0.92387953251128652), + qreal(-0.93299279883473896), + qreal(-0.94154406518302081), + qreal(-0.94952818059303667), + qreal(-0.95694033573220882), + qreal(-0.96377606579543984), + qreal(-0.97003125319454397), + qreal(-0.97570213003852846), + qreal(-0.98078528040323032), + qreal(-0.98527764238894111), + qreal(-0.9891765099647809), + qreal(-0.99247953459871008), + qreal(-0.99518472667219693), + qreal(-0.99729045667869021), + qreal(-0.99879545620517241), + qreal(-0.99969881869620425), + qreal(-1.0), + qreal(-0.99969881869620425), + qreal(-0.99879545620517241), + qreal(-0.99729045667869021), + qreal(-0.99518472667219693), + qreal(-0.99247953459871008), + qreal(-0.9891765099647809), + qreal(-0.98527764238894122), + qreal(-0.98078528040323043), + qreal(-0.97570213003852857), + qreal(-0.97003125319454397), + qreal(-0.96377606579543995), + qreal(-0.95694033573220894), + qreal(-0.94952818059303679), + qreal(-0.94154406518302092), + qreal(-0.93299279883473907), + qreal(-0.92387953251128663), + qreal(-0.91420975570353058), + qreal(-0.90398929312344334), + qreal(-0.89322430119551532), + qreal(-0.88192126434835505), + qreal(-0.87008699110871146), + qreal(-0.85772861000027223), + qreal(-0.84485356524970723), + qreal(-0.83146961230254546), + qreal(-0.81758481315158404), + qreal(-0.80320753148064528), + qreal(-0.78834642762660612), + qreal(-0.77301045336273688), + qreal(-0.75720884650648457), + qreal(-0.74095112535495911), + qreal(-0.724247082951467), + qreal(-0.70710678118654768), + qreal(-0.68954054473706716), + qreal(-0.67155895484701866), + qreal(-0.65317284295377709), + qreal(-0.63439328416364593), + qreal(-0.61523159058062737), + qreal(-0.59569930449243325), + qreal(-0.57580819141784523), + qreal(-0.55557023301960218), + qreal(-0.53499761988709726), + qreal(-0.51410274419322188), + qreal(-0.49289819222978426), + qreal(-0.47139673682599792), + qreal(-0.44961132965460698), + qreal(-0.42755509343028253), + qreal(-0.40524131400499042), + qreal(-0.38268343236509039), + qreal(-0.359895036534988), + qreal(-0.33688985339222), + qreal(-0.31368174039889152), + qreal(-0.2902846772544625), + qreal(-0.26671275747489859), + qreal(-0.24298017990326418), + qreal(-0.21910124015687016), + qreal(-0.19509032201612872), + qreal(-0.17096188876030177), + qreal(-0.14673047445536239), + qreal(-0.12241067519921603), + qreal(-0.098017140329560506), + qreal(-0.073564563599667412), + qreal(-0.049067674327418091), + qreal(-0.024541228522912448) }; QT_END_NAMESPACE diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index c70650d..3d59463 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -3245,6 +3245,10 @@ QString QFSCompleter::pathFromIndex(const QModelIndex &index) const QString currentLocation = dirModel->rootPath(); QString path = index.data(QFileSystemModel::FilePathRole).toString(); if (!currentLocation.isEmpty() && path.startsWith(currentLocation)) { +#if defined(Q_OS_UNIX) || defined(Q_OS_WINCE) + if (currentLocation == QDir::separator()) + return path.mid(currentLocation.length()); +#endif return path.mid(currentLocation.length() + 1); } return index.data(QFileSystemModel::FilePathRole).toString(); @@ -3300,6 +3304,10 @@ QStringList QFSCompleter::splitPath(const QString &path) const else dirModel = sourceModel; QString currentLocation = QDir::toNativeSeparators(dirModel->rootPath()); +#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) + if (currentLocation.endsWith(QLatin1Char(':'))) + currentLocation.append(sep); +#endif if (currentLocation.contains(sep) && path != currentLocation) { QStringList currentLocationList = splitPath(currentLocation); while (!currentLocationList.isEmpty() diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 2a1fba5..cbd9a8a 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -146,9 +146,16 @@ void QAbstractItemViewPrivate::setHoverIndex(const QPersistentModelIndex &index) if (hover == index) return; - q->update(hover); //update the old one + if (selectionBehavior != QAbstractItemView::SelectRows) { + q->update(hover); //update the old one + q->update(index); //update the new one + } else { + QRect oldHoverRect = q->visualRect(hover); + QRect newHoverRect = q->visualRect(index); + viewport->update(QRect(0, newHoverRect.y(), viewport->width(), newHoverRect.height())); + viewport->update(QRect(0, oldHoverRect.y(), viewport->width(), oldHoverRect.height())); + } hover = index; - q->update(hover); //update the new one } void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index) diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index efb8422..d0fa22d 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -1241,15 +1241,6 @@ bool QTreeView::viewportEvent(QEvent *event) viewport()->update(newRect); } } - if (selectionBehavior() == QAbstractItemView::SelectRows) { - QModelIndex newHoverIndex = indexAt(he->pos()); - if (d->hover != newHoverIndex) { - QRect oldHoverRect = visualRect(d->hover); - QRect newHoverRect = visualRect(newHoverIndex); - viewport()->update(QRect(0, newHoverRect.y(), viewport()->width(), newHoverRect.height())); - viewport()->update(QRect(0, oldHoverRect.y(), viewport()->width(), oldHoverRect.height())); - } - } break; } default: break; @@ -2644,10 +2635,13 @@ void QTreeView::selectAll() return; SelectionMode mode = d->selectionMode; d->executePostedLayout(); //make sure we lay out the items - if (mode != SingleSelection && !d->viewItems.isEmpty()) - d->select(d->viewItems.first().index, d->viewItems.last().index, + if (mode != SingleSelection && !d->viewItems.isEmpty()) { + const QModelIndex &idx = d->viewItems.last().index; + QModelIndex lastItemIndex = idx.sibling(idx.row(), d->model->columnCount(idx.parent()) - 1); + d->select(d->viewItems.first().index, lastItemIndex, QItemSelectionModel::ClearAndSelect |QItemSelectionModel::Rows); + } } /*! diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp index 51b3691..ad0c2eb 100644 --- a/src/gui/painting/qoutlinemapper.cpp +++ b/src/gui/painting/qoutlinemapper.cpp @@ -225,9 +225,10 @@ void QOutlineMapper::endOutline() controlPointRect = boundingRect(elements, element_count); #ifdef QT_DEBUG_CONVERT - printf(" - control point rect (%.2f, %.2f) %.2f x %.2f\n", + printf(" - control point rect (%.2f, %.2f) %.2f x %.2f, clip=(%d,%d, %dx%d)\n", controlPointRect.x(), controlPointRect.y(), - controlPointRect.width(), controlPointRect.height()); + controlPointRect.width(), controlPointRect.height(), + m_clip_rect.x(), m_clip_rect.y(), m_clip_rect.width(), m_clip_rect.height()); #endif @@ -235,7 +236,9 @@ void QOutlineMapper::endOutline() const bool do_clip = (controlPointRect.left() < -QT_RASTER_COORD_LIMIT || controlPointRect.right() > QT_RASTER_COORD_LIMIT || controlPointRect.top() < -QT_RASTER_COORD_LIMIT - || controlPointRect.bottom() > QT_RASTER_COORD_LIMIT); + || controlPointRect.bottom() > QT_RASTER_COORD_LIMIT + || controlPointRect.width() > QT_RASTER_COORD_LIMIT + || controlPointRect.height() > QT_RASTER_COORD_LIMIT); if (do_clip) { clipElements(elements, elementTypes(), element_count); diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 0e7adf3..3f2322e 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -475,8 +475,10 @@ bool QRasterPaintEngine::begin(QPaintDevice *device) QRasterPaintEngineState *s = state(); ensureOutlineMapper(); d->outlineMapper->m_clip_rect = d->deviceRect.adjusted(-10, -10, 10, 10); + + // This is the upp QRect bounds(-QT_RASTER_COORD_LIMIT, -QT_RASTER_COORD_LIMIT, - 2*QT_RASTER_COORD_LIMIT, 2*QT_RASTER_COORD_LIMIT); + QT_RASTER_COORD_LIMIT*2 - 1, QT_RASTER_COORD_LIMIT * 2 - 1); d->outlineMapper->m_clip_rect = bounds.intersected(d->outlineMapper->m_clip_rect); diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 3c07451..058f226 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -860,7 +860,7 @@ void QPaintEngineEx::drawPoints(const QPointF *points, int pointCount) for (int i=0; i<count; ++i) { pts[++oset] = points[i].x(); pts[++oset] = points[i].y(); - pts[++oset] = points[i].x() + 0.001; + pts[++oset] = points[i].x() + 1/63.; pts[++oset] = points[i].y(); } QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint); @@ -870,7 +870,7 @@ void QPaintEngineEx::drawPoints(const QPointF *points, int pointCount) } } else { for (int i=0; i<pointCount; ++i) { - qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + 0.001, points[i].y() }; + qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + 1/63., points[i].y() }; QVectorPath path(pts, 2, 0); stroke(path, pen); } @@ -891,7 +891,7 @@ void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount) for (int i=0; i<count; ++i) { pts[++oset] = points[i].x(); pts[++oset] = points[i].y(); - pts[++oset] = points[i].x() + 0.001; + pts[++oset] = points[i].x() + 1/63; pts[++oset] = points[i].y(); } QVectorPath path(pts, count * 2, qpaintengineex_line_types_16, QVectorPath::LinesHint); @@ -901,7 +901,7 @@ void QPaintEngineEx::drawPoints(const QPoint *points, int pointCount) } } else { for (int i=0; i<pointCount; ++i) { - qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + 0.001, points[i].y() }; + qreal pts[] = { points[i].x(), points[i].y(), points[i].x() +1/63., points[i].y() }; QVectorPath path(pts, 2, 0); stroke(path, pen); } diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h index be01549..43f548f 100644 --- a/src/gui/painting/qpainterpath_p.h +++ b/src/gui/painting/qpainterpath_p.h @@ -97,6 +97,7 @@ public: flags(0) { int ptsPos = 0; + bool isLines = true; for (int i=0; i<path.size(); ++i) { const QPainterPath::Element &e = path.at(i); elements[i] = e.type; @@ -104,6 +105,11 @@ public: points[ptsPos++] = e.y; if (e.type == QPainterPath::CurveToElement) flags |= QVectorPath::CurvedShapeMask; + + // This is to check if the path contains only alternating lineTo/moveTo, + // in which case we can set the LinesHint in the path. MoveTo is 0 and + // LineTo is 1 so the i%2 gets us what we want cheaply. + isLines = isLines && e.type == (QPainterPath::ElementType) (i%2); } if (fillRule == Qt::WindingFill) @@ -111,8 +117,14 @@ public: else flags |= QVectorPath::OddEvenFill; - if (!convex) - flags |= QVectorPath::NonConvexShapeMask; + if (isLines) + flags |= QVectorPath::LinesShapeMask; + else { + flags |= QVectorPath::AreaShapeMask; + if (!convex) + flags |= QVectorPath::NonConvexShapeMask; + } + } QVarLengthArray<QPainterPath::ElementType> elements; QVarLengthArray<qreal> points; diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index 49dd47d..0f39b23 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -2069,7 +2069,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o // This is mainly to handle cases where someone sets the font on the window // and then the combo inherits it and passes it onward. At that point the resolve mask // is very, very weak. This makes it stonger. - font.setPointSizeF(menuItem->font.pointSizeF()); + font.setPointSizeF(QFontInfo(menuItem->font).pointSizeF()); if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem) font.setBold(true); diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index ecb7453..97d69b2 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -3996,7 +3996,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // This is mainly to handle cases where someone sets the font on the window // and then the combo inherits it and passes it onward. At that point the resolve mask // is very, very weak. This makes it stonger. - myFont.setPointSizeF(mi->font.pointSizeF()); + myFont.setPointSizeF(QFontInfo(mi->font).pointSizeF()); p->setFont(myFont); p->drawText(xpos, yPos, contentRect.width() - xm - tabwidth + 1, contentRect.height(), text_flags ^ Qt::AlignRight, s); diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index d147ad7..4c57dff 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1780,7 +1780,7 @@ Q_GLOBAL_STATIC(QFontSubst, globalFontSubst) static void initFontSubst() { // default substitutions - static const char *initTbl[] = { + static const char * const initTbl[] = { #if defined(Q_WS_X11) "arial", "helvetica", @@ -1812,7 +1812,6 @@ static void initFontSubst() } } - /*! Returns the first family name to be used whenever \a familyName is specified. The lookup is case insensitive. diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp index f00296c..726426d 100644 --- a/src/gui/widgets/qspinbox.cpp +++ b/src/gui/widgets/qspinbox.cpp @@ -99,6 +99,10 @@ public: Q_Q(QDoubleSpinBox); q->setInputMethodHints(Qt::ImhFormattedNumbersOnly); } + + // When fiddling with the decimals property, we may lose precision in these properties. + double actualMin; + double actualMax; }; @@ -762,6 +766,7 @@ double QDoubleSpinBox::minimum() const void QDoubleSpinBox::setMinimum(double minimum) { Q_D(QDoubleSpinBox); + d->actualMin = minimum; const QVariant m(d->round(minimum)); d->setRange(m, (d->variantCompare(d->maximum, m) > 0 ? d->maximum : m)); } @@ -792,6 +797,7 @@ double QDoubleSpinBox::maximum() const void QDoubleSpinBox::setMaximum(double maximum) { Q_D(QDoubleSpinBox); + d->actualMax = maximum; const QVariant m(d->round(maximum)); d->setRange((d->variantCompare(d->minimum, m) < 0 ? d->minimum : m), m); } @@ -813,6 +819,8 @@ void QDoubleSpinBox::setMaximum(double maximum) void QDoubleSpinBox::setRange(double minimum, double maximum) { Q_D(QDoubleSpinBox); + d->actualMin = minimum; + d->actualMax = maximum; d->setRange(QVariant(d->round(minimum)), QVariant(d->round(maximum))); } @@ -843,7 +851,7 @@ void QDoubleSpinBox::setDecimals(int decimals) Q_D(QDoubleSpinBox); d->decimals = qBound(0, decimals, DBL_MAX_10_EXP + DBL_DIG); - setRange(minimum(), maximum()); // make sure values are rounded + setRange(d->actualMin, d->actualMax); // make sure values are rounded setValue(value()); } @@ -1051,8 +1059,10 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate() { - minimum = QVariant(0.0); - maximum = QVariant(99.99); + actualMin = 0.0; + actualMax = 99.99; + minimum = QVariant(actualMin); + maximum = QVariant(actualMax); value = minimum; singleStep = QVariant(1.0); decimals = 2; diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 6b65886..2a33255 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -580,19 +580,19 @@ void QGL2PaintEngineExPrivate::transferMode(EngineMode newMode) } if (newMode == TextDrawingMode) { - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data()); - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray.data()); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinateArray.data()); + setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinateArray.data()); } if (newMode == ImageDrawingMode) { - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, staticVertexCoordinateArray); - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, staticTextureCoordinateArray); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray); + setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, staticTextureCoordinateArray); } if (newMode == ImageArrayDrawingMode) { - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data()); - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray.data()); - glVertexAttribPointer(QT_OPACITY_ATTR, 1, GL_FLOAT, GL_FALSE, 0, opacityArray.data()); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinateArray.data()); + setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinateArray.data()); + setVertexAttributePointer(QT_OPACITY_ATTR, (GLfloat*)opacityArray.data()); } // This needs to change when we implement high-quality anti-aliasing... @@ -707,9 +707,9 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) prepareForDraw(currentBrush.isOpaque()); #ifdef QT_OPENGL_CACHE_AS_VBOS glBindBuffer(GL_ARRAY_BUFFER, cache->vbo); - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, false, 0, 0); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0); #else - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, false, 0, cache->vertices); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices); #endif glDrawArrays(cache->primitiveType, 0, cache->vertexCount); @@ -829,7 +829,7 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data, glStencilMask(GL_STENCIL_HIGH_BIT); #if 0 glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, data); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data); glDrawArrays(GL_TRIANGLE_STRIP, 0, count); #else @@ -840,7 +840,7 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(const float *data, } else { glStencilFunc(GL_ALWAYS, GL_STENCIL_HIGH_BIT, 0xff); } - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, data); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, data); glDrawArrays(GL_TRIANGLE_STRIP, 0, count); #endif } @@ -954,15 +954,8 @@ bool QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque) void QGL2PaintEngineExPrivate::composite(const QGLRect& boundingRect) { - // Setup a vertex array for the bounding rect: - GLfloat rectVerts[] = { - boundingRect.left, boundingRect.top, - boundingRect.left, boundingRect.bottom, - boundingRect.right, boundingRect.bottom, - boundingRect.right, boundingRect.top - }; - - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, rectVerts); + setCoords(staticVertexCoordinateArray, boundingRect); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, staticVertexCoordinateArray); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } @@ -971,7 +964,7 @@ void QGL2PaintEngineExPrivate::drawVertexArrays(const float *data, int *stops, i GLenum primitive) { // Now setup the pointer to the vertex array: - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, data); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)data); int previousStop = 0; for (int i=0; i<stopCount; ++i) { @@ -1070,7 +1063,7 @@ void QGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &pen) if (opaque) { prepareForDraw(opaque); - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, false, 0, stroker.vertices()); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, stroker.vertices()); glDrawArrays(GL_TRIANGLE_STRIP, 0, stroker.vertexCount() / 2); // QBrush b(Qt::green); @@ -1291,9 +1284,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly GLfloat dx = 1.0 / cache->width(); GLfloat dy = 1.0 / cache->height(); - QGLPoint *oldVertexCoordinateDataPtr = vertexCoordinateArray.data(); - QGLPoint *oldTextureCoordinateDataPtr = textureCoordinateArray.data(); - vertexCoordinateArray.clear(); textureCoordinateArray.clear(); @@ -1306,10 +1296,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, QFontEngineGly textureCoordinateArray.addRect(QRectF(c.x*dx, c.y*dy, c.w * dx, c.h * dy)); } - if (vertexCoordinateArray.data() != oldVertexCoordinateDataPtr) - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray.data()); - if (textureCoordinateArray.data() != oldTextureCoordinateDataPtr) - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray.data()); + setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, (GLfloat*)vertexCoordinateArray.data()); + setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, (GLfloat*)textureCoordinateArray.data()); if (addOffset) { addOffset = false; @@ -1641,6 +1629,8 @@ void QGL2PaintEngineEx::ensureActive() d->shaderManager->setDirty(); d->ctx->d_func()->syncGlState(); setState(state()); + for (int i = 0; i < 3; ++i) + d->vertexAttribPointers[i] = (GLfloat*)-1; // Assume the pointers are clobbered } } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 37bae6f..ce1b538 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -196,6 +196,9 @@ public: void drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints); void drawCachedGlyphs(const QPointF &p, QFontEngineGlyphCache::Type glyphType, const QTextItemInt &ti); + // Calls glVertexAttributePointer if the pointer has changed + inline void setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer); + // draws whatever is in the vertex array: void drawVertexArrays(const float *data, int *stops, int stopCount, GLenum primitive); void drawVertexArrays(QGL2PEXVertexArray &vertexArray, GLenum primitive) { @@ -230,6 +233,7 @@ public: void regenerateClip(); void systemStateChanged(); + static QGLEngineShaderManager* shaderManagerForEngine(QGL2PaintEngineEx *engine) { return engine->d_func()->shaderManager; } static QGL2PaintEngineExPrivate *getData(QGL2PaintEngineEx *engine) { return engine->d_func(); } static void cleanupVectorPath(QPaintEngineEx *engine, void *data); @@ -291,8 +295,24 @@ public: QSet<QVectorPath::CacheEntry *> pathCaches; QVector<GLuint> unusedVBOSToClean; + + const GLfloat *vertexAttribPointers[3]; }; + +void QGL2PaintEngineExPrivate::setVertexAttributePointer(unsigned int arrayIndex, const GLfloat *pointer) +{ + Q_ASSERT(arrayIndex < 3); + if (pointer == vertexAttribPointers[arrayIndex]) + return; + + vertexAttribPointers[arrayIndex] = pointer; + if (arrayIndex == QT_OPACITY_ATTR) + glVertexAttribPointer(arrayIndex, 1, GL_FLOAT, GL_FALSE, 0, pointer); + else + glVertexAttribPointer(arrayIndex, 2, GL_FLOAT, GL_FALSE, 0, pointer); +} + QT_END_NAMESPACE #endif diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 047876f..0720170 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -81,7 +81,7 @@ void QGLTextureGlyphCache::createTextureData(int width, int height) data[i] = 0; if (m_type == QFontEngineGlyphCache::Raster_RGBMask) - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]); else glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &data[0]); @@ -127,11 +127,28 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) glViewport(0, 0, oldWidth, oldHeight); - float vertexCoordinateArray[] = { -1, -1, 1, -1, 1, 1, -1, 1 }; - float textureCoordinateArray[] = { 0, 0, 1, 0, 1, 1, 0, 1 }; - - glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexCoordinateArray); - glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, textureCoordinateArray); + GLfloat* vertexCoordinateArray = pex->staticVertexCoordinateArray; + vertexCoordinateArray[0] = -1.0f; + vertexCoordinateArray[1] = -1.0f; + vertexCoordinateArray[2] = 1.0f; + vertexCoordinateArray[3] = -1.0f; + vertexCoordinateArray[4] = 1.0f; + vertexCoordinateArray[5] = 1.0f; + vertexCoordinateArray[6] = -1.0f; + vertexCoordinateArray[7] = 1.0f; + + GLfloat* textureCoordinateArray = pex->staticTextureCoordinateArray; + textureCoordinateArray[0] = 0.0f; + textureCoordinateArray[1] = 0.0f; + textureCoordinateArray[2] = 1.0f; + textureCoordinateArray[3] = 0.0f; + textureCoordinateArray[4] = 1.0f; + textureCoordinateArray[5] = 1.0f; + textureCoordinateArray[6] = 0.0f; + textureCoordinateArray[7] = 1.0f; + + pex->setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, vertexCoordinateArray); + pex->setVertexAttributePointer(QT_TEXTURE_COORDS_ATTR, textureCoordinateArray); pex->shaderManager->useBlitProgram(); pex->shaderManager->blitProgram()->setUniformValue("imageTexture", QT_IMAGE_TEXTURE_UNIT); @@ -179,8 +196,20 @@ void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph) for (int x = 0; x < maskWidth; ++x) src[x] = -src[x]; // convert 0 and 1 into 0 and 255 } - } - + } else if (mask.format() == QImage::Format_RGB32) { + // Make the alpha component equal to the average of the RGB values. + // This is needed when drawing sub-pixel antialiased text on translucent targets. + for (int y = 0; y < maskHeight; ++y) { + quint32 *src = (quint32 *) mask.scanLine(y); + for (int x = 0; x < maskWidth; ++x) { + uchar r = src[x] >> 16; + uchar g = src[x] >> 8; + uchar b = src[x]; + quint32 avg = (quint32(r) + quint32(g) + quint32(b) + 1) / 3; // "+1" for rounding. + src[x] = (src[x] & 0x00ffffff) | (avg << 24); + } + } + } glBindTexture(GL_TEXTURE_2D, m_texture); if (mask.format() == QImage::Format_RGB32) { diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 547b33e..a262ded 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1555,7 +1555,7 @@ QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include QImage qt_gl_read_texture(const QSize &size, bool alpha_format, bool include_alpha) { - QImage img(size, alpha_format ? QImage::Format_ARGB32 : QImage::Format_RGB32); + QImage img(size, alpha_format ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32); int w = size.width(); int h = size.height(); #if !defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL) diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index cc58c09..c823187 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -4931,7 +4931,8 @@ void QOpenGLPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - bool antialias = !(ti.fontEngine->fontDef.styleStrategy & QFont::NoAntialias); + bool antialias = !(ti.fontEngine->fontDef.styleStrategy & QFont::NoAntialias) + && (d->matrix.type() > QTransform::TxTranslate); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, antialias ? GL_LINEAR : GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, antialias ? GL_LINEAR : GL_NEAREST); |