diff options
Diffstat (limited to 'render')
-rw-r--r-- | render/CMakeLists.txt | 4 | ||||
-rw-r--r-- | render/gles2/surface.c | 5 | ||||
-rw-r--r-- | render/wlr_surface.c | 4 |
3 files changed, 8 insertions, 5 deletions
diff --git a/render/CMakeLists.txt b/render/CMakeLists.txt index 63412b61..d412ddbc 100644 --- a/render/CMakeLists.txt +++ b/render/CMakeLists.txt @@ -1,5 +1,5 @@ -add_library(wlr-render STATIC - matrix.c +add_library(wlr-render + matrix.c wlr_renderer.c wlr_surface.c gles2/shaders.c diff --git a/render/gles2/surface.c b/render/gles2/surface.c index 8c2f459f..f730a499 100644 --- a/render/gles2/surface.c +++ b/render/gles2/surface.c @@ -2,6 +2,7 @@ #include <stdlib.h> #include <assert.h> #include <GLES2/gl2.h> +#include <GLES2/gl2ext.h> #include <wayland-util.h> #include <wayland-server-protocol.h> #include <wlr/render.h> @@ -11,7 +12,7 @@ #include "render/gles2.h" static bool gles2_surface_attach_pixels(struct wlr_surface_state *surface, - enum wl_shm_format format, int width, int height, + enum wl_shm_format format, int stride, int width, int height, const unsigned char *pixels) { assert(surface); const struct pixel_format *fmt = gl_format_for_wl_format(format); @@ -25,8 +26,10 @@ static bool gles2_surface_attach_pixels(struct wlr_surface_state *surface, surface->pixel_format = fmt; GL_CALL(glGenTextures(1, &surface->tex_id)); GL_CALL(glBindTexture(GL_TEXTURE_2D, surface->tex_id)); + GL_CALL(glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, stride)); GL_CALL(glTexImage2D(GL_TEXTURE_2D, 0, fmt->gl_format, width, height, 0, fmt->gl_format, fmt->gl_type, pixels)); + GL_CALL(glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0)); surface->wlr_surface->valid = true; return true; } diff --git a/render/wlr_surface.c b/render/wlr_surface.c index 46a12205..4e4f4101 100644 --- a/render/wlr_surface.c +++ b/render/wlr_surface.c @@ -20,9 +20,9 @@ void wlr_surface_bind(struct wlr_surface *surface) { } bool wlr_surface_attach_pixels(struct wlr_surface *surface, uint32_t format, - int width, int height, const unsigned char *pixels) { + int stride, int width, int height, const unsigned char *pixels) { return surface->impl->attach_pixels(surface->state, - format, width, height, pixels); + format, stride, width, height, pixels); } bool wlr_surface_attach_shm(struct wlr_surface *surface, uint32_t format, |