[gtk+/gtk-3-18] wayland: clean up stride calculation when creating shm surface
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-18] wayland: clean up stride calculation when creating shm surface
- Date: Thu, 28 Jan 2016 03:30:43 +0000 (UTC)
commit 6c192a8856b8fff65dd86b4c6bda28c045e098f8
Author: Ray Strode <rstrode redhat com>
Date: Wed Jan 20 11:40:34 2016 -0500
wayland: clean up stride calculation when creating shm surface
Right now, we assume the stride for the image surface needs to
be 4 byte aligned. This is, in fact, true, but it's better to
ask cairo for the alignment requirement directly rather than
assume we know the alignment rules.
This commit changes the code to use cairo_format_stride_for_width
to calculate a suitable rowstride for pixman.
https://bugzilla.gnome.org/show_bug.cgi?id=760897
gdk/wayland/gdkdisplay-wayland.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 4f60573..b19b6a0 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -1056,7 +1056,7 @@ _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display,
data->scale = scale;
data->busy = FALSE;
- stride = width * 4;
+ stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, width*scale);
data->pool = create_shm_pool (display->shm,
width*scale, height*scale,
@@ -1067,11 +1067,11 @@ _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display,
CAIRO_FORMAT_ARGB32,
width*scale,
height*scale,
- stride*scale);
+ stride);
data->buffer = wl_shm_pool_create_buffer (data->pool, 0,
width*scale, height*scale,
- stride*scale, WL_SHM_FORMAT_ARGB8888);
+ stride, WL_SHM_FORMAT_ARGB8888);
wl_buffer_add_listener (data->buffer, &buffer_listener, surface);
cairo_surface_set_user_data (surface, &gdk_wayland_cairo_key,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]