[PATCH 4/7] compositor: make es->pitch consistent between shm and drm surfaces

Ander Conselvan de Oliveira ander.conselvan.de.oliveira at intel.com
Tue Mar 27 07:36:38 PDT 2012

For shm buffers, es->pitch is set using the stride of the buffer. If
the shell happened to set the surface width to something different than
the buffer width, the contents of the surface would be cropped on the
width during redraw. However, for non-shm surfaces, es->pitch was set to
the surface width. That caused the contents of the buffer to be scaled
on the width when the buffer was wider than the surface.

This makes the behavior on both cases the same: crop on the width and
scale on the height. (which is weird but consistent)
 src/compositor.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 63bed72..f627518 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -700,7 +700,7 @@ weston_buffer_attach(struct wl_buffer *buffer, struct wl_surface *surface)
 		ec->image_target_texture_2d(GL_TEXTURE_2D, es->image);
-		es->pitch = es->geometry.width;
+		es->pitch = buffer->width;

More information about the wayland-devel mailing list