VirtualBox

Changeset 3761 in vbox for trunk/src/VBox/Frontends/VBoxFB


Ignore:
Timestamp:
Jul 22, 2007 10:43:14 AM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
23084
Message:

Main/Frontends: Cleaned up IFramebuffer interface.

Location:
trunk/src/VBox/Frontends/VBoxFB
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxFB/Framebuffer.cpp

    r3614 r3761  
    4242    }
    4343    fbSurfaceLocked = 0;
    44     uint32_t colorDepth;
    45     GetColorDepth(&colorDepth);
    46     fbPitch = fbWidth * (colorDepth / 8);
     44    uint32_t bitsPerPixel;
     45    GetBitsPerPixel(&bitsPerPixel);
     46    fbPitch = fbWidth * (bitsPerPixel / 8);
    4747}
    4848
     
    138138}
    139139
    140 NS_IMETHODIMP VBoxDirectFB::GetColorDepth(uint32_t *colorDepth)
    141 {
    142     if (!colorDepth)
     140NS_IMETHODIMP VBoxDirectFB::GetBitsPerPixel(uint32_t *bitsPerPixel)
     141{
     142    if (!bitsPerPixel)
    143143        return NS_ERROR_INVALID_POINTER;
    144144    DFBSurfacePixelFormat pixelFormat;
     
    147147    {
    148148        case DSPF_RGB16:
    149             *colorDepth = 16;
     149            *bitsPerPixel = 16;
    150150            break;
    151151        case DSPF_RGB24:
    152             *colorDepth = 24;
     152            *bitsPerPixel = 24;
    153153            break;
    154154        case DSPF_RGB32:
    155             *colorDepth = 32;
     155            *bitsPerPixel = 32;
    156156            break;
    157157        default:
    158158            // not good! @@@AH do something!
    159             *colorDepth = 16;
    160     }
    161     return NS_OK;
    162 }
    163 
    164 NS_IMETHODIMP VBoxDirectFB::GetLineSize(uint32_t *lineSize)
    165 {
    166     if (!lineSize)
    167         return NS_ERROR_INVALID_POINTER;
    168     *lineSize = fbPitch;
    169     return NS_OK;
    170 }
    171 
    172 NS_IMETHODIMP VBoxDirectFB::COMGETTER(PixelFormat) (FramebufferPixelFormat_T *pixelFormat)
    173 {
    174     if (!lineSize)
    175         return NS_ERROR_INVALID_POINTER;
    176     *pixelFormat = FramebufferPixelFormat_PixelFormatOpaque;
     159            *bitsPerPixel = 16;
     160    }
     161    return NS_OK;
     162}
     163
     164NS_IMETHODIMP VBoxDirectFB::GetBytesPerLine(uint32_t *bytesPerLine)
     165{
     166    if (!bytesPerLine)
     167        return NS_ERROR_INVALID_POINTER;
     168    *bytesPerLine = fbPitch;
     169    return NS_OK;
     170}
     171
     172NS_IMETHODIMP VBoxDirectFB::COMGETTER(PixelFormat) (ULONG *pixelFormat)
     173{
     174    if (!pixelFormat)
     175        return NS_ERROR_INVALID_POINTER;
     176    *pixelFormat = FramebufferPixelFormat_FOURCC_RGB;
     177    return NS_OK;
     178}
     179
     180NS_IMETHODIMP VBoxDirectFB::COMGETTER(UsesGuestVRAM) (BOOL *usesGuestVRAM)
     181{
     182    if (!usesGuestVRAM)
     183        return NS_ERROR_INVALID_POINTER;
     184    *usesGuestVRAM = FALSE;
    177185    return NS_OK;
    178186}
     
    213221}
    214222
    215 NS_IMETHODIMP VBoxDirectFB::RequestResize(ULONG aScreenId, FramebufferPixelFormat_T pixelFormat, uint32_t vram, uint32_t lineSize, uint32_t w, uint32_t h,
    216                                            PRBool *finished)
     223NS_IMETHODIMP VBoxDirectFB::RequestResize(ULONG aScreenId, ULONG pixelFormat, uint32_t vram,
     224                                          uint32_t bitsPerPixel, uint32_t bytesPerLine,
     225                                          uint32_t w, uint32_t h,
     226                                          PRBool *finished)
    217227{
    218228    uint32_t needsLocking = fbSurfaceLocked;
    219     uint32_t colorDepth;
    220 
    221     GetColorDepth(&colorDepth);
     229    uint32_t bitsPerPixel;
     230
     231    GetBitsPerPixel(&bitsPerPixel);
    222232    printf("RequestResize: w = %d, h = %d, fbSurfaceLocked = %d\n", w, h, fbSurfaceLocked);
    223233
     
    250260    {
    251261        // we adopt to the guest resolution or the next higher that is available
    252         int32_t bestMode = getBestVideoMode(w, h, colorDepth);
     262        int32_t bestMode = getBestVideoMode(w, h, bitsPerPixel);
    253263        if (bestMode == -1)
    254264        {
     
    260270        // does the mode differ from what we wanted?
    261271        if ((videoModes[bestMode].width != w) || (videoModes[bestMode].height != h) ||
    262             (videoModes[bestMode].bpp != colorDepth))
     272            (videoModes[bestMode].bpp != bitsPerPixel))
    263273        {
    264274            printf("The mode does not fit exactly!\n");
  • trunk/src/VBox/Frontends/VBoxFB/Framebuffer.h

    r3153 r3761  
    3939    NS_IMETHOD Unlock();
    4040    NS_IMETHOD GetAddress(uint32_t *address);
    41     NS_IMETHOD GetColorDepth(uint32_t *colorDepth);
    42     NS_IMETHOD GetLineSize(uint32_t *lineSize);
    43     NS_IMETHOD GetPixelFormat(FramebufferPixelFormat_T *pixelFormat);
     41    NS_IMETHOD GetBitsPerPixel(uint32_t *bitsPerPixel);
     42    NS_IMETHOD GetBytesPerLine(uint32_t *bytesPerLine);
     43    NS_IMETHOD GetPixelFormat(ULONG *pixelFormat);
     44    NS_IMETHOD GetUsesGuestVRAM(BOOL *usesGuestVRAM);
    4445    NS_IMETHOD NotifyUpdate(uint32_t x, uint32_t y,
    4546                           uint32_t w, uint32_t h, PRBool *finished);
    46     NS_IMETHOD RequestResize(ULONG aScreenId, FramebufferPixelFormat_T pixelFormat, uint32_t vram, uint32_t lineSize, uint32_t w, uint32_t h,
     47    NS_IMETHOD RequestResize(ULONG aScreenId, ULONG pixelFormat, uint32_t vram,
     48                             uint32_t bitsPerPixel, uint32_t bytesPerLine,
     49                             uint32_t w, uint32_t h,
    4750                             PRBool *finished);
    4851private:
Note: See TracChangeset for help on using the changeset viewer.

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