mirror of
https://github.com/hyprwm/Hyprland
synced 2026-05-07 06:18:05 +02:00
renderer: swizzle on shm screencopy (#14167)
in ds format (XBGR8888) the swizzle was pretty much being ignored. It would cause screenshots taken within DS, or apps which use screencopy like hyprpicker, wayfreeze, and still, to come out with the red and blue channels flipped.
This commit is contained in:
parent
2652e2aeab
commit
d669ea7db2
1 changed files with 10 additions and 14 deletions
|
|
@ -127,21 +127,17 @@ bool CGLFramebuffer::readPixels(CHLBufferReference buffer, uint32_t offsetX, uin
|
|||
uint32_t packStride = minStride(PFORMAT, m_size.x);
|
||||
int glFormat = PFORMAT->glFormat;
|
||||
|
||||
if (glFormat == GL_RGBA)
|
||||
glFormat = GL_BGRA_EXT;
|
||||
|
||||
if (glFormat != GL_BGRA_EXT && glFormat != GL_RGB) {
|
||||
if (PFORMAT->swizzle.has_value()) {
|
||||
if (PFORMAT->swizzle == SWIZZLE_RGBA)
|
||||
glFormat = GL_RGBA;
|
||||
else if (PFORMAT->swizzle == SWIZZLE_BGRA)
|
||||
glFormat = GL_BGRA_EXT;
|
||||
else {
|
||||
LOGM(Log::ERR, "Copied frame via shm might be broken or color flipped");
|
||||
glFormat = GL_RGBA;
|
||||
}
|
||||
if (PFORMAT->swizzle.has_value()) {
|
||||
if (PFORMAT->swizzle == SWIZZLE_RGBA)
|
||||
glFormat = GL_RGBA;
|
||||
else if (PFORMAT->swizzle == SWIZZLE_BGRA)
|
||||
glFormat = GL_BGRA_EXT;
|
||||
else {
|
||||
LOGM(Log::ERR, "Copied frame via shm might be broken or color flipped");
|
||||
glFormat = GL_RGBA;
|
||||
}
|
||||
}
|
||||
} else if (glFormat == GL_RGBA)
|
||||
glFormat = GL_BGRA_EXT;
|
||||
|
||||
// This could be optimized by using a pixel buffer object to make this async,
|
||||
// but really clients should just use a dma buffer anyways.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue