VirtualBox

Ignore:
Timestamp:
Jul 28, 2008 8:10:03 PM (16 years ago)
Author:
vboxsync
Message:

Fe/Qt4: Porting qimage frame-buffer to qt4, fixing some little painting issues.

Location:
trunk/src/VBox/Frontends/VirtualBox4/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleView.cpp

    r10786 r10922  
    119119    UInt32 eventKind = ::GetEventKind (inEvent);
    120120    /* For debugging events */
    121     /* 
     121    /*
    122122    if (!(eventClass == 'cute'))
    123123        ::darwinDebugPrintEvent ("view: ", inEvent);
     
    163163
    164164    /* For debugging events */
    165     /* 
     165    /*
    166166    if (!(eventClass == 'cute'))
    167167        ::darwinDebugPrintEvent ("view: ", inEvent);
     
    11571157            }
    11581158
    1159 #if !defined (Q_WS_WIN) && !defined (Q_WS_PM)
    1160             /* see VBox[QImage|SDL]FrameBuffer::NotifyUpdate(). */
     1159            /* See VBox[QImage|SDL]FrameBuffer::NotifyUpdate(). */
    11611160            case VBoxDefs::RepaintEventType:
    11621161            {
     
    11681167                return true;
    11691168            }
    1170 #endif
    11711169
    11721170            case VBoxDefs::SetRegionEventType:
     
    26842682
    26852683#ifdef Q_WS_MAC
    2686     /* Simulate the right click on 
     2684    /* Simulate the right click on
    26872685     * Host+Left Mouse */
    26882686    if (mIsHostkeyPressed &&
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxFrameBuffer.cpp

    r9495 r10922  
    316316                                                  BOOL *aFinished)
    317317{
    318 #if !defined (Q_WS_WIN) && !defined (Q_WS_PM)
    319     /* we're not on the GUI thread and update() isn't thread safe in Qt 3.3.x
    320        on the Mac (4.2.x is), on Linux (didn't check Qt 4.x there) and
    321        probably on other non-DOS platforms, so post the event instead. */
     318    /* We're not on the GUI thread and update() isn't thread safe in
     319     * Qt 4.3.x on the Win, Qt 3.3.x on the Mac (4.2.x is),
     320     * on Linux (didn't check Qt 4.x there) and probably on other
     321     * non-DOS platforms, so post the event instead. */
    322322    QApplication::postEvent (mView,
    323323                             new VBoxRepaintEvent (aX, aY, aW, aH));
    324 #else
    325     /* we're not on the GUI thread, so update() instead of repaint()! */
    326     mView->viewport()->update (aX - mView->contentsX(),
    327                                aY - mView->contentsY(),
    328                                aW, aH);
    329 #endif
    330     /* the update has been finished, return TRUE */
     324
     325    /* The update has been finished, return TRUE */
    331326    *aFinished = TRUE;
    332327    return S_OK;
     
    335330void VBoxQImageFrameBuffer::paintEvent (QPaintEvent *pe)
    336331{
    337     const QRect &r = pe->rect().intersect (mView->viewport()->rect());
    338 
    339     /*  some outdated rectangle during processing VBoxResizeEvent */
     332    const QRect &r = pe->rect().intersected (mView->viewport()->rect());
     333
     334    /* Some outdated rectangle during processing VBoxResizeEvent */
    340335    if (r.isEmpty())
    341336        return;
     
    349344    FRAMEBUF_DEBUG_START (xxx);
    350345
    351     /* In Qt4 there is not bitblt anymore. So
    352      * we create a qpainter object and paint on
    353      * that. Todo: Do some performance test. */
    354 //#warning port me: do it faster?
    355346    QPainter painter (mView->viewport());
    356     painter.drawImage (r.x(), r.y(), mImg,
    357                        r.x() + mView->contentsX(),
    358                        r.y() + mView->contentsY(),
    359                        r.width(), r.height());
    360 //    if (r.width() < mWdt * 2 / 3)
    361 //    {
    362 //        /* this method is faster for narrow updates */
    363 //        mPM.convertFromImage (mImg.copy (r.x() + mView->contentsX(),
    364 //                                         r.y() + mView->contentsY(),
    365 //                                         r.width(), r.height()));
    366 //        ::bitBlt (mView->viewport(), r.x(), r.y(),
    367 //                  &mPM, 0, 0,
    368 //                  r.width(), r.height(),
    369 //                  Qt::CopyROP, TRUE);
    370 //    }
    371 //    else
    372 //    {
    373 //        /* this method is faster for wide updates */
    374 //        mPM.convertFromImage (QImage (mImg.scanLine (r.y() + mView->contentsY()),
    375 //                                      mImg.width(), r.height(), mImg.depth(),
    376 //                                      0, 0, QImage::LittleEndian));
    377 //        ::bitBlt (mView->viewport(), r.x(), r.y(),
    378 //                  &mPM, r.x() + mView->contentsX(), 0,
    379 //                  r.width(), r.height(),
    380 //                  Qt::CopyROP, TRUE);
    381 //    }
     347
     348    if (r.width() < mWdt * 2 / 3)
     349    {
     350        /* This method is faster for narrow updates */
     351        mPM = QPixmap::fromImage (mImg.copy (r.x() + mView->contentsX(),
     352                                             r.y() + mView->contentsY(),
     353                                             r.width(), r.height()));
     354        painter.drawPixmap (r.x(), r.y(), mPM);
     355    }
     356    else
     357    {
     358        /* This method is faster for wide updates */
     359        mPM = QPixmap::fromImage (QImage (mImg.scanLine (r.y() + mView->contentsY()),
     360                                  mImg.width(), r.height(), mImg.bytesPerLine(),
     361                                  QImage::Format_RGB32));
     362        painter.drawPixmap (r.x() + mView->contentsX(), r.y(), mPM);
     363    }
    382364
    383365    FRAMEBUF_DEBUG_STOP (xxx, r.width(), r.height());
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