Changeset 11942 in vbox for trunk/src/VBox/Frontends/VirtualBox4
- Timestamp:
- Sep 1, 2008 4:56:03 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 35824
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleView.cpp
r11926 r11942 3507 3507 3508 3508 /* Create a ARGB image out of the shape data. */ 3509 /* @todo: The following isn't nice but is working. Will fix this tomorrow. */ 3509 3510 QImage image (me->width(), me->height(), QImage::Format_ARGB32); 3510 3511 unsigned char alpha; 3512 const uint8_t *pbSrcMask = (const uint8_t *)srcAndMaskPtr; 3513 unsigned cbSrcMaskLine = RT_ALIGN(me->width(), 8) / 8; 3511 3514 for (unsigned int y = 0; y < me->height(); ++y) 3515 { 3512 3516 for (unsigned int x = 0; x < me->width(); ++x) 3513 3517 { 3514 unsigned int color = ((unsigned int*)srcShapePtr)[y*me->width()+x]; 3518 int i = y*me->width()+x; 3519 unsigned int color = ((unsigned int*)srcShapePtr)[i]; 3515 3520 if (me->hasAlpha()) 3516 3521 alpha = qAlpha (color); 3517 3522 else 3518 alpha = 0xff; 3523 { 3524 // alpha = !srcAndMaskPtr[i] ? 0xff : 0x00; 3525 if (!(pbSrcMask[x / 8] & (1 << (7 - (x % 8))))) 3526 alpha = 0xff; 3527 else 3528 { 3529 if (qRed (color) == 0xff && 3530 qGreen (color) == 0xff && 3531 qBlue (color) == 0xff) 3532 { 3533 color = 0; 3534 alpha = 0xff; 3535 }else 3536 { 3537 color = 0; 3538 alpha = 0; 3539 } 3540 } 3541 } 3519 3542 image.setPixel (x, y, qRgba (qRed (color), qGreen (color), qBlue (color), alpha)); 3520 3543 } 3544 pbSrcMask += cbSrcMaskLine; 3545 } 3521 3546 /* Invert the mask channel if there is one */ 3522 3547 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 }3548 // if (!me->hasAlpha()) 3549 // { 3550 // uchar* pu8DstData = (uchar*)alloca(me->width() * me->height()); 3551 // unsigned int i = 0; 3552 // while (i < me->width() * me->height()) 3553 // { 3554 // pu8DstData[i] = !srcAndMaskPtr[i] ? 0xff : 0x00; 3555 // ++i; 3556 // } 3557 // QBitmap bitmap = QBitmap::fromData (QSize (me->width(), me->height()), 3558 // pu8DstData, QImage::Format_Mono); 3559 // /* Set the mask to the pixmap */ 3560 // pixmap.setMask (bitmap); 3561 // } 3537 3562 // printf ("has alpha %d- %d %d\n", me->hasAlpha(), me->width(), me->height()); 3538 3563 /* Set the new cursor */
Note:
See TracChangeset
for help on using the changeset viewer.