VirtualBox

Changeset 65345 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jan 17, 2017 12:58:46 AM (8 years ago)
Author:
vboxsync
Message:

VMSVGA: palette fix.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp

    r65305 r65345  
    11721172            /* Note! Using last_palette rather than palette here to preserve the VGA one. */
    11731173            STAM_REL_COUNTER_INC(&pThis->svga.StatRegPaletteRd);
    1174             *pu32 = pThis->last_palette[offReg];
     1174            uint32_t u32 = pThis->last_palette[offReg / 3];
     1175            switch (offReg % 3)
     1176            {
     1177                case 0: *pu32 = (u32 >> 16) & 0xff; break; /* red */
     1178                case 1: *pu32 = (u32 >>  8) & 0xff; break; /* green */
     1179                case 2: *pu32 =  u32        & 0xff; break; /* blue */
     1180            }
    11751181        }
    11761182        else
     
    17081714        else if ((offReg = idxReg - SVGA_PALETTE_BASE) < (uint32_t)SVGA_NUM_PALETTE_REGS)
    17091715        {
    1710             /* Note! Using last_palette rather than palette here to preserve the VGA one. */
     1716            /* Note! Using last_palette rather than palette here to preserve the VGA one.
     1717                     Btw, see rgb_to_pixel32.  */
    17111718            STAM_REL_COUNTER_INC(&pThis->svga.StatRegPaletteWr);
    1712             pThis->last_palette[offReg] = (uint8_t)u32;
     1719            u32 &= 0xff;
     1720            uint32_t uRgb = pThis->last_palette[offReg / 3];
     1721            switch (offReg % 3)
     1722            {
     1723                case 0: uRgb = (uRgb & UINT32_C(0x0000ffff)) | (u32 << 16); break; /* red */
     1724                case 1: uRgb = (uRgb & UINT32_C(0x00ff00ff)) | (u32 <<  8); break; /* green */
     1725                case 2: uRgb = (uRgb & UINT32_C(0x00ffff00)) |  u32       ; break; /* blue */
     1726            }
     1727            pThis->last_palette[offReg / 3] = uRgb;
    17131728        }
    17141729        else
     
    24572472                    {
    24582473                        uintptr_t const idxPal = pbSrc[x] * 3;
    2459                         if ((  pThis->last_palette[idxPal + 2]
    2460                              | pThis->last_palette[idxPal + 1]
    2461                              | pThis->last_palette[idxPal + 0]) > 0xfc)
     2474                        if (((   pThis->last_palette[idxPal]
     2475                              | (pThis->last_palette[idxPal] >>  8)
     2476                              | (pThis->last_palette[idxPal] >> 16)) & 0xff) > 0xfc)
    24622477                            bDst |= fBit;
    24632478                        fBit <<= 1;
     
    25812596                for (uint32_t x = 0; x < cx; x++)
    25822597                {
    2583                     uintptr_t const idxPal = pbSrc[x] * 3;
    2584                     *pu32Dst++ = RT_MAKE_U32_FROM_U8(pThis->last_palette[idxPal + 2],
    2585                                                      pThis->last_palette[idxPal + 1],
    2586                                                      pThis->last_palette[idxPal + 0], 0);
     2598                    uint32_t u = pThis->last_palette[pbSrc[x]];
     2599                    *pu32Dst++ = u;//RT_MAKE_U32_FROM_U8(RT_BYTE1(u), RT_BYTE2(u), RT_BYTE3(u), 0);
    25872600                }
    25882601                pbSrc += cbSrcXorLine;
Note: See TracChangeset for help on using the changeset viewer.

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