Fixed partially out of screen window capture in unix
BUG=596595 Review-Url: https://codereview.webrtc.org/2044693002 Cr-Commit-Position: refs/heads/master@{#13113}
This commit is contained in:
parent
29b1a8d7ec
commit
abfdb53f6d
@ -59,11 +59,7 @@ bool IsXImageRGBFormat(XImage* image) {
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
XServerPixelBuffer::XServerPixelBuffer()
|
||||
: display_(NULL), window_(0),
|
||||
x_image_(NULL),
|
||||
shm_segment_info_(NULL), shm_pixmap_(0), shm_gc_(NULL) {
|
||||
}
|
||||
XServerPixelBuffer::XServerPixelBuffer() {}
|
||||
|
||||
XServerPixelBuffer::~XServerPixelBuffer() {
|
||||
Release();
|
||||
@ -229,7 +225,9 @@ void XServerPixelBuffer::Synchronize() {
|
||||
if (shm_segment_info_ && !shm_pixmap_) {
|
||||
// XShmGetImage can fail if the display is being reconfigured.
|
||||
XErrorTrap error_trap(display_);
|
||||
XShmGetImage(display_, window_, x_image_, 0, 0, AllPlanes);
|
||||
// XShmGetImage fails if the window is partially out of screen.
|
||||
xshm_get_image_succeeded_ =
|
||||
XShmGetImage(display_, window_, x_image_, 0, 0, AllPlanes);
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +238,7 @@ void XServerPixelBuffer::CaptureRect(const DesktopRect& rect,
|
||||
|
||||
uint8_t* data;
|
||||
|
||||
if (shm_segment_info_) {
|
||||
if (shm_segment_info_ && (shm_pixmap_ || xshm_get_image_succeeded_)) {
|
||||
if (shm_pixmap_) {
|
||||
XCopyArea(display_, window_, shm_pixmap_, shm_gc_,
|
||||
rect.left(), rect.top(), rect.width(), rect.height(),
|
||||
|
||||
@ -70,13 +70,14 @@ class XServerPixelBuffer {
|
||||
const DesktopRect& rect,
|
||||
DesktopFrame* frame);
|
||||
|
||||
Display* display_;
|
||||
Window window_;
|
||||
Display* display_ = nullptr;
|
||||
Window window_ = 0;
|
||||
DesktopSize window_size_;
|
||||
XImage* x_image_;
|
||||
XShmSegmentInfo* shm_segment_info_;
|
||||
Pixmap shm_pixmap_;
|
||||
GC shm_gc_;
|
||||
XImage* x_image_ = nullptr;
|
||||
XShmSegmentInfo* shm_segment_info_ = nullptr;
|
||||
Pixmap shm_pixmap_ = 0;
|
||||
GC shm_gc_ = nullptr;
|
||||
bool xshm_get_image_succeeded_ = false;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(XServerPixelBuffer);
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user