[gtk+/gtk-3-18] wayland: don't pass in width and height to create_shm_pool
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-18] wayland: don't pass in width and height to create_shm_pool
- Date: Thu, 28 Jan 2016 03:30:48 +0000 (UTC)
commit 0443756f0ff018daeecd32440228776269d8d03f
Author: Ray Strode <rstrode redhat com>
Date: Wed Jan 20 12:35:44 2016 -0500
wayland: don't pass in width and height to create_shm_pool
create_shm_pool doesn't need the width or height, it just needs
the total size. By passing it in, we're requiring it to redo
stride calculation unnecessarily.
This commit drops the width and height parameters and makes the
function just take the total size directly.
https://bugzilla.gnome.org/show_bug.cgi?id=760897
gdk/wayland/gdkdisplay-wayland.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index b19b6a0..d06a8d1 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -975,14 +975,13 @@ static const struct wl_buffer_listener buffer_listener = {
static struct wl_shm_pool *
create_shm_pool (struct wl_shm *shm,
- int width,
- int height,
+ int size,
size_t *buf_length,
void **data_out)
{
char filename[] = "/tmp/wayland-shm-XXXXXX";
struct wl_shm_pool *pool;
- int fd, size, stride;
+ int fd;
void *data;
fd = mkstemp (filename);
@@ -994,8 +993,6 @@ create_shm_pool (struct wl_shm *shm,
}
unlink (filename);
- stride = width * 4;
- size = stride * height;
if (ftruncate (fd, size) < 0)
{
g_critical (G_STRLOC ": Truncating temporary file failed: %s",
@@ -1059,7 +1056,7 @@ _gdk_wayland_display_create_shm_surface (GdkWaylandDisplay *display,
stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, width*scale);
data->pool = create_shm_pool (display->shm,
- width*scale, height*scale,
+ height*scale*stride,
&data->buf_length,
&data->buf);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]