VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlay.h@ 22824

Last change on this file since 22824 was 22824, checked in by vboxsync, 16 years ago

burn fix

File size: 36.2 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VBoxFrameBuffer Overly classes declarations
5 */
6
7/*
8 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.virtualbox.org. This file is free software;
12 * you can redistribute it and/or modify it under the terms of the GNU
13 * General Public License (GPL) as published by the Free Software
14 * Foundation, in version 2 as it comes in the "COPYING" file of the
15 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19 * Clara, CA 95054 USA or visit http://www.sun.com if you need
20 * additional information or have any questions.
21 */
22#ifndef __VBoxFBOverlay_h__
23#define __VBoxFBOverlay_h__
24#if defined (VBOX_GUI_USE_QGL)
25#include "COMDefs.h"
26#include <QGLWidget>
27#include <iprt/assert.h>
28#include <iprt/critsect.h>
29
30#ifdef DEBUG
31#include "iprt/stream.h"
32#define VBOXQGLLOG(_m) RTPrintf _m
33#define VBOXQGLLOGREL(_m) do { RTPrintf _m ; LogRel( _m ); } while(0)
34#else
35#define VBOXQGLLOG(_m)
36#define VBOXQGLLOGREL(_m) LogRel( _m )
37#endif
38#define VBOXQGLLOG_ENTER(_m)
39//do{VBOXQGLLOG(("==>[%s]:", __FUNCTION__)); VBOXQGLLOG(_m);}while(0)
40#define VBOXQGLLOG_EXIT(_m)
41//do{VBOXQGLLOG(("<==[%s]:", __FUNCTION__)); VBOXQGLLOG(_m);}while(0)
42#ifdef DEBUG
43#define VBOXQGL_ASSERTNOERR() \
44 do { GLenum err = glGetError(); \
45 if(err != GL_NO_ERROR) VBOXQGLLOG(("gl error ocured (0x%x)\n", err)); \
46 Assert(err == GL_NO_ERROR); \
47 }while(0)
48
49#define VBOXQGL_CHECKERR(_op) \
50 do { \
51 glGetError(); \
52 _op \
53 VBOXQGL_ASSERTNOERR(); \
54 }while(0)
55#else
56#define VBOXQGL_ASSERTNOERR() \
57 do {}while(0)
58
59#define VBOXQGL_CHECKERR(_op) \
60 do { \
61 _op \
62 }while(0)
63#endif
64
65#ifdef DEBUG
66#include <iprt/time.h>
67
68#define VBOXGETTIME() RTTimeNanoTS()
69
70#define VBOXPRINTDIF(_nano, _m) do{\
71 uint64_t cur = VBOXGETTIME(); \
72 VBOXQGLLOG(_m); \
73 VBOXQGLLOG(("(%Lu)\n", cur - (_nano))); \
74 }while(0)
75
76class VBoxVHWADbgTimeCounter
77{
78public:
79 VBoxVHWADbgTimeCounter(const char* msg) {mTime = VBOXGETTIME(); mMsg=msg;}
80 ~VBoxVHWADbgTimeCounter() {VBOXPRINTDIF(mTime, (mMsg));}
81private:
82 uint64_t mTime;
83 const char* mMsg;
84};
85
86#define VBOXQGLLOG_METHODTIME(_m) VBoxVHWADbgTimeCounter _dbgTimeCounter(_m)
87#else
88#define VBOXQGLLOG_METHODTIME(_m)
89#endif
90
91#define VBOXQGLLOG_QRECT(_p, _pr, _s) do{\
92 VBOXQGLLOG((_p " x(%d), y(%d), w(%d), h(%d)" _s, (_pr)->x(), (_pr)->y(), (_pr)->width(), (_pr)->height()));\
93 }while(0)
94
95#define VBOXQGLLOG_CKEY(_p, _pck, _s) do{\
96 VBOXQGLLOG((_p " l(0x%x), u(0x%x)" _s, (_pck)->lower(), (_pck)->upper()));\
97 }while(0)
98
99class VBoxVHWADirtyRect
100{
101public:
102 VBoxVHWADirtyRect() :
103 mIsClear(true)
104 {}
105
106 VBoxVHWADirtyRect(const QRect & aRect)
107 {
108 if(aRect.isEmpty())
109 {
110 mIsClear = false;
111 mRect = aRect;
112 }
113 else
114 {
115 mIsClear = true;
116 }
117 }
118
119 bool isClear() const { return mIsClear; }
120
121 void add(const QRect & aRect)
122 {
123 if(aRect.isEmpty())
124 return;
125
126 mRect = mIsClear ? aRect : mRect.united(aRect);
127 mIsClear = false;
128 }
129
130 void add(const VBoxVHWADirtyRect & aRect)
131 {
132 if(aRect.isClear())
133 return;
134 add(aRect.rect());
135 }
136
137 void set(const QRect & aRect)
138 {
139 if(aRect.isEmpty())
140 {
141 mIsClear = true;
142 }
143 else
144 {
145 mRect = aRect;
146 mIsClear = false;
147 }
148 }
149
150 void clear() { mIsClear = true; }
151
152 const QRect & rect() const {return mRect;}
153
154 const QRect & toRect()
155 {
156 if(isClear())
157 {
158 mRect.setCoords(0, 0, -1, -1);
159 }
160 return mRect;
161 }
162
163 bool intersects(const QRect & aRect) const {return mIsClear ? false : mRect.intersects(aRect);}
164
165 bool intersects(const VBoxVHWADirtyRect & aRect) const {return mIsClear ? false : aRect.intersects(mRect);}
166
167 QRect united(const QRect & aRect) const {return mIsClear ? aRect : aRect.united(mRect);}
168
169 bool contains(const QRect & aRect) const {return mIsClear ? false : aRect.contains(mRect);}
170
171 void subst(const VBoxVHWADirtyRect & aRect) { if(!mIsClear && aRect.contains(mRect)) clear(); }
172
173private:
174 QRect mRect;
175 bool mIsClear;
176};
177
178class VBoxVHWAColorKey
179{
180public:
181 VBoxVHWAColorKey() :
182 mUpper(0),
183 mLower(0)
184 {}
185
186 VBoxVHWAColorKey(uint32_t aUpper, uint32_t aLower) :
187 mUpper(aUpper),
188 mLower(aLower)
189 {}
190
191 uint32_t upper() const {return mUpper; }
192 uint32_t lower() const {return mLower; }
193
194 bool operator==(const VBoxVHWAColorKey & other) const { return mUpper == other.mUpper && mLower == other.mLower; }
195private:
196 uint32_t mUpper;
197 uint32_t mLower;
198};
199
200class VBoxVHWAColorComponent
201{
202public:
203 VBoxVHWAColorComponent() :
204 mMask(0),
205 mRange(0),
206 mOffset(32),
207 mcBits(0)
208 {}
209
210 VBoxVHWAColorComponent(uint32_t aMask);
211
212 uint32_t mask() const { return mMask; }
213 uint32_t range() const { return mRange; }
214 uint32_t offset() const { return mOffset; }
215 uint32_t cBits() const { return mcBits; }
216 uint32_t colorVal(uint32_t col) const { return (col & mMask) >> mOffset; }
217 float colorValNorm(uint32_t col) const { return ((float)colorVal(col))/mRange; }
218private:
219 uint32_t mMask;
220 uint32_t mRange;
221 uint32_t mOffset;
222 uint32_t mcBits;
223};
224
225class VBoxVHWAColorFormat
226{
227public:
228
229// VBoxVHWAColorFormat(GLint aInternalFormat, GLenum aFormat, GLenum aType, uint32_t aDataFormat);
230 VBoxVHWAColorFormat(uint32_t bitsPerPixel, uint32_t r, uint32_t g, uint32_t b);
231 VBoxVHWAColorFormat(uint32_t fourcc);
232 VBoxVHWAColorFormat(){}
233 GLint internalFormat() const {return mInternalFormat; }
234 GLenum format() const {return mFormat; }
235 GLenum type() const {return mType; }
236 bool isValid() const {return mBitsPerPixel != 0; }
237 uint32_t fourcc() const {return mDataFormat;}
238 uint32_t bitsPerPixel() const { return mBitsPerPixel; }
239 uint32_t bitsPerPixelTex() const { return mBitsPerPixelTex; }
240// uint32_t bitsPerPixelDd() const { return mBitsPerPixelDd; }
241 void pixel2Normalized(uint32_t pix, float *r, float *g, float *b) const;
242 uint32_t widthCompression() const {return mWidthCompression;}
243 uint32_t heightCompression() const {return mHeightCompression;}
244 const VBoxVHWAColorComponent& r() const {return mR;}
245 const VBoxVHWAColorComponent& g() const {return mG;}
246 const VBoxVHWAColorComponent& b() const {return mB;}
247 const VBoxVHWAColorComponent& a() const {return mA;}
248
249 bool equals (const VBoxVHWAColorFormat & other) const;
250
251private:
252 void init(uint32_t bitsPerPixel, uint32_t r, uint32_t g, uint32_t b);
253 void init(uint32_t fourcc);
254
255 GLint mInternalFormat;
256 GLenum mFormat;
257 GLenum mType;
258 uint32_t mDataFormat;
259
260 uint32_t mBitsPerPixel;
261 uint32_t mBitsPerPixelTex;
262// uint32_t mBitsPerPixelDd;
263 uint32_t mWidthCompression;
264 uint32_t mHeightCompression;
265 VBoxVHWAColorComponent mR;
266 VBoxVHWAColorComponent mG;
267 VBoxVHWAColorComponent mB;
268 VBoxVHWAColorComponent mA;
269};
270
271class VBoxVHWATexture
272{
273public:
274 VBoxVHWATexture() {}
275 VBoxVHWATexture(const QRect & aRect, const VBoxVHWAColorFormat &aFormat);
276 virtual ~VBoxVHWATexture();
277 virtual void init(uchar *pvMem);
278 void setAddress(uchar *pvMem) {mAddress = pvMem;}
279 void update(const QRect * pRect) { doUpdate(mAddress, pRect);}
280 void bind() {glBindTexture(texTarget(), mTexture);}
281
282 virtual void texCoord(int x, int y);
283 virtual void multiTexCoord(GLenum texUnit, int x, int y);
284
285// GLuint texture() {return mTexture;}
286 const QRect & texRect() {return mTexRect;}
287 const QRect & rect() {return mRect;}
288 uchar * address(){ return mAddress; }
289 uint32_t rectSizeTex(const QRect * pRect) {return pRect->width() * pRect->height() * mBytesPerPixelTex;}
290 uchar * pointAddress(int x, int y)
291 {
292 x = toXTex(x);
293 y = toYTex(y);
294 return pointAddressTex(x, y);
295 }
296 uint32_t pointOffsetTex(int x, int y) { return y*mBytesPerLine + x*mBytesPerPixelTex; }
297 uchar * pointAddressTex(int x, int y) { return mAddress + pointOffsetTex(x, y); }
298 int toXTex(int x) {return x/mColorFormat.widthCompression();}
299 int toYTex(int y) {return y/mColorFormat.heightCompression();}
300 ulong memSize(){ return mBytesPerLine * mRect.height(); }
301 uint32_t bytesPerLine() {return mBytesPerLine; }
302
303protected:
304 virtual void doUpdate(uchar * pAddress, const QRect * pRect);
305 virtual void initParams();
306 virtual void load();
307 virtual GLenum texTarget() {return GL_TEXTURE_2D; }
308
309
310 QRect mTexRect; /* texture size */
311 QRect mRect; /* img size */
312 uchar * mAddress;
313 GLuint mTexture;
314 uint32_t mBytesPerPixel;
315 uint32_t mBytesPerPixelTex;
316 uint32_t mBytesPerLine;
317 VBoxVHWAColorFormat mColorFormat;
318private:
319 void uninit();
320};
321
322class VBoxVHWATextureNP2 : public VBoxVHWATexture
323{
324public:
325 VBoxVHWATextureNP2() : VBoxVHWATexture() {}
326 VBoxVHWATextureNP2(const QRect & aRect, const VBoxVHWAColorFormat &aFormat) :
327 VBoxVHWATexture(aRect, aFormat){
328 mTexRect = QRect(0, 0, aRect.width()/aFormat.widthCompression(), aRect.height()/aFormat.heightCompression());
329 }
330};
331
332class VBoxVHWATextureNP2Rect : public VBoxVHWATextureNP2
333{
334public:
335 VBoxVHWATextureNP2Rect() : VBoxVHWATextureNP2() {}
336 VBoxVHWATextureNP2Rect(const QRect & aRect, const VBoxVHWAColorFormat &aFormat) :
337 VBoxVHWATextureNP2(aRect, aFormat){}
338
339 virtual void texCoord(int x, int y);
340 virtual void multiTexCoord(GLenum texUnit, int x, int y);
341protected:
342 virtual GLenum texTarget();
343};
344
345class VBoxVHWATextureNP2RectPBO : public VBoxVHWATextureNP2Rect
346{
347public:
348 VBoxVHWATextureNP2RectPBO() : VBoxVHWATextureNP2Rect() {}
349 VBoxVHWATextureNP2RectPBO(const QRect & aRect, const VBoxVHWAColorFormat &aFormat) :
350 VBoxVHWATextureNP2Rect(aRect, aFormat){}
351 virtual ~VBoxVHWATextureNP2RectPBO();
352
353 virtual void init(uchar *pvMem);
354protected:
355 virtual void load();
356 virtual void doUpdate(uchar * pAddress, const QRect * pRect);
357private:
358 GLuint mPBO;
359};
360
361class VBoxVHWAHandleTable
362{
363public:
364 VBoxVHWAHandleTable(uint32_t initialSize);
365 ~VBoxVHWAHandleTable();
366 uint32_t put(void * data);
367 bool mapPut(uint32_t h, void * data);
368 void* get(uint32_t h);
369 void* remove(uint32_t h);
370private:
371 void doPut(uint32_t h, void * data);
372 void doRemove(uint32_t h);
373 void** mTable;
374 uint32_t mcSize;
375 uint32_t mcUsage;
376 uint32_t mCursor;
377};
378
379/* data flow:
380 * I. NON-Yinverted surface:
381 * 1.direct memory update (paint, lock/unlock):
382 * mem->tex->fb
383 * 2.blt
384 * srcTex->invFB->tex->fb
385 * |->mem
386 *
387 * II. Yinverted surface:
388 * 1.direct memory update (paint, lock/unlock):
389 * mem->tex->fb
390 * 2.blt
391 * srcTex->fb->tex
392 * |->mem
393 *
394 * III. flip support:
395 * 1. Yinverted<->NON-YInverted conversion :
396 * mem->tex-(rotate model view, force LAZY complete fb update)->invFB->tex
397 * fb-->| |->mem
398 * */
399class VBoxVHWASurfaceBase
400{
401public:
402 VBoxVHWASurfaceBase(
403 class VBoxGLWidget *mWidget,
404#if 0
405 class VBoxVHWAGlContextState *aState,
406 bool aIsYInverted,
407#endif
408 const QSize & aSize,
409 const QRect & aTargRect,
410 const QRect & aSrcRect,
411 const QRect & aVisTargRect,
412 VBoxVHWAColorFormat & aColorFormat,
413 VBoxVHWAColorKey * pSrcBltCKey, VBoxVHWAColorKey * pDstBltCKey,
414 VBoxVHWAColorKey * pSrcOverlayCKey, VBoxVHWAColorKey * pDstOverlayCKey,
415 bool bVGA);
416
417 virtual ~VBoxVHWASurfaceBase();
418
419 void init(VBoxVHWASurfaceBase * pPrimary, uchar *pvMem);
420
421 void uninit();
422
423 static void globalInit();
424
425// int blt(const QRect * aDstRect, VBoxVHWASurfaceBase * aSrtSurface, const QRect * aSrcRect, const VBoxVHWAColorKey * pDstCKeyOverride, const VBoxVHWAColorKey * pSrcCKeyOverride);
426
427 int lock(const QRect * pRect, uint32_t flags);
428
429 int unlock();
430
431 void updatedMem(const QRect * aRect);
432
433 void performDisplay(VBoxVHWASurfaceBase *pPrimary);
434
435 void setRects(VBoxVHWASurfaceBase *pPrimary, const QRect & aTargRect, const QRect & aSrcRect, const QRect & aVisibleTargRect, bool bForceReinit);
436 void setTargRectPosition(VBoxVHWASurfaceBase *pPrimary, const QPoint & aPoint, const QRect & aVisibleTargRect);
437 void updateVisibleTargRect(VBoxVHWASurfaceBase *pPrimary, const QRect & aVisibleTargRect);
438
439 static ulong calcBytesPerPixel(GLenum format, GLenum type);
440
441 static GLsizei makePowerOf2(GLsizei val);
442
443 bool addressAlocated() const { return mFreeAddress; }
444 uchar * address(){ return mAddress; }
445
446 ulong memSize();
447
448 ulong width() { return mRect.width(); }
449 ulong height() { return mRect.height(); }
450 const QSize size() {return mRect.size();}
451
452 GLenum format() {return mColorFormat.format(); }
453 GLint internalFormat() { return mColorFormat.internalFormat(); }
454 GLenum type() { return mColorFormat.type(); }
455 uint32_t fourcc() {return mColorFormat.fourcc(); }
456
457// ulong bytesPerPixel() { return mpTex[0]->bytesPerPixel(); }
458 ulong bitsPerPixel() { return mColorFormat.bitsPerPixel(); }
459// ulong bitsPerPixelDd() { return mColorFormat.bitsPerPixelDd(); }
460 ulong bytesPerLine() { return mpTex[0]->bytesPerLine(); }
461
462 const VBoxVHWAColorKey * dstBltCKey() const { return mpDstBltCKey; }
463 const VBoxVHWAColorKey * srcBltCKey() const { return mpSrcBltCKey; }
464 const VBoxVHWAColorKey * dstOverlayCKey() const { return mpDstOverlayCKey; }
465 const VBoxVHWAColorKey * defaultSrcOverlayCKey() const { return mpDefaultSrcOverlayCKey; }
466 const VBoxVHWAColorKey * defaultDstOverlayCKey() const { return mpDefaultDstOverlayCKey; }
467 const VBoxVHWAColorKey * srcOverlayCKey() const { return mpSrcOverlayCKey; }
468 void resetDefaultSrcOverlayCKey() { mpSrcOverlayCKey = mpDefaultSrcOverlayCKey; }
469 void resetDefaultDstOverlayCKey() { mpDstOverlayCKey = mpDefaultDstOverlayCKey; }
470
471 void setDstBltCKey(const VBoxVHWAColorKey * ckey)
472 {
473 if(ckey)
474 {
475 mDstBltCKey = *ckey;
476 mpDstBltCKey = &mDstBltCKey;
477 }
478 else
479 {
480 mpDstBltCKey = NULL;
481 }
482 }
483
484 void setSrcBltCKey(const VBoxVHWAColorKey * ckey)
485 {
486 if(ckey)
487 {
488 mSrcBltCKey = *ckey;
489 mpSrcBltCKey = &mSrcBltCKey;
490 }
491 else
492 {
493 mpSrcBltCKey = NULL;
494 }
495 }
496
497 void setDefaultDstOverlayCKey(const VBoxVHWAColorKey * ckey)
498 {
499 if(ckey)
500 {
501 mDefaultDstOverlayCKey = *ckey;
502 mpDefaultDstOverlayCKey = &mDefaultDstOverlayCKey;
503 }
504 else
505 {
506 mpDefaultDstOverlayCKey = NULL;
507 }
508 }
509
510 void setDefaultSrcOverlayCKey(const VBoxVHWAColorKey * ckey)
511 {
512 if(ckey)
513 {
514 mDefaultSrcOverlayCKey = *ckey;
515 mpDefaultSrcOverlayCKey = &mDefaultSrcOverlayCKey;
516 }
517 else
518 {
519 mpDefaultSrcOverlayCKey = NULL;
520 }
521 }
522
523 void setOverriddenDstOverlayCKey(const VBoxVHWAColorKey * ckey)
524 {
525 if(ckey)
526 {
527 mOverriddenDstOverlayCKey = *ckey;
528 mpDstOverlayCKey = &mOverriddenDstOverlayCKey;
529 }
530 else
531 {
532 mpDstOverlayCKey = NULL;
533 }
534 }
535
536 void setOverriddenSrcOverlayCKey(const VBoxVHWAColorKey * ckey)
537 {
538 if(ckey)
539 {
540 mOverriddenSrcOverlayCKey = *ckey;
541 mpSrcOverlayCKey = &mOverriddenSrcOverlayCKey;
542 }
543 else
544 {
545 mpSrcOverlayCKey = NULL;
546 }
547 }
548
549 const VBoxVHWAColorKey * getActiveSrcOverlayCKey()
550 {
551 return mpSrcOverlayCKey;
552 }
553
554 const VBoxVHWAColorKey * getActiveDstOverlayCKey(VBoxVHWASurfaceBase * pPrimary)
555 {
556 return mpDstOverlayCKey ? mpDefaultDstOverlayCKey : pPrimary->mpDstOverlayCKey;
557 }
558
559 const VBoxVHWAColorFormat & colorFormat() {return mColorFormat; }
560
561 void setAddress(uchar * addr);
562
563 const QRect& rect() const {return mRect;}
564 const QRect& srcRect() const {return mSrcRect; }
565 const QRect& targRect() const {return mTargRect; }
566 class VBoxVHWASurfList * getComplexList() {return mComplexList; }
567
568 class VBoxVHWAGlProgramMngr * getGlProgramMngr();
569 static int setCKey(class VBoxVHWAGlProgramVHWA * pProgram, const VBoxVHWAColorFormat * pFormat, const VBoxVHWAColorKey * pCKey, bool bDst);
570
571 uint32_t handle() const {return mHGHandle;}
572 void setHandle(uint32_t h) {mHGHandle = h;}
573
574private:
575 void doSetRectValuesInternal(const QRect & aTargRect, const QRect & aSrcRect, const QRect & aVisTargRect);
576
577 void setComplexList(VBoxVHWASurfList *aComplexList) { mComplexList = aComplexList; }
578 void initDisplay(VBoxVHWASurfaceBase *pPrimary);
579 void deleteDisplay();
580
581 GLuint createDisplay(VBoxVHWASurfaceBase *pPrimary);
582 void doDisplay(VBoxVHWASurfaceBase *pPrimary, VBoxVHWAGlProgramVHWA * pProgram, bool bBindDst);
583 void synchTexMem(const QRect * aRect);
584
585 int performBlt(const QRect * pDstRect, VBoxVHWASurfaceBase * pSrcSurface, const QRect * pSrcRect, const VBoxVHWAColorKey * pDstCKey, const VBoxVHWAColorKey * pSrcCKey, bool blt);
586
587 void doTex2FB(const QRect * pDstRect, const QRect * pSrcRect);
588 void doMultiTex2FB(const QRect * pDstRect, VBoxVHWATexture * pDstTex, const QRect * pSrcRect, int cSrcTex);
589 void doMultiTex2FB(const QRect * pDstRect, const QRect * pSrcRect, int cSrcTex);
590
591 QRect mRect; /* == Inv FB size */
592
593 QRect mSrcRect;
594 QRect mTargRect; /* == Vis FB size */
595
596 QRect mVisibleTargRect;
597 QRect mVisibleSrcRect;
598
599 GLuint mVisibleDisplay;
600
601 bool mVisibleDisplayInitialized;
602
603 uchar * mAddress;
604 VBoxVHWATexture *mpTex[3];
605
606 VBoxVHWAColorFormat mColorFormat;
607
608 VBoxVHWAColorKey *mpSrcBltCKey;
609 VBoxVHWAColorKey *mpDstBltCKey;
610 VBoxVHWAColorKey *mpSrcOverlayCKey;
611 VBoxVHWAColorKey *mpDstOverlayCKey;
612
613 VBoxVHWAColorKey *mpDefaultDstOverlayCKey;
614 VBoxVHWAColorKey *mpDefaultSrcOverlayCKey;
615
616 VBoxVHWAColorKey mSrcBltCKey;
617 VBoxVHWAColorKey mDstBltCKey;
618 VBoxVHWAColorKey mOverriddenSrcOverlayCKey;
619 VBoxVHWAColorKey mOverriddenDstOverlayCKey;
620 VBoxVHWAColorKey mDefaultDstOverlayCKey;
621 VBoxVHWAColorKey mDefaultSrcOverlayCKey;
622
623 int mLockCount;
624 /* memory buffer not reflected in fm and texture, e.g if memory buffer is replaced or in case of lock/unlock */
625 VBoxVHWADirtyRect mUpdateMem2TexRect;
626
627 bool mFreeAddress;
628
629 class VBoxVHWASurfList *mComplexList;
630
631 class VBoxGLWidget *mWidget;
632
633 uint32_t mHGHandle;
634
635#ifdef DEBUG
636public:
637 uint64_t cFlipsCurr;
638 uint64_t cFlipsTarg;
639#endif
640 friend class VBoxVHWASurfList;
641};
642
643typedef std::list <VBoxVHWASurfaceBase*> SurfList;
644typedef std::list <VBoxVHWASurfList*> OverlayList;
645typedef std::list <struct _VBOXVHWACMD *> VHWACommandList;
646
647class VBoxVHWASurfList
648{
649public:
650
651 VBoxVHWASurfList() : mCurrent(NULL) {}
652 void add(VBoxVHWASurfaceBase *pSurf)
653 {
654 VBoxVHWASurfList * pOld = pSurf->getComplexList();
655 if(pOld)
656 {
657 pOld->remove(pSurf);
658 }
659 mSurfaces.push_back(pSurf);
660 pSurf->setComplexList(this);
661 }
662
663 void clear()
664 {
665 for (SurfList::iterator it = mSurfaces.begin();
666 it != mSurfaces.end(); ++ it)
667 {
668 (*it)->setComplexList(NULL);
669 }
670 mSurfaces.clear();
671 mCurrent = NULL;
672 }
673
674 size_t size() const {return mSurfaces.size(); }
675
676 void remove(VBoxVHWASurfaceBase *pSurf)
677 {
678 mSurfaces.remove(pSurf);
679 pSurf->setComplexList(NULL);
680 if(mCurrent == pSurf)
681 mCurrent = NULL;
682 }
683
684 bool empty() { return mSurfaces.empty(); }
685
686 void setCurrentVisible(VBoxVHWASurfaceBase *pSurf)
687 {
688 mCurrent = pSurf;
689 }
690
691 VBoxVHWASurfaceBase * current() { return mCurrent; }
692 const SurfList & surfaces() const {return mSurfaces;}
693
694private:
695
696 SurfList mSurfaces;
697 VBoxVHWASurfaceBase* mCurrent;
698};
699
700class VBoxVHWADisplay
701{
702public:
703 VBoxVHWADisplay() :
704 mSurfVGA(NULL)
705// ,
706// mSurfPrimary(NULL)
707 {}
708
709 VBoxVHWASurfaceBase * setVGA(VBoxVHWASurfaceBase * pVga)
710 {
711 VBoxVHWASurfaceBase * old = mSurfVGA;
712 mSurfVGA = pVga;
713 mPrimary.clear();
714 if(pVga)
715 {
716 Assert(!pVga->getComplexList());
717 mPrimary.add(pVga);
718 mPrimary.setCurrentVisible(pVga);
719 }
720// mSurfPrimary = pVga;
721 mOverlays.clear();
722 return old;
723 }
724
725 VBoxVHWASurfaceBase * updateVGA(VBoxVHWASurfaceBase * pVga)
726 {
727 VBoxVHWASurfaceBase * old = mSurfVGA;
728 Assert(old);
729 mSurfVGA = pVga;
730 return old;
731 }
732
733 VBoxVHWASurfaceBase * getVGA() const
734 {
735 return mSurfVGA;
736 }
737
738 VBoxVHWASurfaceBase * getPrimary()
739 {
740 return mPrimary.current();
741 }
742
743 void addOverlay(VBoxVHWASurfList * pSurf)
744 {
745 mOverlays.push_back(pSurf);
746 }
747
748 void checkAddOverlay(VBoxVHWASurfList * pSurf)
749 {
750 if(!hasOverlay(pSurf))
751 addOverlay(pSurf);
752 }
753
754 bool hasOverlay(VBoxVHWASurfList * pSurf)
755 {
756 for (OverlayList::iterator it = mOverlays.begin();
757 it != mOverlays.end(); ++ it)
758 {
759 if((*it) == pSurf)
760 {
761 return true;
762 }
763 }
764 return false;
765 }
766
767 void removeOverlay(VBoxVHWASurfList * pSurf)
768 {
769 mOverlays.remove(pSurf);
770 }
771
772 void performDisplay()
773 {
774 VBoxVHWASurfaceBase * pPrimary = mPrimary.current();
775 pPrimary->performDisplay(NULL);
776
777 for (OverlayList::const_iterator it = mOverlays.begin();
778 it != mOverlays.end(); ++ it)
779 {
780 VBoxVHWASurfaceBase * pOverlay = (*it)->current();
781 if(pOverlay)
782 {
783 pOverlay->performDisplay(pPrimary);
784 }
785 }
786 }
787
788 const OverlayList & overlays() const {return mOverlays;}
789 const VBoxVHWASurfList & primaries() const { return mPrimary; }
790
791private:
792 VBoxVHWASurfaceBase *mSurfVGA;
793 VBoxVHWASurfList mPrimary;
794
795 OverlayList mOverlays;
796};
797
798typedef void (VBoxGLWidget::*PFNVBOXQGLOP)(void* );
799
800typedef void (*PFNVBOXQGLFUNC)(void*, void*);
801
802typedef enum
803{
804 VBOXVHWA_PIPECMD_PAINT = 1,
805 VBOXVHWA_PIPECMD_VHWA,
806 VBOXVHWA_PIPECMD_OP,
807 VBOXVHWA_PIPECMD_FUNC,
808}VBOXVHWA_PIPECMD_TYPE;
809
810typedef struct VBOXVHWACALLBACKINFO
811{
812 VBoxGLWidget *pThis;
813 PFNVBOXQGLOP pfnCallback;
814 void * pContext;
815}VBOXVHWACALLBACKINFO;
816
817typedef struct VBOXVHWAFUNCCALLBACKINFO
818{
819 PFNVBOXQGLFUNC pfnCallback;
820 void * pContext1;
821 void * pContext2;
822}VBOXVHWAFUNCCALLBACKINFO;
823
824class VBoxVHWACommandElement
825{
826public:
827 void setVHWACmd(struct _VBOXVHWACMD * pCmd)
828 {
829 mType = VBOXVHWA_PIPECMD_VHWA;
830 u.mpCmd = pCmd;
831 }
832
833 void setPaintCmd(const QRect & aRect)
834 {
835 mType = VBOXVHWA_PIPECMD_PAINT;
836 mRect = aRect;
837 }
838
839 void setOp(const VBOXVHWACALLBACKINFO & aOp)
840 {
841 mType = VBOXVHWA_PIPECMD_OP;
842 u.mCallback = aOp;
843 }
844
845 void setFunc(const VBOXVHWAFUNCCALLBACKINFO & aOp)
846 {
847 mType = VBOXVHWA_PIPECMD_FUNC;
848 u.mFuncCallback = aOp;
849 }
850
851 void setData(VBOXVHWA_PIPECMD_TYPE aType, void * pvData)
852 {
853 switch(aType)
854 {
855 case VBOXVHWA_PIPECMD_PAINT:
856 setPaintCmd(*((QRect*)pvData));
857 break;
858 case VBOXVHWA_PIPECMD_VHWA:
859 setVHWACmd((struct _VBOXVHWACMD *)pvData);
860 break;
861 case VBOXVHWA_PIPECMD_OP:
862 setOp(*((VBOXVHWACALLBACKINFO *)pvData));
863 break;
864 case VBOXVHWA_PIPECMD_FUNC:
865 setFunc(*((VBOXVHWAFUNCCALLBACKINFO *)pvData));
866 break;
867 default:
868 Assert(0);
869 break;
870 }
871 }
872
873 VBOXVHWA_PIPECMD_TYPE type() const {return mType;}
874 const QRect & rect() const {return mRect;}
875 struct _VBOXVHWACMD * vhwaCmd() const {return u.mpCmd;}
876 const VBOXVHWACALLBACKINFO & op() const {return u.mCallback; }
877 const VBOXVHWAFUNCCALLBACKINFO & func() const {return u.mFuncCallback; }
878
879 VBoxVHWACommandElement * mpNext;
880private:
881 VBOXVHWA_PIPECMD_TYPE mType;
882 union
883 {
884 struct _VBOXVHWACMD * mpCmd;
885 VBOXVHWACALLBACKINFO mCallback;
886 VBOXVHWAFUNCCALLBACKINFO mFuncCallback;
887 }u;
888 QRect mRect;
889};
890
891class VBoxVHWACommandElementPipe
892{
893public:
894 VBoxVHWACommandElementPipe() :
895 mpFirst(NULL),
896 mpLast(NULL)
897 {}
898
899 void put(VBoxVHWACommandElement *pCmd)
900 {
901 if(mpLast)
902 {
903 Assert(mpFirst);
904 mpLast->mpNext = pCmd;
905 mpLast = pCmd;
906 }
907 else
908 {
909 Assert(!mpFirst);
910 mpFirst = pCmd;
911 mpLast = pCmd;
912 }
913 pCmd->mpNext= NULL;
914
915 }
916
917 VBoxVHWACommandElement * detachList()
918 {
919 if(mpLast)
920 {
921 VBoxVHWACommandElement * pHead = mpFirst;
922 mpFirst = NULL;
923 mpLast = NULL;
924 return pHead;
925 }
926 return NULL;
927 }
928private:
929 VBoxVHWACommandElement *mpFirst;
930 VBoxVHWACommandElement *mpLast;
931};
932
933class VBoxVHWACommandElementStack
934{
935public:
936 VBoxVHWACommandElementStack() :
937 mpFirst(NULL) {}
938
939 void push(VBoxVHWACommandElement *pCmd)
940 {
941 pCmd->mpNext = mpFirst;
942 mpFirst = pCmd;
943 }
944
945 void pusha(VBoxVHWACommandElement *pFirst, VBoxVHWACommandElement *pLast)
946 {
947 pLast->mpNext = mpFirst;
948 mpFirst = pFirst;
949 }
950
951 VBoxVHWACommandElement * pop()
952 {
953 if(mpFirst)
954 {
955 VBoxVHWACommandElement * ret = mpFirst;
956 mpFirst = ret->mpNext;
957 return ret;
958 }
959 return NULL;
960 }
961private:
962 VBoxVHWACommandElement *mpFirst;
963};
964
965class VBoxVHWACommandElementProcessor
966{
967public:
968 VBoxVHWACommandElementProcessor(class VBoxConsoleView *aView);
969 ~VBoxVHWACommandElementProcessor();
970 void postCmd(VBOXVHWA_PIPECMD_TYPE aType, void * pvData);
971 class VBoxVHWACommandElement * detachCmdList(class VBoxVHWACommandElement * pFirst2Free, VBoxVHWACommandElement * pLast2Free);
972
973private:
974 RTCRITSECT mCritSect;
975 class VBoxVHWACommandProcessEvent *mpFirstEvent;
976 class VBoxVHWACommandProcessEvent *mpLastEvent;
977 class VBoxConsoleView *mView;
978 bool mbNewEvent;
979 VBoxVHWACommandElementStack mFreeElements;
980 VBoxVHWACommandElement mElementsBuffer[2048];
981};
982
983class VBoxVHWACommandsQueue
984{
985public:
986 void enqueue(PFNVBOXQGLFUNC pfn, void* pContext1, void* pContext2);
987
988 VBoxVHWACommandElement * detachList();
989
990 void freeList(VBoxVHWACommandElement * pList);
991
992private:
993 VBoxVHWACommandElementPipe mCmds;
994};
995
996class VBoxGLWidget : public QGLWidget
997{
998public:
999 VBoxGLWidget (class VBoxConsoleView *aView, QWidget *aParent);
1000 ~VBoxGLWidget();
1001
1002 ulong vboxPixelFormat() { return mPixelFormat; }
1003 bool vboxUsesGuestVRAM() { return mUsesGuestVRAM; }
1004
1005 uchar *vboxAddress() { return mDisplay.getVGA() ? mDisplay.getVGA()->address() : NULL; }
1006
1007#ifdef VBOX_WITH_VIDEOHWACCEL
1008 uchar *vboxVRAMAddressFromOffset(uint64_t offset);
1009 uint64_t vboxVRAMOffsetFromAddress(uchar* addr);
1010 uint64_t vboxVRAMOffset(VBoxVHWASurfaceBase * pSurf);
1011
1012 void vhwaSaveExec(struct SSMHANDLE * pSSM);
1013 int vhwaLoadExec(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version);
1014
1015 int vhwaSurfaceCanCreate(struct _VBOXVHWACMD_SURF_CANCREATE *pCmd);
1016 int vhwaSurfaceCreate(struct _VBOXVHWACMD_SURF_CREATE *pCmd);
1017 int vhwaSurfaceDestroy(struct _VBOXVHWACMD_SURF_DESTROY *pCmd);
1018 int vhwaSurfaceLock(struct _VBOXVHWACMD_SURF_LOCK *pCmd);
1019 int vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd);
1020 int vhwaSurfaceBlt(struct _VBOXVHWACMD_SURF_BLT *pCmd);
1021 int vhwaSurfaceFlip(struct _VBOXVHWACMD_SURF_FLIP *pCmd);
1022 int vhwaSurfaceOverlayUpdate(struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmf);
1023 int vhwaSurfaceOverlaySetPosition(struct _VBOXVHWACMD_SURF_OVERLAY_SETPOSITION *pCmd);
1024 int vhwaSurfaceColorkeySet(struct _VBOXVHWACMD_SURF_COLORKEY_SET *pCmd);
1025 int vhwaQueryInfo1(struct _VBOXVHWACMD_QUERYINFO1 *pCmd);
1026 int vhwaQueryInfo2(struct _VBOXVHWACMD_QUERYINFO2 *pCmd);
1027 int vhwaConstruct(struct _VBOXVHWACMD_HH_CONSTRUCT *pCmd);
1028
1029 bool hasSurfaces() const;
1030 bool hasVisibleOverlays();
1031 const QRect & overlaysRectUnion();
1032#endif
1033
1034 ulong vboxBitsPerPixel() { return mDisplay.getVGA()->bitsPerPixel(); }
1035 ulong vboxBytesPerLine() { return mDisplay.getVGA() ? mDisplay.getVGA()->bytesPerLine() : 0; }
1036 int vboxFbWidth() {return mDisplay.getVGA()->width(); }
1037 int vboxFbHeight() {return mDisplay.getVGA()->height(); }
1038 bool vboxIsInitialized() {return mDisplay.getVGA() != NULL; }
1039
1040// void vboxPaintEvent (QPaintEvent *pe) {vboxPerformGLOp(&VBoxGLWidget::vboxDoPaint, pe); }
1041 void vboxResizeEvent (class VBoxResizeEvent *re) {vboxPerformGLOp(&VBoxGLWidget::vboxDoResize, re); }
1042
1043 void vboxProcessVHWACommands(class VBoxVHWACommandElementProcessor * pPipe) {vboxPerformGLOp(&VBoxGLWidget::vboxDoProcessVHWACommands, pPipe);}
1044#ifdef VBOX_WITH_VIDEOHWACCEL
1045 void vboxVHWACmd (struct _VBOXVHWACMD * pCmd) {vboxPerformGLOp(&VBoxGLWidget::vboxDoVHWACmd, pCmd);}
1046#endif
1047 class VBoxVHWAGlProgramMngr * vboxVHWAGetGlProgramMngr() { return mpMngr; }
1048
1049 VBoxVHWASurfaceBase * vboxGetVGASurface() { return mDisplay.getVGA(); }
1050
1051 static void doSetupMatrix(const QSize & aSize, bool bInverted);
1052
1053 void vboxDoUpdateViewport(const QRect & aRect);
1054 void vboxDoUpdateRect(const QRect * pRect);
1055
1056 const QRect & vboxViewport() const {return mViewport;}
1057
1058 void performDisplay() { mDisplay.performDisplay(); }
1059protected:
1060
1061 void paintGL()
1062 {
1063 if(mpfnOp)
1064 {
1065 (this->*mpfnOp)(mOpContext);
1066 mpfnOp = NULL;
1067 }
1068// else
1069// {
1070 mDisplay.performDisplay();
1071// }
1072 }
1073
1074 void initializeGL();
1075
1076private:
1077 static void setupMatricies(const QSize &display);
1078 static void adjustViewport(const QSize &display, const QRect &viewport);
1079 void vboxDoResize(void *re);
1080// void vboxDoPaint(void *rec);
1081
1082
1083#ifdef VBOXQGL_DBG_SURF
1084 void vboxDoTestSurfaces(void *context);
1085#endif
1086#ifdef VBOX_WITH_VIDEOHWACCEL
1087 void vboxDoVHWACmdExec(void *cmd);
1088 void vboxDoVHWACmdAndFree(void *cmd);
1089 void vboxDoVHWACmd(void *cmd);
1090
1091 void vboxCheckUpdateAddress (VBoxVHWASurfaceBase * pSurface, uint64_t offset)
1092 {
1093 if (pSurface->addressAlocated())
1094 {
1095 uchar * addr = vboxVRAMAddressFromOffset(offset);
1096 if(addr)
1097 {
1098 pSurface->setAddress(addr);
1099 }
1100 }
1101 }
1102
1103 int vhwaSaveSurface(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf, uint32_t surfCaps);
1104 int vhwaLoadSurface(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version);
1105 int vhwaSaveOverlayData(struct SSMHANDLE * pSSM, VBoxVHWASurfaceBase *pSurf, bool bVisible);
1106 int vhwaLoadOverlayData(VHWACommandList * pCmdList, struct SSMHANDLE * pSSM, uint32_t u32Version);
1107 void vhwaDoSurfaceOverlayUpdate(VBoxVHWASurfaceBase *pDstSurf, VBoxVHWASurfaceBase *pSrcSurf, struct _VBOXVHWACMD_SURF_OVERLAY_UPDATE *pCmd);
1108#endif
1109 static const QGLFormat & vboxGLFormat();
1110
1111 VBoxVHWADisplay mDisplay;
1112
1113
1114 /* we do all opengl stuff in the paintGL context,
1115 * submit the operation to be performed
1116 * @todo: could be moved outside the updateGL */
1117 void vboxPerformGLOp(PFNVBOXQGLOP pfn, void* pContext)
1118 {
1119 mpfnOp = pfn;
1120 mOpContext = pContext;
1121 updateGL();
1122 }
1123
1124// /* posts op to UI thread */
1125// int vboxExecOpSynch(PFNVBOXQGLOP pfn, void* pContext);
1126// void vboxExecOnResize(PFNVBOXQGLOP pfn, void* pContext);
1127
1128 void vboxDoProcessVHWACommands(void *pContext);
1129
1130 class VBoxVHWACommandElement * processCmdList(class VBoxVHWACommandElement * pCmd);
1131
1132 VBoxVHWASurfaceBase* handle2Surface(uint32_t h)
1133 {
1134 VBoxVHWASurfaceBase* pSurf = (VBoxVHWASurfaceBase*)mSurfHandleTable.get(h);
1135 Assert(pSurf);
1136 return pSurf;
1137 }
1138
1139 VBoxVHWAHandleTable mSurfHandleTable;
1140
1141 PFNVBOXQGLOP mpfnOp;
1142 void *mOpContext;
1143
1144 ulong mPixelFormat;
1145 bool mUsesGuestVRAM;
1146// bool mbVGASurfCreated;
1147 QRect mViewport;
1148
1149 class VBoxConsoleView *mView;
1150
1151 VBoxVHWASurfList *mConstructingList;
1152 int32_t mcRemaining2Contruct;
1153
1154 /* this is used in saved state restore to postpone surface restoration
1155 * till the framebuffer size is restored */
1156 VHWACommandList mOnResizeCmdList;
1157
1158 class VBoxVHWAGlProgramMngr *mpMngr;
1159};
1160
1161
1162typedef enum
1163{
1164 VBOXFBOVERLAY_DONE = 1,
1165 VBOXFBOVERLAY_MODIFIED,
1166 VBOXFBOVERLAY_UNTOUCHED
1167} VBOXFBOVERLAY_RESUT;
1168
1169class VBoxQGLOverlay
1170{
1171public:
1172 VBoxQGLOverlay (class VBoxConsoleView *aView, class VBoxFrameBuffer * aContainer);
1173
1174 int onVHWACommand(struct _VBOXVHWACMD * pCommand);
1175
1176 void onVHWACommandEvent(QEvent * pEvent);
1177
1178 /**
1179 * to be called on NotifyUpdate framebuffer call
1180 * @return true if the request was processed & should not be forwarded to the framebuffer
1181 * false - otherwise */
1182 bool onNotifyUpdate (ULONG aX, ULONG aY,
1183 ULONG aW, ULONG aH);
1184
1185 VBOXFBOVERLAY_RESUT onPaintEvent (const QPaintEvent *pe, QRect *pRect);
1186 void onResizeEvent (const class VBoxResizeEvent *re);
1187 void onResizeEventPostprocess (const class VBoxResizeEvent *re);
1188
1189 static bool isAcceleration2DVideoAvailable();
1190
1191 /* not supposed to be called by clients */
1192 int vhwaLoadExec(struct SSMHANDLE * pSSM, uint32_t u32Version);
1193 void vhwaSaveExec(struct SSMHANDLE * pSSM);
1194private:
1195
1196 void makeCurrent()
1197 {
1198 if(!mGlCurrent)
1199 {
1200 mGlCurrent = true;
1201 mpOverlayWidget->makeCurrent();
1202 }
1203 }
1204
1205 void performDisplayOverlay()
1206 {
1207 if(mOverlayVisible)
1208 {
1209#if 0
1210 mpOverlayWidget->updateGL();
1211#else
1212 makeCurrent();
1213 mpOverlayWidget->performDisplay();
1214 mpOverlayWidget->swapBuffers();
1215#endif
1216 }
1217 }
1218
1219 void vboxOpExit()
1220 {
1221 performDisplayOverlay();
1222 mGlCurrent = false;
1223 }
1224
1225
1226 void vboxSetGlOn(bool on);
1227 bool vboxGetGlOn() { return mGlOn; }
1228 void vboxSynchGl();
1229 void vboxDoVHWACmdExec(void *cmd);
1230 void vboxShowOverlay(bool show);
1231 void vboxDoCheckUpdateViewport();
1232 void vboxDoVHWACmd(void *cmd);
1233 void vboxDoUpdateRect(const QRect * pRect);
1234// void vboxUpdateOverlayPosition(const QPoint & pos);
1235 void vboxCheckUpdateOverlay(const QRect & rect);
1236 VBoxVHWACommandElement * processCmdList(VBoxVHWACommandElement * pCmd);
1237
1238 int vhwaConstruct(struct _VBOXVHWACMD_HH_CONSTRUCT *pCmd);
1239
1240 VBoxGLWidget *mpOverlayWidget;
1241 class VBoxConsoleView *mView;
1242 class VBoxFrameBuffer *mContainer;
1243 bool mGlOn;
1244 bool mOverlayWidgetVisible;
1245 bool mOverlayVisible;
1246 bool mGlCurrent;
1247 bool mProcessingCommands;
1248 QRect mOverlayViewport;
1249 VBoxVHWADirtyRect mMainDirtyRect;
1250
1251 VBoxVHWACommandElementProcessor mCmdPipe;
1252
1253 /* this is used in saved state restore to postpone surface restoration
1254 * till the framebuffer size is restored */
1255 VHWACommandList mOnResizeCmdList;
1256};
1257
1258
1259template <class T>
1260class VBoxOverlayFrameBuffer : public T
1261{
1262public:
1263 VBoxOverlayFrameBuffer (class VBoxConsoleView *aView)
1264 : T(aView),
1265 mOverlay(aView, this)
1266 {}
1267
1268
1269 STDMETHOD(ProcessVHWACommand)(BYTE *pCommand)
1270 {
1271 return mOverlay.onVHWACommand((struct _VBOXVHWACMD*)pCommand);
1272 }
1273
1274 void doProcessVHWACommand(QEvent * pEvent)
1275 {
1276 mOverlay.onVHWACommandEvent(pEvent);
1277 }
1278
1279 STDMETHOD(NotifyUpdate) (ULONG aX, ULONG aY,
1280 ULONG aW, ULONG aH)
1281 {
1282 if(mOverlay.onNotifyUpdate(aX, aY, aW, aH))
1283 return S_OK;
1284 return T::NotifyUpdate(aX, aY, aW, aH);
1285 }
1286
1287 void paintEvent (QPaintEvent *pe)
1288 {
1289 QRect rect;
1290 VBOXFBOVERLAY_RESUT res = mOverlay.onPaintEvent(pe, &rect);
1291 switch(res)
1292 {
1293 case VBOXFBOVERLAY_MODIFIED:
1294 {
1295 QPaintEvent modified(rect);
1296 T::paintEvent(&modified);
1297 } break;
1298 case VBOXFBOVERLAY_UNTOUCHED:
1299 T::paintEvent(pe);
1300 break;
1301 }
1302 }
1303
1304 void resizeEvent (VBoxResizeEvent *re)
1305 {
1306 mOverlay.onResizeEvent(re);
1307 T::resizeEvent(re);
1308 mOverlay.onResizeEventPostprocess(re);
1309 }
1310private:
1311 VBoxQGLOverlay mOverlay;
1312};
1313
1314#endif
1315
1316#endif /* #ifndef __VBoxFBOverlay_h__ */
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette