From 4123fbfeab3395d15ef8428b01587c887790a31d Mon Sep 17 00:00:00 2001 From: the_fiddler <the_fiddler@ebc5dd9b-fb1d-0410-b6f8-d24c324e9604> Date: Sun, 23 Mar 2008 12:51:41 +0000 Subject: [PATCH] Cache default display mode. --- Source/OpenTK/Graphics/GraphicsMode.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/OpenTK/Graphics/GraphicsMode.cs b/Source/OpenTK/Graphics/GraphicsMode.cs index 86aaf8e9..2d9870a6 100644 --- a/Source/OpenTK/Graphics/GraphicsMode.cs +++ b/Source/OpenTK/Graphics/GraphicsMode.cs @@ -20,6 +20,7 @@ namespace OpenTK.Graphics bool stereo; IntPtr index; // The id of the pixel format or visual. + static GraphicsMode defaultMode; static IGraphicsMode implementation; static object mode_selection_lock = new object(); @@ -292,7 +293,12 @@ namespace OpenTK.Graphics /// <summary>Returns an OpenTK.GraphicsFormat compatible with the underlying platform.</summary> public static GraphicsMode Default { - get { return new GraphicsMode(DisplayDevice.Default.BitsPerPixel, 16, 0, 0, 0, 2, false); } + get + { + if (defaultMode == null) + defaultMode = new GraphicsMode(DisplayDevice.Default.BitsPerPixel, 16, 0, 0, 0, 2, false); + return defaultMode; + } } #endregion