- Timestamp:
- Dec 4, 2014 6:26:28 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r53389 r53446 814 814 void UIFrameBuffer::paintDefault(QPaintEvent *pEvent) 815 815 { 816 /* Prepare the 'paint' rectangle: */ 817 QRect paintRect = pEvent->rect(); 818 816 819 /* Scaled image is NULL by default: */ 817 820 QImage scaledImage; … … 823 826 scaledImage = m_image.copy(); 824 827 /* And scaling the image to predefined scaled-factor: */ 825 scaledImage = scaledImage.scaled(m_scaledSize, Qt::IgnoreAspectRatio, Qt:: SmoothTransformation);828 scaledImage = scaledImage.scaled(m_scaledSize, Qt::IgnoreAspectRatio, Qt::FastTransformation); 826 829 } 827 830 /* Finally we are choosing image to paint from: */ 828 831 const QImage &sourceImage = scaledImage.isNull() ? m_image : scaledImage; 829 832 830 /* Get rectangle to paint: */831 QRect paintRect = pEvent->rect().intersected(sourceImage.rect()).intersected(m_pMachineView->viewport()->geometry());833 /* Make sure paint-rectangle is within the image boundary: */ 834 paintRect = paintRect.intersected(sourceImage.rect()); 832 835 if (paintRect.isEmpty()) 833 836 return; … … 844 847 void UIFrameBuffer::paintSeamless(QPaintEvent *pEvent) 845 848 { 849 /* Prepare the 'paint' rectangle: */ 850 QRect paintRect = pEvent->rect(); 851 846 852 /* Scaled image is NULL by default: */ 847 853 QImage scaledImage; … … 853 859 scaledImage = m_image.copy(); 854 860 /* And scaling the image to predefined scaled-factor: */ 855 scaledImage = scaledImage.scaled(m_scaledSize, Qt::IgnoreAspectRatio, Qt:: SmoothTransformation);861 scaledImage = scaledImage.scaled(m_scaledSize, Qt::IgnoreAspectRatio, Qt::FastTransformation); 856 862 } 857 863 /* Finally we are choosing image to paint from: */ 858 864 const QImage &sourceImage = scaledImage.isNull() ? m_image : scaledImage; 859 865 860 /* Get rectangle to paint: */861 QRect paintRect = pEvent->rect().intersected(sourceImage.rect()).intersected(m_pMachineView->viewport()->geometry());866 /* Make sure paint-rectangle is within the image boundary: */ 867 paintRect = paintRect.intersected(sourceImage.rect()); 862 868 if (paintRect.isEmpty()) 863 869 return; … … 935 941 if (dBackingScaleFactor > 1.0) 936 942 { 937 /* Should we optimize HiDPI output for performance? */ 943 /* Should we 944 * perform logical HiDPI scaling and optimize it for performance? */ 938 945 if (hiDPIOptimizationType == HiDPIOptimizationType_Performance) 939 946 { … … 941 948 subPixmap = subPixmap.scaled(subPixmap.size() * dBackingScaleFactor, 942 949 Qt::IgnoreAspectRatio, Qt::FastTransformation); 950 } 951 943 952 # ifdef Q_WS_MAC 944 953 # ifdef VBOX_GUI_WITH_HIDPI 954 /* Should we 955 * perform logical HiDPI scaling and optimize it for performance? */ 956 if (hiDPIOptimizationType == HiDPIOptimizationType_Performance) 957 { 945 958 /* Mark sub-pixmap as HiDPI: */ 946 959 subPixmap.setDevicePixelRatio(dBackingScaleFactor); 960 } 947 961 # endif /* VBOX_GUI_WITH_HIDPI */ 948 962 # endif /* Q_WS_MAC */ 949 } 950 } 963 } 964 965 /* Which point we should draw corresponding sub-pixmap? */ 966 QPoint paintPoint = rect.topLeft(); 951 967 952 968 /* Draw sub-pixmap: */ 953 painter.drawPixmap( rect.x(), rect.y(), subPixmap);969 painter.drawPixmap(paintPoint, subPixmap); 954 970 #else /* QIMAGE_FRAMEBUFFER_WITH_DIRECT_OUTPUT */ 955 971 /* If HiDPI 'backing scale factor' defined: */
Note:
See TracChangeset
for help on using the changeset viewer.