Changeset 53520 in vbox for trunk/src/VBox
- Timestamp:
- Dec 12, 2014 10:47:13 AM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r53518 r53520 865 865 void UIFrameBuffer::paintDefault(QPaintEvent *pEvent) 866 866 { 867 /* Prepare the 'paint' rectangle: */868 QRect paintRect = pEvent->rect();869 870 /* Take the backing-scale-factor into account: */871 if (useUnscaledHiDPIOutput() && backingScaleFactor() > 1.0)872 {873 paintRect.moveTo(paintRect.topLeft() * backingScaleFactor());874 paintRect.setSize(paintRect.size() * backingScaleFactor());875 }876 877 867 /* Scaled image is NULL by default: */ 878 868 QImage scaledImage; … … 889 879 const QImage &sourceImage = scaledImage.isNull() ? m_image : scaledImage; 890 880 881 /* Prepare the 'paint' rectangle: */ 882 QRect paintRect = pEvent->rect(); 883 884 /* Take the backing-scale-factor into account: */ 885 if (useUnscaledHiDPIOutput() && backingScaleFactor() > 1.0) 886 { 887 paintRect.moveTo(paintRect.topLeft() * backingScaleFactor()); 888 paintRect.setSize(paintRect.size() * backingScaleFactor()); 889 } 890 891 891 /* Make sure paint-rectangle is within the image boundary: */ 892 892 paintRect = paintRect.intersected(sourceImage.rect()); … … 905 905 void UIFrameBuffer::paintSeamless(QPaintEvent *pEvent) 906 906 { 907 /* Prepare the 'paint' rectangle: */908 QRect paintRect = pEvent->rect();909 910 /* Take the backing-scale-factor into account: */911 if (useUnscaledHiDPIOutput() && backingScaleFactor() > 1.0)912 {913 paintRect.moveTo(paintRect.topLeft() * backingScaleFactor());914 paintRect.setSize(paintRect.size() * backingScaleFactor());915 }916 917 907 /* Scaled image is NULL by default: */ 918 908 QImage scaledImage; … … 929 919 const QImage &sourceImage = scaledImage.isNull() ? m_image : scaledImage; 930 920 921 /* Prepare the 'paint' rectangle: */ 922 QRect paintRect = pEvent->rect(); 923 924 /* Take the backing-scale-factor into account: */ 925 if (useUnscaledHiDPIOutput() && backingScaleFactor() > 1.0) 926 { 927 paintRect.moveTo(paintRect.topLeft() * backingScaleFactor()); 928 paintRect.setSize(paintRect.size() * backingScaleFactor()); 929 } 930 931 931 /* Make sure paint-rectangle is within the image boundary: */ 932 932 paintRect = paintRect.intersected(sourceImage.rect()); … … 947 947 /* Erase required region, slowly, rectangle-by-rectangle: */ 948 948 foreach (const QRect &rect, regionToErase.rects()) 949 painter.eraseRect(rect); 949 eraseImageRect(painter, rect, 950 useUnscaledHiDPIOutput(), hiDPIOptimizationType(), backingScaleFactor()); 950 951 /* Restore composition-mode: */ 951 952 painter.setCompositionMode(QPainter::CompositionMode_SourceOver); … … 981 982 982 983 /* static */ 984 void UIFrameBuffer::eraseImageRect(QPainter &painter, const QRect &rect, 985 bool fUseUnscaledHiDPIOutput, 986 HiDPIOptimizationType hiDPIOptimizationType, 987 double dBackingScaleFactor) 988 { 989 /* Prepare sub-pixmap: */ 990 QPixmap subPixmap = QPixmap(rect.width(), rect.height()); 991 992 /* If HiDPI 'backing scale factor' defined: */ 993 if (dBackingScaleFactor > 1.0) 994 { 995 /* Should we 996 * perform logical HiDPI scaling and optimize it for performance? */ 997 if (!fUseUnscaledHiDPIOutput && hiDPIOptimizationType == HiDPIOptimizationType_Performance) 998 { 999 /* Adjust sub-pixmap: */ 1000 subPixmap = QPixmap(rect.width() * dBackingScaleFactor, 1001 rect.height() * dBackingScaleFactor); 1002 } 1003 1004 #ifdef Q_WS_MAC 1005 # ifdef VBOX_GUI_WITH_HIDPI 1006 /* Should we 1007 * do not perform logical HiDPI scaling or 1008 * perform logical HiDPI scaling and optimize it for performance? */ 1009 if (fUseUnscaledHiDPIOutput || hiDPIOptimizationType == HiDPIOptimizationType_Performance) 1010 { 1011 /* Mark sub-pixmap as HiDPI: */ 1012 subPixmap.setDevicePixelRatio(dBackingScaleFactor); 1013 } 1014 # endif /* VBOX_GUI_WITH_HIDPI */ 1015 #endif /* Q_WS_MAC */ 1016 } 1017 1018 /* Which point we should draw corresponding sub-pixmap? */ 1019 QPointF paintPoint = rect.topLeft(); 1020 1021 /* Take the backing-scale-factor into account: */ 1022 if (fUseUnscaledHiDPIOutput && dBackingScaleFactor > 1.0) 1023 paintPoint /= dBackingScaleFactor; 1024 1025 /* Draw sub-pixmap: */ 1026 painter.drawPixmap(paintPoint, subPixmap); 1027 } 1028 1029 /* static */ 983 1030 void UIFrameBuffer::drawImageRect(QPainter &painter, const QImage &image, const QRect &rect, 984 1031 int iContentsShiftX, int iContentsShiftY, … … 1031 1078 1032 1079 /* Which point we should draw corresponding sub-pixmap? */ 1033 QPoint paintPoint = rect.topLeft();1080 QPointF paintPoint = rect.topLeft(); 1034 1081 1035 1082 /* Take the backing-scale-factor into account: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
r53518 r53520 252 252 void paintSeamless(QPaintEvent *pEvent); 253 253 254 /** Erases corresponding @a rect with @a painter. */ 255 static void eraseImageRect(QPainter &painter, const QRect &rect, 256 bool fUseUnscaledHiDPIOutput, 257 HiDPIOptimizationType hiDPIOptimizationType, 258 double dBackingScaleFactor); 254 259 /** Draws corresponding @a rect of passed @a image with @a painter. */ 255 260 static void drawImageRect(QPainter &painter, const QImage &image, const QRect &rect,
Note:
See TracChangeset
for help on using the changeset viewer.