mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
render/gles2: use format bpp when reading pixels
This commit is contained in:
parent
4fa90b0511
commit
f34a1b75eb
2 changed files with 5 additions and 1 deletions
|
@ -25,12 +25,16 @@ struct pixel_format formats[] = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.wl_format = WL_SHM_FORMAT_XBGR8888,
|
.wl_format = WL_SHM_FORMAT_XBGR8888,
|
||||||
|
.depth = 24,
|
||||||
|
.bpp = 32,
|
||||||
.gl_format = GL_RGBA,
|
.gl_format = GL_RGBA,
|
||||||
.gl_type = GL_UNSIGNED_BYTE,
|
.gl_type = GL_UNSIGNED_BYTE,
|
||||||
.shader = &shaders.rgbx
|
.shader = &shaders.rgbx
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.wl_format = WL_SHM_FORMAT_ABGR8888,
|
.wl_format = WL_SHM_FORMAT_ABGR8888,
|
||||||
|
.depth = 32,
|
||||||
|
.bpp = 32,
|
||||||
.gl_format = GL_RGBA,
|
.gl_format = GL_RGBA,
|
||||||
.gl_type = GL_UNSIGNED_BYTE,
|
.gl_type = GL_UNSIGNED_BYTE,
|
||||||
.shader = &shaders.rgba
|
.shader = &shaders.rgba
|
||||||
|
|
|
@ -229,7 +229,7 @@ static bool wlr_gles2_read_pixels(struct wlr_renderer *renderer,
|
||||||
unsigned char *p = data + dst_y * stride;
|
unsigned char *p = data + dst_y * stride;
|
||||||
for (size_t i = src_y; i < src_y + height; ++i) {
|
for (size_t i = src_y; i < src_y + height; ++i) {
|
||||||
glReadPixels(src_x, src_y + height - i - 1, width, 1, fmt->gl_format,
|
glReadPixels(src_x, src_y + height - i - 1, width, 1, fmt->gl_format,
|
||||||
fmt->gl_type, p + i * stride + dst_x * 4);
|
fmt->gl_type, p + i * stride + dst_x * fmt->bpp / 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue