VirtualBox

Changeset 3763 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 22, 2007 1:13:51 PM (17 years ago)
Author:
vboxsync
Message:

FE/Qt: Optimized the QImage rendering method (used by default on Win32 hosts) which doubled 2D performance in guests with installed additions.

File:
1 edited

Legend:

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

    r3761 r3763  
    375375    mHgt = re->height();
    376376
    377     mImg = QImage (mWdt, mHgt, 32, 0, QImage::LittleEndian);
    378     mPixelFormat = FramebufferPixelFormat_FOURCC_RGB;
    379     mUsesGuestVRAM = false;
     377    bool fallback = false;
     378
     379    /* check if we support the pixel format and can use the guest VRAM directly */
     380    if (re->pixelFormat() == FramebufferPixelFormat_FOURCC_RGB)
     381    {
     382        switch (re->bitsPerPixel())
     383        {
     384            case 32:
     385            case 24:
     386            case 16:
     387                break;
     388            default:
     389                fallback = true;
     390                break;
     391        }
     392
     393        if (!fallback)
     394        {
     395            /* QImage only supports 32-bit aligned scan lines */
     396            fallback = re->bytesPerLine() !=
     397                ((mWdt * re->bitsPerPixel() + 31) / 32) * 4;
     398            Assert (!fallback);
     399
     400            if (!fallback)
     401            {
     402                mImg = QImage ((uchar *) re->VRAM(), mWdt, mHgt,
     403                               re->bitsPerPixel(), NULL, 0, QImage::LittleEndian);
     404                mPixelFormat = re->pixelFormat();
     405                mUsesGuestVRAM = true;
     406            }
     407        }
     408    }
     409    else
     410    {
     411        fallback = true;
     412    }
     413
     414    if (fallback)
     415    {
     416        /* we don't support either the pixel format or the color depth,
     417         * fallback to a self-provided 32bpp RGB buffer */
     418        mImg = QImage (mWdt, mHgt, 32, 0, QImage::LittleEndian);
     419        mPixelFormat = FramebufferPixelFormat_FOURCC_RGB;
     420        mUsesGuestVRAM = false;
     421    }
    380422}
    381423
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