diff --git a/src/backend/gl/blur.c b/src/backend/gl/blur.c index c2de2e0..271a17a 100644 --- a/src/backend/gl/blur.c +++ b/src/backend/gl/blur.c @@ -322,16 +322,17 @@ bool gl_blur_impl(double opacity, struct gl_blur_context *bctx, void *mask, auto coord = ccalloc(nrects * 16, GLint); auto indices = ccalloc(nrects * 6, GLuint); - x_rect_to_coords(nrects, rects, - (coord_t){.x = extent_resized->x1, .y = extent_resized->y2}, - bctx->fb_height, source_size.height, false, coord, indices); + auto extent_height = extent_resized->y2 - extent_resized->y1; + x_rect_to_coords( + nrects, rects, (coord_t){.x = extent_resized->x1, .y = extent_resized->y1}, + extent_height, bctx->fb_height, source_size.height, false, coord, indices); auto coord_resized = ccalloc(nrects_resized * 16, GLint); auto indices_resized = ccalloc(nrects_resized * 6, GLuint); x_rect_to_coords(nrects_resized, rects_resized, - (coord_t){.x = extent_resized->x1, .y = extent_resized->y2}, - bctx->fb_height, bctx->fb_height, false, coord_resized, - indices_resized); + (coord_t){.x = extent_resized->x1, .y = extent_resized->y1}, + extent_height, bctx->fb_height, bctx->fb_height, false, + coord_resized, indices_resized); pixman_region32_fini(®_blur_resized); GLuint vao[2]; diff --git a/src/backend/gl/gl_common.c b/src/backend/gl/gl_common.c index d7840d8..3e7c5c8 100644 --- a/src/backend/gl/gl_common.c +++ b/src/backend/gl/gl_common.c @@ -482,16 +482,16 @@ static void _gl_compose(backend_t *base, struct backend_image *img, GLuint targe /// @param[in] nrects, rects rectangles /// @param[in] image_dst origin of the OpenGL texture, affect the calculated texture /// coordinates +/// @param[in] extend_height height of the drawing extent /// @param[in] texture_height height of the OpenGL texture /// @param[in] root_height height of the back buffer /// @param[in] y_inverted whether the texture is y inverted /// @param[out] coord, indices output -void x_rect_to_coords(int nrects, const rect_t *rects, coord_t image_dst, int texture_height, - int root_height, bool y_inverted, GLint *coord, GLuint *indices) { +void x_rect_to_coords(int nrects, const rect_t *rects, coord_t image_dst, + int extent_height, int texture_height, int root_height, + bool y_inverted, GLint *coord, GLuint *indices) { image_dst.y = root_height - image_dst.y; - if (y_inverted) { - image_dst.y -= texture_height; - } + image_dst.y -= extent_height; for (int i = 0; i < nrects; i++) { // Y-flip. Note after this, crect.y1 > crect.y2 @@ -568,8 +568,8 @@ void gl_compose(backend_t *base, void *image_data, coord_t image_dst, void *mask auto coord = ccalloc(nrects * 16, GLint); auto indices = ccalloc(nrects * 6, GLuint); coord_t mask_offset = {.x = mask_dst.x - image_dst.x, .y = mask_dst.y - image_dst.y}; - x_rect_to_coords(nrects, rects, image_dst, inner->height, gd->height, - inner->y_inverted, coord, indices); + x_rect_to_coords(nrects, rects, image_dst, inner->height, inner->height, + gd->height, inner->y_inverted, coord, indices); _gl_compose(base, img, gd->back_fbo, mask, mask_offset, coord, indices, nrects); free(indices); @@ -1157,7 +1157,6 @@ enum device_status gl_device_status(backend_t *base) { } if (glGetGraphicsResetStatusARB() == GL_NO_ERROR) { return DEVICE_STATUS_NORMAL; - } else { - return DEVICE_STATUS_RESETTING; } + return DEVICE_STATUS_RESETTING; } diff --git a/src/backend/gl/gl_common.h b/src/backend/gl/gl_common.h index f716093..743d8b5 100644 --- a/src/backend/gl/gl_common.h +++ b/src/backend/gl/gl_common.h @@ -118,8 +118,9 @@ typedef struct session session_t; #define GL_PROG_MAIN_INIT \ { .prog = 0, .unifm_opacity = -1, .unifm_invert_color = -1, .unifm_tex = -1, } -void x_rect_to_coords(int nrects, const rect_t *rects, coord_t image_dst, int texture_height, - int root_height, bool y_inverted, GLint *coord, GLuint *indices); +void x_rect_to_coords(int nrects, const rect_t *rects, coord_t image_dst, + int extent_height, int texture_height, int root_height, + bool y_inverted, GLint *coord, GLuint *indices); GLuint gl_create_shader(GLenum shader_type, const char *shader_str); GLuint gl_create_program(const GLuint *const shaders, int nshaders);