HighDPI: Disable scrolling for non-integer deltas
Disable the scrolling optimization in QBackingStore and fall back to repainting for non-integer deltas. The existing rendered pixels are not re-usable in this case. The test is made on the delta, and not on the scale factor. This means that user code can cooperate and generate (logical delta, scale factor) combinations that result in integer pixel deltas (which _can_ be scrolled). Change-Id: I36eb5d9e00449428bc9095edd8732782b996db16 Task-number: QTBUG-52452 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>bb10
parent
97318a3d5f
commit
a2157df28b
|
|
@ -230,11 +230,16 @@ QSize QBackingStore::size() const
|
|||
*/
|
||||
bool QBackingStore::scroll(const QRegion &area, int dx, int dy)
|
||||
{
|
||||
Q_UNUSED(area);
|
||||
Q_UNUSED(dx);
|
||||
Q_UNUSED(dy);
|
||||
// Disable scrolling for non-integer scroll deltas. For this case
|
||||
// the the existing rendered pixels can't be re-used, and we return
|
||||
// false to signal that a repaint is needed.
|
||||
const qreal nativeDx = QHighDpi::toNativePixels(qreal(dx), d_ptr->window);
|
||||
const qreal nativeDy = QHighDpi::toNativePixels(qreal(dy), d_ptr->window);
|
||||
if (qFloor(nativeDx) != nativeDx || qFloor(nativeDy) != nativeDy)
|
||||
return false;
|
||||
|
||||
return d_ptr->platformBackingStore->scroll(QHighDpi::toNativeLocalRegion(area, d_ptr->window), QHighDpi::toNativePixels(dx, d_ptr->window), QHighDpi::toNativePixels(dy, d_ptr->window));
|
||||
return d_ptr->platformBackingStore->scroll(QHighDpi::toNativeLocalRegion(area, d_ptr->window),
|
||||
nativeDx, nativeDy);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
Loading…
Reference in New Issue