- Timestamp:
- Feb 15, 2018 4:59:45 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r71030 r71033 1373 1373 const QImage &sourceImage = scaledImage.isNull() ? m_image : scaledImage; 1374 1374 1375 /* Prepare the 'paint' rectangle: */ 1376 QRect paintRect = pEvent->rect(); 1375 /* Prepare the base and hidpi paint rectangles: */ 1376 const QRect paintRect = pEvent->rect(); 1377 QRect paintRectHiDPI = paintRect; 1377 1378 1378 1379 /* Take the device-pixel-ratio into account: */ 1379 1380 if (useUnscaledHiDPIOutput() && devicePixelRatio() > 1.0) 1380 1381 { 1381 paintRect .moveTo(paintRect.topLeft() * devicePixelRatio());1382 paintRect .setSize(paintRect.size() * devicePixelRatio());1383 } 1384 1385 /* Make sure paint-rectangle is within the image boundary: */1386 paintRect = paintRect.intersected(sourceImage.rect());1387 if (paintRect .isEmpty())1382 paintRectHiDPI.moveTo(paintRectHiDPI.topLeft() * devicePixelRatio()); 1383 paintRectHiDPI.setSize(paintRectHiDPI.size() * devicePixelRatio()); 1384 } 1385 1386 /* Make sure hidpi paint rectangle is within the image boundary: */ 1387 paintRectHiDPI = paintRectHiDPI.intersected(sourceImage.rect()); 1388 if (paintRectHiDPI.isEmpty()) 1388 1389 return; 1389 1390 … … 1394 1395 /* On OSX for Qt5 we need to fill the backing store first: */ 1395 1396 painter.setCompositionMode(QPainter::CompositionMode_Source); 1396 painter.fillRect(p Event->rect(), QColor(Qt::black));1397 painter.fillRect(paintRect, QColor(Qt::black)); 1397 1398 painter.setCompositionMode(QPainter::CompositionMode_SourceAtop); 1398 1399 #endif /* VBOX_WS_MAC */ 1399 1400 1400 /* Draw image rectangle: */1401 drawImageRect(painter, sourceImage, paintRect ,1401 /* Draw hidpi image rectangle: */ 1402 drawImageRect(painter, sourceImage, paintRectHiDPI, 1402 1403 m_pMachineView->contentsX(), m_pMachineView->contentsY(), 1403 1404 useUnscaledHiDPIOutput(), … … 1434 1435 const QImage &sourceImage = scaledImage.isNull() ? m_image : scaledImage; 1435 1436 1436 /* Prepare the 'paint' rectangle: */ 1437 QRect paintRect = pEvent->rect(); 1438 1439 /* Prepare seamless regions to erase/paint: */ 1440 lock(); 1441 const QRegion eraseRegion = QRegion(paintRect) - m_syncVisibleRegion; 1442 const QRegion paintRegion = QRegion(paintRect) & m_syncVisibleRegion; 1443 unlock(); 1437 /* Prepare the base and hidpi paint rectangles: */ 1438 const QRect paintRect = pEvent->rect(); 1439 QRect paintRectHiDPI = paintRect; 1444 1440 1445 1441 /* Take the device-pixel-ratio into account: */ 1446 1442 if (useUnscaledHiDPIOutput() && devicePixelRatio() > 1.0) 1447 1443 { 1448 paintRect .moveTo(paintRect.topLeft() * devicePixelRatio());1449 paintRect .setSize(paintRect.size() * devicePixelRatio());1450 } 1451 1452 /* Make sure paint-rectangle is within the image boundary: */1453 paintRect = paintRect.intersected(sourceImage.rect());1454 if (paintRect .isEmpty())1444 paintRectHiDPI.moveTo(paintRectHiDPI.topLeft() * devicePixelRatio()); 1445 paintRectHiDPI.setSize(paintRectHiDPI.size() * devicePixelRatio()); 1446 } 1447 1448 /* Make sure hidpi paint rectangle is within the image boundary: */ 1449 paintRectHiDPI = paintRectHiDPI.intersected(sourceImage.rect()); 1450 if (paintRectHiDPI.isEmpty()) 1455 1451 return; 1456 1452 … … 1458 1454 QPainter painter(m_pMachineView->viewport()); 1459 1455 1460 /* A pply painter clippingfor erasing: */1461 painter.setClipRegion(eraseRegion);1462 /* Set composition-mode to erase: */1456 /* Adjust painter for erasing: */ 1457 lock(); 1458 painter.setClipRegion(QRegion(paintRect) - m_syncVisibleRegion); 1463 1459 painter.setCompositionMode(QPainter::CompositionMode_Clear); 1464 /* Erase rectangle: */ 1465 eraseImageRect(painter, paintRect, 1460 unlock(); 1461 1462 /* Erase hidpi rectangle: */ 1463 eraseImageRect(painter, paintRectHiDPI, 1466 1464 useUnscaledHiDPIOutput(), 1467 1465 #ifdef VBOX_WS_MAC … … 1470 1468 devicePixelRatio()); 1471 1469 1472 /* A pply painter clippingfor painting: */1473 painter.setClipRegion(paintRegion);1474 /* Set composition-mode to paint: */1470 /* Adjust painter for painting: */ 1471 lock(); 1472 painter.setClipRegion(QRegion(paintRect) & m_syncVisibleRegion); 1475 1473 painter.setCompositionMode(QPainter::CompositionMode_SourceOver); 1474 unlock(); 1476 1475 1477 1476 #ifdef VBOX_WITH_TRANSLUCENT_SEAMLESS 1478 1477 /* In case of translucent seamless for Qt5 we need to fill the backing store first: */ 1479 1478 painter.setCompositionMode(QPainter::CompositionMode_Source); 1480 painter.fillRect(p Event->rect(), QColor(Qt::black));1479 painter.fillRect(paintRect, QColor(Qt::black)); 1481 1480 painter.setCompositionMode(QPainter::CompositionMode_SourceAtop); 1482 1481 #endif /* VBOX_WITH_TRANSLUCENT_SEAMLESS */ 1483 1482 1484 /* Draw image rectangle: */1485 drawImageRect(painter, sourceImage, paintRect ,1483 /* Draw hidpi image rectangle: */ 1484 drawImageRect(painter, sourceImage, paintRectHiDPI, 1486 1485 m_pMachineView->contentsX(), m_pMachineView->contentsY(), 1487 1486 useUnscaledHiDPIOutput(),
Note:
See TracChangeset
for help on using the changeset viewer.