VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBQGL.cpp@ 43138

Last change on this file since 43138 was 29794, checked in by vboxsync, 14 years ago

FE/Qt4: remove old core

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1/* $Id: VBoxFBQGL.cpp 29794 2010-05-25 16:06:59Z vboxsync $ */
2/** @file
3 * VBoxFBQGL Opengl-based FrameBuffer implementation
4 */
5
6/*
7 * Copyright (C) 2009 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17#if defined (VBOX_GUI_USE_QGLFB)
18
19#ifdef VBOX_WITH_PRECOMPILED_HEADERS
20# include "precomp.h"
21#else /* !VBOX_WITH_PRECOMPILED_HEADERS */
22#define LOG_GROUP LOG_GROUP_GUI
23
24#include "VBoxFrameBuffer.h"
25
26/* Qt includes */
27#include <QGLWidget>
28
29#ifdef VBOX_WITH_VIDEOHWACCEL
30#include <VBox/VBoxVideo.h>
31#endif
32#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
33
34
35/** @class VBoxQGLFrameBuffer
36 *
37 * The VBoxQImageFrameBuffer class is a class that implements the IFrameBuffer
38 * interface and uses QImage as the direct storage for VM display data. QImage
39 * is then converted to QPixmap and blitted to the console view widget.
40 */
41
42/** @note This method is called on EMT from under this object's lock */
43STDMETHODIMP VBoxQGLFrameBuffer::NotifyUpdate (ULONG aX, ULONG aY,
44 ULONG aW, ULONG aH)
45{
46// /* We're not on the GUI thread and update() isn't thread safe in
47// * Qt 4.3.x on the Win, Qt 3.3.x on the Mac (4.2.x is),
48// * on Linux (didn't check Qt 4.x there) and probably on other
49// * non-DOS platforms, so post the event instead. */
50#ifdef VBOXQGL_PROF_BASE
51 QApplication::postEvent (mView,
52 new VBoxRepaintEvent (aX, aY, aW, aH));
53#else
54 QRect r(aX, aY, aW, aH);
55 mCmdPipe.postCmd(VBOXVHWA_PIPECMD_PAINT, &r, 0);
56#endif
57 return S_OK;
58}
59
60#ifdef VBOXQGL_PROF_BASE
61STDMETHODIMP VBoxQGLFrameBuffer::RequestResize (ULONG aScreenId, ULONG aPixelFormat,
62 BYTE *aVRAM, ULONG aBitsPerPixel, ULONG aBytesPerLine,
63 ULONG aWidth, ULONG aHeight,
64 BOOL *aFinished)
65{
66 aWidth = VBOXQGL_PROF_WIDTH;
67 aHeight = VBOXQGL_PROF_HEIGHT;
68 VBoxFrameBuffer::RequestResize (aScreenId, aPixelFormat,
69 aVRAM, aBitsPerPixel, aBytesPerLine,
70 aWidth, aHeight,
71 aFinished);
72
73// if(aVRAM)
74 {
75 for(;;)
76 {
77 ULONG aX = 0;
78 ULONG aY = 0;
79 ULONG aW = aWidth;
80 ULONG aH = aHeight;
81 NotifyUpdate (aX, aY, aW, aH);
82 RTThreadSleep(40);
83 }
84 }
85 return S_OK;
86}
87#endif
88
89VBoxGLWidget* VBoxQGLFrameBuffer::vboxWidget()
90{
91 return (VBoxGLWidget*)mView->viewport();
92}
93
94void VBoxQGLFrameBuffer::paintEvent (QPaintEvent *pe)
95{
96 Q_UNUSED(pe);
97 VBoxGLWidget * pw = vboxWidget();
98 pw->makeCurrent();
99
100 QRect vp(mView->contentsX(), mView->contentsY(), pw->width(), pw->height());
101 if(vp != pw->vboxViewport())
102 {
103 pw->vboxDoUpdateViewport(vp);
104 }
105
106 pw->performDisplayAndSwap(true);
107}
108
109void VBoxQGLFrameBuffer::resizeEvent (VBoxResizeEvent *re)
110{
111 mWdt = re->width();
112 mHgt = re->height();
113
114 vboxWidget()->vboxResizeEvent(re);
115}
116
117/* processing the VHWA command, called from the GUI thread */
118void VBoxQGLFrameBuffer::doProcessVHWACommand(QEvent * pEvent)
119{
120 Q_UNUSED(pEvent);
121 vboxWidget()->vboxProcessVHWACommands(&mCmdPipe);
122}
123
124
125#ifdef VBOX_WITH_VIDEOHWACCEL
126
127STDMETHODIMP VBoxQGLFrameBuffer::ProcessVHWACommand(BYTE *pCommand)
128{
129 VBOXVHWACMD * pCmd = (VBOXVHWACMD*)pCommand;
130// Assert(0);
131 /* indicate that we process and complete the command asynchronously */
132 pCmd->Flags |= VBOXVHWACMD_FLAG_HG_ASYNCH;
133 /* post the command to the GUI thread for processing */
134// QApplication::postEvent (mView,
135// new VBoxVHWACommandProcessEvent (pCmd));
136 mCmdPipe.postCmd(VBOXVHWA_PIPECMD_VHWA, pCmd, 0);
137 return S_OK;
138}
139
140#endif
141
142#endif
143
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use