Framebuffer.h revision 6689f0711e9e1b86331b2aea94083bc86ebe3e58
/** @file
*
* VBox frontends: VBoxSDL (simple frontend based on SDL):
* Declaration 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 (GPL) 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.
*/
#ifndef __H_FRAMEBUFFER
#define __H_FRAMEBUFFER
#include "VBoxSDL.h"
#include <iprt/critsect.h>
#ifdef VBOX_SECURELABEL
#include <SDL_ttf.h>
/* function pointers */
extern "C"
{
extern DECLSPEC SDL_Surface* (SDLCALL *pTTF_RenderUTF8_Solid)(TTF_Font *font, const char *text, SDL_Color fg);
extern DECLSPEC SDL_Surface* (SDLCALL *pTTF_RenderUTF8_Shaded)(TTF_Font *font, const char *text, SDL_Color fg, SDL_Color bg);
extern DECLSPEC SDL_Surface* (SDLCALL *pTTF_RenderUTF8_Blended)(TTF_Font *font, const char *text, SDL_Color fg);
}
#endif /* VBOX_SECURELABEL */
{
uint32_t u32FixedWidth = ~(uint32_t)0, uint32_t u32FixedHeight = ~(uint32_t)0, uint32_t u32FixedBPP = ~(uint32_t)0);
#ifdef RT_OS_WINDOWS
{
return ::InterlockedIncrement (&refcnt);
}
{
if (cnt == 0)
return cnt;
}
{
if (riid == IID_IUnknown)
{
AddRef();
return S_OK;
}
if (riid == IID_IFramebuffer)
{
AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
#endif
// internal public methods
bool initialized() { return mfInitialized; }
void resizeGuest();
void resizeSDL();
void update(int x, int y, int w, int h, bool fGuestRelative);
void repaint();
bool getFullscreen();
void setFullscreen(bool fFullscreen);
int getXOffset();
int getYOffset();
#ifdef VBOX_SECURELABEL
void setSecureLabelText(const char *text);
void paintSecureLabel(int x, int y, int w, int h, bool fForce);
#endif
void uninit();
/** the sdl thread */
/** false if constructor failed */
bool mfInitialized;
/** maximum possible screen width in pixels (~0 = no restriction) */
/** maximum possible screen height in pixels (~0 = no restriction) */
/** current guest screen width in pixels */
/** current guest screen height in pixels */
/** fixed SDL screen width (~0 = not set) */
/** fixed SDL screen height (~0 = not set) */
/** fixed SDL bits per pixel (~0 = not set) */
/** default BPP */
/** Y offset in pixels, i.e. guest-nondrawable area at the top */
/** X offset for guest screen centering */
/** Y offset for guest screen centering */
/** flag whether we're in fullscreen mode */
bool mfFullscreen;
/** framebuffer update semaphore */
/** flag whether the SDL window should be resizable */
bool mfResizable;
/** flag whether we print out SDL information */
bool mfShowSDLConfig;
#ifdef VBOX_SECURELABEL
/** current secure label text */
/** current secure label foreground color (RGB) */
/** current secure label background color (RGB) */
/** secure label font handle */
/** secure label height in pixels */
/** secure label offset from the top of the secure label */
#endif
#ifdef RT_OS_WINDOWS
long refcnt;
#endif
/** the application Icon */
};
{
#ifdef RT_OS_WINDOWS
{
return ::InterlockedIncrement (&refcnt);
}
{
if (cnt == 0)
return cnt;
}
{
if (riid == IID_IUnknown)
{
AddRef();
return S_OK;
}
if (riid == IID_IFramebuffer)
{
AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
#endif
/* These are not used, or return standard values. */
// internal public methods
/** Overlay X offset */
/** Overlay Y offset */
/** Overlay width */
/** Overlay height */
/** Whether the overlay is currently active */
/** The parent IFramebuffer */
/** SDL surface containing the actual framebuffer bits */
/** Additional SDL surface used for combining the framebuffer and the overlay */
#ifdef RT_OS_WINDOWS
long refcnt;
#endif
};
#endif // __H_FRAMEBUFFER