Changeset 53963 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Jan 26, 2015 4:12:24 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 97861
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r53961 r53963 290 290 QRect rect(iX, iY, iWidth, iHeight); 291 291 292 /* Take the scale-factor into account: */ 293 const double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid()); 294 if (dScaleFactor != 1.0) 295 { 296 rect.moveTo(floor((double)rect.x() * dScaleFactor) - 1, 297 floor((double)rect.y() * dScaleFactor) - 1); 298 rect.setSize(QSize(ceil((double)rect.width() * dScaleFactor) + 2, 299 ceil((double)rect.height() * dScaleFactor) + 2)); 292 /* Take the scaling into account: */ 293 const double dScaleFactor = frameBuffer()->scaleFactor(); 294 const QSize scaledSize = frameBuffer()->scaledSize(); 295 if (scaledSize.isValid()) 296 { 297 /* Calculate corresponding scale-factors: */ 298 const double xScaleFactor = visualStateType() == UIVisualStateType_Scale ? 299 (double)scaledSize.width() / frameBuffer()->width() : dScaleFactor; 300 const double yScaleFactor = visualStateType() == UIVisualStateType_Scale ? 301 (double)scaledSize.height() / frameBuffer()->height() : dScaleFactor; 302 /* Adjust corresponding viewport part: */ 303 rect.moveTo(floor((double)rect.x() * xScaleFactor) - 1, 304 floor((double)rect.y() * yScaleFactor) - 1); 305 rect.setSize(QSize(ceil((double)rect.width() * xScaleFactor) + 2, 306 ceil((double)rect.height() * yScaleFactor) + 2)); 300 307 } 301 308 … … 306 313 #ifdef Q_WS_MAC 307 314 /* Take the backing-scale-factor into account: */ 308 if ( gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid()))309 { 310 const double dBackingScaleFactor = darwinBackingScaleFactor(machineWindow());315 if (frameBuffer()->useUnscaledHiDPIOutput()) 316 { 317 const double dBackingScaleFactor = frameBuffer()->backingScaleFactor(); 311 318 if (dBackingScaleFactor > 1.0) 312 319 { … … 974 981 if (gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid())) 975 982 { 976 const double dBackingScaleFactor = darwinBackingScaleFactor(machineWindow());983 const double dBackingScaleFactor = frameBuffer()->backingScaleFactor(); 977 984 if (dBackingScaleFactor > 1.0) 978 985 { … … 1002 1009 if (gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid())) 1003 1010 { 1004 const double dBackingScaleFactor = darwinBackingScaleFactor(machineWindow());1011 const double dBackingScaleFactor = frameBuffer()->backingScaleFactor(); 1005 1012 if (dBackingScaleFactor > 1.0) 1006 1013 { … … 1231 1238 QPainter painter(viewport()); 1232 1239 /* Take the scale-factor into account: */ 1233 if ( gEDataManager->scaleFactor(vboxGlobal().managedVMUuid()) == 1.0)1240 if (frameBuffer()->scaleFactor() == 1.0) 1234 1241 painter.drawPixmap(rect.topLeft(), pausePixmap()); 1235 1242 else … … 1426 1433 { 1427 1434 /* Take the scale-factor into account: */ 1428 const double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid());1435 const double dScaleFactor = frameBuffer()->scaleFactor(); 1429 1436 if (dScaleFactor != 1.0) 1430 1437 size = QSize(size.width() * dScaleFactor, size.height() * dScaleFactor); … … 1434 1441 if (gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid())) 1435 1442 { 1436 const double dBackingScaleFactor = darwinBackingScaleFactor(machineWindow());1443 const double dBackingScaleFactor = frameBuffer()->backingScaleFactor(); 1437 1444 if (dBackingScaleFactor > 1.0) 1438 1445 size = QSize(size.width() / dBackingScaleFactor, size.height() / dBackingScaleFactor); … … 1450 1457 if (gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid())) 1451 1458 { 1452 const double dBackingScaleFactor = darwinBackingScaleFactor(machineWindow());1459 const double dBackingScaleFactor = frameBuffer()->backingScaleFactor(); 1453 1460 if (dBackingScaleFactor > 1.0) 1454 1461 size = QSize(size.width() * dBackingScaleFactor, size.height() * dBackingScaleFactor); … … 1457 1464 1458 1465 /* Take the scale-factor into account: */ 1459 const double dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid());1466 const double dScaleFactor = frameBuffer()->scaleFactor(); 1460 1467 if (dScaleFactor != 1.0) 1461 1468 size = QSize(size.width() / dScaleFactor, size.height() / dScaleFactor); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp
r53959 r53963 946 946 if (gEDataManager->useUnscaledHiDPIOutput(vboxGlobal().managedVMUuid())) 947 947 { 948 const double dBackingScaleFactor = darwinBackingScaleFactor(m_windows.value(uScreenId));948 const double dBackingScaleFactor = pFrameBuffer->backingScaleFactor(); 949 949 if (dBackingScaleFactor > 1.0) 950 950 { -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp
r53962 r53963 101 101 /* Update machine-view sliders: */ 102 102 updateSliders(); 103 }104 105 void UIMachineViewScale::sltHandleNotifyUpdate(int iX, int iY, int iW, int iH)106 {107 /* Initialize variables for scale mode: */108 const QSize scaledSize = frameBuffer()->scaledSize();109 const double xScaleFactor = (double)scaledSize.width() / frameBuffer()->width();110 const double yScaleFactor = (double)scaledSize.height() / frameBuffer()->height();111 112 /* Update corresponding viewport part,113 * But make sure we update always a bigger rectangle than requested to114 * catch all rounding errors. (use 1 time the ratio factor and115 * round down on top/left, but round up for the width/height) */116 viewport()->update((int)(iX * xScaleFactor) - ((int)xScaleFactor) - 1,117 (int)(iY * yScaleFactor) - ((int)yScaleFactor) - 1,118 (int)(iW * xScaleFactor) + ((int)xScaleFactor + 2) * 2,119 (int)(iH * yScaleFactor) + ((int)yScaleFactor + 2) * 2);120 103 } 121 104 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.h
r53962 r53963 42 42 void sltPerformGuestScale(); 43 43 44 /* Handler: Frame-buffer NotifyUpdate stuff: */45 void sltHandleNotifyUpdate(int iX, int iY, int iW, int iH);46 47 44 private: 48 45
Note:
See TracChangeset
for help on using the changeset viewer.