Stefan Dösinger : wined3d: Update the glOrtho between 2 rhw draws if the viewport was changed.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Feb 13 07:03:41 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 46e8d6778772de45c02f7dd206b35c004f176746
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=46e8d6778772de45c02f7dd206b35c004f176746

Author: Stefan Dösinger <stefandoesinger at gmx.at>
Date:   Mon Feb 13 13:25:21 2006 +0100

wined3d: Update the glOrtho between 2 rhw draws if the viewport was changed.

---

 dlls/wined3d/device.c          |    1 +
 dlls/wined3d/drawprim.c        |    3 ++-
 dlls/wined3d/surface.c         |    3 ++-
 dlls/wined3d/wined3d_private.h |    1 +
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 2f6910b..04a2fe8 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2695,6 +2695,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetVie
         TRACE("Recording... not performing anything\n");
         return D3D_OK;
     }
+    This->viewport_changed = TRUE;
 
     ENTER_GL();
 
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 1328967..4a7468b 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -200,10 +200,11 @@ static BOOL primitiveInitState(IWineD3DD
     if (!useVS && vtx_transformed) {
 
         /* If the last draw was transformed as well, no need to reapply all the matrixes */
-        if (!This->last_was_rhw) {
+        if ( (!This->last_was_rhw) || (This->viewport_changed) ) {
 
             double X, Y, height, width, minZ, maxZ;
             This->last_was_rhw = TRUE;
+            This->viewport_changed = FALSE;
 
             /* Transformed already into viewport coordinates, so we do not need transform
                matrices. Reset all matrices to identity and leave the default matrix in world
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 4cb1b3e..766874a 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -708,10 +708,11 @@ HRESULT WINAPI IWineD3DSurfaceImpl_Unloc
             /* glDrawPixels transforms the raster position as though it was a vertex -
                we want to draw at screen position 0,0 - Set up ortho (rhw) mode as
                per drawprim (and leave set - it will sort itself out due to last_was_rhw */
-            if (!myDevice->last_was_rhw) {
+            if ( (!myDevice->last_was_rhw) || (myDevice->viewport_changed) ) {
 
                 double X, Y, height, width, minZ, maxZ;
                 myDevice->last_was_rhw = TRUE;
+                myDevice->viewport_changed = FALSE;
 
                 /* Transformed already into viewport coordinates, so we do not need transform
                    matrices. Reset all matrices to identity and leave the default matrix in world
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 9ba687c..990c6e3 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -494,6 +494,7 @@ typedef struct IWineD3DDeviceImpl
     BOOL                    proj_valid;
     BOOL                    view_ident;        /* true iff view matrix is identity                */
     BOOL                    last_was_rhw;      /* true iff last draw_primitive was in xyzrhw mode */
+    BOOL                    viewport_changed;  /* Was the viewport changed since the last draw?   */
     GLenum                  tracking_parm;     /* Which source is tracking current colour         */
     LONG                    tracking_color;    /* used iff GL_COLOR_MATERIAL was enabled          */
 #define                         DISABLED_TRACKING  0  /* Disabled                                 */




More information about the wine-cvs mailing list