From 051a0cde7b0a0dda9eef166f9aecd09dfc0a00cf Mon Sep 17 00:00:00 2001 From: Chen Zhang Date: Fri, 25 Jan 2019 15:47:23 +0800 Subject: ui/egl-helpers: Augment parameter list of egl_texture_blend() to convey scales of viewport This would help gtk-egl display showing scaled DMABuf cursor images when gtk window was zoomed. A default scale of (1.0, 1.0) was presumed for call sites where no scaling is needed. Signed-off-by: Chen Zhang Message-id: 23B229B3-3095-4DFB-8369-866784808D30@me.com Signed-off-by: Gerd Hoffmann --- ui/egl-helpers.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'ui/egl-helpers.c') diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c index 5e115b3fb4..e90eef8c9c 100644 --- a/ui/egl-helpers.c +++ b/ui/egl-helpers.c @@ -120,14 +120,15 @@ void egl_texture_blit(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip) } void egl_texture_blend(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip, - int x, int y) + int x, int y, double scale_x, double scale_y) { glBindFramebuffer(GL_FRAMEBUFFER_EXT, dst->framebuffer); + int w = scale_x * src->width; + int h = scale_y * src->height; if (flip) { - glViewport(x, y, src->width, src->height); + glViewport(x, y, w, h); } else { - glViewport(x, dst->height - src->height - y, - src->width, src->height); + glViewport(x, dst->height - h - y, w, h); } glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, src->texture); -- cgit 1.4.1