[gtk/wip/matthiasc/gl-icon-cache: 4/9] Don't generate mipmaps needlessly
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/gl-icon-cache: 4/9] Don't generate mipmaps needlessly
- Date: Sun, 2 Jun 2019 18:01:25 +0000 (UTC)
commit 6eccd469372a7c6e7f35172fa06fdc221f79c883
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Jun 2 15:54:50 2019 +0000
Don't generate mipmaps needlessly
GL_LINEAR doesn't use mipmaps, so don't generate them.
gsk/gl/gskgldriver.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gsk/gl/gskgldriver.c b/gsk/gl/gskgldriver.c
index 4dd603b040..a63248ea12 100644
--- a/gsk/gl/gskgldriver.c
+++ b/gsk/gl/gskgldriver.c
@@ -791,6 +791,12 @@ gsk_gl_driver_init_texture_empty (GskGLDriver *self,
glBindTexture (GL_TEXTURE_2D, 0);
}
+static gboolean
+filter_uses_mipmaps (int filter)
+{
+ return filter != GL_NEAREST && filter != GL_LINEAR;
+}
+
void
gsk_gl_driver_init_texture_with_surface (GskGLDriver *self,
int texture_id,
@@ -826,6 +832,6 @@ gsk_gl_driver_init_texture_with_surface (GskGLDriver *self,
t->min_filter = min_filter;
t->mag_filter = mag_filter;
- if (t->min_filter != GL_NEAREST)
+ if (filter_uses_mipmaps (t->min_filter))
glGenerateMipmap (GL_TEXTURE_2D);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]