Changeset 22834 in vbox
- Timestamp:
- Sep 8, 2009 12:03:54 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 5 edited
-
include/VBoxConsoleView.h (modified) (1 diff)
-
include/VBoxFBOverlay.h (modified) (6 diffs)
-
include/VBoxFrameBuffer.h (modified) (1 diff)
-
src/VBoxConsoleView.cpp (modified) (3 diffs)
-
src/VBoxFBOverlay.cpp (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h
r22816 r22834 138 138 void requestToResize (const QSize &aSize); 139 139 140 #ifdef VBOX_WITH_VIDEOHWACCEL 141 void scrollContentsBy (int dx, int dy); 142 #endif 143 140 144 #if defined(Q_WS_MAC) 141 145 void updateDockIcon(); -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxFBOverlay.h
r22826 r22834 572 572 void setHandle(uint32_t h) {mHGHandle = h;} 573 573 574 const VBoxVHWADirtyRect & getDirtyRect() { return mUpdateMem2TexRect; } 575 574 576 private: 575 577 void doSetRectValuesInternal(const QRect & aTargRect, const QRect & aSrcRect, const QRect & aVisTargRect); … … 1187 1189 void onResizeEventPostprocess (const class VBoxResizeEvent *re); 1188 1190 1191 void viewportResized(QResizeEvent * re) 1192 { 1193 vboxDoCheckUpdateViewport(); 1194 mGlCurrent = false; 1195 } 1196 1197 void viewportScrolled(int dx, int dy) 1198 { 1199 vboxDoCheckUpdateViewport(); 1200 mGlCurrent = false; 1201 } 1202 1189 1203 static bool isAcceleration2DVideoAvailable(); 1190 1204 … … 1193 1207 void vhwaSaveExec(struct SSMHANDLE * pSSM); 1194 1208 private: 1209 int vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd); 1210 1211 void repaintMain(); 1212 void repaintOverlay() 1213 { 1214 if(mNeedOverlayRepaint) 1215 { 1216 mNeedOverlayRepaint = false; 1217 performDisplayOverlay(); 1218 } 1219 } 1220 void repaint() 1221 { 1222 repaintOverlay(); 1223 repaintMain(); 1224 } 1195 1225 1196 1226 void makeCurrent() … … 1217 1247 } 1218 1248 1219 void vboxOpExit()1220 {1221 performDisplayOverlay();1222 mGlCurrent = false;1223 }1249 // void vboxOpExit() 1250 // { 1251 // performDisplayOverlay(); 1252 // mGlCurrent = false; 1253 // } 1224 1254 1225 1255 1226 1256 void vboxSetGlOn(bool on); 1227 1257 bool vboxGetGlOn() { return mGlOn; } 1228 voidvboxSynchGl();1258 bool vboxSynchGl(); 1229 1259 void vboxDoVHWACmdExec(void *cmd); 1230 1260 void vboxShowOverlay(bool show); 1231 1261 void vboxDoCheckUpdateViewport(); 1232 1262 void vboxDoVHWACmd(void *cmd); 1233 void vboxDoUpdateRect(const QRect * pRect);1263 void addMainDirtyRect(const QRect & aRect); 1234 1264 // void vboxUpdateOverlayPosition(const QPoint & pos); 1235 1265 void vboxCheckUpdateOverlay(const QRect & rect); … … 1246 1276 bool mGlCurrent; 1247 1277 bool mProcessingCommands; 1278 bool mNeedOverlayRepaint; 1248 1279 QRect mOverlayViewport; 1249 1280 VBoxVHWADirtyRect mMainDirtyRect; … … 1310 1341 mOverlay.onResizeEventPostprocess(re); 1311 1342 } 1343 1344 void viewportResized(QResizeEvent * re) 1345 { 1346 mOverlay.viewportResized(re); 1347 T::viewportResized(re); 1348 } 1349 1350 void viewportScrolled(int dx, int dy) 1351 { 1352 mOverlay.viewportScrolled(dx, dy); 1353 T::viewportScrolled(dx, dy); 1354 } 1312 1355 private: 1313 1356 VBoxQGLOverlay mOverlay; -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxFrameBuffer.h
r22822 r22834 243 243 * the event is framebuffer implementation specific */ 244 244 virtual void doProcessVHWACommand(QEvent * pEvent); 245 246 virtual void viewportResized(QResizeEvent * re){} 247 248 virtual void viewportScrolled(int dx, int dy){} 245 249 #endif 246 250 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp
r22822 r22834 1733 1733 } 1734 1734 1735 #ifdef VBOX_WITH_VIDEOHWACCEL 1736 void VBoxConsoleView::scrollContentsBy (int dx, int dy) 1737 { 1738 if (mAttached && mFrameBuf) 1739 { 1740 mFrameBuf->viewportScrolled(dx, dy); 1741 } 1742 QAbstractScrollArea::scrollContentsBy (dx, dy); 1743 } 1744 #endif 1745 1746 1735 1747 bool VBoxConsoleView::eventFilter (QObject *watched, QEvent *e) 1736 1748 { … … 1783 1795 if (mMouseCaptured) 1784 1796 updateMouseClipping(); 1797 #ifdef VBOX_WITH_VIDEOHWACCEL 1798 if (mFrameBuf) 1799 { 1800 mFrameBuf->viewportResized((QResizeEvent*)e); 1801 } 1802 #endif 1785 1803 break; 1786 1804 } … … 2977 2995 { 2978 2996 #if 1 2979 2997 2980 2998 LogRel3(("%s: type=%03d x=%03d y=%03d btns=%08X wdelta=%03d wdir=%s\n", 2981 2999 __PRETTY_FUNCTION__ , aType, aPos.x(), aPos.y(), -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxFBOverlay.cpp
r22826 r22834 5087 5087 mGlCurrent(false), 5088 5088 mProcessingCommands(false), 5089 mNeedOverlayRepaint(false), 5089 5090 mCmdPipe(aView) 5090 5091 { … … 5127 5128 5128 5129 mProcessingCommands = false; 5129 vboxOpExit(); 5130 repaint(); 5131 // vboxOpExit(); 5132 mGlCurrent = false; 5130 5133 } 5131 5134 … … 5154 5157 Q_UNUSED(pRect); 5155 5158 5156 if(mOverlayWidgetVisible && !mProcessingCommands) 5159 // if(mOverlayWidgetVisible && !mProcessingCommands) 5160 // { 5161 // Assert(!mGlCurrent); 5162 // vboxDoCheckUpdateViewport(); 5163 // vboxOpExit(); 5164 // } 5165 return VBOXFBOVERLAY_UNTOUCHED; 5166 } 5167 5168 void VBoxQGLOverlay::onResizeEvent (const VBoxResizeEvent *re) 5169 { 5170 Q_UNUSED(re); 5171 } 5172 5173 void VBoxQGLOverlay::onResizeEventPostprocess (const VBoxResizeEvent *re) 5174 { 5175 Q_UNUSED(re); 5176 5177 if(mGlOn) 5157 5178 { 5158 5179 Assert(!mGlCurrent); 5159 vboxDoCheckUpdateViewport(); 5160 vboxOpExit(); 5161 } 5162 return VBOXFBOVERLAY_UNTOUCHED; 5163 } 5164 5165 void VBoxQGLOverlay::onResizeEvent (const VBoxResizeEvent *re) 5166 { 5167 Q_UNUSED(re); 5168 } 5169 5170 void VBoxQGLOverlay::onResizeEventPostprocess (const VBoxResizeEvent *re) 5171 { 5172 Q_UNUSED(re); 5173 5174 bool bDoOpExit = false; 5175 5176 if(mGlOn) 5177 { 5178 Assert(!mGlCurrent); 5180 Assert(!mNeedOverlayRepaint); 5179 5181 mGlCurrent = false; 5180 5182 makeCurrent(); 5181 5183 /* need to ensure we're in synch */ 5182 vboxSynchGl(); 5183 bDoOpExit = true; 5184 mNeedOverlayRepaint = vboxSynchGl(); 5184 5185 } 5185 5186 … … 5194 5195 } 5195 5196 mOnResizeCmdList.clear(); 5196 bDoOpExit = true; 5197 } 5198 5199 if(bDoOpExit) 5200 { 5201 vboxOpExit(); 5202 } 5203 Assert(mGlCurrent == false); 5204 5197 } 5198 5199 repaintOverlay(); 5200 mGlCurrent = false; 5201 } 5202 5203 void VBoxQGLOverlay::repaintMain() 5204 { 5205 if(mMainDirtyRect.isClear()) 5206 return; 5207 5208 const QRect &rect = mMainDirtyRect.rect(); 5209 if(mOverlayWidgetVisible) 5210 { 5211 if(mOverlayViewport.contains(rect)) 5212 return; 5213 } 5214 5215 mView->viewport()->repaint (rect.x() - mView->contentsX(), 5216 rect.y() - mView->contentsY(), 5217 rect.width(), rect.height()); 5218 5219 mMainDirtyRect.clear(); 5205 5220 } 5206 5221 … … 5215 5230 } 5216 5231 5217 void VBoxQGLOverlay::vboxDoUpdateRect(const QRect * pRect)5218 {5219 if(mGlOn)5220 {5221 makeCurrent();5222 mpOverlayWidget->vboxDoUpdateRect(pRect);5223 vboxOpExit();5224 }5225 5226 mView->viewport()->repaint (pRect->x() - mView->contentsX(),5227 pRect->y() - mView->contentsY(),5228 pRect->width(), pRect->height());5229 5230 /* translate to widget coords5231 * @todo: may eliminate this */5232 // QPaintEvent pe(pRect->translated(-mView->contentsX(), -mView->contentsY()));5233 // VBoxQImageFrameBuffer::paintEvent (&pe);5234 }5235 5236 voidVBoxQGLOverlay::vboxSynchGl()5232 //void VBoxQGLOverlay::vboxDoUpdateRect(const QRect * pRect) 5233 //{ 5234 // if(mGlOn) 5235 // { 5236 // makeCurrent(); 5237 // mpOverlayWidget->vboxDoUpdateRect(pRect); 5238 // vboxOpExit(); 5239 // } 5240 // 5241 // mView->viewport()->repaint (pRect->x() - mView->contentsX(), 5242 // pRect->y() - mView->contentsY(), 5243 // pRect->width(), pRect->height()); 5244 // 5245 // /* translate to widget coords 5246 // * @todo: may eliminate this */ 5247 //// QPaintEvent pe(pRect->translated(-mView->contentsX(), -mView->contentsY())); 5248 //// VBoxQImageFrameBuffer::paintEvent (&pe); 5249 //} 5250 5251 bool VBoxQGLOverlay::vboxSynchGl() 5237 5252 { 5238 5253 if(mpOverlayWidget->vboxIsInitialized() … … 5244 5259 && mContainer->height() == mpOverlayWidget->vboxFbHeight()) 5245 5260 { 5246 return ;5261 return false; 5247 5262 } 5248 5263 /* create and issue a resize event to the gl widget to ensure we have all gl data initialized … … 5256 5271 5257 5272 mpOverlayWidget->vboxResizeEvent(&re); 5273 return true; 5258 5274 } 5259 5275 … … 5306 5322 makeCurrent(); 5307 5323 mpOverlayWidget->vboxDoUpdateViewport(overVp); 5324 mNeedOverlayRepaint = true; 5308 5325 } 5309 5326 … … 5353 5370 // 5354 5371 // vboxShowOverlay(show); 5372 } 5373 5374 void VBoxQGLOverlay::addMainDirtyRect(const QRect & aRect) 5375 { 5376 mMainDirtyRect.add(aRect); 5377 if(mGlOn) 5378 { 5379 mpOverlayWidget->vboxDoUpdateRect(&aRect); 5380 if(aRect.intersects(mpOverlayWidget->vboxViewport())) 5381 { 5382 mNeedOverlayRepaint = true; 5383 } 5384 } 5385 } 5386 5387 int VBoxQGLOverlay::vhwaSurfaceUnlock(struct _VBOXVHWACMD_SURF_UNLOCK *pCmd) 5388 { 5389 int rc = mpOverlayWidget->vhwaSurfaceUnlock(pCmd); 5390 VBoxVHWASurfaceBase * pVGA = mpOverlayWidget->vboxGetVGASurface(); 5391 const VBoxVHWADirtyRect & rect = pVGA->getDirtyRect(); 5392 if(!rect.isClear()) 5393 { 5394 mMainDirtyRect.add(rect); 5395 } 5396 return rc; 5355 5397 } 5356 5398 … … 5411 5453 { 5412 5454 VBOXVHWACMD_SURF_UNLOCK * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_UNLOCK); 5413 pCmd->rc = mpOverlayWidget->vhwaSurfaceUnlock(pBody);5455 pCmd->rc = vhwaSurfaceUnlock(pBody); 5414 5456 } break; 5415 5457 case VBOXVHWACMD_TYPE_SURF_BLT: … … 5422 5464 VBOXVHWACMD_SURF_FLIP * pBody = VBOXVHWACMD_BODY(pCmd, VBOXVHWACMD_SURF_FLIP); 5423 5465 pCmd->rc = mpOverlayWidget->vhwaSurfaceFlip(pBody); 5466 mNeedOverlayRepaint = true; 5424 5467 } break; 5425 5468 case VBOXVHWACMD_TYPE_SURF_OVERLAY_UPDATE: … … 5553 5596 { 5554 5597 case VBOXVHWA_PIPECMD_PAINT: 5555 vboxDoUpdateRect(&pCmd->rect());5598 addMainDirtyRect(pCmd->rect()); 5556 5599 break; 5557 5600 #ifdef VBOX_WITH_VIDEOHWACCEL
Note:
See TracChangeset
for help on using the changeset viewer.

