Changeset 108075 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Feb 5, 2025 3:25:19 PM (3 months ago)
- svn:sync-xref-src-repo-rev:
- 167368
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r107411 r108075 277 277 void updateCoordinateSystem(); 278 278 279 /** Applies alignment hack to HiDPI rectangle to avoid rounding problem. 280 * @todo Temporary hack, please redo. */ 281 static void alignHackForHiDPIRect(QRect &rectHiDPI, double rdPixelRatio); 282 279 283 /** Default paint routine. */ 280 284 void paintDefault(QPaintEvent *pEvent); … … 1250 1254 m_transform = m_transform.scale(devicePixelRatioActual(), devicePixelRatioActual()); 1251 1255 m_transform = m_transform.scale(1.0 / devicePixelRatio(), 1.0 / devicePixelRatio()); 1256 } 1257 1258 /*static*/ void UIFrameBufferPrivate::alignHackForHiDPIRect(QRect &rectHiDPI, double rdPixelRatio) 1259 { 1260 /* HACK ALERT! Extend the rectangle to avoid rounding issues related to devicePixelRatio(). */ 1261 if (rdPixelRatio != 1.0) 1262 { 1263 int iAlign; 1264 switch (unsigned(rdPixelRatio * 8.0) & 7) /* ASSUMES scaling granularity */ 1265 { 1266 case 1: /* x.125 */ 1267 case 3: /* x.375 */ 1268 case 5: /* x.625 */ 1269 case 7: /* x.875 */ 1270 iAlign = 8; 1271 break; 1272 case 2: /* x.25 */ 1273 case 6: /* x.75 */ 1274 iAlign = 4; 1275 break; 1276 case 4: /* x.5 */ 1277 iAlign = 2; 1278 break; 1279 default: 1280 return; 1281 } 1282 rectHiDPI.setTop(rectHiDPI.top() & ~iAlign); 1283 rectHiDPI.setBottom((rectHiDPI.bottom() + iAlign - 1) & ~iAlign); 1284 rectHiDPI.setLeft(rectHiDPI.left() & ~iAlign); 1285 rectHiDPI.setRight((rectHiDPI.right() + iAlign - 1) & ~iAlign); 1286 } 1252 1287 } 1253 1288 … … 1295 1330 paintRectHiDPI.moveTo(paintRectHiDPI.topLeft() * devicePixelRatio()); 1296 1331 paintRectHiDPI.setSize(paintRectHiDPI.size() * devicePixelRatio()); 1332 alignHackForHiDPIRect(paintRectHiDPI, devicePixelRatio()); 1297 1333 1298 1334 /* Make sure hidpi paint rectangle is within the image boundary: */ … … 1389 1425 paintRectHiDPI.moveTo(paintRectHiDPI.topLeft() * devicePixelRatio()); 1390 1426 paintRectHiDPI.setSize(paintRectHiDPI.size() * devicePixelRatio()); 1427 alignHackForHiDPIRect(paintRectHiDPI, devicePixelRatio()); 1391 1428 1392 1429 /* Make sure hidpi paint rectangle is within the image boundary: */ … … 1512 1549 /* Which point we should draw corresponding sub-pixmap? */ 1513 1550 QPoint paintPoint = rect.topLeft(); 1514 /* Take the device-pixel-ratio into account: */ 1551 /* Take the device-pixel-ratio into account. 1552 Note! I (bird) suspect this is the culprit for the off by one issues 1553 during stuff like XP text mode installer and a bunch of other 1554 situations (some involving XP desktop). alignHackForHiDPIRect() 1555 attempts to work around this by avoiding any rounding by making 1556 sure the update rectangle is a multiple of the scaling factor. 1557 Unfortuantely, due to clipping concerns, we have to apply the 1558 hack in the calling code. */ 1515 1559 paintPoint /= dDevicePixelRatio; 1516 1560
Note:
See TracChangeset
for help on using the changeset viewer.