mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-20 11:07:38 +03:00
Ensure cell start position is clamped to a pixel
This commit is contained in:
parent
b4024bf7f2
commit
11badac95d
@ -138,6 +138,18 @@ clamp_position_to_nearest_pixel(float pos, const unsigned int viewport_size) {
|
||||
return -1.f + num_of_pixels * px;
|
||||
}
|
||||
|
||||
static inline float
|
||||
gl_pos_x(const unsigned int px_from_left_margin, const unsigned int viewport_size) {
|
||||
const float px = 2.f / viewport_size;
|
||||
return -1.f + px_from_left_margin * px;
|
||||
}
|
||||
|
||||
static inline float
|
||||
gl_pos_y(const unsigned int px_from_top_margin, const unsigned int viewport_size) {
|
||||
const float px = 2.f / viewport_size;
|
||||
return 1.f - px_from_top_margin * px;
|
||||
}
|
||||
|
||||
|
||||
GraphicsManager* grman_alloc(void);
|
||||
void grman_clear(GraphicsManager*, bool, CellPixelSize fg);
|
||||
|
@ -709,8 +709,8 @@ static void
|
||||
init_screen_render_data(OSWindow *osw, const WindowGeometry *g, ScreenRenderData *d) {
|
||||
d->dx = gl_size(osw->fonts_data->cell_width, osw->viewport_width);
|
||||
d->dy = gl_size(osw->fonts_data->cell_height, osw->viewport_height);
|
||||
d->xstart = -1.f + gl_size(g->left, osw->viewport_width);
|
||||
d->ystart = 1.f - gl_size(g->top, osw->viewport_height);
|
||||
d->xstart = gl_pos_x(g->left, osw->viewport_width);
|
||||
d->ystart = gl_pos_y(g->top, osw->viewport_height);
|
||||
}
|
||||
|
||||
PYWRAP1(set_tab_bar_render_data) {
|
||||
|
Loading…
Reference in New Issue
Block a user