diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-10-03 13:50:10 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-10-03 13:50:10 +0100 |
commit | 2c94822167672597d870dbeed9ffc95ea2bf93d3 (patch) | |
tree | 64360f9d04fe2c6ddec5fffb6272d6f811490d45 /ui/egl-helpers.c | |
parent | be9d199751789fdc96a3febe3f0768f1338d87ca (diff) | |
parent | 7364dbdabb7824d5bde1e341bb6d928282f01c83 (diff) |
Merge remote-tracking branch 'remotes/kraxel/tags/ui-20170929-pull-request' into staging
ui and input patches.
# gpg: Signature made Fri 29 Sep 2017 11:21:45 BST
# gpg: using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg: aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138
* remotes/kraxel/tags/ui-20170929-pull-request:
ui: add tracing of VNC authentication process
ui: add tracing of VNC operations related to QIOChannel
virtio-input: send rel-wheel events for wheel buttons
egl: misc framebuffer helper improvements.
console: purge curses bits from console.h
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui/egl-helpers.c')
-rw-r--r-- | ui/egl-helpers.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c index bb19a5eeca..cde9965dea 100644 --- a/ui/egl-helpers.c +++ b/ui/egl-helpers.c @@ -26,16 +26,23 @@ EGLConfig qemu_egl_config; /* ------------------------------------------------------------------ */ +static void egl_fb_delete_texture(egl_fb *fb) +{ + if (!fb->delete_texture) { + return; + } + + glDeleteTextures(1, &fb->texture); + fb->delete_texture = false; +} + void egl_fb_destroy(egl_fb *fb) { if (!fb->framebuffer) { return; } - if (fb->delete_texture) { - glDeleteTextures(1, &fb->texture); - fb->delete_texture = false; - } + egl_fb_delete_texture(fb); glDeleteFramebuffers(1, &fb->framebuffer); fb->width = 0; @@ -51,11 +58,15 @@ void egl_fb_setup_default(egl_fb *fb, int width, int height) fb->framebuffer = 0; /* default framebuffer */ } -void egl_fb_create_for_tex(egl_fb *fb, int width, int height, GLuint texture) +void egl_fb_setup_for_tex(egl_fb *fb, int width, int height, + GLuint texture, bool delete) { + egl_fb_delete_texture(fb); + fb->width = width; fb->height = height; fb->texture = texture; + fb->delete_texture = delete; if (!fb->framebuffer) { glGenFramebuffers(1, &fb->framebuffer); } @@ -65,7 +76,7 @@ void egl_fb_create_for_tex(egl_fb *fb, int width, int height, GLuint texture) GL_TEXTURE_2D, fb->texture, 0); } -void egl_fb_create_new_tex(egl_fb *fb, int width, int height) +void egl_fb_setup_new_tex(egl_fb *fb, int width, int height) { GLuint texture; @@ -74,8 +85,7 @@ void egl_fb_create_new_tex(egl_fb *fb, int width, int height) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, 0); - egl_fb_create_for_tex(fb, width, height, texture); - fb->delete_texture = true; + egl_fb_setup_for_tex(fb, width, height, texture, true); } void egl_fb_blit(egl_fb *dst, egl_fb *src, bool flip) |