Class WlShmPoolProxy
- All Implemented Interfaces:
WaylandObject
The wl_shm_pool object encapsulates a piece of memory shared between the compositor and client. Through the wl_shm_pool object, the client can allocate shared memory wl_buffer objects. All objects created through the same pool share the same underlying mapped memory. Reusing the mapped memory avoids the setup/teardown overhead and is useful when interactively resizing a surface or for many small buffers.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWlShmPoolProxy
(MemorySegment pointer) WlShmPoolProxy
(MemorySegment pointer, WlShmPoolEvents implementation, int version) -
Method Summary
Modifier and TypeMethodDescriptioncreateBuffer
(WlBufferEvents implementation, int offset, int width, int height, int stride, int format) create a buffer from the poolvoid
destroy()
destroy the poolvoid
resize
(int size) change the size of the pool mappingMethods inherited from class org.freedesktop.wayland.client.Proxy
equals, getId, getImplementation, getPointer, getVersion, hashCode, marshal, marshal, marshalConstructor, setQueue
-
Field Details
-
INTERFACE_NAME
- See Also:
-
-
Constructor Details
-
WlShmPoolProxy
-
WlShmPoolProxy
-
-
Method Details
-
createBuffer
public WlBufferProxy createBuffer(WlBufferEvents implementation, int offset, int width, int height, int stride, int format) create a buffer from the poolCreate a wl_buffer object from the pool.
The buffer is created offset bytes into the pool and has width and height as specified. The stride argument specifies the number of bytes from the beginning of one row to the beginning of the next. The format is the pixel format of the buffer and must be one of those advertised through the wl_shm.format event.
A buffer will keep a reference to the pool it was created from so it is valid to destroy the pool immediately after creating a buffer from it.
- Parameters:
implementation
- A protocol event listener for the newly created proxy.offset
- buffer byte offset within the poolwidth
- buffer width, in pixelsheight
- buffer height, in pixelsstride
- number of bytes from the beginning of one row to the beginning of the next rowformat
- buffer pixel format
-
destroy
public void destroy()destroy the poolDestroy the shared memory pool.
The mmapped memory will be released when all buffers that have been created from this pool are gone.
- Overrides:
destroy
in classProxy<WlShmPoolEvents>
-
resize
public void resize(int size) change the size of the pool mappingThis request will cause the server to remap the backing memory for the pool from the file descriptor passed when the pool was created, but using the new size. This request can only be used to make the pool bigger.
This request only changes the amount of bytes that are mmapped by the server and does not touch the file corresponding to the file descriptor passed at creation time. It is the client's responsibility to ensure that the file is at least as big as the new pool size.
- Parameters:
size
- new size of the pool, in bytes
-