VirtualBox

儲存庫 vbox 的更動 17175


忽略:
時間撮記:
2009-2-26 下午04:09:24 (16 年 以前)
作者:
vboxsync
訊息:

FE/Qt4: Quartz2D should be available for 64bit & Cocoa also. See what the 64bit build machine thinks about that.

位置:
trunk/src/VBox/Frontends/VirtualBox
檔案:
修改 8 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r17126 r17175  
    151151VirtualBox_DEFS           = VBOX_GUI_SEPARATE_VM_PROCESS
    152152VirtualBox_DEFS.debug     = VBOX_CHECK_STATE # QT_FATAL_ASSERT
    153 VirtualBox_DEFS.darwin    = VBOX_GUI_USE_QIMAGE VBOX_WITHOUT_QHTTP
     153VirtualBox_DEFS.darwin    = VBOX_GUI_USE_QUARTZ2D VBOX_GUI_USE_QIMAGE VBOX_WITHOUT_QHTTP
    154154ifndef VBOX_WITH_COCOA_QT
    155155VirtualBox_DEFS.darwin.x86= VBOX_GUI_USE_QUARTZ2D USE_HID_FOR_MODIFIERS
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxDockIconPreview.h

    r16484 r17175  
    2727
    2828#ifdef QT_MAC_USE_COCOA
     29# include <ApplicationServices/ApplicationServices.h>
    2930/** @todo include chocolatey headers... */
    3031#else
     
    4445
    4546    void updateDockOverlay();
    46 #ifndef QT_MAC_USE_COCOA
     47//#ifndef QT_MAC_USE_COCOA
    4748    void updateDockPreview (CGImageRef aVMImage);
    48 #endif
     49//#endif
    4950    void updateDockPreview (VBoxFrameBuffer *aFrameBuffer);
    5051
    5152private:
    52 #ifdef QT_MAC_USE_COCOA
     53//#ifdef QT_MAC_USE_COCOA
    5354    /** @todo Carbon -> Cocoa */
    54 #else
     55//#else
    5556    inline void initPreviewImages();
    5657    inline void initOverlayData (int aBitmapByteCount);
     
    6768        return aRect;
    6869    }
    69 #endif /* !QT_MAC_USE_COCOA */
     70//#endif /* !QT_MAC_USE_COCOA */
    7071
    7172    /* Private member vars */
    7273    VBoxConsoleWnd *mMainWnd;
    73 #ifdef QT_MAC_USE_COCOA
     74//#ifdef QT_MAC_USE_COCOA
    7475    /** @todo Carbon -> Cocoa */
    75 #else
     76//#else
    7677    const CGRect mDockIconRect;
    7778
     
    8889    CGRect mUpdateRect;
    8990    CGRect mMonitorRect;
    90 #endif
     91//#endif
    9192};
    9293
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils-darwin.h

    r17150 r17175  
    151151class QImage;
    152152
    153 # ifndef QT_MAC_USE_COCOA
    154 
    155 /* Asserts if a != noErr and prints the error code */
    156 #  define AssertCarbonOSStatus(a) AssertMsg ((a) == noErr, ("Carbon OSStatus: %d\n", static_cast<int> (a)))
    157 
    158153/* Converting stuff */
    159154CGImageRef darwinToCGImageRef (const QImage *aImage);
     
    171166    return static_cast<CGContext *> (aWidget->macCGHandle());
    172167}
     168
     169# ifndef QT_MAC_USE_COCOA
     170
     171/* Asserts if a != noErr and prints the error code */
     172#  define AssertCarbonOSStatus(a) AssertMsg ((a) == noErr, ("Carbon OSStatus: %d\n", static_cast<int> (a)))
     173
    173174
    174175/**
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp

    r17126 r17175  
    30313031         * an repaint only. All the magic clipping stuff is done
    30323032         * in the paint engine. */
     3033#ifndef QT_MAC_USE_COCOA
    30333034        HIViewReshapeStructure (::darwinToNativeView (console->viewport()));
     3035#endif /* QT_MAC_USE_COCOA */
    30343036//        HIWindowInvalidateShadow (::darwinToWindowRef (console->viewport()));
    30353037//        ReshapeCustomWindow (::darwinToWindowRef (this));
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBQuartz2D.cpp

    r17126 r17175  
    159159    Assert (mImage);
    160160
     161#ifndef QT_MAC_USE_COCOA
    161162    VBoxConsoleWnd *main = qobject_cast <VBoxConsoleWnd *> (vboxGlobal().mainWindow());
    162163    Assert (VALID_PTR (main));
     
    252253        HIViewDrawCGImage (ctx, &destRect, subImage);
    253254    }
     255#endif /* QT_MAC_USE_COCOA */
    254256}
    255257
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxDockIconPreview.cpp

    r17126 r17175  
    3232#endif
    3333
    34 #ifndef QT_MAC_USE_COCOA
     34//#ifndef QT_MAC_USE_COCOA
    3535/* Import private function to capture the window content of any given window. */
    3636CG_EXTERN_C_BEGIN
     
    4141CG_EXTERN void CGContextCopyWindowCaptureContentsToRect(CGContextRef c, CGRect dstRect, CGSConnectionID connection, CGSWindowID window, int zero);
    4242CG_EXTERN_C_END
    43 #endif /* !QT_MAC_USE_COCOA */
     43//#endif /* !QT_MAC_USE_COCOA */
    4444
    4545VBoxDockIconPreview::VBoxDockIconPreview (VBoxConsoleWnd *aMainWnd, const QPixmap& aOverlayImage)
    4646    :  mMainWnd (aMainWnd)
    47 #ifdef QT_MAC_USE_COCOA
    48 #else
     47//#ifdef QT_MAC_USE_COCOA
     48//#else
    4949     , mDockIconRect (CGRectMake (0, 0, 128, 128))
    5050     , mDockMonitor (NULL)
     
    5353     , mUpdateRect (CGRectMake (0, 0, 0, 0))
    5454     , mMonitorRect (CGRectMake (0, 0, 0, 0))
    55 #endif
     55//#endif
    5656{
    5757#ifdef QT_MAC_USE_COCOA
     
    8888}
    8989
    90 #ifndef QT_MAC_USE_COCOA
     90//#ifndef QT_MAC_USE_COCOA
    9191
    9292void VBoxDockIconPreview::initPreviewImages()
     
    158158}
    159159
    160 #endif /* !QT_MAC_USE_COCOA */
     160//#endif /* !QT_MAC_USE_COCOA */
    161161
    162162void VBoxDockIconPreview::updateDockOverlay()
     
    208208}
    209209
    210 #ifndef QT_MAC_USE_COCOA
     210//#ifndef QT_MAC_USE_COCOA
    211211void VBoxDockIconPreview::updateDockPreview (CGImageRef aVMImage)
    212212{
     
    251251    CGContextDrawImage (context, flipRect (iconRect), aVMImage);
    252252
     253#ifndef QT_MAC_USE_COCOA
    253254    /* Process the content of any external OpenGL window. */
    254255    WindowRef w = darwinToNativeWindow (mMainWnd);
     
    293294        }
    294295    }
     296#endif /* QT_MAC_USE_COCOA */
    295297
    296298    /* Draw the glossy overlay */
     
    306308    CGColorSpaceRelease (cs);
    307309}
    308 #endif /* !QT_MAC_USE_COCOA */
     310//#endif /* !QT_MAC_USE_COCOA */
    309311
    310312void VBoxDockIconPreview::updateDockPreview (VBoxFrameBuffer *aFrameBuffer)
    311313{
    312 #ifdef QT_MAC_USE_COCOA
    313 #else  /* !QT_MAC_USE_COCOA */
     314//#ifdef QT_MAC_USE_COCOA
     315//#else  /* !QT_MAC_USE_COCOA */
    314316    CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
    315317    Assert (cs);
     
    329331    CGDataProviderRelease (dp);
    330332    CGColorSpaceRelease (cs);
    331 #endif /* !QT_MAC_USE_COCOA */
    332 }
    333 
     333//#endif /* !QT_MAC_USE_COCOA */
     334}
     335
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin-carbon.cpp

    r17150 r17175  
    8585    QImage *qimg = (QImage *)info;
    8686    delete qimg;
    87 }
    88 
    89 /**
    90  * Converts a QPixmap to a CGImage.
    91  *
    92  * @returns CGImageRef for the new image. (Remember to release it when finished with it.)
    93  * @param   aPixmap     Pointer to the QPixmap instance to convert.
    94  */
    95 CGImageRef darwinToCGImageRef (const QImage *aImage)
    96 {
    97     QImage *imageCopy = new QImage (*aImage);
    98     /** @todo this code assumes 32-bit image input, the lazy bird convert image to 32-bit method is anything but optimal... */
    99     if (imageCopy->format() != QImage::Format_ARGB32)
    100         *imageCopy = imageCopy->convertToFormat (QImage::Format_ARGB32);
    101     Assert (!imageCopy->isNull());
    102 
    103     CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
    104     CGDataProviderRef dp = CGDataProviderCreateWithData (imageCopy, aImage->bits(), aImage->numBytes(), darwinDataProviderReleaseQImage);
    105 
    106     CGBitmapInfo bmpInfo = kCGImageAlphaFirst | kCGBitmapByteOrder32Host;
    107     CGImageRef ir = CGImageCreate (imageCopy->width(), imageCopy->height(), 8, 32, imageCopy->bytesPerLine(), cs,
    108                                    bmpInfo, dp, 0 /*decode */, 0 /* shouldInterpolate */,
    109                                    kCGRenderingIntentDefault);
    110     CGColorSpaceRelease (cs);
    111     CGDataProviderRelease (dp);
    112 
    113     Assert (ir);
    114     return ir;
    115 }
    116 
    117 /**
    118  * Converts a QPixmap to a CGImage.
    119  *
    120  * @returns CGImageRef for the new image. (Remember to release it when finished with it.)
    121  * @param   aPixmap     Pointer to the QPixmap instance to convert.
    122  */
    123 CGImageRef darwinToCGImageRef (const QPixmap *aPixmap)
    124 {
    125     return aPixmap->toMacCGImageRef();
    126 }
    127 
    128 /**
    129  * Loads an image using Qt and converts it to a CGImage.
    130  *
    131  * @returns CGImageRef for the new image. (Remember to release it when finished with it.)
    132  * @param   aSource     The source name.
    133  */
    134 CGImageRef darwinToCGImageRef (const char *aSource)
    135 {
    136     QPixmap qpm (QString(":/") + aSource);
    137     Assert (!qpm.isNull());
    138     return ::darwinToCGImageRef (&qpm);
    13987}
    14088
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.cpp

    r17150 r17175  
    2121
    2222#include "VBoxUtils-darwin.h"
     23
     24#include <iprt/assert.h>
    2325
    2426#include <QApplication>
     
    126128    painter.end();
    127129    return dragPixmap;
     130}
     131
     132/**
     133 * Callback for deleting the QImage object when CGImageCreate is done
     134 * with it (which is probably not until the returned CFGImageRef is released).
     135 *
     136 * @param   info        Pointer to the QImage.
     137 */
     138static void darwinDataProviderReleaseQImage (void *info, const void *, size_t)
     139{
     140    QImage *qimg = (QImage *)info;
     141    delete qimg;
     142}
     143
     144/**
     145 * Converts a QPixmap to a CGImage.
     146 *
     147 * @returns CGImageRef for the new image. (Remember to release it when finished with it.)
     148 * @param   aPixmap     Pointer to the QPixmap instance to convert.
     149 */
     150CGImageRef darwinToCGImageRef (const QImage *aImage)
     151{
     152    QImage *imageCopy = new QImage (*aImage);
     153    /** @todo this code assumes 32-bit image input, the lazy bird convert image to 32-bit method is anything but optimal... */
     154    if (imageCopy->format() != QImage::Format_ARGB32)
     155        *imageCopy = imageCopy->convertToFormat (QImage::Format_ARGB32);
     156    Assert (!imageCopy->isNull());
     157
     158    CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
     159    CGDataProviderRef dp = CGDataProviderCreateWithData (imageCopy, aImage->bits(), aImage->numBytes(), darwinDataProviderReleaseQImage);
     160
     161    CGBitmapInfo bmpInfo = kCGImageAlphaFirst | kCGBitmapByteOrder32Host;
     162    CGImageRef ir = CGImageCreate (imageCopy->width(), imageCopy->height(), 8, 32, imageCopy->bytesPerLine(), cs,
     163                                   bmpInfo, dp, 0 /*decode */, 0 /* shouldInterpolate */,
     164                                   kCGRenderingIntentDefault);
     165    CGColorSpaceRelease (cs);
     166    CGDataProviderRelease (dp);
     167
     168    Assert (ir);
     169    return ir;
     170}
     171
     172/**
     173 * Converts a QPixmap to a CGImage.
     174 *
     175 * @returns CGImageRef for the new image. (Remember to release it when finished with it.)
     176 * @param   aPixmap     Pointer to the QPixmap instance to convert.
     177 */
     178CGImageRef darwinToCGImageRef (const QPixmap *aPixmap)
     179{
     180    return aPixmap->toMacCGImageRef();
     181}
     182
     183/**
     184 * Loads an image using Qt and converts it to a CGImage.
     185 *
     186 * @returns CGImageRef for the new image. (Remember to release it when finished with it.)
     187 * @param   aSource     The source name.
     188 */
     189CGImageRef darwinToCGImageRef (const char *aSource)
     190{
     191    QPixmap qpm (QString(":/") + aSource);
     192    Assert (!qpm.isNull());
     193    return ::darwinToCGImageRef (&qpm);
    128194}
    129195
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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