backends/x11/nested: Draw the stage view CRTCs with the correct size

The nested stage tries to emulate how CRTCs are drawn, but fails to do
this when a stage view is scaled as it didn't adapt the viewport size
according to the stage view scale.

https://bugzilla.gnome.org/show_bug.cgi?id=786663
This commit is contained in:
Jonas Ådahl 2017-08-23 11:47:26 +08:00
parent 7821256f5c
commit eacf2f2187

View File

@ -122,6 +122,7 @@ draw_crtc (MetaMonitor *monitor,
CoglMatrix transform;
float texture_width, texture_height;
float sample_x, sample_y, sample_width, sample_height;
float scale;
int viewport_x, viewport_y;
int viewport_width, viewport_height;
float s_1, t_1, s_2, t_2;
@ -198,6 +199,11 @@ draw_crtc (MetaMonitor *monitor,
viewport_width = monitor_crtc_mode->crtc_mode->width;
viewport_height = monitor_crtc_mode->crtc_mode->height;
}
scale = clutter_stage_view_get_scale (data->view);
viewport_width = roundf (viewport_width / scale);
viewport_height = roundf (viewport_height / scale);
cogl_framebuffer_set_viewport (onscreen,
viewport_x, viewport_y,
viewport_width, viewport_height);