Make visual bell flash much more gentle
Right now visual bell makes background flash sharply with bright white (when configured with darkish color theme). This causes eye strain, especially prominent in unlit environments. This change makes background bounce smoothly between regular bg color and highlight (selection) bg color for the configured visual bell duration. Intensity is animated with cubic easing functions. It currently peaks at 20% of the duration, this is hardcoded. Mark functions computing intensity and easing as inline Do smarter blending of visual bell flash Blend highlight color with pegtop's softlight mode over both background and half as much over foreground. This should help with flash visibility in light themed and inverted colors contexts. Blend flash in BACKGROUND pass also Revert "Do smarter blending of visual bell flash" This reverts commit 9a269d55c7d04334b1c4891c42914423517dfad6. Revert "Blend flash in BACKGROUND pass also" This reverts commit 756332cb9d7576b08db78406e37349aa6d1df156. Revert "Make visual bell flash much more gentle" This reverts commit cbfe5d59ada2da690e14c7532a7468b0c307c462. Render flash overlay in a separate drawcall Trigger frequent repaints to make for smooth animation Attenuate flash a bit more
This commit is contained in:
@@ -458,6 +458,23 @@ draw_tint(bool premult, Screen *screen, GLfloat xstart, GLfloat ystart, GLfloat
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
}
|
||||
|
||||
void
|
||||
draw_visual_bell_flash(GLfloat intensity, GLfloat xstart, GLfloat ystart, GLfloat w, GLfloat h, Screen *screen) {
|
||||
glEnable(GL_BLEND);
|
||||
// BLEND_PREMULT
|
||||
glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ONE);
|
||||
bind_program(TINT_PROGRAM);
|
||||
// TODO config option worth?
|
||||
GLfloat attenuation = 0.4f;
|
||||
color_type flash = colorprofile_to_color(screen->color_profile, screen->color_profile->overridden.highlight_bg, screen->color_profile->configured.highlight_bg);
|
||||
#define C(shift) ((((GLfloat)((flash >> shift) & 0xFF)) / 255.0f) * intensity * attenuation)
|
||||
glUniform4f(tint_program_layout.tint_color_location, C(16), C(8), C(0), intensity * attenuation);
|
||||
#undef C
|
||||
glUniform4f(tint_program_layout.edges_location, xstart, ystart - h, xstart + w, ystart);
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_cells_interleaved(ssize_t vao_idx, ssize_t gvao_idx, Screen *screen, OSWindow *w, GLfloat xstart, GLfloat ystart, GLfloat width, GLfloat height) {
|
||||
glEnable(GL_BLEND);
|
||||
@@ -650,6 +667,11 @@ draw_cells(ssize_t vao_idx, ssize_t gvao_idx, GLfloat xstart, GLfloat ystart, GL
|
||||
vao_idx, gvao_idx, screen, os_window, xstart, ystart, w, h);
|
||||
else draw_cells_simple(vao_idx, gvao_idx, screen);
|
||||
}
|
||||
|
||||
float intensity = screen_visual_bell_intensity(screen);
|
||||
if (intensity > 0.0f) {
|
||||
draw_visual_bell_flash((GLfloat)intensity, xstart, ystart, w, h, screen);
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user