summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2015-02-09 16:10:22 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2015-02-09 16:10:22 +0000
commit8eb58dc5574e996d4c0676db6f9ef667e7261d6f (patch)
treee32bd7c9f0e626bd77b0c2eebee9f3b936f21f51
parentc3c338dcc0a7f4d96283efb583268b9983147786 (diff)
downloadgtk+-8eb58dc5574e996d4c0676db6f9ef667e7261d6f.tar.gz
gl: Clean up the required version accessors
We can simplify the code, since we only have core GL profiles in GDK. https://bugzilla.gnome.org/show_bug.cgi?id=741946
-rw-r--r--gdk/gdkglcontext.c45
1 files changed, 17 insertions, 28 deletions
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index aac9e42223..a1b1088a2f 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -526,10 +526,9 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
g_return_if_fail (!priv->realized);
- g_return_if_fail (priv->profile == GDK_GL_PROFILE_3_2_CORE);
- priv->major = major;
- priv->minor = minor;
+ priv->major = MAX (major, 3);
+ priv->minor = MAX (minor, 2);
}
/**
@@ -549,34 +548,24 @@ gdk_gl_context_get_required_version (GdkGLContext *context,
int *minor)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
+ int maj, min;
- if (major != NULL && priv->major > 0)
- *major = priv->major;
+ g_return_if_fail (GDK_IS_GL_CONTEXT (context));
+
+ if (priv->major > 0)
+ maj = priv->major;
else
- {
- switch (priv->profile)
- {
- case GDK_GL_PROFILE_DEFAULT:
- case GDK_GL_PROFILE_3_2_CORE:
- if (major != NULL)
- *major = 3;
- break;
- }
- }
+ maj = 3;
- if (minor != NULL && priv->minor > 0)
- *minor = priv->minor;
+ if (priv->minor > 0)
+ min = priv->minor;
else
- {
- switch (priv->profile)
- {
- case GDK_GL_PROFILE_DEFAULT:
- case GDK_GL_PROFILE_3_2_CORE:
- if (minor != NULL)
- *minor = 2;
- break;
- }
- }
+ min = 2;
+
+ if (major != NULL)
+ *major = maj;
+ if (minor != NULL)
+ *minor = min;
}
/**
@@ -601,7 +590,7 @@ gdk_gl_context_realize (GdkGLContext *context,
g_return_val_if_fail (GDK_IS_GL_CONTEXT (context), FALSE);
if (priv->realized)
- return priv->realized;
+ return TRUE;
priv->realized = GDK_GL_CONTEXT_GET_CLASS (context)->realize (context, error);