[GTK3] Fix integer scaling
This commit is contained in:
parent
f3f1bf293a
commit
6e263cd22a
12
gtk3/main.c
12
gtk3/main.c
@ -103,19 +103,24 @@ static void update_viewport(void) {
|
||||
y_factor = (int)(y_factor);
|
||||
}
|
||||
|
||||
/*if (configuration.scaling_mode != GB_SDL_SCALING_ENTIRE_WINDOW) {
|
||||
if (true /*configuration.scaling_mode != GB_SDL_SCALING_ENTIRE_WINDOW*/) {
|
||||
if (x_factor > y_factor) {
|
||||
x_factor = y_factor;
|
||||
}
|
||||
else {
|
||||
y_factor = x_factor;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
unsigned new_width = x_factor * GB_get_screen_width(&gb);
|
||||
unsigned new_height = y_factor * GB_get_screen_height(&gb);
|
||||
|
||||
rect = (Rect){(win_width - new_width) / 2, (win_height - new_height) / 2, new_width, new_height};
|
||||
rect = (Rect){
|
||||
(win_width - new_width) / 2,
|
||||
(win_height - new_height) / 2,
|
||||
new_width,
|
||||
new_height
|
||||
};
|
||||
|
||||
glViewport(rect.x, rect.y, rect.w, rect.h);
|
||||
}
|
||||
@ -283,6 +288,7 @@ static void startup(GApplication *app, gpointer user_data_gptr) {
|
||||
g_signal_connect(gl_area, "render", G_CALLBACK(gl_draw), NULL);
|
||||
g_signal_connect(gl_area, "resize", G_CALLBACK(gl_resize), NULL);
|
||||
g_signal_connect(gl_area, "unrealize", G_CALLBACK(gl_finish), NULL);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(main_window), GTK_WIDGET(gl_area));
|
||||
|
||||
// Handle the whole menubar situation …
|
||||
|
@ -129,8 +129,8 @@ bool init_shader_with_name(shader_t *shader, const char *name)
|
||||
glBindTexture(GL_TEXTURE_2D, shader->texture);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
shader->texture_uniform = glGetUniformLocation(shader->program, "image");
|
||||
|
||||
@ -138,8 +138,8 @@ bool init_shader_with_name(shader_t *shader, const char *name)
|
||||
glBindTexture(GL_TEXTURE_2D, shader->previous_texture);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
shader->previous_texture_uniform = glGetUniformLocation(shader->program, "previous_image");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user