[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg
Subject:    Re: Question regarding XGetImage in libx11
From:       Alan Coopersmith <alan.coopersmith () oracle ! com>
Date:       2021-07-31 16:35:58
Message-ID: abd8d745-979d-eb2f-1979-141fa4a2e0eb () oracle ! com
[Download RAW message or body]

On 7/30/21 10:49 PM, Chuanlong Du wrote:
> I was reading the source code of the file GetImage.c 
> <https://gitlab.freedesktop.org/xorg/lib/libx11/-/blob/master/src/GetImage.c>  and got 
> confused about the function XGetImage. Specifically, I'm confused about where 
> the defined variable registerxGetImageReq*req; is used. The function never uses 
> it again after setting values for req at line 83 
> <https://gitlab.freedesktop.org/xorg/lib/libx11/-/blob/master/src/GetImage.c#L83>. 

The GetReq() call at line 73 sets up req to be in the Xlib buffer of requests to
send to the X server.  The _XReply call at line 85 causes everything in that
buffer, including req, to be sent to the X server for processing, so it
implicitly processes the contents of req.

> At line 85 
> <https://gitlab.freedesktop.org/xorg/lib/libx11/-/blob/master/src/GetImage.c#L85>, 
> does the function _XReply copy the whole display/screen's data to rep or just 
> the specified rectangle defined by req? If _XReply copies the whole 
> display/screen's data, where does the function XGetImage crop the image to keep 
> the specified rectangle only?

The function _XReply simply sends the message to the X server, who does all the
processing and returns the reply.  The X server is responsible for copying just
the specified area, not the whole screen, so Xlib does not need to do any
cropping on its own.

-- 
	-Alan Coopersmith-               alan.coopersmith@oracle.com
	 Oracle Solaris Engineering - https://blogs.oracle.com/alanc
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic