Added software cursor fallback

This commit is contained in:
Scott Anderson 2017-06-26 17:34:15 +12:00
parent f252c5a792
commit 0cd94f0cf0
15 changed files with 115 additions and 42 deletions

View file

@ -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

View file

@ -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>
@ -10,15 +11,17 @@
#include "render/gles2.h"
static bool gles2_surface_attach_pixels(struct wlr_surface_state *surface,
uint32_t format, int width, int height, const unsigned char *pixels) {
uint32_t format, int stride, int width, int height, const unsigned char *pixels) {
assert(surface);
surface->wlr_surface->width = width;
surface->wlr_surface->height = height;
surface->wlr_surface->format = format;
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, format, width, height, 0,
format, GL_UNSIGNED_BYTE, pixels));
GL_CALL(glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0));
surface->wlr_surface->valid = true;
return true;
}

View file

@ -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,