VirtualBox

Changeset 31318 in vbox


Ignore:
Timestamp:
Aug 2, 2010 4:19:19 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
64345
Message:

FE/Qt4-OSX: next try on fixing scale mode on OSX

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
2 edited

Legend:

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

    r31233 r31318  
    184184        {
    185185            CGImageRef pauseImg = ::darwinToCGImageRef(&m_pMachineView->pauseShot());
    186             subImage = CGImageCreateWithImageInRect(pauseImg, CGRectMake (m_pMachineView->contentsX(), m_pMachineView->contentsY(), m_pMachineView->visibleWidth(), m_pMachineView->visibleHeight()));
     186            subImage = CGImageCreateWithImageInRect(pauseImg, CGRectMake(m_pMachineView->contentsX(), m_pMachineView->contentsY(), m_pMachineView->visibleWidth(), m_pMachineView->visibleHeight()));
    187187            CGImageRelease(pauseImg);
    188188        }
    189189        else
    190             subImage = CGImageCreateWithImageInRect(m_image, CGRectMake (m_pMachineView->contentsX(), m_pMachineView->contentsY(), m_pMachineView->visibleWidth(), m_pMachineView->visibleHeight()));
     190            subImage = CGImageCreateWithImageInRect(m_image, CGRectMake(m_pMachineView->contentsX(), m_pMachineView->contentsY(), m_pMachineView->visibleWidth(), m_pMachineView->visibleHeight()));
    191191        Assert(VALID_PTR(subImage));
    192192        /* Clear the background (Make the rect fully transparent) */
     
    247247         * of the bounding box of the current paint event */
    248248        CGRect ir = ::darwinToCGRect(aEvent->rect());
    249         CGRect is = CGRectMake(CGRectGetMinX(ir) + m_pMachineView->contentsX(), CGRectGetMinY(ir) + m_pMachineView->contentsY(), CGRectGetWidth(ir), CGRectGetHeight(ir));
     249        CGRect is = CGRectMake(CGRectGetMinX(ir), CGRectGetMinY(ir), CGRectGetWidth(ir), CGRectGetHeight(ir));
    250250
    251251        double iw = 1.0;
     
    275275            is.size.height = (int)(is.size.height * ih) + 2;
    276276            /* Make sure the size is within the image boundaries */
    277             is = CGRectIntersection(is, CGRectMake(0, 0, CGImageGetWidth(m_image), CGImageGetHeight(m_image)));
     277            CGRect is1 = CGRectIntersection(is, CGRectMake(0, 0, CGImageGetWidth(m_image), CGImageGetHeight(m_image)));
    278278            /* Cause we probably changed the rectangle to update in the origin
    279279             * coordinate system, we have to recalculate the update rectangle
    280280             * for the screen coordinates as well. Please note that this has to
    281281             * be in double precision. */
    282             ir.origin.x = is.origin.x / iw;
    283             ir.origin.y = is.origin.y / ih;
    284             ir.size.width = is.size.width / iw;
    285             ir.size.height = is.size.height / ih;
    286             /* Create the sub image */
    287             subImage = CGImageCreateWithImageInRect(m_image, is);
     282            ir.origin.x = is1.origin.x / iw;
     283            ir.origin.y = is1.origin.y / ih;
     284            ir.size.width = is1.size.width / iw;
     285            ir.size.height = is1.size.height / ih;
     286            /* Create the sub image. Note: The copy step is necessary otherwise
     287             * strange things happens especially on Snow Leopard. No idea why. */
     288            CGImageRef tmpImage = CGImageCreateWithImageInRect(m_image, is1);
     289            subImage = CGImageCreateCopy(tmpImage);
     290            CGImageRelease(tmpImage);
    288291        }
    289292        if (subImage)
     
    306309            CGContextSetInterpolationQuality(ctx, kCGInterpolationHigh);
    307310            /* Draw the image. */
    308 
    309311            CGContextDrawImage(ctx, ::darwinFlipCGRect(ir, CGRectGetHeight(viewRect)), subImage);
    310312            CGImageRelease(subImage);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp

    r31299 r31318  
    197197             * catch all rounding errors. (use 1 time the ratio factor and
    198198             * round down on top/left, but round up for the width/height) */
    199             viewport()->repaint((int)(pPaintEvent->x() * xRatio) - ((int)xRatio),
    200                                 (int)(pPaintEvent->y() * yRatio) - ((int)yRatio),
    201                                 (int)(pPaintEvent->width() * xRatio) + ((int)xRatio + 1) * 2,
    202                                 (int)(pPaintEvent->height() * yRatio) + ((int)yRatio + 1) * 2);
     199            viewport()->repaint((int)(pPaintEvent->x() * xRatio) - ((int)xRatio) - 1,
     200                                (int)(pPaintEvent->y() * yRatio) - ((int)yRatio) - 1,
     201                                (int)(pPaintEvent->width() * xRatio) + ((int)xRatio + 2) * 2,
     202                                (int)(pPaintEvent->height() * yRatio) + ((int)yRatio + 2) * 2);
    203203            pEvent->accept();
    204204            return true;
Note: See TracChangeset for help on using the changeset viewer.

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