Changeset 7776 in vbox for trunk/src/VBox
- Timestamp:
- Apr 7, 2008 3:54:46 PM (17 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r7774 r7776 104 104 #include "Builtins.h" 105 105 #include "Builtins2.h" 106 106 107 107 108 /******************************************************************************* … … 145 146 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 146 147 }; 148 147 149 148 150 #ifndef VBOX_DEVICE_STRUCT_TESTCASE … … 3581 3583 case LOGO_CMD_SET_OFFSET: 3582 3584 pData->offLogoData = u32; 3583 break;3585 break; 3584 3586 case LOGO_CMD_SET_X: 3585 pData-> LogoX= u32;3586 break;3587 pData->xLogo = u32; 3588 break; 3587 3589 case LOGO_CMD_SET_Y: 3588 pData-> LogoY= u32;3589 break;3590 pData->yLogo = u32; 3591 break; 3590 3592 case LOGO_CMD_SET_WIDTH: 3591 pData-> LogoWidth= u32;3592 break;3593 pData->cxLogo = u32; 3594 break; 3593 3595 case LOGO_CMD_SET_HEIGHT: 3594 pData-> LogoHeight= u32;3595 break;3596 pData->cyLogo = u32; 3597 break; 3596 3598 case LOGO_CMD_SET_DEPTH: 3597 pData-> LogoDepth= u32;3598 break;3599 pData->cBitsLogo = u32; 3600 break; 3599 3601 case LOGO_CMD_SET_PALSIZE: 3600 pData-> PalSize= u32;3601 break;3602 pData->cbPal = u32; 3603 break; 3602 3604 default: 3603 3605 Log(("vbeIOPortWriteCMDLogo: invalid command %d\n", pData->LogoCommand)); … … 3621 3623 case LOGO_CMD_SET_PALSIZE: 3622 3624 pData->LogoCommand = u32 & 0xFF00; 3623 break; 3625 break; 3626 3624 3627 case LOGO_CMD_SET_DEFAULT: 3625 3628 pData->BmpImage = LOGO_IMAGE_DEFAULT; 3626 3629 pData->offLogoData = 0; 3627 3630 pData->LogoCommand = LOGO_CMD_NOP; 3628 break; 3631 break; 3632 3629 3633 case LOGO_CMD_SET_PAL: 3630 3634 { … … 3636 3640 pu8Pal = (uint8_t *)&g_abVgaDefBiosLogo[pData->offLogoData]; 3637 3641 3638 for (i = 0; i <= pData-> PalSize; i++)3642 for (i = 0; i <= pData->cbPal; i++) 3639 3643 { 3640 uint8_t b; 3641 uint32_t p = 0; 3644 uint32_t u32Pal = 0; 3642 3645 3643 3646 for (j = 0; j < 3; j++) 3644 3647 { 3645 p <<= 8;3646 b = (uint8_t)*pu8Pal++;3647 p|= b;3648 uint8_t b = *pu8Pal++; 3649 u32Pal <<= 8; 3650 u32Pal |= b; 3648 3651 } 3649 *pu8Pal++;3650 3651 pData-> Palette[i] = p;3652 pu8Pal++; /* skip unused byte */ 3653 3654 pData->au32Palette[i] = u32Pal; 3652 3655 } 3656 break; 3653 3657 } 3654 break; 3658 3655 3659 case LOGO_CMD_CLS: 3656 3660 { … … 3662 3666 *pu32TmpPtr++ = 0; 3663 3667 } 3668 break; 3664 3669 } 3665 break; 3670 3666 3671 case LOGO_CMD_SHOW_BMP: 3667 3672 case LOGO_CMD_SHOW_TEXT: … … 3672 3677 * Determin bytes per pixel in the destination buffer. 3673 3678 */ 3674 size_t scr_cx = LOGO_MAX_WIDTH;3675 size_t scr_cy = LOGO_MAX_HEIGHT;3676 3677 3679 if ((u32 & 0xFF00) == LOGO_CMD_SHOW_TEXT) 3678 3680 { 3679 pData-> LogoX= LOGO_F12TEXT_X;3680 pData-> LogoY= LOGO_F12TEXT_Y;3681 3682 pData-> LogoWidth= LOGO_F12TEXT_WIDTH;3683 pData-> LogoHeight= LOGO_F12TEXT_HEIGHT;3684 pData-> LogoDepth= 1;3681 pData->xLogo = LOGO_F12TEXT_X; 3682 pData->yLogo = LOGO_F12TEXT_Y; 3683 3684 pData->cxLogo = LOGO_F12TEXT_WIDTH; 3685 pData->cyLogo = LOGO_F12TEXT_HEIGHT; 3686 pData->cBitsLogo = 1; 3685 3687 } 3686 3688 3687 uint32_t cx = pData-> LogoWidth;3688 uint32_t cy = pData-> LogoHeight;3689 uint32_t cx = pData->cxLogo; 3690 uint32_t cy = pData->cyLogo; 3689 3691 const uint8_t *pu8Src; 3690 3692 uint8_t *pu8TmpPtr; … … 3695 3697 uint16_t i; 3696 3698 3697 pu8Dst += pData-> LogoX * 4 + pData->LogoY* cbLineDst;3698 3699 switch (pData-> LogoDepth)3699 pu8Dst += pData->xLogo * 4 + pData->yLogo * cbLineDst; 3700 3701 switch (pData->cBitsLogo) 3700 3702 { 3701 3703 case 1: 3702 pu8Dst += pData-> LogoHeight* cbLineDst;3704 pu8Dst += pData->cyLogo * cbLineDst; 3703 3705 cbPadBytes = 0; 3704 break; 3706 break; 3707 3705 3708 case 4: 3706 if (((pData-> LogoWidth % 8) == 0) || ((pData->LogoWidth% 8) > 6))3709 if (((pData->cxLogo % 8) == 0) || ((pData->cxLogo % 8) > 6)) 3707 3710 cbPadBytes = 0; 3708 else if ((pData-> LogoWidth% 8) <= 2)3711 else if ((pData->cxLogo % 8) <= 2) 3709 3712 cbPadBytes = 3; 3710 else if ((pData-> LogoWidth% 8) <= 4)3713 else if ((pData->cxLogo % 8) <= 4) 3711 3714 cbPadBytes = 2; 3712 3715 else 3713 3716 cbPadBytes = 1; 3714 break; 3717 break; 3718 3715 3719 case 8: 3716 cbPadBytes = ((pData->LogoWidth % 4) == 0) ? 0 : (4 - (pData->LogoWidth % 4)); 3717 break; 3720 cbPadBytes = ((pData->cxLogo % 4) == 0) ? 0 : (4 - (pData->cxLogo % 4)); 3721 break; 3722 3718 3723 case 24: 3719 3724 cbPadBytes = cx % 4; 3720 break;3725 break; 3721 3726 } 3722 3727 3723 if (pData-> LogoDepth== 1)3728 if (pData->cBitsLogo == 1) 3724 3729 pu8Src = &g_abLogoF12BootText[0]; 3725 3730 else … … 3737 3742 pu8TmpPtr = pu8Dst; 3738 3743 3739 if (pData-> LogoDepth!= 1)3744 if (pData->cBitsLogo != 1) 3740 3745 j = 0; 3741 3746 … … 3744 3749 uint8_t pix; 3745 3750 3746 switch (pData-> LogoDepth)3751 switch (pData->cBitsLogo) 3747 3752 { 3748 3753 case 1: … … 3759 3764 *pu8TmpPtr++; 3760 3765 3761 if (j++ >= 7) j = 0; 3766 j = (j + 1) % 8; 3767 break; 3762 3768 } 3763 break; 3769 3764 3770 case 4: 3765 3771 { 3766 uint32_t p;3767 3768 3772 if (!j) 3769 3773 c = *pu8Src++; … … 3772 3776 c <<= 4; 3773 3777 3774 p = pData->Palette[pix];3775 3776 pix = ( p>> 16) & 0xFF;3778 uint32_t u32Pal = pData->au32Palette[pix]; 3779 3780 pix = (u32Pal >> 16) & 0xFF; 3777 3781 *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS; 3778 pix = ( p>> 8) & 0xFF;3782 pix = (u32Pal >> 8) & 0xFF; 3779 3783 *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS; 3780 pix = p& 0xFF;3784 pix = u32Pal & 0xFF; 3781 3785 *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS; 3782 3786 *pu8TmpPtr++; 3783 3787 3784 if (j++ >= 1) j = 0; 3788 j = (j + 1) % 2; 3789 break; 3785 3790 } 3786 break; 3791 3787 3792 case 8: 3788 3793 { 3789 uint32_t p; 3790 3791 p = pData->Palette[*pu8Src++]; 3792 3793 pix = (p >> 16) & 0xFF; 3794 uint32_t u32Pal = pData->au32Palette[*pu8Src++]; 3795 3796 pix = (u32Pal >> 16) & 0xFF; 3794 3797 *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS; 3795 pix = ( p>> 8) & 0xFF;3798 pix = (u32Pal >> 8) & 0xFF; 3796 3799 *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS; 3797 pix = p& 0xFF;3800 pix = u32Pal & 0xFF; 3798 3801 *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS; 3799 3802 *pu8TmpPtr++; 3803 break; 3800 3804 } 3801 break; 3805 3802 3806 case 24: 3803 3807 *pu8TmpPtr++ = *pu8Src++ * cbStep / LOGO_SHOW_STEPS; … … 3805 3809 *pu8TmpPtr++ = *pu8Src++ * cbStep / LOGO_SHOW_STEPS; 3806 3810 *pu8TmpPtr++; 3807 break;3811 break; 3808 3812 } 3809 3813 } … … 3816 3820 * Invalidate the area. 3817 3821 */ 3818 pData->pDrv->pfnUpdateRect(pData->pDrv, 0, 0, scr_cx, scr_cy); 3822 /** @todo cannot call this here. Just set the appropriate dirty bits. */ 3823 pData->pDrv->pfnUpdateRect(pData->pDrv, 0, 0, LOGO_MAX_WIDTH, LOGO_MAX_WIDTH); 3819 3824 3820 3825 pData->LogoCommand = LOGO_CMD_NOP; 3826 break; 3821 3827 } 3822 break; 3828 3823 3829 default: 3824 3830 Log(("vbeIOPortWriteCMDLogo: invalid command %d\n", u32)); … … 5449 5455 if (VBOX_SUCCESS(rc)) 5450 5456 { 5451 if (cbFile > 0 )5457 if (cbFile > 0 && cbFile < 32*_1M) 5452 5458 LogoHdr.cbLogo = (uint32_t)cbFile; 5453 5459 else … … 5461 5467 */ 5462 5468 LogRel(("vgaR3Construct: Failed to open logo file '%s', rc=%Vrc!\n", pData->pszLogoFile, rc)); 5463 RTFileClose(FileLogo); 5469 if (FileLogo != NIL_RTFILE) 5470 RTFileClose(FileLogo); 5464 5471 FileLogo = NIL_RTFILE; 5465 5472 MMR3HeapFree(pData->pszLogoFile); -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r7774 r7776 331 331 uint8_t Padding8; /**< Alignment padding. */ 332 332 /** Logo X. */ 333 uint16_t LogoX;333 uint16_t xLogo; 334 334 /** Logo Y. */ 335 uint16_t LogoY;335 uint16_t yLogo; 336 336 /** Logo width. */ 337 uint16_t LogoWidth;337 uint16_t cxLogo; 338 338 /** Logo height. */ 339 uint16_t LogoHeight;339 uint16_t cyLogo; 340 340 /** Logo depth. */ 341 uint16_t LogoDepth;341 uint16_t cBitsLogo; 342 342 /** Palette size. */ 343 uint16_t PalSize;343 uint16_t cbPal; 344 344 /** Palette data. */ 345 uint32_t Palette[256];345 uint32_t au32Palette[256]; 346 346 #endif /* VBOX */ 347 347 } VGAState;
Note:
See TracChangeset
for help on using the changeset viewer.