aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2024-04-13 05:14:04 +0200
committerPřemysl Eric Janouch <p@janouch.name>2024-04-13 05:16:48 +0200
commit3c8ddcaf264a08102b27ae96a8a8340cb0abc997 (patch)
treec6a94a25933ae418e0acb5f280568c22e7c5be8d
parente3ec07a19f01d21738095ba7c4fb09efc8be544e (diff)
downloadfiv-origin/master.tar.gz
fiv-origin/master.tar.xz
fiv-origin/master.zip
Fix high-DPI scaling with OpenGLorigin/master
We used to render multiple copies (four for a scaling factor of 2).
-rw-r--r--fiv-view.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fiv-view.c b/fiv-view.c
index f0cd577..911e249 100644
--- a/fiv-view.c
+++ b/fiv-view.c
@@ -851,6 +851,10 @@ gl_draw(FivView *self, cairo_t *cr)
cliph = allocation.height;
}
+ int scale = gtk_widget_get_scale_factor(GTK_WIDGET(self));
+ clipw *= scale;
+ cliph *= scale;
+
enum { SRC, DEST };
GLuint textures[2] = {};
glGenTextures(2, textures);
@@ -963,7 +967,7 @@ gl_draw(FivView *self, cairo_t *cr)
GdkWindow *window = gtk_widget_get_window(GTK_WIDGET(self));
cairo_translate(cr, dx, dy);
gdk_cairo_draw_from_gl(
- cr, window, textures[DEST], GL_TEXTURE, 1, 0, 0, clipw, cliph);
+ cr, window, textures[DEST], GL_TEXTURE, scale, 0, 0, clipw, cliph);
gdk_gl_context_make_current(self->gl_context);
glDeleteBuffers(1, &vertex_buffer);