mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-09-01 06:41:30 +00:00
Fix indentation from last PR and cleanup case
This commit is contained in:
parent
d218040d26
commit
1b96771820
1 changed files with 11 additions and 12 deletions
|
|
@ -432,14 +432,14 @@ draw_background_image(OSWindow *w) {
|
|||
GLfloat vwidth = (GLfloat)window_width;
|
||||
GLfloat vheight = (GLfloat)window_height;
|
||||
if (CENTER_SCALED == OPT(background_image_layout)) {
|
||||
GLfloat ifrac = iwidth / iheight;
|
||||
if (ifrac > (vwidth / vheight)) {
|
||||
iheight = vheight;
|
||||
iwidth = iheight * ifrac;
|
||||
} else {
|
||||
iwidth = vwidth;
|
||||
iheight = iwidth / ifrac;
|
||||
}
|
||||
GLfloat ifrac = iwidth / iheight;
|
||||
if (ifrac > (vwidth / vheight)) {
|
||||
iheight = vheight;
|
||||
iwidth = iheight * ifrac;
|
||||
} else {
|
||||
iwidth = vwidth;
|
||||
iheight = iwidth / ifrac;
|
||||
}
|
||||
}
|
||||
glUniform4f(bgimage_program_layout.uniforms.sizes,
|
||||
vwidth, vheight, iwidth, iheight);
|
||||
|
|
@ -450,17 +450,16 @@ draw_background_image(OSWindow *w) {
|
|||
case TILING: case MIRRORED: case CLAMPED:
|
||||
tiled = 1.f; break;
|
||||
case SCALED:
|
||||
tiled = 0.f; break;
|
||||
break;
|
||||
case CENTER_CLAMPED:
|
||||
case CENTER_SCALED:
|
||||
tiled = 0.f;
|
||||
case CENTER_SCALED: {
|
||||
GLfloat wfrac = (vwidth - iwidth) / vwidth;
|
||||
GLfloat hfrac = (vheight - iheight) / vheight;
|
||||
left += wfrac;
|
||||
right -= wfrac;
|
||||
top -= hfrac;
|
||||
bottom += hfrac;
|
||||
break;
|
||||
} break;
|
||||
}
|
||||
glUniform1f(bgimage_program_layout.uniforms.tiled, tiled);
|
||||
glUniform4f(bgimage_program_layout.uniforms.positions, left, top, right, bottom);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue