本文整理汇总了C++中CDisplay::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ CDisplay::isNull方法的具体用法?C++ CDisplay::isNull怎么用?C++ CDisplay::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDisplay
的用法示例。
在下文中一共展示了CDisplay::isNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepareFrameBuffer
void UIMachineViewScale::prepareFrameBuffer()
{
/* That method is partial copy-paste of UIMachineView::prepareFrameBuffer()
* and its temporary here just because not all of our frame-buffers are currently supports scale-mode;
* When all of our frame-buffers will be supporting scale-mode, method will be removed!
* Here we are processing only these frame-buffer types, which knows scale-mode! */
/* Prepare frame-buffer depending on render-mode: */
switch (vboxGlobal().vmRenderMode())
{
#ifdef VBOX_GUI_USE_QUARTZ2D
case VBoxDefs::Quartz2DMode:
/* Indicate that we are doing all drawing stuff ourself: */
viewport()->setAttribute(Qt::WA_PaintOnScreen);
m_pFrameBuffer = new UIFrameBufferQuartz2D(this);
break;
#endif /* VBOX_GUI_USE_QUARTZ2D */
default:
#ifdef VBOX_GUI_USE_QIMAGE
case VBoxDefs::QImageMode:
m_pFrameBuffer = new UIFrameBufferQImage(this);
break;
#endif /* VBOX_GUI_USE_QIMAGE */
AssertReleaseMsgFailed(("Scale-mode is currently NOT supporting that render-mode: %d\n", vboxGlobal().vmRenderMode()));
LogRel(("Scale-mode is currently NOT supporting that render-mode: %d\n", vboxGlobal().vmRenderMode()));
qApp->exit(1);
break;
}
/* If frame-buffer was prepared: */
if (m_pFrameBuffer)
{
/* Prepare display: */
CDisplay display = session().GetConsole().GetDisplay();
Assert(!display.isNull());
m_pFrameBuffer->AddRef();
display.SetFramebuffer(m_uScreenId, CFramebuffer(m_pFrameBuffer));
}
QSize size;
#ifdef Q_WS_X11
/* Processing pseudo resize-event to synchronize frame-buffer with stored
* framebuffer size. On X11 this will be additional done when the machine
* state was 'saved'. */
if (session().GetMachine().GetState() == KMachineState_Saved)
size = guestSizeHint();
#endif /* Q_WS_X11 */
/* If there is a preview image saved, we will resize the framebuffer to the
* size of that image. */
ULONG buffer = 0, width = 0, height = 0;
CMachine machine = session().GetMachine();
machine.QuerySavedScreenshotPNGSize(0, buffer, width, height);
if (buffer > 0)
{
/* Init with the screenshot size */
size = QSize(width, height);
/* Try to get the real guest dimensions from the save state */
ULONG guestWidth = 0, guestHeight = 0;
machine.QuerySavedGuestSize(0, guestWidth, guestHeight);
if ( guestWidth > 0
&& guestHeight > 0)
size = QSize(guestWidth, guestHeight);
}
/* If we have a valid size, resize the framebuffer. */
if ( size.width() > 0
&& size.height() > 0)
{
UIResizeEvent event(FramebufferPixelFormat_Opaque, NULL, 0, 0, size.width(), size.height());
frameBuffer()->resizeEvent(&event);
}
}
示例2: prepareFrameBuffer
//.........这里部分代码省略.........
m_pFrameBuffer = new UIDDRAWFrameBuffer(this);
if (!m_pFrameBuffer || m_pFrameBuffer->address() == NULL)
{
if (m_pFrameBuffer)
delete m_pFrameBuffer;
m_mode = VBoxDefs::QImageMode;
m_pFrameBuffer = new UIFrameBufferQImage(this);
}
break;
#endif /* VBOX_GUI_USE_DDRAW */
#endif
#ifdef VBOX_GUI_USE_QUARTZ2D
case VBoxDefs::Quartz2DMode:
/* Indicate that we are doing all drawing stuff ourself: */
viewport()->setAttribute(Qt::WA_PaintOnScreen);
# ifdef VBOX_WITH_VIDEOHWACCEL
if (m_fAccelerate2DVideo)
{
UIFrameBuffer* pFramebuffer = uisession()->frameBuffer(screenId());
if (pFramebuffer)
pFramebuffer->setView(this);
else
{
/* these two additional template args is a workaround to this [VBox|UI] duplication
* @todo: they are to be removed once VBox stuff is gone */
pFramebuffer = new VBoxOverlayFrameBuffer<UIFrameBufferQuartz2D, UIMachineView, UIResizeEvent>(this, &machineWindowWrapper()->session(), (uint32_t)screenId());
uisession()->setFrameBuffer(screenId(), pFramebuffer);
}
m_pFrameBuffer = pFramebuffer;
}
else
m_pFrameBuffer = new UIFrameBufferQuartz2D(this);
# else /* VBOX_WITH_VIDEOHWACCEL */
m_pFrameBuffer = new UIFrameBufferQuartz2D(this);
# endif /* !VBOX_WITH_VIDEOHWACCEL */
break;
#endif /* VBOX_GUI_USE_QUARTZ2D */
default:
AssertReleaseMsgFailed(("Render mode must be valid: %d\n", vboxGlobal().vmRenderMode()));
LogRel(("Invalid render mode: %d\n", vboxGlobal().vmRenderMode()));
qApp->exit(1);
break;
}
/* If frame-buffer was prepared: */
if (m_pFrameBuffer)
{
/* Prepare display: */
CDisplay display = session().GetConsole().GetDisplay();
Assert(!display.isNull());
#ifdef VBOX_WITH_VIDEOHWACCEL
CFramebuffer fb(NULL);
if (m_fAccelerate2DVideo)
{
LONG XOrigin, YOrigin;
/* Check if the framebuffer is already assigned;
* in this case we do not need to re-assign it neither do we need to AddRef. */
display.GetFramebuffer(m_uScreenId, fb, XOrigin, YOrigin);
}
if (fb.raw() != m_pFrameBuffer) /* <-this will evaluate to true iff m_fAccelerate2DVideo is disabled or iff no framebuffer is yet assigned */
#endif /* VBOX_WITH_VIDEOHWACCEL */
{
m_pFrameBuffer->AddRef();
}
/* Always perform SetFramebuffer to ensure 3D gets notified: */
display.SetFramebuffer(m_uScreenId, CFramebuffer(m_pFrameBuffer));
}
QSize size;
#ifdef Q_WS_X11
/* Processing pseudo resize-event to synchronize frame-buffer with stored
* framebuffer size. On X11 this will be additional done when the machine
* state was 'saved'. */
if (session().GetMachine().GetState() == KMachineState_Saved)
size = guestSizeHint();
#endif /* Q_WS_X11 */
/* If there is a preview image saved, we will resize the framebuffer to the
* size of that image. */
ULONG buffer = 0, width = 0, height = 0;
CMachine machine = session().GetMachine();
machine.QuerySavedScreenshotPNGSize(0, buffer, width, height);
if (buffer > 0)
{
/* Init with the screenshot size */
size = QSize(width, height);
/* Try to get the real guest dimensions from the save state */
ULONG guestWidth = 0, guestHeight = 0;
machine.QuerySavedGuestSize(0, guestWidth, guestHeight);
if ( guestWidth > 0
&& guestHeight > 0)
size = QSize(guestWidth, guestHeight);
}
/* If we have a valid size, resize the framebuffer. */
if ( size.width() > 0
&& size.height() > 0)
{
UIResizeEvent event(FramebufferPixelFormat_Opaque, NULL, 0, 0, size.width(), size.height());
frameBuffer()->resizeEvent(&event);
}
}