Changeset 11926 in vbox for trunk/src/VBox/Frontends/VirtualBox4
- Timestamp:
- Sep 1, 2008 3:23:56 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 35802
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleView.cpp
r11882 r11926 39 39 #include <QStatusBar> 40 40 #include <QPainter> 41 #include <QBitmap> 41 42 42 43 #ifdef Q_WS_WIN … … 827 828 828 829 #ifdef Q_WS_MAC 829 DarwinCursorClearHandle (&mDarwinCursor);830 // DarwinCursorClearHandle (&mDarwinCursor); 830 831 #endif 831 832 } … … 2816 2817 #ifdef Q_WS_MAC /** @todo Christian, can you look at this. It causes flickering and IIRC is really a Qt3 workaround which probably isn't needed. If it is needed it needs to be redone. */ 2817 2818 /* Update the mouse cursor; this is a bit excessive really... */ 2818 if (!DarwinCursorIsNull (&mDarwinCursor))2819 DarwinCursorSet (&mDarwinCursor);2819 // if (!DarwinCursorIsNull (&mDarwinCursor)) 2820 // DarwinCursorSet (&mDarwinCursor); 2820 2821 #endif 2821 2822 if (mMainWnd->isTrueFullscreen()) … … 3505 3506 #elif defined(Q_WS_MAC) 3506 3507 3508 /* Create a ARGB image out of the shape data. */ 3509 QImage image (me->width(), me->height(), QImage::Format_ARGB32); 3510 unsigned char alpha; 3511 for (unsigned int y = 0; y < me->height(); ++y) 3512 for (unsigned int x = 0; x < me->width(); ++x) 3513 { 3514 unsigned int color = ((unsigned int*)srcShapePtr)[y*me->width()+x]; 3515 if (me->hasAlpha()) 3516 alpha = qAlpha (color); 3517 else 3518 alpha = 0xff; 3519 image.setPixel (x, y, qRgba (qRed (color), qGreen (color), qBlue (color), alpha)); 3520 } 3521 /* Invert the mask channel if there is one */ 3522 QPixmap pixmap (QPixmap::fromImage (image)); 3523 if (!me->hasAlpha()) 3524 { 3525 uchar* pu8DstData = (uchar*)alloca(me->width() * me->height()); 3526 unsigned int i = 0; 3527 while (i < me->width() * me->height()) 3528 { 3529 pu8DstData[i] = 0xff-srcAndMaskPtr[i]; 3530 ++i; 3531 } 3532 QBitmap bitmap = QBitmap::fromData (QSize (me->width(), me->height()), 3533 pu8DstData, QImage::Format_Mono); 3534 /* Set the mask to the pixmap */ 3535 pixmap.setMask (bitmap); 3536 } 3537 // printf ("has alpha %d- %d %d\n", me->hasAlpha(), me->width(), me->height()); 3538 /* Set the new cursor */ 3539 QCursor cursor (pixmap, 3540 me->xHot(), me->yHot()); 3541 viewport()->setCursor (cursor); 3542 ok = true; 3507 3543 /* 3508 3544 * Qt3/Mac only supports black/white cursors and it offers no way … … 3510 3546 * Which means we're pretty much forced to do it our own way. 3511 3547 */ 3512 int rc;3513 3514 /* dispose of the old cursor. */3515 if (!DarwinCursorIsNull (&mDarwinCursor))3516 {3517 rc = DarwinCursorDestroy (&mDarwinCursor);3518 AssertRC (rc);3519 }3520 3521 /* create the new cursor */3522 rc = DarwinCursorCreate (me->width(), me->height(), me->xHot(), me->yHot(), me->hasAlpha(),3523 srcAndMaskPtr, srcShapePtr, &mDarwinCursor);3524 AssertRC (rc);3525 if (VBOX_SUCCESS (rc))3526 {3527 /** @todo check current mouse coordinates. */3528 rc = DarwinCursorSet (&mDarwinCursor);3529 AssertRC (rc);3530 }3531 ok = VBOX_SUCCESS (rc);3548 // int rc; 3549 // 3550 // /* dispose of the old cursor. */ 3551 // if (!DarwinCursorIsNull (&mDarwinCursor)) 3552 // { 3553 // rc = DarwinCursorDestroy (&mDarwinCursor); 3554 // AssertRC (rc); 3555 // } 3556 // 3557 // /* create the new cursor */ 3558 // rc = DarwinCursorCreate (me->width(), me->height(), me->xHot(), me->yHot(), me->hasAlpha(), 3559 // srcAndMaskPtr, srcShapePtr, &mDarwinCursor); 3560 // AssertRC (rc); 3561 // if (VBOX_SUCCESS (rc)) 3562 // { 3563 // /** @todo check current mouse coordinates. */ 3564 // rc = DarwinCursorSet (&mDarwinCursor); 3565 // AssertRC (rc); 3566 // } 3567 // ok = VBOX_SUCCESS (rc); 3532 3568 NOREF (srcShapePtrScan); 3533 3569
Note:
See TracChangeset
for help on using the changeset viewer.