Changeset 51436 in vbox for trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp
- Timestamp:
- May 28, 2014 9:12:15 AM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 93991
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxSDL/Framebuffer.cpp
r50406 r51436 130 130 mLabelOffs = 0; 131 131 #endif 132 133 mfUpdates = false; 132 134 133 135 rc = RTCritSectInit(&mUpdateLock); … … 553 555 } 554 556 557 extern ComPtr<IDisplay> gpDisplay; 558 559 /* This method runs on the main SDL thread. */ 560 void VBoxSDLFB::notifyChange(ULONG aScreenId) 561 { 562 /* Disable screen updates. */ 563 RTCritSectEnter(&mUpdateLock); 564 565 if (mpPendingSourceBitmap.isNull()) 566 { 567 /* Do nothing. Change event already processed. */ 568 RTCritSectLeave(&mUpdateLock); 569 return; 570 } 571 572 /* Disable screen updates. */ 573 mfUpdates = false; 574 575 /* Release the current bitmap and keep the pending one. */ 576 mpSourceBitmap = mpPendingSourceBitmap; 577 mpPendingSourceBitmap.setNull(); 578 579 RTCritSectLeave(&mUpdateLock); 580 581 BYTE *pAddress = NULL; 582 ULONG ulWidth = 0; 583 ULONG ulHeight = 0; 584 ULONG ulBitsPerPixel = 0; 585 ULONG ulBytesPerLine = 0; 586 ULONG ulPixelFormat = 0; 587 588 mpSourceBitmap->QueryBitmapInfo(&pAddress, 589 &ulWidth, 590 &ulHeight, 591 &ulBitsPerPixel, 592 &ulBytesPerLine, 593 &ulPixelFormat); 594 595 if ( mGuestXRes == ulWidth 596 && mGuestYRes == ulHeight 597 && mBitsPerPixel == ulBitsPerPixel 598 && mBytesPerLine == ulBytesPerLine 599 && mPtrVRAM == pAddress 600 ) 601 { 602 mfSameSizeRequested = true; 603 } 604 else 605 { 606 mfSameSizeRequested = false; 607 } 608 609 mGuestXRes = ulWidth; 610 mGuestYRes = ulHeight; 611 mPixelFormat = FramebufferPixelFormat_Opaque; 612 mPtrVRAM = pAddress; 613 mBitsPerPixel = ulBitsPerPixel; 614 mBytesPerLine = ulBytesPerLine; 615 mUsesGuestVRAM = FALSE; /* yet */ 616 617 resizeGuest(); 618 } 619 620 STDMETHODIMP VBoxSDLFB::NotifyChange(ULONG aScreenId, 621 ULONG aXOrigin, 622 ULONG aYOrigin, 623 ULONG aWidth, 624 ULONG aHeight) 625 { 626 LogRel(("NotifyChange: %d %d,%d %dx%d\n", 627 aScreenId, aXOrigin, aYOrigin, aWidth, aHeight)); 628 629 /* Obtain the new screen bitmap. */ 630 RTCritSectEnter(&mUpdateLock); 631 632 /* Save the new bitmap. */ 633 mpPendingSourceBitmap.setNull(); 634 gpDisplay->QuerySourceBitmap(aScreenId, mpPendingSourceBitmap.asOutParam()); 635 636 RTCritSectLeave(&mUpdateLock); 637 638 SDL_Event event; 639 event.type = SDL_USEREVENT; 640 event.user.type = SDL_USER_EVENT_NOTIFYCHANGE; 641 event.user.code = mScreenId; 642 643 PushSDLEventForSure(&event); 644 645 RTThreadYield(); 646 647 return S_OK; 648 } 649 555 650 /** 556 651 * Returns whether we like the given video mode. … … 686 781 687 782 /* is the guest in a linear framebuffer mode we support? */ 688 if (m UsesGuestVRAM)783 if (mPtrVRAM || mUsesGuestVRAM) 689 784 { 690 785 /* Create a source surface from guest VRAM. */ … … 710 805 mfSameSizeRequested = false; 711 806 LogFlow(("VBoxSDL:: the same resolution requested, skipping the resize.\n")); 807 808 /* Enable screen updates. */ 809 RTCritSectEnter(&mUpdateLock); 810 mfUpdates = true; 811 RTCritSectLeave(&mUpdateLock); 812 712 813 return; 713 814 } … … 715 816 /* now adjust the SDL resolution */ 716 817 resizeSDL(); 818 819 /* Enable screen updates. */ 820 RTCritSectEnter(&mUpdateLock); 821 mfUpdates = true; 822 RTCritSectLeave(&mUpdateLock); 823 824 repaint(); 717 825 } 718 826 … … 961 1069 return; 962 1070 1071 RTCritSectEnter(&mUpdateLock); 1072 Log(("Updates %d, %d,%d %dx%d\n", mfUpdates, x, y, w, h)); 1073 if (!mfUpdates) 1074 { 1075 RTCritSectLeave(&mUpdateLock); 1076 return; 1077 } 963 1078 /* the source and destination rectangles */ 964 1079 SDL_Rect srcRect; … … 1039 1154 paintSecureLabel(0, 0, 0, 0, false); 1040 1155 #endif 1156 RTCritSectLeave(&mUpdateLock); 1041 1157 } 1042 1158
Note:
See TracChangeset
for help on using the changeset viewer.