From e2b7712302f332de73e2527c7f58f11c72251346 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 9 Aug 2017 22:56:57 -0400 Subject: Use texture->pixel_format instead of re-scanning --- render/gles2/texture.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'render') diff --git a/render/gles2/texture.c b/render/gles2/texture.c index ff823fc1..f29f54a3 100644 --- a/render/gles2/texture.c +++ b/render/gles2/texture.c @@ -43,11 +43,7 @@ static bool gles2_texture_update_pixels(struct wlr_texture_state *texture, return gles2_texture_upload_pixels(texture, format, stride, width, height, pixels); } - const struct pixel_format *fmt = gl_format_for_wl_format(format); - if (!fmt || !fmt->gl_format) { - wlr_log(L_ERROR, "No supported pixel format for this texture"); - return false; - } + const struct pixel_format *fmt = texture->pixel_format; GL_CALL(glBindTexture(GL_TEXTURE_2D, texture->tex_id)); GL_CALL(glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, stride)); GL_CALL(glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, x)); @@ -98,11 +94,7 @@ static bool gles2_texture_update_shm(struct wlr_texture_state *texture, if (texture->wlr_texture->format != format) { return gles2_texture_upload_shm(texture, format, buffer); } - const struct pixel_format *fmt = gl_format_for_wl_format(format); - if (!fmt || !fmt->gl_format) { - wlr_log(L_ERROR, "No supported pixel format for this texture"); - return false; - } + const struct pixel_format *fmt = texture->pixel_format; wl_shm_buffer_begin_access(buffer); uint8_t *pixels = wl_shm_buffer_get_data(buffer); int pitch = wl_shm_buffer_get_stride(buffer) / (fmt->bpp / 8); -- cgit v1.2.3