diff options
Diffstat (limited to 'wayland/buffers.c')
-rw-r--r-- | wayland/buffers.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/wayland/buffers.c b/wayland/buffers.c index ff1e5ecf..227d6d2c 100644 --- a/wayland/buffers.c +++ b/wayland/buffers.c | |||
@@ -50,8 +50,10 @@ static const struct wl_buffer_listener buffer_listener = { | |||
50 | }; | 50 | }; |
51 | 51 | ||
52 | static struct buffer *create_buffer(struct window *window, struct buffer *buf, | 52 | static struct buffer *create_buffer(struct window *window, struct buffer *buf, |
53 | int32_t width, int32_t height, uint32_t format) { | 53 | int32_t width, int32_t height, int32_t scale, uint32_t format) { |
54 | 54 | ||
55 | width *= scale; | ||
56 | height *= scale; | ||
55 | uint32_t stride = width * 4; | 57 | uint32_t stride = width * 4; |
56 | uint32_t size = stride * height; | 58 | uint32_t size = stride * height; |
57 | 59 | ||
@@ -63,7 +65,8 @@ static struct buffer *create_buffer(struct window *window, struct buffer *buf, | |||
63 | } | 65 | } |
64 | void *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); | 66 | void *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); |
65 | struct wl_shm_pool *pool = wl_shm_create_pool(window->registry->shm, fd, size); | 67 | struct wl_shm_pool *pool = wl_shm_create_pool(window->registry->shm, fd, size); |
66 | buf->buffer = wl_shm_pool_create_buffer(pool, 0, width, height, stride, format); | 68 | buf->buffer = wl_shm_pool_create_buffer(pool, 0, |
69 | width, height, stride, format); | ||
67 | wl_shm_pool_destroy(pool); | 70 | wl_shm_pool_destroy(pool); |
68 | close(fd); | 71 | close(fd); |
69 | unlink(name); | 72 | unlink(name); |
@@ -72,10 +75,10 @@ static struct buffer *create_buffer(struct window *window, struct buffer *buf, | |||
72 | 75 | ||
73 | buf->width = width; | 76 | buf->width = width; |
74 | buf->height = height; | 77 | buf->height = height; |
75 | buf->surface = cairo_image_surface_create_for_data(data, CAIRO_FORMAT_ARGB32, width, height, stride); | 78 | buf->surface = cairo_image_surface_create_for_data(data, |
79 | CAIRO_FORMAT_ARGB32, width, height, stride); | ||
76 | buf->cairo = cairo_create(buf->surface); | 80 | buf->cairo = cairo_create(buf->surface); |
77 | buf->pango = pango_cairo_create_context(buf->cairo); | 81 | buf->pango = pango_cairo_create_context(buf->cairo); |
78 | pango_cairo_context_set_resolution(buf->pango, 96 * 2); | ||
79 | 82 | ||
80 | wl_buffer_add_listener(buf->buffer, &buffer_listener, buf); | 83 | wl_buffer_add_listener(buf->buffer, &buffer_listener, buf); |
81 | return buf; | 84 | return buf; |
@@ -114,7 +117,9 @@ struct buffer *get_next_buffer(struct window *window) { | |||
114 | } | 117 | } |
115 | 118 | ||
116 | if (!buffer->buffer) { | 119 | if (!buffer->buffer) { |
117 | if (!create_buffer(window, buffer, window->width, window->height, WL_SHM_FORMAT_ARGB8888)) { | 120 | if (!create_buffer(window, buffer, |
121 | window->width, window->height, window->scale, | ||
122 | WL_SHM_FORMAT_ARGB8888)) { | ||
118 | return NULL; | 123 | return NULL; |
119 | } | 124 | } |
120 | } | 125 | } |