UIFrameBuffer.h revision dbad8d5cc357812b98ebba09d541c4ba21edef3b
/** @file
*
* VBox frontends: Qt GUI ("VirtualBox"):
* UIFrameBuffer class and subclasses declarations
*/
/*
* Copyright (C) 2010-2011 Oracle Corporation
*
* 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 ___UIFrameBuffer_h___
#define ___UIFrameBuffer_h___
/* Global includes */
#include <QRegion>
#include <QPaintEvent>
/* Local includes */
#include "COMDefs.h"
#include <iprt/critsect.h>
/**
* Frame buffer resize event.
*/
{
};
/**
* Frame buffer repaint event.
*/
{
int x() { return m_iX; }
int y() { return m_iY; }
};
/**
* Frame buffer set region event.
*/
{
};
/**
* Common IFramebuffer implementation for all methods used by GUI to maintain
* the VM display video memory.
*
* Note that although this class can be called from multiple threads
* (in particular, the GUI thread and EMT) it doesn't protect access to every
* data field using its mutex lock. This is because all synchronization between
* the GUI and the EMT thread is supposed to be done using the
* IFramebuffer::NotifyUpdate() and IFramebuffer::RequestResize() methods
* (in particular, the \a aFinished parameter of these methods is responsible
* for the synchronization). These methods are always called on EMT and
* therefore always follow one another but never in parallel.
*
* Using this object's mutex lock (exposed also in IFramebuffer::Lock() and
* IFramebuffer::Unlock() implementations) usually makes sense only if some
* third-party thread (i.e. other than GUI or EMT) needs to make sure that
* *no* VM display update or resize event can occur while it is accessing
* IFramebuffer properties or the underlying display memory storage area.
*
* See IFramebuffer documentation for more info.
*/
{
virtual ~UIFrameBuffer();
#if defined (Q_OS_WIN32)
{
return ::InterlockedIncrement(&m_iRefCnt);
}
{
if (cnt == 0)
return cnt;
}
#endif
/* IFramebuffer COM methods */
BOOL *pbFinished);
BOOL *pbSupported);
inline int convertGuestXTo(int x) const { return m_scaledSize.isValid() ? qRound((double)m_scaledSize.width() / m_width * x) : x; }
inline int convertGuestYTo(int y) const { return m_scaledSize.isValid() ? qRound((double)m_scaledSize.height() / m_height * y) : y; }
inline int convertHostXTo(int x) const { return m_scaledSize.isValid() ? qRound((double)m_width / m_scaledSize.width() * x) : x; }
inline int convertHostYTo(int y) const { return m_scaledSize.isValid() ? qRound((double)m_height / m_scaledSize.height() * y) : y; }
{
}
virtual bool usesGuestVRAM()
{
return false;
}
/**
* Called on the GUI thread (from VBoxConsoleView) when some part of the
* VM display viewport needs to be repainted on the host screen.
*/
/**
* Called on the GUI thread (from VBoxConsoleView) after it gets a
* UIResizeEvent posted from the RequestResize() method implementation.
*/
{
}
/**
* Called on the GUI thread (from VBoxConsoleView) when the VM console
* window is moved.
*/
#ifdef VBOX_WITH_VIDEOHWACCEL
/* this method is called from the GUI thread
* to perform the actual Video HW Acceleration command processing
* the event is framebuffer implementation specific */
#endif
bool m_fIsDeleted;
#if defined (Q_OS_WIN32)
long m_iRefCnt;
#endif
};
#endif // !___UIFrameBuffer_h___