VirtualBox

Changeset 33189 in vbox for trunk


Ignore:
Timestamp:
Oct 18, 2010 9:57:33 AM (14 years ago)
Author:
vboxsync
Message:

FE/Qt4: Make sure there is enough room when painting the preview bg/glossy image.

File:
1 edited

Legend:

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

    r32431 r33189  
    148148    QRect cr = contentsRect();
    149149    /* Draw the background with the monitor and the shadow */
    150     painter.drawImage(cr.x(), cr.y(), *m_pbgImage);
     150    if (m_pbgImage)
     151        painter.drawImage(cr.x(), cr.y(), *m_pbgImage);
    151152//    painter.setPen(Qt::red);
    152153//    painter.drawRect(cr.adjusted(0, 0, -1, -1));
     
    185186    }
    186187    /* Draw the glossy overlay last */
    187     painter.drawImage(m_vRect.x(), m_vRect.y(), *m_pGlossyImg);
     188    if (m_pGlossyImg)
     189        painter.drawImage(m_vRect.x(), m_vRect.y(), *m_pGlossyImg);
    188190}
    189191
     
    388390void UIVMPreviewWindow::repaintBGImages()
    389391{
     392    /* Delete the old images */
     393    if (m_pbgImage)
     394        delete m_pbgImage;
     395    if (m_pGlossyImg)
     396        delete m_pGlossyImg;
     397
     398    /* Check that there is enough room for our fancy stuff. If not we just
     399     * draw nothing. */
     400    QRect cr = contentsRect();
     401    if (   cr.width()  < 30
     402        || cr.height() < 30)
     403        return;
     404
    390405    QPalette pal = palette();
    391     QRect cr = contentsRect();
    392406    m_wRect = cr.adjusted(10, 10, -10, -10);
    393407    m_vRect = m_wRect.adjusted(m_vMargin, m_vMargin, -m_vMargin, -m_vMargin).adjusted(-3, -3, 3, 3);
     
    425439#endif
    426440    /* Make a copy of the new bg image */
    427     if (m_pbgImage)
    428         delete m_pbgImage;
    429441    m_pbgImage = new QImage(imageO);
    430442
     
    441453
    442454    /* Paint the glossy path on a QImage */
    443     if (m_pGlossyImg)
    444         delete m_pGlossyImg;
    445455    QImage image(m_vRect.size(), QImage::Format_ARGB32);
    446456    QColor bg1(Qt::white); /* We want blur to transparent _and_ white. */
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