Changeset 46364 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Jun 3, 2013 3:02:38 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 86180
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp
r46361 r46364 163 163 } 164 164 165 /* This method is called on EMT from under this object's lock! */166 165 STDMETHODIMP UIFrameBuffer::RequestResize(ULONG uScreenId, ULONG uPixelFormat, 167 166 BYTE *pVRAM, ULONG uBitsPerPixel, ULONG uBytesPerLine, … … 220 219 } 221 220 222 /**223 * Returns whether we like the given video mode.224 * @note We always like a mode smaller than the current framebuffer225 * size.226 *227 * @returns COM status code228 * @param width video mode width in pixels229 * @param height video mode height in pixels230 * @param bpp video mode bit depth in bits per pixel231 * @param supported pointer to result variable232 */233 221 STDMETHODIMP UIFrameBuffer::VideoModeSupported(ULONG uWidth, ULONG uHeight, ULONG uBPP, BOOL *pbSupported) 234 222 { … … 281 269 STDMETHODIMP UIFrameBuffer::SetVisibleRegion(BYTE *pRectangles, ULONG uCount) 282 270 { 271 /* Make sure frame-buffer is not yet scheduled for removal: */ 272 if (m_fIsScheduledToDelete) 273 return E_FAIL; 274 275 /* Make sure rectangles were passed: */ 283 276 PRTRECT rects = (PRTRECT)pRectangles; 284 285 277 if (!rects) 286 278 return E_POINTER; 287 279 288 QRegion reg; 289 for (ULONG ind = 0; ind < uCount; ++ ind) 280 /* Compose region: */ 281 QRegion region; 282 for (ULONG ind = 0; ind < uCount; ++ind) 290 283 { 284 /* Get current rectangle: */ 291 285 QRect rect; 292 286 rect.setLeft(rects->xLeft); 293 287 rect.setTop(rects->yTop); 294 /* QRect are inclusive*/288 /* Which is inclusive: */ 295 289 rect.setRight(rects->xRight - 1); 296 290 rect.setBottom(rects->yBottom - 1); 297 reg += rect; 298 ++ rects; 291 /* Append region: */ 292 region += rect; 293 ++rects; 299 294 } 300 lock(); /* See comment in setView(). */ 301 m_syncVisibleRegion = reg; 302 if (m_pMachineView) 303 QApplication::postEvent(m_pMachineView, new UISetRegionEvent(reg)); 304 unlock(); 305 295 296 /* See comment in setView(): */ 297 lock(); 298 299 /* We are directly updating synchronous visible-region: */ 300 m_syncVisibleRegion = region; 301 /* And send async signal to update asynchronous one: */ 302 if (m_pMachineView) 303 emit sigSetVisibleRegion(region); 304 305 /* Unlock thread finally: */ 306 unlock(); 307 308 /* Confirm SetVisibleRegion: */ 306 309 return S_OK; 307 310 } … … 369 372 m_pMachineView, SLOT(sltHandleNotifyUpdate(int, int, int, int)), 370 373 Qt::QueuedConnection); 374 connect(this, SIGNAL(sigSetVisibleRegion(QRegion)), 375 m_pMachineView, SLOT(sltHandleSetVisibleRegion(QRegion)), 376 Qt::QueuedConnection); 371 377 } 372 378 … … 377 383 disconnect(this, SIGNAL(sigNotifyUpdate(int, int, int, int)), 378 384 m_pMachineView, SLOT(sltHandleNotifyUpdate(int, int, int, int))); 379 } 380 385 disconnect(this, SIGNAL(sigSetVisibleRegion(QRegion)), 386 m_pMachineView, SLOT(sltHandleSetVisibleRegion(QRegion))); 387 } 388 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h
r46361 r46364 67 67 68 68 /** 69 * Frame buffer set region event.70 */71 class UISetRegionEvent : public QEvent72 {73 public:74 75 UISetRegionEvent(const QRegion ®ion)76 : QEvent((QEvent::Type)SetRegionEventType)77 , m_region(region) {}78 QRegion region() { return m_region; }79 80 private:81 82 QRegion m_region;83 };84 85 /**86 69 * Common IFramebuffer implementation for all methods used by GUI to maintain 87 70 * the VM display video memory. … … 115 98 int iWidth, int iHeight); 116 99 void sigNotifyUpdate(int iX, int iY, int iWidth, int iHeight); 100 void sigSetVisibleRegion(QRegion region); 117 101 118 102 public: … … 206 190 virtual void resizeEvent(UIResizeEvent *pEvent) = 0; 207 191 virtual void paintEvent(QPaintEvent *pEvent) = 0; 208 virtual void applyVisibleRegion Event(UISetRegionEvent *pEvent) = 0;192 virtual void applyVisibleRegion(const QRegion ®ion) = 0; 209 193 210 194 #ifdef VBOX_WITH_VIDEOHWACCEL -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.cpp
r46322 r46364 178 178 } 179 179 180 void UIFrameBufferQImage::applyVisibleRegion Event(UISetRegionEvent *pEvent)180 void UIFrameBufferQImage::applyVisibleRegion(const QRegion ®ion) 181 181 { 182 182 /* Make sure async visible-region changed: */ 183 if (m_asyncVisibleRegion == pEvent->region())183 if (m_asyncVisibleRegion == region) 184 184 return; 185 185 186 186 /* We are accounting async visible-regions one-by-one 187 187 * to keep corresponding viewport area always updated! */ 188 m_pMachineView->viewport()->update( pEvent->region()+ m_asyncVisibleRegion);189 m_asyncVisibleRegion = pEvent->region();188 m_pMachineView->viewport()->update(region + m_asyncVisibleRegion); 189 m_asyncVisibleRegion = region; 190 190 191 191 #ifdef Q_WS_X11 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQImage.h
r46255 r46364 47 47 void resizeEvent(UIResizeEvent *pEvent); 48 48 void paintEvent(QPaintEvent *pEvent); 49 void applyVisibleRegion Event(UISetRegionEvent *pEvent);49 void applyVisibleRegion(const QRegion ®ion); 50 50 51 51 private: -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.cpp
r46283 r46364 73 73 } 74 74 75 STDMETHODIMP UIFrameBufferQuartz2D::SetVisibleRegion(BYTE *aRectangles, ULONG aCount) 76 { 77 PRTRECT rects = (PRTRECT)aRectangles; 78 75 STDMETHODIMP UIFrameBufferQuartz2D::SetVisibleRegion(BYTE *pRectangles, ULONG aCount) 76 { 77 /* Make sure frame-buffer is not yet scheduled for removal: */ 78 if (m_fIsScheduledToDelete) 79 return E_FAIL; 80 81 /* Make sure rectangles were passed: */ 82 PRTRECT rects = (PRTRECT)pRectangles; 79 83 if (!rects) 80 84 return E_POINTER; … … 103 107 rgnRcts->used = 0; 104 108 109 /* Compose region: */ 105 110 QRegion reg; 106 // printf ("Region rects follow...\n"); 107 QRect vmScreenRect (0, 0, width(), height()); 111 QRect vmScreenRect(0, 0, width(), height()); 108 112 for (ULONG ind = 0; ind < aCount; ++ ind) 109 113 { 114 /* Get current rectangle: */ 110 115 QRect rect; 111 116 rect.setLeft(rects->xLeft); 112 117 rect.setTop(rects->yTop); 113 /* QRect are inclusive*/118 /* Which is inclusive: */ 114 119 rect.setRight(rects->xRight - 1); 115 120 rect.setBottom(rects->yBottom - 1); … … 117 122 /* The rect should intersect with the vm screen. */ 118 123 rect = vmScreenRect.intersect(rect); 119 ++ rects; 120 /* Make sure only valid rects are distributed */ 121 /* todo: Test if the other framebuffer implementation have the same 122 * problem with invalid rects (In Linux/Windows) */ 124 ++rects; 125 /* Make sure only valid rects are distributed: */ 123 126 if (rect.isValid() && 124 127 rect.width() > 0 && rect.height() > 0) … … 127 130 continue; 128 131 132 /* That is some *magic* added by Knut in r27807: */ 129 133 CGRect *cgRct = &rgnRcts->rcts[rgnRcts->used]; 130 134 cgRct->origin.x = rect.x(); … … 132 136 cgRct->size.width = rect.width(); 133 137 cgRct->size.height = rect.height(); 134 // printf ("Region rect[%d - %d]: %d %d %d %d\n", rgnRcts->used, aCount, rect.x(), rect.y(), rect.height(), rect.width());135 138 rgnRcts->used++; 136 139 } 137 // printf ("..................................\n");138 140 139 141 RegionRects *pOld = ASMAtomicXchgPtrT(&mRegion, rgnRcts, RegionRects *); … … 142 144 RTMemFree(pOld); 143 145 144 QApplication::postEvent(m_pMachineView, new UISetRegionEvent (reg)); 145 146 /* Send async signal to update asynchronous visible-region: */ 147 if (m_pMachineView) 148 emit sigSetVisibleRegion(region); 149 150 /* Confirm SetVisibleRegion: */ 146 151 return S_OK; 147 152 } … … 463 468 } 464 469 465 void UIFrameBufferQuartz2D::applyVisibleRegion Event(UISetRegionEvent *pEvent)470 void UIFrameBufferQuartz2D::applyVisibleRegion(const QRegion ®ion) 466 471 { 467 472 /* Make sure async visible-region changed: */ 468 if (m_asyncVisibleRegion == pEvent->region())473 if (m_asyncVisibleRegion == region) 469 474 return; 470 475 … … 472 477 * to invalidate whole the viewport area! */ 473 478 ::darwinWindowInvalidateShape(m_pMachineView->viewport()); 474 m_asyncVisibleRegion = pEvent->region();479 m_asyncVisibleRegion = region; 475 480 } 476 481 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBufferQuartz2D.h
r46255 r46364 50 50 void resizeEvent(UIResizeEvent *pEvent); 51 51 void paintEvent(QPaintEvent *pEvent); 52 void applyVisibleRegion Event(UISetRegionEvent *pEvent);52 void applyVisibleRegion(const QRegion ®ion); 53 53 54 54 #ifdef VBOX_WITH_VIDEOHWACCEL -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp
r46361 r46364 283 283 /* Update corresponding viewport part: */ 284 284 viewport()->update(iX - contentsX(), iY - contentsY(), iWidth, iHeight); 285 } 286 287 void UIMachineView::sltHandleSetVisibleRegion(QRegion region) 288 { 289 /* Used only in seamless-mode. */ 290 Q_UNUSED(region); 285 291 } 286 292 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h
r46361 r46364 93 93 94 94 /* Handler: Frame-buffer RequestResize stuff: */ 95 v oid sltHandleRequestResize(int iPixelFormat, uchar *pVRAM,95 virtual void sltHandleRequestResize(int iPixelFormat, uchar *pVRAM, 96 96 int iBitsPerPixel, int iBytesPerLine, 97 97 int iWidth, int iHeight); 98 98 99 99 /* Handler: Frame-buffer NotifyUpdate stuff: */ 100 void sltHandleNotifyUpdate(int iX, int iY, int iWidth, int iHeight); 100 virtual void sltHandleNotifyUpdate(int iX, int iY, int iWidth, int iHeight); 101 102 /* Handler: Frame-buffer SetVisibleRegion stuff: */ 103 virtual void sltHandleSetVisibleRegion(QRegion region); 101 104 102 105 /* Watch dog for desktop resizes: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp
r46362 r46364 70 70 } 71 71 72 bool UIMachineViewSeamless::event(QEvent *pEvent)72 void UIMachineViewSeamless::sltHandleSetVisibleRegion(QRegion region) 73 73 { 74 switch (pEvent->type()) 75 { 76 case SetRegionEventType: 77 { 78 /* Apply new seamless-region: */ 79 m_pFrameBuffer->applyVisibleRegionEvent(static_cast<UISetRegionEvent*>(pEvent)); 80 return true; 81 } 82 83 default: 84 break; 85 } 86 return UIMachineView::event(pEvent); 74 /* Apply new seamless-region: */ 75 m_pFrameBuffer->applyVisibleRegion(region); 87 76 } 88 77 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h
r46362 r46364 39 39 virtual ~UIMachineViewSeamless(); 40 40 41 private slots: 42 43 /* Handler: Frame-buffer SetVisibleRegion stuff: */ 44 virtual void sltHandleSetVisibleRegion(QRegion region); 45 41 46 private: 42 47 43 48 /* Event handlers: */ 44 bool event(QEvent *pEvent);45 49 bool eventFilter(QObject *pWatched, QEvent *pEvent); 46 50
Note:
See TracChangeset
for help on using the changeset viewer.