[PATCH 1/5] wined3d: Construct the projection matrix directly in set_blit_dimension().

Henri Verbeet hverbeet at codeweavers.com
Tue Nov 1 14:15:18 CDT 2011


This saves a needless matrix multiplication and is actually more obvious than
the glOrtho() call.
---
 dlls/wined3d/context.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 29d0b3f..31a604c 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1666,13 +1666,20 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont
 }
 
 /* GL locking is done by the caller */
-static inline void set_blit_dimension(UINT width, UINT height) {
+static void set_blit_dimension(UINT width, UINT height)
+{
+    const GLdouble projection[] =
+    {
+        2.0 / width,          0.0,  0.0, 0.0,
+                0.0, 2.0 / height,  0.0, 0.0,
+                0.0,          0.0,  2.0, 0.0,
+               -1.0,         -1.0, -1.0, 1.0,
+    };
+
     glMatrixMode(GL_PROJECTION);
     checkGLcall("glMatrixMode(GL_PROJECTION)");
-    glLoadIdentity();
-    checkGLcall("glLoadIdentity()");
-    glOrtho(0, width, 0, height, 0.0, -1.0);
-    checkGLcall("glOrtho");
+    glLoadMatrixd(projection);
+    checkGLcall("glLoadMatrixd");
     glViewport(0, 0, width, height);
     checkGLcall("glViewport");
 }
-- 
1.7.3.4




More information about the wine-patches mailing list