Changeset 53816 in vbox for trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter
- Timestamp:
- Jan 15, 2015 12:01:56 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 97624
- Location:
- trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/server_presenter.h
r53814 r53816 215 215 int SetVisibleRegionsChanged(); 216 216 int SetCompositor(const struct VBOXVR_SCR_COMPOSITOR * pCompositor); 217 void SetScaleFactor(GLdouble scaleFactor);218 GLdouble GetScaleFactor();217 bool SetScaleFactor(GLdouble scaleFactorW, GLdouble scaleFactorH); 218 bool GetScaleFactor(GLdouble *scaleFactorW, GLdouble *scaleFactorH); 219 219 int UpdateBegin(); 220 220 void UpdateEnd(); … … 252 252 CR_FBWIN_FLAGS mFlags; 253 253 uint64_t mParentId; 254 volatile uint32_t mScaleFactorStorage; 254 255 RTSEMRW scaleFactorLock; 256 GLdouble mScaleFactorWStorage; 257 GLdouble mScaleFactorHStorage; 255 258 }; 256 259 -
trunk/src/VBox/HostServices/SharedOpenGL/crserverlib/presenter/window.cpp
r53814 r53816 29 29 mHeight(0), 30 30 mParentId(parentId), 31 mScaleFactorStorage(1) 32 { 31 mScaleFactorWStorage(1.0), 32 mScaleFactorHStorage(1.0) 33 { 34 int rc; 35 33 36 mFlags.Value = 0; 37 38 rc = RTSemRWCreate(&scaleFactorLock); 39 if (!RT_SUCCESS(rc)) 40 WARN(("Unable to initialize scaling factor data lock.")); 34 41 } 35 42 … … 131 138 if (mWidth != width || mHeight != height) 132 139 { 133 GLdouble scaleFactor = GetScaleFactor(); 140 GLdouble scaleFactorW, scaleFactorH; 141 142 /* Reset to default values if operation was unsuccessfull. */ 143 if (!GetScaleFactor(&scaleFactorW, &scaleFactorH)) 144 scaleFactorW = scaleFactorH = 1.0; 134 145 135 146 mFlags.fCompositoEntriesModified = 1; 136 mWidth = scaleFactor ? (uint32_t)((GLdouble)width * scaleFactor) : width;137 mHeight = scaleFactor ? (uint32_t)((GLdouble)height * scaleFactor) : height;147 mWidth = scaleFactorW ? (uint32_t)((GLdouble)width * scaleFactorW) : width; 148 mHeight = scaleFactorH ? (uint32_t)((GLdouble)height * scaleFactorH) : height; 138 149 139 150 LOG(("CrWIN: Size [%d ; %d]", width, height)); … … 197 208 198 209 199 void CrFbWindow::SetScaleFactor(GLdouble scaleFactor) 200 { 201 ASMAtomicWriteU32(&mScaleFactorStorage, (uint32_t)scaleFactor); 202 } 203 204 205 GLdouble CrFbWindow::GetScaleFactor() 206 { 207 return (GLdouble)ASMAtomicReadU32(&mScaleFactorStorage); 210 bool CrFbWindow::SetScaleFactor(GLdouble scaleFactorW, GLdouble scaleFactorH) 211 { 212 int rc; 213 214 rc = RTSemRWRequestWrite(scaleFactorLock, RT_INDEFINITE_WAIT); 215 if (RT_SUCCESS(rc)) 216 { 217 mScaleFactorWStorage = scaleFactorW; 218 mScaleFactorHStorage = scaleFactorH; 219 RTSemRWReleaseWrite(scaleFactorLock); 220 return true; 221 } 222 223 return false; 224 } 225 226 227 bool CrFbWindow::GetScaleFactor(GLdouble *scaleFactorW, GLdouble *scaleFactorH) 228 { 229 int rc; 230 231 rc = RTSemRWRequestRead(scaleFactorLock, RT_INDEFINITE_WAIT); 232 if (RT_SUCCESS(rc)) 233 { 234 *scaleFactorW = mScaleFactorWStorage; 235 *scaleFactorH = mScaleFactorHStorage; 236 RTSemRWReleaseRead(scaleFactorLock); 237 return true; 238 } 239 240 return false; 208 241 } 209 242 … … 242 275 if (fPresentNeeded || mFlags.fForcePresentOnReenable) 243 276 { 244 GLdouble scaleFactor = GetScaleFactor(); 277 GLdouble scaleFactorW, scaleFactorH; 278 /* Reset to default values if operation was unseccessfull. */ 279 if (!GetScaleFactor(&scaleFactorW, &scaleFactorH)) 280 scaleFactorW = scaleFactorH = 1.0; 245 281 246 282 mFlags.fForcePresentOnReenable = false; 247 283 if (mpCompositor) 248 284 { 249 CrVrScrCompositorSetStretching((VBOXVR_SCR_COMPOSITOR *)mpCompositor, scaleFactor , scaleFactor);285 CrVrScrCompositorSetStretching((VBOXVR_SCR_COMPOSITOR *)mpCompositor, scaleFactorW, scaleFactorH); 250 286 cr_server.head_spu->dispatch_table.VBoxPresentComposition(mSpuWindow, mpCompositor, NULL); 251 287 } … … 259 295 Rect.yBottom = mHeight; 260 296 CrVrScrCompositorInit(&TmpCompositor, &Rect); 261 CrVrScrCompositorSetStretching((VBOXVR_SCR_COMPOSITOR *)&TmpCompositor, scaleFactor , scaleFactor);297 CrVrScrCompositorSetStretching((VBOXVR_SCR_COMPOSITOR *)&TmpCompositor, scaleFactorW, scaleFactorH); 262 298 /* this is a cleanup operation 263 299 * empty compositor is guarantid to be released on VBoxPresentComposition return */ … … 316 352 CrFbWindow::~CrFbWindow() 317 353 { 354 int rc; 355 318 356 Destroy(); 357 358 rc = RTSemRWDestroy(scaleFactorLock); 359 if (!RT_SUCCESS(rc)) 360 WARN(("Unable to release scaling factor data lock.")); 319 361 } 320 362
Note:
See TracChangeset
for help on using the changeset viewer.