compositor: make es->pitch consistent between shm and drm surfaces
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Tue, 27 Mar 2012 14:36:38 +0000 (17:36 +0300)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 27 Mar 2012 20:36:53 +0000 (16:36 -0400)
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

index 83ec3ed..be0e798 100644 (file)
@@ -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;
        }
 }