VirtualBox

Changeset 53446 in vbox for trunk


Ignore:
Timestamp:
Dec 4, 2014 6:26:28 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 6278: Support for scaled video-output: Using fast-scaling mechanism and optimize corresponding code for further feature injection.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp

    r53389 r53446  
    814814void UIFrameBuffer::paintDefault(QPaintEvent *pEvent)
    815815{
     816    /* Prepare the 'paint' rectangle: */
     817    QRect paintRect = pEvent->rect();
     818
    816819    /* Scaled image is NULL by default: */
    817820    QImage scaledImage;
     
    823826        scaledImage = m_image.copy();
    824827        /* 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);
    826829    }
    827830    /* Finally we are choosing image to paint from: */
    828831    const QImage &sourceImage = scaledImage.isNull() ? m_image : scaledImage;
    829832
    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());
    832835    if (paintRect.isEmpty())
    833836        return;
     
    844847void UIFrameBuffer::paintSeamless(QPaintEvent *pEvent)
    845848{
     849    /* Prepare the 'paint' rectangle: */
     850    QRect paintRect = pEvent->rect();
     851
    846852    /* Scaled image is NULL by default: */
    847853    QImage scaledImage;
     
    853859        scaledImage = m_image.copy();
    854860        /* 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);
    856862    }
    857863    /* Finally we are choosing image to paint from: */
    858864    const QImage &sourceImage = scaledImage.isNull() ? m_image : scaledImage;
    859865
    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());
    862868    if (paintRect.isEmpty())
    863869        return;
     
    935941    if (dBackingScaleFactor > 1.0)
    936942    {
    937         /* Should we optimize HiDPI output for performance? */
     943        /* Should we
     944         * perform logical HiDPI scaling and optimize it for performance? */
    938945        if (hiDPIOptimizationType == HiDPIOptimizationType_Performance)
    939946        {
     
    941948            subPixmap = subPixmap.scaled(subPixmap.size() * dBackingScaleFactor,
    942949                                         Qt::IgnoreAspectRatio, Qt::FastTransformation);
     950        }
     951
    943952# ifdef Q_WS_MAC
    944953#  ifdef VBOX_GUI_WITH_HIDPI
     954        /* Should we
     955         * perform logical HiDPI scaling and optimize it for performance? */
     956        if (hiDPIOptimizationType == HiDPIOptimizationType_Performance)
     957        {
    945958            /* Mark sub-pixmap as HiDPI: */
    946959            subPixmap.setDevicePixelRatio(dBackingScaleFactor);
     960        }
    947961#  endif /* VBOX_GUI_WITH_HIDPI */
    948962# endif /* Q_WS_MAC */
    949         }
    950     }
     963    }
     964
     965    /* Which point we should draw corresponding sub-pixmap? */
     966    QPoint paintPoint = rect.topLeft();
    951967
    952968    /* Draw sub-pixmap: */
    953     painter.drawPixmap(rect.x(), rect.y(), subPixmap);
     969    painter.drawPixmap(paintPoint, subPixmap);
    954970#else /* QIMAGE_FRAMEBUFFER_WITH_DIRECT_OUTPUT */
    955971    /* If HiDPI 'backing scale factor' defined: */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette