Changeset 51606 in vbox for trunk/src/VBox/Main/src-client
- Timestamp:
- Jun 11, 2014 2:54:11 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r51605 r51606 586 586 fVGAResizing = false; 587 587 588 mFramebufferUpdateMode = FramebufferUpdateMode_NotifyUpdate; 589 588 590 ULONG ul; 589 591 mParent->machine()->COMGETTER(MonitorCount)(&ul); … … 599 601 /* All secondary monitors are disabled at startup. */ 600 602 maFramebuffers[ul].fDisabled = ul > 0; 603 604 maFramebuffers[ul].updateImage.pu8Address = NULL; 605 maFramebuffers[ul].updateImage.cbLine = 0; 601 606 602 607 maFramebuffers[ul].xOrigin = 0; … … 660 665 { 661 666 maFramebuffers[uScreenId].pSourceBitmap.setNull(); 667 maFramebuffers[uScreenId].updateImage.pSourceBitmap.setNull(); 668 maFramebuffers[uScreenId].updateImage.pu8Address = NULL; 669 maFramebuffers[uScreenId].updateImage.cbLine = 0; 662 670 maFramebuffers[uScreenId].pFramebuffer.setNull(); 663 671 } … … 896 904 return VINF_SUCCESS; 897 905 } 906 907 COMSETTER(FramebufferUpdateMode)(FramebufferUpdateMode_NotifyUpdate); 898 908 899 909 if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN) … … 1124 1134 { 1125 1135 if (w != 0 && h != 0) 1126 pFramebuffer->NotifyUpdate(x, y, w, h); 1136 { 1137 if (RT_LIKELY(mFramebufferUpdateMode == FramebufferUpdateMode_NotifyUpdate)) 1138 { 1139 pFramebuffer->NotifyUpdate(x, y, w, h); 1140 } 1141 else if (mFramebufferUpdateMode == FramebufferUpdateMode_NotifyUpdateImage) 1142 { 1143 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1144 1145 DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId]; 1146 1147 if (!pFBInfo->updateImage.pSourceBitmap.isNull()) 1148 { 1149 Assert(pFBInfo->updateImage.pu8Address); 1150 1151 size_t cbData = w * h * 4; 1152 com::SafeArray<BYTE> image(cbData); 1153 1154 uint8_t *pu8Dst = image.raw(); 1155 const uint8_t *pu8Src = pFBInfo->updateImage.pu8Address + pFBInfo->updateImage.cbLine * y + x * 4; 1156 1157 int i; 1158 for (i = y; i < y + h; ++i) 1159 { 1160 memcpy(pu8Dst, pu8Src, w * 4); 1161 pu8Dst += w * 4; 1162 pu8Src += pFBInfo->updateImage.cbLine; 1163 } 1164 1165 pFramebuffer->NotifyUpdateImage(x, y, w, h, ComSafeArrayAsInParam(image)); 1166 } 1167 } 1168 } 1127 1169 } 1128 1170 … … 2182 2224 } 2183 2225 } 2226 } 2227 2228 2229 /* 2230 * IDisplay properties 2231 */ 2232 2233 STDMETHODIMP Display::COMGETTER(FramebufferUpdateMode)(FramebufferUpdateMode_T *aFramebufferUpdateMode) 2234 { 2235 LogRelFlowFunc(("\n")); 2236 2237 CheckComArgPointerValid(aFramebufferUpdateMode); 2238 2239 AutoCaller autoCaller(this); 2240 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2241 2242 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2243 2244 *aFramebufferUpdateMode = mFramebufferUpdateMode; 2245 2246 return S_OK; 2247 } 2248 2249 STDMETHODIMP Display::COMSETTER(FramebufferUpdateMode)(FramebufferUpdateMode_T aFramebufferUpdateMode) 2250 { 2251 LogRelFlowFunc(("aFramebufferUpdateMode %d\n", aFramebufferUpdateMode)); 2252 2253 AutoCaller autoCaller(this); 2254 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 2255 2256 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 2257 2258 /* Reset the update mode. */ 2259 unsigned uScreenId; 2260 for (uScreenId = 0; uScreenId < mcMonitors; ++uScreenId) 2261 { 2262 DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId]; 2263 pFBInfo->updateImage.pu8Address = NULL; 2264 pFBInfo->updateImage.cbLine = 0; 2265 pFBInfo->updateImage.pSourceBitmap.setNull(); 2266 } 2267 2268 if (aFramebufferUpdateMode == FramebufferUpdateMode_NotifyUpdateImage) 2269 { 2270 /* Query source bitmaps. */ 2271 for (uScreenId = 0; uScreenId < mcMonitors; ++uScreenId) 2272 { 2273 DISPLAYFBINFO *pFBInfo = &maFramebuffers[uScreenId]; 2274 HRESULT hr = querySourceBitmap(uScreenId, pFBInfo->updateImage.pSourceBitmap.asOutParam()); 2275 if (SUCCEEDED(hr)) 2276 { 2277 BYTE *pAddress = NULL; 2278 ULONG ulWidth = 0; 2279 ULONG ulHeight = 0; 2280 ULONG ulBitsPerPixel = 0; 2281 ULONG ulBytesPerLine = 0; 2282 ULONG ulPixelFormat = 0; 2283 2284 hr = pFBInfo->updateImage.pSourceBitmap->QueryBitmapInfo(&pAddress, 2285 &ulWidth, 2286 &ulHeight, 2287 &ulBitsPerPixel, 2288 &ulBytesPerLine, 2289 &ulPixelFormat); 2290 if (SUCCEEDED(hr)) 2291 { 2292 pFBInfo->updateImage.pu8Address = pAddress; 2293 pFBInfo->updateImage.cbLine = ulBytesPerLine; 2294 } 2295 } 2296 2297 if (FAILED(hr)) 2298 { 2299 pFBInfo->updateImage.pSourceBitmap.setNull(); 2300 } 2301 } 2302 } 2303 2304 mFramebufferUpdateMode = aFramebufferUpdateMode; 2305 2306 return S_OK; 2184 2307 } 2185 2308
Note:
See TracChangeset
for help on using the changeset viewer.