Framebuffer.cpp revision d4d1e5c2849c0d87dcda3f1e71258cb780369d2d
/** @file
*
* VBox frontends: VBoxSDL (simple frontend based on SDL):
* Implementation of VBoxSDLFB (SDL framebuffer) class
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License as published by the Free Software Foundation,
* in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
* distribution. VirtualBox OSE is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY of any kind.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
#ifdef __OS2__
#endif
using namespace com;
#define LOG_GROUP LOG_GROUP_GUI
#include <stdlib.h>
#include <signal.h>
#include "VBoxSDL.h"
#include "Framebuffer.h"
#include "Ico64x01.h"
#if defined(VBOX_WITH_XPCOM)
#endif
#ifdef VBOX_SECURELABEL
/* function pointers */
extern "C"
{
DECLSPEC SDL_Surface* (SDLCALL *pTTF_RenderUTF8_Solid)(TTF_Font *font, const char *text, SDL_Color fg);
}
#endif /* VBOX_SECURELABEL */
//
// Constructor / destructor
//
/**
* SDL framebuffer constructor. It is called from the main
* (i.e. SDL) thread. Therefore it is safe to use SDL calls
* here.
* @param fFullscreen flag whether we start in fullscreen mode
* @param fResizable flag whether the SDL window should be resizable
* @param fShowSDLConfig flag whether we print out SDL settings
* @param iFixedWidth fixed SDL width (-1 means not set)
* @param iFixedHeight fixed SDL height (-1 means not set)
*/
{
int rc;
LogFlow(("VBoxSDLFB::VBoxSDLFB\n"));
#if defined (__WIN__)
refcnt = 0;
#endif
mfInitialized = false;
mTopOffset = 0;
mDefaultSDLBPP = 32;
mCenterXOffset = 0;
mCenterYOffset = 0;
/* Start with standard screen dimensions. */
mGuestXRes = 640;
mGuestYRes = 480;
mLineSize = 0;
#ifdef VBOX_SECURELABEL
mLabelFont = NULL;
mLabelHeight = 0;
#endif
/* memorize the thread that inited us, that's the SDL thread */
#ifdef __WIN__
/* default to DirectX if nothing else set */
if (!getenv("SDL_VIDEODRIVER"))
{
_putenv("SDL_VIDEODRIVER=directx");
// _putenv("SDL_VIDEODRIVER=windib");
}
#endif
#ifdef __LINUX__
/* On some X servers the mouse is stuck inside the bottom right corner.
#endif
if (rc != 0)
{
return;
}
#ifdef __LINUX__
/* NOTE: we still want Ctrl-C to work, so we undo the SDL redirections */
#endif
if (videoInfo)
{
{
default:
}
/* output what SDL is capable of */
if (mfShowSDLConfig)
RTPrintf("SDL capabilities:\n"
" Hardware surface support: %s\n"
" Window manager available: %s\n"
" Screen to screen blits accelerated: %s\n"
" Screen to screen colorkey blits accelerated: %s\n"
" Screen to screen alpha blits accelerated: %s\n"
" Memory to screen blits accelerated: %s\n"
" Memory to screen colorkey blits accelerated: %s\n"
" Memory to screen alpha blits accelerated: %s\n"
" Color fills accelerated: %s\n"
" Video memory in kilobytes: %d\n"
" Optimal bpp mode: %d\n"
"SDL video driver: %s\n",
getenv("SDL_VIDEODRIVER"));
}
if (12320 == g_cbIco64x01)
{
/** @todo make it as simple as possible. No PNM interpreter here... */
if (mWMIcon)
{
}
}
/* Default framebuffer render mode is normal (draw the entire framebuffer) */
resizeGuest();
mfInitialized = true;
}
{
LogFlow(("VBoxSDLFB::~VBoxSDLFB\n"));
}
/**
* Returns the current framebuffer width in pixels.
*
* @returns COM status code
* @param width Address of result buffer.
*/
{
LogFlow(("VBoxSDLFB::GetWidth\n"));
if (!width)
return E_INVALIDARG;
*width = mGuestXRes;
return S_OK;
}
/**
* Returns the current framebuffer height in pixels.
*
* @returns COM status code
* @param height Address of result buffer.
*/
{
LogFlow(("VBoxSDLFB::GetHeight\n"));
if (!height)
return E_INVALIDARG;
*height = mGuestYRes;
return S_OK;
}
/**
* Lock the framebuffer (make its address immutable).
*
* @returns COM status code
*/
{
LogFlow(("VBoxSDLFB::Lock\n"));
return S_OK;
}
/**
* Unlock the framebuffer.
*
* @returns COM status code
*/
{
LogFlow(("VBoxSDLFB::Unlock\n"));
return S_OK;
}
/**
* Return the framebuffer start address.
*
* @returns COM status code.
* @param address Pointer to result variable.
*/
{
LogFlow(("VBoxSDLFB::GetAddress\n"));
if (!address)
return E_INVALIDARG;
if (mSurfVRAM)
{
}
else
{
/* That's actually rather bad. */
AssertMsgFailed(("mSurfVRAM is NULL!\n"));
return E_FAIL;
}
return S_OK;
}
/**
* Return the current framebuffer color depth.
*
* @returns COM status code
* @param colorDepth Address of result variable
*/
{
LogFlow(("VBoxSDLFB::GetColorDepth\n"));
if (!colorDepth)
return E_INVALIDARG;
/* get the information directly from the surface in use */
return S_OK;
}
/**
* Return the current framebuffer line size in bytes.
*
* @returns COM status code.
* @param lineSize Address of result variable.
*/
{
LogFlow(("VBoxSDLFB::GetLineSize\n"));
if (!lineSize)
return E_INVALIDARG;
/* get the information directly from the surface */
return S_OK;
}
{
if (!pixelFormat)
return E_POINTER;
return S_OK;
}
/**
* Returns by how many pixels the guest should shrink its
* video mode height values.
*
* @returns COM status code.
* @param heightReduction Address of result variable.
*/
{
if (!heightReduction)
return E_POINTER;
#ifdef VBOX_SECURELABEL
#else
*heightReduction = 0;
#endif
return S_OK;
}
/**
* Returns a pointer to an alpha-blended overlay used for displaying status
* icons above the framebuffer.
*
* @returns COM status code.
* @param aOverlay The overlay framebuffer.
*/
{
if (!aOverlay)
return E_POINTER;
/* Not yet implemented */
*aOverlay = 0;
return S_OK;
}
/**
* Return the current framebuffer render mode
*
* @returns COM status code
* @param renderMode framebuffer render mode
*/
{
if (!renderMode)
return E_POINTER;
return S_OK;
}
/**
* Change the current framebuffer render mode
*
* @returns COM status code
* @param renderMode framebuffer render mode
*/
{
if (!renderMode)
return E_POINTER;
return S_OK;
}
/**
* Notify framebuffer of an update.
*
* @returns COM status code
* @param x Update region upper left corner x value.
* @param y Update region upper left corner y value.
* @param w Update region width in pixels.
* @param h Update region height in pixels.
* @param finished Address of output flag whether the update
* could be fully processed in this call (which
* has to return immediately) or VBox should wait
* for a call to the update complete API before
* continuing with display updates.
*/
{
/*
* The input values are in guest screen coordinates.
*/
LogFlow(("VBoxSDLFB::NotifyUpdate: x = %d, y = %d, w = %d, h = %d\n",
x, y, w, h));
#ifdef __LINUX__
/*
* SDL does not allow us to make this call from any other thread than
* the main SDL thread (which initialized the video mode). So we have
* to send an event to the main SDL thread and process it there. For
* sake of simplicity, we encode all information in the event parameters.
*/
// 16 bit is enough for coordinates
#else /* !__LINUX__ */
update(x, y, w, h, true /* fGuestRelative */);
#endif /* !__LINUX__ */
/*
* The Display thread can continue as we will lock the framebuffer
* from the SDL thread when we get to actually doing the update.
*/
if (finished)
return S_OK;
}
/**
* Request a display resize from the framebuffer.
*
* @returns COM status code.
* @param pixelFormat The requested pixel format.
* @param vram Pointer to the guest VRAM buffer (can be NULL).
* @param lineSize Size of a scanline in bytes.
* @param w New display width in pixels.
* @param h New display height in pixels.
* @param finished Address of output flag whether the update
* could be fully processed in this call (which
* has to return immediately) or VBox should wait
* for all call to the resize complete API before
* continuing with display updates.
*/
STDMETHODIMP VBoxSDLFB::RequestResize(ULONG aScreenId, FramebufferPixelFormat_T pixelFormat, BYTE *vram,
{
LogFlow(("VBoxSDLFB::RequestResize: w = %d, h = %d, pixelFormat: %d, vram = %p, lineSize = %d\n",
/*
* SDL does not allow us to make this call from any other thread than
* the main thread (the one which initialized the video mode). So we
* have to send an event to the main SDL thread and tell VBox to wait.
*/
if (!finished)
{
AssertMsgFailed(("RequestResize requires the finished flag!\n"));
return E_FAIL;
}
mGuestXRes = w;
mGuestYRes = h;
/* Try multiple times if necessary */
/* we want this request to be processed quickly, so yield the CPU */
*finished = false;
return S_OK;
}
/**
* Returns which acceleration operations are supported
*
* @returns COM status code
* @param operation acceleration operation code
* @supported result
*/
STDMETHODIMP VBoxSDLFB::OperationSupported(FramebufferAccelerationOperation_T operation, BOOL *supported)
{
if (!supported)
return E_POINTER;
// SDL gives us software surfaces, futile
*supported = false;
#if 0
switch (operation)
{
*supported = true;
break;
*supported = true;
break;
default:
*supported = false;
}
#endif
return S_OK;
}
/**
* Returns whether we like the given video mode.
*
* @returns COM status code
* @param width video mode width in pixels
* @param height video mode height in pixels
* @param bpp video mode bit depth in bits per pixel
* @param supported pointer to result variable
*/
{
if (!supported)
return E_POINTER;
/* are constraints set? */
if ( ( (mMaxScreenWidth != ~(uint32_t)0)
&& (width > mMaxScreenWidth)
|| ( (mMaxScreenHeight != ~(uint32_t)0)
&& (height > mMaxScreenHeight))))
{
/* nope, we don't want that (but still don't freak out if it is set) */
#ifdef DEBUG
#endif
*supported = false;
}
else
{
/* anything will do */
*supported = true;
}
return S_OK;
}
{
if (!handled)
return E_POINTER;
// SDL gives us software surfaces, futile
#if 0
//SDL_UpdateRect(mScreen, x, y, width, height);
*handled = true;
#else
*handled = false;
#endif
return S_OK;
}
{
if (!handled)
return E_POINTER;
// SDL gives us software surfaces, futile
#if 0
*handled = true;
#else
*handled = false;
#endif
return S_OK;
}
{
if (!aPcRect)
return E_POINTER;
/* @todo */
return S_OK;
}
{
if (!paRect)
return E_POINTER;
/* @todo */
return S_OK;
}
//
// Internal public methods
//
/**
* Method that does the actual resize of the guest framebuffer and
* then changes the SDL framebuffer setup.
*/
void VBoxSDLFB::resizeGuest()
{
int cBitsPerPixel = 32;
/* pixel characteristics, default to fallback 32bpp format */
cBitsPerPixel = 16;
else if (mPixelFormat == FramebufferPixelFormat_PixelFormatRGB24)
cBitsPerPixel = 24;
switch (cBitsPerPixel)
{
}
/* first free the current surface */
if (mSurfVRAM)
{
}
/* is the guest in a linear framebuffer mode we support? */
{
/* Create a source surface from guest VRAM. */
}
else
{
/* Create a software surface for which SDL allocates the RAM */
}
/* now adjust the SDL resolution */
resizeSDL();
}
/**
* Sets SDL video mode. This is independent from guest video
* mode changes.
*
* @remarks Must be called from the SDL thread!
*/
{
LogFlow(("VBoxSDL:resizeSDL\n"));
/*
* We request a hardware surface from SDL so that we can perform
* accelerated system memory to VRAM blits. The way video handling
* works it that on the one hand we have the screen surface from SDL
* and on the other hand we have a software surface that we create
* using guest VRAM memory for linear modes and using SDL allocated
* system memory for text and non linear graphics modes. We never
* directly write to the screen surface but always use SDL blitting
* functions to blit from our system memory surface to the VRAM.
* Therefore, SDL can take advantage of hardware acceleration.
*/
if (mfResizable)
if (mfFullscreen)
/*
* Now we have to check whether there are video mode restrictions
*/
/* Get available fullscreen/hardware modes */
/* -1 means that any mode is possible (usually non fullscreen) */
{
/*
* according to the SDL documentation, the API guarantees that
* the modes are sorted from larger to smaller, so we just
* take the first entry as the maximum.
*/
mMaxScreenWidth = modes[0]->w;
mMaxScreenHeight = modes[0]->h;
}
else
{
/* no restriction */
mMaxScreenWidth = ~(uint32_t)0;
mMaxScreenHeight = ~(uint32_t)0;
}
/* reset the centering offsets */
mCenterXOffset = 0;
mCenterYOffset = 0;
/* we either have a fixed SDL resolution or we take the guest's */
if (mFixedSDLWidth != ~(uint32_t)0)
{
}
else
{
#ifdef VBOX_SECURELABEL
#else
#endif
}
/* we don't have any extra space by default */
mTopOffset = 0;
/*
* Now set the screen resolution and get the surface pointer
* @todo BPP is not supported!
*/
#ifdef VBOX_SECURELABEL
/*
* For non fixed SDL resolution, the above call tried to add the label height
* to the guest height. If it worked, we have an offset. If it didn't the below
* code will try again with the original guest resolution.
*/
if (mFixedSDLWidth == ~(uint32_t)0)
{
/* if it didn't work, then we have to go for the original resolution and paint over the guest */
if (!mScreen)
{
}
else
{
/* we now have some extra space */
}
}
else
{
/* in case the guest resolution is small enough, we do have a top offset */
/* we also might have to center the guest picture */
if (mFixedSDLWidth > mGuestXRes)
}
#endif
if (mScreen)
{
#ifdef VBOX_WIN32_UI
/* inform the UI code */
#endif
if (mfShowSDLConfig)
}
repaint();
}
/**
* Update specified framebuffer area. The coordinates can either be
* relative to the guest framebuffer or relative to the screen.
*
* @remarks Must be called from the SDL thread on Linux!
* @param x left column
* @param y top row
* @param w width in pixels
* @param h height in pixels
* @param fGuestRelative flag whether the above values are guest relative or screen relative;
*/
{
#ifdef __LINUX__
#endif
return;
/* the source and destination rectangles */
/* this is how many pixels we have to cut off from the height for this specific blit */
int yCutoffGuest = 0;
#ifdef VBOX_SECURELABEL
bool fPaintLabel = false;
/* if we have a label and no space for it, we have to cut off a bit */
if (mLabelHeight && !mTopOffset)
{
if (y < (int)mLabelHeight)
yCutoffGuest = mLabelHeight - y;
}
#endif
/**
* If we get a SDL window relative update, we
* just perform a full screen update to keep things simple.
*
* @todo improve
*/
if (!fGuestRelative)
{
#ifdef VBOX_SECURELABEL
/* repaint the label if necessary */
if (y < (int)mLabelHeight)
fPaintLabel = true;
#endif
x = 0;
w = mGuestXRes;
y = 0;
h = mGuestYRes;
}
srcRect.x = x;
srcRect.y = y + yCutoffGuest;
srcRect.w = w;
/*
* Destination rectangle is just offset by the label height.
* There are two cases though: label height is added to the
* guest resolution (mTopOffset == mLabelHeight; yCutoffGuest == 0)
* or the label cuts off a portion of the guest screen (mTopOffset == 0;
* yCutoffGuest >= 0)
*/
dstRect.x = x + mCenterXOffset;
#ifdef VBOX_SECURELABEL
#else
#endif
dstRect.w = w;
//RTPrintf("y = %d h = %d mapped to srcY %d srcH %d mapped to dstY = %d dstH %d (guestrel: %d, mLabelHeight: %d, mTopOffset: %d)\n",
/*
* Now we just blit
*/
/* hardware surfaces don't need update notifications */
#ifdef VBOX_SECURELABEL
if (fPaintLabel)
paintSecureLabel(0, 0, 0, 0, false);
#endif
}
/**
* Repaint the whole framebuffer
*
* @remarks Must be called from the SDL thread!
*/
{
LogFlow(("VBoxSDLFB::repaint\n"));
}
bool VBoxSDLFB::getFullscreen()
{
LogFlow(("VBoxSDLFB::getFullscreen\n"));
return mfFullscreen;
}
/**
* Toggle fullscreen mode
*
* @remarks Must be called from the SDL thread!
*/
{
/* only change the SDL resolution, do not touch the guest framebuffer */
resizeSDL();
}
/**
* Returns the current x offset of the start of the guest screen
*
* @returns current x offset in pixels
*/
int VBoxSDLFB::getXOffset()
{
/* there can only be an offset for centering */
return mCenterXOffset;
}
/**
* Returns the current y offset of the start of the guest screen
*
* @returns current y offset in pixels
*/
int VBoxSDLFB::getYOffset()
{
/* we might have a top offset and a center offset */
return mTopOffset + mCenterYOffset;
}
#ifdef VBOX_SECURELABEL
/**
* Setup the secure labeling parameters
*
* @returns VBox status code
* @param height height of the secure label area in pixels
* @param font file path fo the TrueType font file
* @param pointsize font size in points
*/
{
LogFlow(("VBoxSDLFB:initSecureLabel: new offset: %d pixels, new font: %s, new pointsize: %d\n",
pTTF_Init();
if (!mLabelFont)
{
return VERR_OPEN_FAILED;
}
mSecureLabelColorFG = 0x0000FF00;
mSecureLabelColorBG = 0x00FFFF00;
repaint();
return VINF_SUCCESS;
}
/**
* Set the secure label text and repaint the label
*
* @param text UTF-8 string of new label
* @remarks must be called from the SDL thread!
*/
{
paintSecureLabel(0, 0, 0, 0, true);
}
/**
* Sets the secure label background color.
*
* @param colorFG encoded RGB value for text
* @param colorBG encored RGB value for background
* @remarks must be called from the SDL thread!
*/
{
paintSecureLabel(0, 0, 0, 0, true);
}
/**
* Paint the secure label if required
*
* @param fForce Force the repaint
* @remarks must be called from the SDL thread!
*/
{
#ifdef __LINUX__
#endif
/* only when the function is present */
if (!pTTF_RenderUTF8_Solid)
return;
/* check if we can skip the paint */
{
return;
}
/* first fill the background */
/* now the text */
{
mSecureLabelColorFG & 0x000000FF, 0};
rect.x = 10;
}
/* make sure to update the screen */
}
#endif /* VBOX_SECURELABEL */
/**
* Terminate SDL
*
* @remarks must be called from the SDL thread!
*/
{
if (mSurfVRAM)
{
}
#ifdef VBOX_SECURELABEL
if (mLabelFont)
if (pTTF_Quit)
pTTF_Quit();
#endif
if (mWMIcon)
{
}
}
// IFramebufferOverlay
///////////////////////////////////////////////////////////////////////////////////
/**
* Constructor for the VBoxSDLFBOverlay class (IFramebufferOverlay implementation)
*
* @param x Initial X offset for the overlay
* @param y Initial Y offset for the overlay
* @param width Initial width for the overlay
* @param height Initial height for the overlay
* @param visible Whether the overlay is initially visible
* @param alpha Initial alpha channel value for the overlay
*/
{}
/**
* Destructor for the VBoxSDLFBOverlay class.
*/
{
}
/**
* Perform any initialisation of the overlay that can potentially fail
*
* @returns S_OK on success or the reason for the failure
*/
{
0x00ff0000, 0x0000ff00, 0x000000ff, 0);
0x000000ff, 0xff000000);
return S_OK;
}
/**
* Returns the current overlay X offset in pixels.
*
* @returns COM status code
* @param x Address of result buffer.
*/
{
LogFlow(("VBoxSDLFBOverlay::GetX\n"));
if (!x)
return E_INVALIDARG;
*x = mOverlayX;
return S_OK;
}
/**
* Returns the current overlay height in pixels.
*
* @returns COM status code
* @param height Address of result buffer.
*/
{
LogFlow(("VBoxSDLFBOverlay::GetY\n"));
if (!y)
return E_INVALIDARG;
*y = mOverlayY;
return S_OK;
}
/**
* Returns the current overlay width in pixels. In fact, this returns the line size.
*
* @returns COM status code
* @param width Address of result buffer.
*/
{
LogFlow(("VBoxSDLFBOverlay::GetWidth\n"));
if (!width)
return E_INVALIDARG;
return S_OK;
}
/**
* Returns the current overlay line size in pixels.
*
* @returns COM status code
* @param lineSize Address of result buffer.
*/
{
LogFlow(("VBoxSDLFBOverlay::GetLineSize\n"));
if (!lineSize)
return E_INVALIDARG;
return S_OK;
}
/**
* Returns the current overlay height in pixels.
*
* @returns COM status code
* @param height Address of result buffer.
*/
{
LogFlow(("VBoxSDLFBOverlay::GetHeight\n"));
if (!height)
return E_INVALIDARG;
*height = mOverlayHeight;
return S_OK;
}
/**
* Returns whether the overlay is currently visible.
*
* @returns COM status code
* @param visible Address of result buffer.
*/
{
LogFlow(("VBoxSDLFBOverlay::GetVisible\n"));
if (!visible)
return E_INVALIDARG;
return S_OK;
}
/**
* Sets whether the overlay is currently visible.
*
* @returns COM status code
* @param visible New value.
*/
{
LogFlow(("VBoxSDLFBOverlay::SetVisible\n"));
return S_OK;
}
/**
* Returns the value of the global alpha channel.
*
* @returns COM status code
* @param alpha Address of result buffer.
*/
{
LogFlow(("VBoxSDLFBOverlay::GetAlpha\n"));
return E_NOTIMPL;
}
/**
* Sets whether the overlay is currently visible.
*
* @returns COM status code
* @param alpha new value.
*/
{
LogFlow(("VBoxSDLFBOverlay::SetAlpha\n"));
return E_NOTIMPL;
}
/**
* Returns the address of the framebuffer bits for writing to.
*
* @returns COM status code
* @param alpha Address of result buffer.
*/
{
LogFlow(("VBoxSDLFBOverlay::GetAddress\n"));
if (!address)
return E_INVALIDARG;
return S_OK;
}
/**
* Returns the current colour depth. In fact, this is always 32bpp.
*
* @returns COM status code
* @param colorDepth Address of result buffer.
*/
{
LogFlow(("VBoxSDLFBOverlay::GetColorDepth\n"));
if (!colorDepth)
return E_INVALIDARG;
*colorDepth = 32;
return S_OK;
}
/**
* Returns the current pixel format. In fact, this is always RGB32.
*
* @returns COM status code
* @param pixelFormat Address of result buffer.
*/
{
LogFlow(("VBoxSDLFBOverlay::GetPixelFormat\n"));
if (!pixelFormat)
return E_INVALIDARG;
return S_OK;
}
/**
* Returns the height reduction. In fact, this is always 0.
*
* @returns COM status code
* @param heightReduction Address of result buffer.
*/
{
LogFlow(("VBoxSDLFBOverlay::GetHeightReduction\n"));
if (!heightReduction)
return E_INVALIDARG;
*heightReduction = 0;
return S_OK;
}
/**
* Returns the overlay for this framebuffer. Obviously, we return NULL here.
*
* @returns COM status code
* @param overlay Address of result buffer.
*/
{
LogFlow(("VBoxSDLFBOverlay::GetOverlay\n"));
if (!aOverlay)
return E_INVALIDARG;
*aOverlay = 0;
return S_OK;
}
/**
* Lock the overlay. This should not be used - lock the parent IFramebuffer instead.
*
* @returns COM status code
*/
{
LogFlow(("VBoxSDLFBOverlay::Lock\n"));
AssertMsgFailed(("You should not attempt to lock an IFramebufferOverlay object -\n"
"lock the parent IFramebuffer object instead.\n"));
return E_NOTIMPL;
}
/**
* Unlock the overlay.
*
* @returns COM status code
*/
{
LogFlow(("VBoxSDLFBOverlay::Unlock\n"));
AssertMsgFailed(("You should not attempt to lock an IFramebufferOverlay object -\n"
"lock the parent IFramebuffer object instead.\n"));
return E_NOTIMPL;
}
/**
* Change the X and Y co-ordinates of the overlay area.
*
* @returns COM status code
* @param x New X co-ordinate.
* @param y New Y co-ordinate.
*/
{
mOverlayX = x;
mOverlayY = y;
return S_OK;
}
/**
* Notify the overlay that a section of the framebuffer has been redrawn.
*
* @returns COM status code
* @param x X co-ordinate of upper left corner of modified area.
* @param y Y co-ordinate of upper left corner of modified area.
* @param w Width of modified area.
* @param h Height of modified area.
* @retval finished Set if the operation has completed.
*
* All we do here is to send a request to the parent to update the affected area,
* translating between our co-ordinate system and the parent's. It would be have
* been better to call the parent directly, but such is life. We leave bounds
* checking to the parent.
*/
{
}
/**
* Change the dimensions of the overlay.
*
* @returns COM status code
* @param pixelFormat Must be FramebufferPixelFormat_PixelFormatRGB32.
* @param vram Must be NULL.
* @param lineSize Ignored.
* @param w New overlay width.
* @param h New overlay height.
* @retval finished Set if the operation has completed.
*/
{
mOverlayWidth = w;
mOverlayHeight = h;
0x00ff0000, 0x0000ff00, 0x000000ff, 0);
0x000000ff, 0xff000000);
return S_OK;
}
/**
* Queries whether we support a given accelerated opperation. Since we do not currently
* support any accelerated operations, we always return false in supported.
*
* @returns COM status code
* @param operation The operation being queried
* @retval supported Whether or not we support that operation
*/
{
if (!supported)
return E_POINTER;
/* We currently do not support any acceleration here, and will probably not in
the forseeable future. */
*supported = false;
return S_OK;
}
/**
* Returns whether we like the given video mode.
*
* @returns COM status code
* @param width video mode width in pixels
* @param height video mode height in pixels
* @param bpp video mode bit depth in bits per pixel
* @retval supported pointer to result variable
*
* Basically, we support anything with 32bpp.
*/
{
if (!supported)
return E_POINTER;
if (bpp == 32)
*supported = true;
else
*supported = false;
return S_OK;
}
/**
* Fill an area of the framebuffer with solid colour
*
* @returns COM status code
* @param x X co-ordinate of the area to fill, top-left corner
* @param y Y co-ordinate of the area to fill, top-left corner
* @param width width of the area to fill
* @param height height of the area to fill
* @param color colour with which to fill the area
* @retval handled whether we support this operation or not
*
* Since we currently do not have any way of doing this faster than
* the VGA device, we simply false in handled.
*/
{
LogFlow(("VBoxSDLFBOverlay::SolidFill called\n"));
if (!handled)
return E_POINTER;
*handled = false;
return S_OK;
}
/**
* Since we currently do not have any way of doing this faster than
* the VGA device, we simply false in handled.
*/
{
LogFlow(("VBoxSDLFBOverlay::CopyScreenBits called.\n"));
if (!handled)
return E_POINTER;
*handled = false;
return S_OK;
}