Speed up shadow generation for small windows

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2019-01-01 11:35:59 +00:00
parent 3686bf7a33
commit 428c24a6fa
7 changed files with 34 additions and 17 deletions

View File

@ -47,7 +47,7 @@ solid_picture(session_t *ps, bool argb, double a, double r, double g, double b)
}
xcb_image_t *make_shadow(xcb_connection_t *c, const conv *kernel,
const double *shadow_sum, double opacity, int width, int height) {
double opacity, int width, int height) {
/*
* We classify shadows into 4 kinds of regions
* r = shadow radius
@ -62,6 +62,7 @@ xcb_image_t *make_shadow(xcb_connection_t *c, const conv *kernel,
* height+r +-----+---------+-----+
*/
xcb_image_t *ximage;
const double *shadow_sum = kernel->rsum;
int d = kernel->size, r = d / 2;
int swidth = width + r * 2, sheight = height + r * 2;
@ -181,7 +182,7 @@ bool build_shadow(session_t *ps, double opacity, const int width, const int heig
xcb_gcontext_t gc = None;
shadow_image =
make_shadow(ps->c, ps->gaussian_map, ps->shadow_sum, opacity, width, height);
make_shadow(ps->c, ps->gaussian_map, opacity, width, height);
if (!shadow_image) {
log_error("Failed to make shadow");
return false;

View File

@ -19,5 +19,5 @@ solid_picture(session_t *ps, bool argb, double a, double r, double g, double b);
void paint_all_new(session_t *ps, region_t *region, win *const t);
xcb_image_t *make_shadow(xcb_connection_t *c, const conv *kernel,
const double *shadow_sum, double opacity, int width, int height);
xcb_image_t *
make_shadow(xcb_connection_t *c, const conv *kernel, double opacity, int width, int height);