From 66290eec023db7034fee13e1264f63f3473a3e2e Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Tue, 7 May 2019 00:29:02 +0100 Subject: [PATCH] new backend: glx: fix off-by-1 in blur shader generation Signed-off-by: Yuxuan Shui --- man/compton.1.asciidoc | 4 ++-- src/backend/gl/gl_common.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/man/compton.1.asciidoc b/man/compton.1.asciidoc index fa896da7..69b9d23e 100644 --- a/man/compton.1.asciidoc +++ b/man/compton.1.asciidoc @@ -187,9 +187,9 @@ WIDTH,HEIGHT,ELE1,ELE2,ELE3,ELE4,ELE5... + In other words, the matrix is formatted as a list of comma separated numbers. The first two numbers must be integers, which specify the width and height of the matrix. They must be odd numbers. Then, the following 'width * height - 1' numbers specifies the numbers in the matrix, row by row, excluding the center element. + -The elements are finite floating point numbers. The decimal pointer has to be '.' (a period), and scientific notation is not supported. +The elements are finite floating point numbers. The decimal pointer has to be '.' (a period), scientific notation is not supported. + -The element in the center will either be 1.0 or changing based on opacity, depending on whether you have `--blur-background-fixed`. Yet the automatic adjustment of blur factor may not work well with a custom blur kernel. +The element in the center will either be 1.0 or varying based on opacity, depending on whether you have `--blur-background-fixed`. Yet the automatic adjustment of blur factor may not work well with a custom blur kernel. + A 7x7 Gaussian blur kernel (sigma = 0.84089642) looks like: + diff --git a/src/backend/gl/gl_common.c b/src/backend/gl/gl_common.c index d59da3c6..fb165338 100644 --- a/src/backend/gl/gl_common.c +++ b/src/backend/gl/gl_common.c @@ -716,7 +716,7 @@ static bool gl_init_blur(struct gl_data *gd, conv *const *const kernels) { auto kern = kernels[i]; // Build shader int width = kern->w, height = kern->h; - int nele = width * height - 1; + int nele = width * height; size_t body_len = (strlen(shader_add) + 42) * (uint)nele; char *shader_body = ccalloc(body_len, char); char *pc = shader_body;