Exemple #1
0
/*
 * Display driver callbacks.
 */
BOOL APIENTRY VBoxDispDrvSetPalette(DHPDEV dhpdev, PALOBJ *ppalo, FLONG fl, ULONG iStart, ULONG cColors)
{
    BYTE aClut[MAX_CLUT_SIZE];
    PVIDEO_CLUT pClut = (PVIDEO_CLUT) aClut;
    PVIDEO_CLUTDATA pData = &pClut->LookupTable[0].RgbArray;
    PVBOXDISPDEV pDev = (PVBOXDISPDEV)dhpdev;
    NOREF(fl);
    int rc;
    LOGF_ENTER();

    pClut->NumEntries = (USHORT) cColors;
    pClut->FirstEntry = (USHORT) iStart;

    /* Copy PALOBJ colors to PVIDEO_CLUT */
    if (cColors != PALOBJ_cGetColors(ppalo, iStart, cColors, (ULONG*) pData))
    {
        WARN(("PALOBJ_cGetColors failed"));
        return FALSE;
    }

    /* Set reserved bytes to 0 and perform shifting if needed */
    for (ULONG idx=0; idx<cColors; ++idx)
    {
        pData[idx].Unused = 0;
        if (pDev->mode.ulPaletteShift)
        {
            pData[idx].Red >>= pDev->mode.ulPaletteShift;
            pData[idx].Green >>= pDev->mode.ulPaletteShift;
            pData[idx].Blue >>= pDev->mode.ulPaletteShift;
        }
    }
Exemple #2
0
BOOL DrvSetPalette (DHPDEV dhpdev,
                    PALOBJ *ppalo,
                    FLONG  fl,
                    ULONG  iStart,
                    ULONG  cColors)
{
    BYTE ajClutSpace[MAX_CLUT_SIZE];
    PVIDEO_CLUT pScreenClut = (PVIDEO_CLUT) ajClutSpace;
    PPALETTEENTRY pape;
    ULONG ulTemp = 256;

    UNREFERENCED_PARAMETER (fl);

    DISPBLTDBG ((1, "TGA.DLL!DrvSetPalette - Entry\n"));
    DISPBLTDBG ((2, "TGA.DLL!DrvSetPalette - ppalo [%x], fl [%x], iStart [%d], cColors [%d]\n", ppalo, fl, iStart, cColors));

    // Fill in pScreenClut header info

    pScreenClut->NumEntries = (USHORT)cColors;
    pScreenClut->FirstEntry = (USHORT)iStart;

    pape = (PPALETTEENTRY) (pScreenClut->LookupTable);

    if (cColors != PALOBJ_cGetColors (ppalo, iStart, cColors, (PULONG) pape))
    {
        RIP ("DISP DrvSetPalette failed PALOBJ_cGetColors\n");
        return FALSE;
    }

    // Set the high reserved byte in each palette entry to 0.

    while (cColors--)
        pape[cColors].peFlags = 0;

    // Set palette registers

    if (EngDeviceIoControl (((PPDEV)(dhpdev))->hDriver,
                           IOCTL_VIDEO_SET_COLOR_REGISTERS,
                           pScreenClut,
                           MAX_CLUT_SIZE,
                           NULL,
                           0,
                          &cColors))
    {
        RIP ("DISP DrvSetPalette failed EngDeviceIoControl\n");
        return FALSE;
    }

    DISPBLTDBG ((1, "TGA.DLL!DrvSetPalette - Exit\n"));

    return TRUE;
}