mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 09:59:48 +01:00
buffer: add single-pixel-buffer-v1 special case in buffer_is_opaque()
This commit is contained in:
parent
431e8a7fd7
commit
cf7b91cc5f
1 changed files with 10 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
#include <assert.h>
|
||||
#include <drm_fourcc.h>
|
||||
#include <string.h>
|
||||
#include <wlr/interfaces/wlr_buffer.h>
|
||||
#include "render/pixel_format.h"
|
||||
|
@ -111,7 +112,16 @@ bool buffer_is_opaque(struct wlr_buffer *buffer) {
|
|||
format = shm.format;
|
||||
} else if (wlr_buffer_begin_data_ptr_access(buffer,
|
||||
WLR_BUFFER_DATA_PTR_ACCESS_READ, &data, &format, &stride)) {
|
||||
bool opaque = false;
|
||||
if (buffer->width == 1 && buffer->height == 1 && format == DRM_FORMAT_ARGB8888) {
|
||||
// Special case for single-pixel-buffer-v1
|
||||
const uint8_t *argb8888 = data; // little-endian byte order
|
||||
opaque = argb8888[3] == 0xFF;
|
||||
}
|
||||
wlr_buffer_end_data_ptr_access(buffer);
|
||||
if (opaque) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue