mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-03 03:31:59 +00:00
renderer-gl: Fix wrong stride error when reading pixels
The gl_renderer_do_read_pixels() is expecting stride in bytes. Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
This commit is contained in:
parent
e74f2897b9
commit
623c7b5202
|
@ -2007,7 +2007,8 @@ gl_renderer_repaint_output(struct weston_output *output,
|
|||
|
||||
if (rb->pixels) {
|
||||
uint32_t *pixels = rb->pixels;
|
||||
int stride = go->fb_size.width;
|
||||
int width = go->fb_size.width;
|
||||
int stride = width * (compositor->read_format->bpp >> 3);
|
||||
pixman_box32_t *extents = &rb->base.damage.extents;
|
||||
struct weston_geometry rect = {
|
||||
.x = go->area.x,
|
||||
|
@ -2024,13 +2025,14 @@ gl_renderer_repaint_output(struct weston_output *output,
|
|||
}
|
||||
|
||||
if (gr->gl_version >= gr_gl_version(3, 0) && ! gr->fan_debug) {
|
||||
glPixelStorei(GL_PACK_ROW_LENGTH, stride);
|
||||
glPixelStorei(GL_PACK_ROW_LENGTH, width);
|
||||
rect.width = extents->x2 - extents->x1;
|
||||
rect.x += extents->x1 - (int)output->pos.c.x;
|
||||
pixels += extents->x1 - (int)output->pos.c.x;
|
||||
}
|
||||
|
||||
gl_renderer_do_read_pixels(gr, compositor->read_format, pixels, stride, &rect);
|
||||
gl_renderer_do_read_pixels(gr, compositor->read_format, pixels,
|
||||
stride, &rect);
|
||||
|
||||
if (gr->gl_version >= gr_gl_version(3, 0))
|
||||
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
|
||||
|
|
Loading…
Reference in a new issue