Skip to content

Commit 3f28791

Browse files
[Linux] Fix layer position when compositing without glBlitFramebuffer (flutter#196083)
Regression from 8f5e9b0. Fixes flutter#195885
1 parent 6c68490 commit 3f28791

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎engine/src/flutter/shell/platform/linux/fl_compositor_opengl.cc‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,14 @@ static void composite_layer(FlCompositorOpenGL* self,
6969
double y,
7070
int width,
7171
int height) {
72-
size_t texture_width = fl_framebuffer_get_width(framebuffer);
73-
size_t texture_height = fl_framebuffer_get_height(framebuffer);
74-
fl_compositor_opengl_shader_set_offset(self->shader, (2 * x / width) - 1.0,
75-
(2 * y / height) - 1.0);
76-
fl_compositor_opengl_shader_set_scale(self->shader, texture_width / width,
77-
texture_height / height);
72+
double scale_x =
73+
static_cast<double>(fl_framebuffer_get_width(framebuffer)) / width;
74+
double scale_y =
75+
static_cast<double>(fl_framebuffer_get_height(framebuffer)) / height;
76+
fl_compositor_opengl_shader_set_offset(self->shader,
77+
(2 * x / width) + scale_x - 1.0,
78+
1.0 - (2 * y / height) - scale_y);
79+
fl_compositor_opengl_shader_set_scale(self->shader, scale_x, scale_y);
7880

7981
GLuint texture_id = fl_framebuffer_get_texture_id(framebuffer);
8082
glBindTexture(GL_TEXTURE_2D, texture_id);

0 commit comments

Comments
 (0)